[Build] Add build-tools-api and build-tools-impl modules

#KT-57396 In Progress
This commit is contained in:
Alexander.Likhachev
2023-03-17 13:57:54 +01:00
committed by Space Team
parent 3ab057b5e8
commit 3a8d7c0839
10 changed files with 74 additions and 0 deletions
+1
View File
@@ -47,6 +47,7 @@
/compiler/backend/ "Kotlin JVM"
/compiler/backend.common.jvm/ "Kotlin JVM"
/compiler/backend-common/ "Kotlin JVM" "Kotlin JS" "Kotlin Native" "Kotlin Wasm"
/compiler/build-tools/ "Kotlin Build Tools"
/compiler/builtins-serializer/ "Kotlin Compiler Core"
/compiler/cli/ "Kotlin Compiler Core"
/compiler/cli/cli-js/ "Kotlin JS" "Kotlin Wasm"
+3
View File
@@ -0,0 +1,3 @@
## Build Tools
Please refer to the [Build Tools API readme](./build-tools-api/README.md).
@@ -0,0 +1,9 @@
## Build Tools API
This module contains public interfaces for Kotlin build tools.
Using APIs from this module should be the preferred way to work with Kotlin compiler when integrating Kotlin builds into different build systems.
The Kotlin stdlib of at least Kotlin 1.4 is expected to be a dependency of a consumer of the API.
The default implementation of the API is located in the [build-tools-impl](../build-tools-impl) directory.
Interfaces implementation are expected to be loaded using the [ServiceLoader](https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html).
The purpose of such a segregation is to allow using this API with different Kotlin compiler versions.
@@ -0,0 +1,14 @@
plugins {
kotlin("jvm")
id("jps-compatible")
}
configureKotlinCompileTasksGradleCompatibility()
dependencies {
compileOnly(kotlinStdlib())
}
publish()
standardPublicJars()
@@ -0,0 +1,14 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.buildtools.api
/**
* A facade for invoking compilation in Kotlin compiler. It allows to use compiler in different modes.
* TODO: add a mention where to see the available modes after implementing them
*/
interface CompilationService {
fun compile()
}
@@ -0,0 +1,13 @@
plugins {
kotlin("jvm")
id("jps-compatible")
}
dependencies {
api(project(":compiler:build-tools:build-tools-api"))
implementation(kotlinStdlib())
}
publish()
standardPublicJars()
@@ -0,0 +1,14 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.buildtools.internal
import org.jetbrains.kotlin.buildtools.api.CompilationService
internal class CompilationServiceImpl : CompilationService {
override fun compile() {
println("I'm simulating compilation, nothing more yet")
}
}
@@ -0,0 +1 @@
org.jetbrains.kotlin.buildtools.internal.CompilationServiceImpl
+2
View File
@@ -12,6 +12,8 @@
<trust file=".*[.]pom" regex="true"/>
<trust file="kotlin-native-prebuilt-.*" regex="true"/>
<trust group="gradle" name="gradle" file="gradle-.*-src[.]zip" regex="true"/>
<trust group="org.jetbrains.kotlin" name="build-tools-api" version="1.9.[0-9](-.+)?" regex="true"/>
<trust group="org.jetbrains.kotlin" name="build-tools-impl" version="1.9.[0-9](-.+)?" regex="true"/>
<trust group="org.jetbrains.kotlin" name="builtins" version="1.9.[0-9](-.+)?" regex="true"/>
<trust group="org.jetbrains.kotlin" name="kotlin-android-extensions" version="1.9.[0-9](-.+)?" regex="true"/>
<trust group="org.jetbrains.kotlin" name="kotlin-annotation-processing-embeddable" version="1.9.[0-9](-.+)?" regex="true"/>
+3
View File
@@ -378,6 +378,9 @@ if (!buildProperties.inJpsBuildIdeaSync) {
":prepare:ide-plugin-dependencies:kotlin-compiler-fir-for-ide"
}
include ":compiler:build-tools:build-tools-api",
":compiler:build-tools:build-tools-impl"
void intellij(String imlPath) {
File imlFile = new File("${rootDir}/intellij/community/plugins/kotlin/${imlPath}")
imlFile = imlFile.exists() ? imlFile : new File("${rootDir}/intellij/plugins/kotlin/${imlPath}")