[K/N][build] Dependencies fixes: trove4j and kotlin-compiler

* Depend on kotlin-compiler project instead of its runtimeElements only
* trove4j fixes: add as a dependency and use common version
* Strip dependencies in different projects: remove unnecessary
This commit is contained in:
Pavel Punegov
2022-10-11 18:44:48 +02:00
committed by Space Team
parent ea6b784e41
commit d2c58cdd27
8 changed files with 31 additions and 22 deletions
@@ -30,12 +30,11 @@ application {
dependencies {
implementation(project(":kotlin-native:Interop:Indexer"))
implementation(project(":kotlin-native:utilities:basic-utils"))
api(project(path = ":kotlin-native:endorsedLibraries:kotlinx.cli", configuration = "jvmRuntimeElements"))
implementation(project(path = ":kotlin-native:endorsedLibraries:kotlinx.cli", configuration = "jvmRuntimeElements"))
api(project(":kotlin-stdlib"))
api(project(path = ":kotlin-compiler", configuration = "runtimeElements"))
api(project(":kotlinx-metadata-klib"))
api(project(":native:kotlin-native-utils"))
implementation(project(":kotlinx-metadata-klib"))
implementation(project(":native:kotlin-native-utils"))
implementation(project(":compiler:util"))
implementation(project(":compiler:ir.serialization.common"))
+3 -3
View File
@@ -103,17 +103,17 @@ configurations {
}
dependencies {
trove4j_jar "org.jetbrains.intellij.deps:trove4j:1.0.20181211@jar"
kotlin_compiler_jar project(kotlinCompilerModule)
kotlin_compiler_jar kotlinCompilerModule
kotlin_stdlib_jar kotlinStdLibModule
use(DependenciesKt) {
trove4j_jar commonDependency("org.jetbrains.intellij.deps:trove4j")
kotlin_reflect_jar commonDependency("org.jetbrains.kotlin:kotlin-reflect")
}
kotlin_script_runtime_jar project(":kotlin-script-runtime")
compilerApi project(":kotlin-native:utilities:basic-utils")
compilerApi project(kotlinCompilerModule)
compilerImplementation project(":kotlin-compiler")
compilerApi project(":native:kotlin-native-utils")
compilerApi project(":core:descriptors")
compilerApi project(":compiler:ir.tree")
@@ -42,8 +42,8 @@ configurations {
}
dependencies {
api 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
cli_bc project(path: ':kotlin-native:backend.native', configuration: 'cli_bcApiElements')
// TODO: upgrade coroutines to common version
api DependenciesKt.commonDependency(project, "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7")
}
ext.testOutputRoot = rootProject.file("test.output").absolutePath
@@ -6480,7 +6480,7 @@ fileCheckTest("filecheck_constants_merge") {
}
dependencies {
nopPluginApi project(kotlinCompilerModule)
nopPluginApi kotlinCompilerModule
nopPluginApi project(":native:kotlin-native-utils")
nopPluginApi project(":core:descriptors")
nopPluginApi project(":compiler:ir.tree")
@@ -6493,7 +6493,7 @@ dependencies {
nopPluginApi project(":kotlin-util-klib-metadata")
nopPluginApi project(":compiler:ir.serialization.common")
api project(kotlinCompilerModule)
implementation kotlinCompilerModule
api project(path: ':kotlin-native:backend.native', configuration: 'cli_bcApiElements')
api DependenciesKt.commonDependency(project, "junit")
}
+1 -1
View File
@@ -78,7 +78,7 @@ ext {
KonanTarget.LINUX_MIPSEL32.INSTANCE
]
kotlinCompilerModule= [path: ":kotlin-compiler", configuration: "runtimeElements"]
kotlinCompilerModule = project(":kotlin-compiler")
kotlinStdLibModule= project(":kotlin-stdlib")
kotlinScriptRuntimeModule= project(":kotlin-script-runtime")
kotlinUtilKliMetadatabModule= project(":kotlin-util-klib-metadata")
@@ -1,5 +1,4 @@
import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.kotlin.konan.target.KonanTarget.MACOS_ARM64
import org.jetbrains.kotlin.kotlinNativeDist
plugins {
@@ -16,7 +15,7 @@ val testCompilerClasspath by configurations.creating {
}
}
repositories{
repositories {
mavenCentral()
}
@@ -25,7 +24,7 @@ val testPlugin by configurations.creating
val testPluginRuntime by configurations.creating
fun DependencyHandlerScope.testPluginRuntime(any: Any) {
val notation = any as? String ?: return add(testPluginRuntime.name, any){}
val notation = any as? String ?: return add(testPluginRuntime.name, any) {}
val (group, artifact, version) = notation.split(":")
val platformName = HostManager.host.name
val gradlePlatformName = platformName.replace("_", "")
@@ -79,11 +78,15 @@ projectTest {
* It's expected that test should be executed on CI, but currently this project under `kotlin.native.enabled`
*/
dependsOn(runtimeJar)
val runtimeJarPathProvider = project.provider { runtimeJar.get().outputs.files.asPath }
val runtimeJarPathProvider = project.provider {
val jar = runtimeJar.get().outputs.files.asPath
val trove = configurations.detachedConfiguration(
dependencies.module(commonDependency("org.jetbrains.intellij.deps:trove4j"))
)
(trove.files + jar).joinToString(File.pathSeparatorChar.toString())
}
doFirst {
systemProperty("compilerClasspath", runtimeJarPathProvider.get())
systemProperty("kotlin.native.home", kotlinNativeDist)
}
}
}
@@ -21,6 +21,5 @@ tasks.named<KotlinCompile>("compileKotlin") {
dependencies {
api(project(":kotlin-stdlib"))
implementation(project(project.project(":kotlin-native").extra["kotlinCompilerModule"] as Map<String, *>))
implementation(project(":compiler:util"))
}
@@ -23,4 +23,5 @@ dependencies {
implementation project(':kotlin-native:Interop:StubGenerator')
implementation project(':kotlin-native:klib')
implementation project(":kotlin-native:utilities:basic-utils")
implementation project(path: ":kotlin-native:endorsedLibraries:kotlinx.cli", configuration: "jvmRuntimeElements")
}
+9 -2
View File
@@ -111,9 +111,16 @@ fun nativeTest(taskName: String, vararg tags: String) = projectTest(
TestProperty.COMPILER_CLASSPATH.setUpFromGradleProperty(this) {
val customNativeHome = TestProperty.KOTLIN_NATIVE_HOME.readGradleProperty(this)
if (customNativeHome != null) {
file(customNativeHome).resolve("konan/lib/kotlin-native-compiler-embeddable.jar").absolutePath
file(customNativeHome).run {
val embeddableJar = resolve("konan/lib/kotlin-native-compiler-embeddable.jar").absolutePath
val troveJar = resolve("konan/lib/trove4j.jar").absolutePath
troveJar + File.pathSeparatorChar.toString() + embeddableJar
}
} else {
val kotlinNativeCompilerEmbeddable = configurations.detachedConfiguration(dependencies.project(":kotlin-native-compiler-embeddable"))
val kotlinNativeCompilerEmbeddable = configurations.detachedConfiguration(
dependencies.project(":kotlin-native-compiler-embeddable"),
dependencies.module(commonDependency("org.jetbrains.intellij.deps:trove4j"))
)
dependsOn(kotlinNativeCompilerEmbeddable)
kotlinNativeCompilerEmbeddable.files.joinToString(";")
}