diff --git a/kotlin-native/build-tools/build.gradle.kts b/kotlin-native/build-tools/build.gradle.kts index c0b8713c08f..ece68def300 100644 --- a/kotlin-native/build-tools/build.gradle.kts +++ b/kotlin-native/build-tools/build.gradle.kts @@ -16,16 +16,19 @@ plugins { } buildscript { + val rootBuildDirectory by extra(project.file("../..")) + + apply(from = rootBuildDirectory.resolve("kotlin-native/gradle/loadRootProperties.gradle")) dependencies { - classpath("com.google.code.gson:gson:2.8.6") + classpath(commonDependency("com.google.code.gson:gson")) } } val rootProperties = Properties().apply { - rootDir.resolve("../gradle.properties").reader().use(::load) + project(":kotlin-native").projectDir.resolve("gradle.properties").reader().use(::load) } -val kotlinVersion: String by rootProperties +val kotlinVersion = project.bootstrapKotlinVersion val konanVersion: String by rootProperties val slackApiVersion: String by rootProperties val ktorVersion: String by rootProperties @@ -46,50 +49,40 @@ dependencies { implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion") implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") - implementation("com.ullink.slack:simpleslackapi:$slackApiVersion") + implementation("com.ullink.slack:simpleslackapi:$slackApiVersion") { + exclude(group = "com.google.code.gson", module = "gson") // Workaround for Gradle dependency resolution error + } + val versionPropertiesFile = project.rootProject.projectDir.resolve("gradle/versions.properties") + val versionProperties = Properties() + versionPropertiesFile.inputStream().use { propInput -> + versionProperties.load(propInput) + } + configurations.all { + resolutionStrategy.eachDependency { + if (requested.group == "com.google.code.gson" && requested.name == "gson") { + useVersion(versionProperties["versions.gson"] as String) + because("Force using same gson version because of https://github.com/google/gson/pull/1991") + } + } + } implementation("io.ktor:ktor-client-auth:$ktorVersion") implementation("io.ktor:ktor-client-core:$ktorVersion") implementation("io.ktor:ktor-client-cio:$ktorVersion") - api("org.jetbrains.kotlin:kotlin-native-utils:$kotlinVersion") + api(project(":native:kotlin-native-utils")) // Located in /shared and always provided by the composite build. - api("org.jetbrains.kotlin:kotlin-native-shared:$konanVersion") - implementation("gradle.plugin.com.github.johnrengelman:shadow:$shadowVersion") - - implementation("org.jetbrains.kotlinx:kotlinx-metadata-klib:$metadataVersion") +// api("org.jetbrains.kotlin:kotlin-native-shared:$kotlinVersion") +// implementation("gradle.plugin.com.github.johnrengelman:shadow:$shadowVersion") +// +// implementation("org.jetbrains.kotlinx:kotlinx-metadata-klib:$metadataVersion") } sourceSets["main"].withConvention(KotlinSourceSet::class) { kotlin.srcDir("$projectDir/../tools/benchmarks/shared/src/main/kotlin/report") } -gradlePlugin { - plugins { - create("benchmarkPlugin") { - id = "benchmarking" - implementationClass = "org.jetbrains.kotlin.benchmark.KotlinNativeBenchmarkingPlugin" - } - create("compileBenchmarking") { - id = "compile-benchmarking" - implementationClass = "org.jetbrains.kotlin.benchmark.CompileBenchmarkingPlugin" - } - create("swiftBenchmarking") { - id = "swift-benchmarking" - implementationClass = "org.jetbrains.kotlin.benchmark.SwiftBenchmarkingPlugin" - } - create("compileToBitcode") { - id = "compile-to-bitcode" - implementationClass = "org.jetbrains.kotlin.bitcode.CompileToBitcodePlugin" - } - create("runtimeTesting") { - id = "runtime-testing" - implementationClass = "org.jetbrains.kotlin.testing.native.RuntimeTestingPlugin" - } - } -} - val compileKotlin: KotlinCompile by tasks val compileGroovy: GroovyCompile by tasks @@ -100,6 +93,6 @@ compileKotlin.apply { // Add Kotlin classes to a classpath for the Groovy compiler compileGroovy.apply { - classpath += project.files(compileKotlin.destinationDir) + classpath += project.files(compileKotlin.destinationDirectory) dependsOn(compileKotlin) } diff --git a/settings.gradle b/settings.gradle index 2c699c7a1c7..af3178ffdf6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -783,4 +783,5 @@ if (buildProperties.isKotlinNativeEnabled) { include ':kotlin-native:backend.native:tests' include ":kotlin-native-compiler-embeddable" project(":kotlin-native-compiler-embeddable").projectDir = "$rootDir/kotlin-native/prepare/kotlin-native-embeddable-compiler" as File + include ':kotlin-native:build-tools' }