[repo] Migrate Groovy build scripts to use 'kotlinStdlib()' directly from buildSrc

This commit is contained in:
Yahor Berdnikau
2023-06-30 18:16:57 +02:00
committed by Space Team
parent 3629a9db30
commit 5de2b5aeb4
15 changed files with 19 additions and 20 deletions
@@ -3,6 +3,8 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@file:JvmName("RepoDependencies")
import org.gradle.api.GradleException import org.gradle.api.GradleException
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.artifacts.* import org.gradle.api.artifacts.*
@@ -81,6 +83,7 @@ fun Project.preloadedDeps(
fun kotlinDep(artifactBaseName: String, version: String, classifier: String? = null): String = fun kotlinDep(artifactBaseName: String, version: String, classifier: String? = null): String =
listOfNotNull("org.jetbrains.kotlin:kotlin-$artifactBaseName:$version", classifier).joinToString(":") listOfNotNull("org.jetbrains.kotlin:kotlin-$artifactBaseName:$version", classifier).joinToString(":")
@JvmOverloads
fun Project.kotlinStdlib(suffix: String? = null, classifier: String? = null): Any { fun Project.kotlinStdlib(suffix: String? = null, classifier: String? = null): Any {
return if (kotlinBuildProperties.useBootstrapStdlib) return if (kotlinBuildProperties.useBootstrapStdlib)
kotlinDep(listOfNotNull("stdlib", suffix).joinToString("-"), bootstrapKotlinVersion, classifier) kotlinDep(listOfNotNull("stdlib", suffix).joinToString("-"), bootstrapKotlinVersion, classifier)
+2 -2
View File
@@ -141,7 +141,7 @@ configurations {
dependencies { dependencies {
kotlin_compiler_jar kotlinCompilerModule kotlin_compiler_jar kotlinCompilerModule
kotlin_stdlib_jar kotlinStdLibModule kotlin_stdlib_jar kotlinStdLibModule
use(DependenciesKt) { use(RepoDependencies) {
trove4j_jar commonDependency("org.jetbrains.intellij.deps:trove4j") trove4j_jar commonDependency("org.jetbrains.intellij.deps:trove4j")
kotlin_reflect_jar commonDependency("org.jetbrains.kotlin:kotlin-reflect") kotlin_reflect_jar commonDependency("org.jetbrains.kotlin:kotlin-reflect")
compilerApi(commonDependency("org.jetbrains.intellij.deps.fastutil:intellij-deps-fastutil")) { setTransitive(false) } compilerApi(commonDependency("org.jetbrains.intellij.deps.fastutil:intellij-deps-fastutil")) { setTransitive(false) }
@@ -252,4 +252,4 @@ publishing {
ArtifactsKt.sourcesJar(project) { ArtifactsKt.sourcesJar(project) {
it.from(sourceSets["cli_bc"].allSource) it.from(sourceSets["cli_bc"].allSource)
it.from(sourceSets["compiler"].allSource) it.from(sourceSets["compiler"].allSource)
} }
@@ -36,7 +36,7 @@ configurations {
dependencies { dependencies {
// TODO: upgrade coroutines to common version // TODO: upgrade coroutines to common version
api DependenciesKt.commonDependency(project, "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7") api RepoDependencies.commonDependency(project, "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7")
} }
ext.testOutputRoot = rootProject.file("test.output").absolutePath ext.testOutputRoot = rootProject.file("test.output").absolutePath
@@ -6246,7 +6246,7 @@ dependencies {
implementation kotlinCompilerModule implementation kotlinCompilerModule
api project(path: ':kotlin-native:backend.native', configuration: 'cli_bcApiElements') api project(path: ':kotlin-native:backend.native', configuration: 'cli_bcApiElements')
api DependenciesKt.commonDependency(project, "junit") api RepoDependencies.commonDependency(project, "junit")
} }
// Configure build for iOS device targets. // Configure build for iOS device targets.
+2 -2
View File
@@ -44,7 +44,7 @@ dependencies {
implementation project(":kotlin-stdlib") implementation project(":kotlin-stdlib")
implementation project(path: ':kotlin-native:backend.native', configuration: 'cli_bcApiElements') implementation project(path: ':kotlin-native:backend.native', configuration: 'cli_bcApiElements')
implementation project(":kotlin-native:utilities:basic-utils") implementation project(":kotlin-native:utilities:basic-utils")
testImplementation DependenciesKt.commonDependency(project, "junit") testImplementation RepoDependencies.commonDependency(project, "junit")
testImplementation project(":kotlin-test:kotlin-test-junit") testImplementation project(":kotlin-test:kotlin-test-junit")
} }
@@ -60,4 +60,4 @@ test {
} }
classpath = distClasspath + sourceSets.test.runtimeClasspath - sourceSets.main.runtimeClasspath classpath = distClasspath + sourceSets.test.runtimeClasspath - sourceSets.main.runtimeClasspath
} }
} }
-4
View File
@@ -86,8 +86,4 @@ allprojects { project ->
lambda() lambda()
} }
} }
dependencies.ext.kotlinStdlib = { suffix ->
DependenciesKt.kotlinStdlib(project, suffix, null)
}
} }
@@ -24,7 +24,7 @@ dependencies {
api project(':kotlin-test:kotlin-test-junit') api project(':kotlin-test:kotlin-test-junit')
compileOnly kotlinStdlib() compileOnly RepoDependencies.kotlinStdlib(project)
compileOnly project(':compiler') compileOnly project(':compiler')
compileOnly project(':compiler:plugin-api') compileOnly project(':compiler:plugin-api')
compileOnly project(':compiler:cli-common') compileOnly project(':compiler:cli-common')
@@ -5,7 +5,7 @@ apply plugin: 'kotlin-platform-common'
JvmToolchain.updateJvmTarget(project, "1.8") JvmToolchain.updateJvmTarget(project, "1.8")
dependencies { dependencies {
api kotlinStdlib("common") api RepoDependencies.kotlinStdlib(project, "common")
testApi project(":kotlin-test:kotlin-test-common") testApi project(":kotlin-test:kotlin-test-common")
} }
+1 -1
View File
@@ -5,7 +5,7 @@ apply plugin: 'kotlin-platform-common'
JvmToolchain.updateJvmTarget(project, "1.8") JvmToolchain.updateJvmTarget(project, "1.8")
dependencies { dependencies {
api kotlinStdlib("common") api RepoDependencies.kotlinStdlib(project, "common")
testApi project(":kotlin-test:kotlin-test-annotations-common") testApi project(":kotlin-test:kotlin-test-annotations-common")
} }
+1 -1
View File
@@ -10,7 +10,7 @@ configurations {
dependencies { dependencies {
expectedBy project(':kotlin-test:kotlin-test-common') expectedBy project(':kotlin-test:kotlin-test-common')
expectedBy project(':kotlin-test:kotlin-test-annotations-common') expectedBy project(':kotlin-test:kotlin-test-annotations-common')
api kotlinStdlib("js") api RepoDependencies.kotlinStdlib(project, "js")
} }
compileKotlin2Js { compileKotlin2Js {
+1 -1
View File
@@ -54,7 +54,7 @@ tasks.register("populateNodeModules", Copy) {
} }
node { node {
version = DependenciesKt.getNodejsVersion(project) version = RepoDependencies.getNodejsVersion(project)
download = true download = true
} }
+1 -1
View File
@@ -16,7 +16,7 @@ sourceSets {
dependencies { dependencies {
expectedBy project(':kotlin-test:kotlin-test-common') expectedBy project(':kotlin-test:kotlin-test-common')
api(kotlinStdlib()) api(RepoDependencies.kotlinStdlib(project))
testApi(project(":kotlin-test:kotlin-test-junit")) testApi(project(":kotlin-test:kotlin-test-junit"))
testApi('junit:junit:4.13.2') testApi('junit:junit:4.13.2')
} }
+1 -1
View File
@@ -22,7 +22,7 @@ sourceSets {
} }
dependencies { dependencies {
api kotlinStdlib() api RepoDependencies.kotlinStdlib(project)
compileOnly project(':core:descriptors') compileOnly project(':core:descriptors')
compileOnly project(':core:descriptors.jvm') compileOnly project(':core:descriptors.jvm')
compileOnly project(':core:deserialization') compileOnly project(':core:deserialization')
+1 -1
View File
@@ -327,7 +327,7 @@ artifacts {
node { node {
download = true download = true
version = DependenciesKt.getNodejsVersion(project) version = RepoDependencies.getNodejsVersion(project)
nodeProjectDir = buildDir nodeProjectDir = buildDir
} }
@@ -15,7 +15,7 @@ sourceSets {
} }
dependencies { dependencies {
compileOnly DependenciesKt.kotlinBuiltins(project) compileOnly RepoDependencies.kotlinBuiltins(project)
} }
configureSourcesJar() configureSourcesJar()
+1 -1
View File
@@ -7,7 +7,7 @@ JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_8)
configurePublishing(project) configurePublishing(project)
dependencies { dependencies {
compileOnly kotlinStdlib() compileOnly RepoDependencies.kotlinStdlib(project)
} }
sourceSets { sourceSets {