Skip to content

Commit da5f138

Browse files
authored
[infra] Use same version as apiVersion for stdlib & friends (#6293)
* Use same version as apiVersion for stdlib & friends See https://youtrack.jetbrains.com/issue/KT-58999/ * Do not conflict with KGP dependency handling * Keep JS stdlib aligned with the compiler * fixed parallel forks * Revert "fixed parallel forks" This reverts commit 479651f. * more heap size
1 parent 0f83b56 commit da5f138

File tree

4 files changed

+20
-25
lines changed

4 files changed

+20
-25
lines changed

build-logic/src/main/kotlin/CompilerOptions.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
21
import com.android.build.gradle.BaseExtension
32
import org.gradle.api.JavaVersion
43
import org.gradle.api.Project
4+
import org.gradle.api.artifacts.ExternalDependency
55
import org.gradle.api.plugins.JavaPluginExtension
66
import org.gradle.api.tasks.compile.JavaCompile
77
import org.gradle.api.tasks.testing.Test
@@ -29,6 +29,7 @@ fun KotlinCommonCompilerOptions.configure(target: Int, kotlinCompilerOptions: Ko
2929
// D8 can dex Java17 bytecode
3030
17
3131
}
32+
3233
else -> target
3334
}
3435

@@ -67,7 +68,7 @@ fun KotlinCommonCompilerOptions.configure(target: Int, kotlinCompilerOptions: Ko
6768
}
6869

6970
private fun Int.toJvmTarget(): JvmTarget {
70-
return when(this) {
71+
return when (this) {
7172
8 -> JvmTarget.JVM_1_8
7273
else -> JvmTarget.fromTarget(this.toString())
7374
}
@@ -107,7 +108,7 @@ val Project.androidExtensionOrNull: BaseExtension?
107108

108109
fun Project.configureJavaAndKotlinCompilers(jvmTarget: Int?, kotlinCompilerOptions: KotlinCompilerOptions) {
109110
@Suppress("NAME_SHADOWING")
110-
val jvmTarget = jvmTarget?: 8
111+
val jvmTarget = jvmTarget ?: 8
111112

112113
kotlinExtensionOrNull?.forEachCompilerOptions { isAndroid ->
113114
configure(jvmTarget, kotlinCompilerOptions, isAndroid)
@@ -147,6 +148,7 @@ fun Project.configureJavaAndKotlinCompilers(jvmTarget: Int?, kotlinCompilerOptio
147148
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
148149
}
149150

151+
kotlinExtensionOrNull?.coreLibrariesVersion = "${kotlinCompilerOptions.version.version}.0"
150152
/**
151153
* Required because of:
152154
*

gradle/libraries.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ junit = "4.13.2"
3030
kotlin-plugin-min = "1.9.0"
3131
kotlin-plugin = "2.1.0"
3232
kotlin-plugin-max = "2.1.0"
33-
kotlin-stdlib = "2.0.0"
3433
kotlinx-coroutines = "1.8.0"
3534
kotlinx-datetime = "0.5.0"
3635
kotlinx-serialization-runtime = "1.6.2"
@@ -118,24 +117,25 @@ intellij-changelog = "org.jetbrains.intellij.plugins:gradle-changelog-plugin:2.0
118117
jetbrains-annotations = { group = "org.jetbrains", name = "annotations", version.ref = "jetbrains-annotations" }
119118
junit = { group = "junit", name = "junit", version.ref = "junit" }
120119
kotlin-allopen = { group = "org.jetbrains.kotlin", name = "kotlin-allopen", version.ref = "kotlin-plugin" }
121-
kotlin-compiletesting = { group = "dev.zacsweers.kctfork", name = "core", version = "0.4.0" }
120+
kotlin-compiletesting = { group = "dev.zacsweers.kctfork", name = "core", version = "0.6.0" }
122121
graphql-java = "com.graphql-java:graphql-java:20.4"
123122
# The main kotlin version for build-logic and Gradle tests
124123
kotlin-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-plugin" }
125124
kotlin-plugin-compose = { group = "org.jetbrains.kotlin", name = "compose-compiler-gradle-plugin", version.ref = "kotlin-plugin" }
126125
# For Gradle integration tests to make sure we stay compatible with 1.5.0
127126
kotlin-plugin-min = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-plugin-min" }
128127
kotlin-plugin-max = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-plugin-max" }
129-
kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect" } # the Kotlin plugin resolves the version
130-
kotlin-stdlib-common = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-common", version.ref = "kotlin-stdlib" }
131-
kotlin-stdlib-jvm = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin-stdlib" }
132-
kotlin-stdlib-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-js", version.ref = "kotlin-stdlib" }
133-
kotlin-stdlib-wasm-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-wasm-js", version.ref = "kotlin-stdlib" }
134-
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test" } # the Kotlin plugin resolves the version
135-
kotlin-test-js = { group = "org.jetbrains.kotlin", name = "kotlin-test-js" } # the Kotlin plugin resolves the version
136-
kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit" } # the Kotlin plugin resolves the version
137-
kotlin-test-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin-stdlib" } # use the same version as the stdlib
138-
kotlin-test-junit-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin-stdlib" } # use the same version as the stdlib
128+
kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect" } # use same version as apiVersion
129+
kotlin-stdlib-common = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-common" } # use same version as apiVersion
130+
kotlin-stdlib-jvm = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib" } # use same version as apiVersion
131+
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test" } # use same version as apiVersion
132+
kotlin-test-js = { group = "org.jetbrains.kotlin", name = "kotlin-test-js" } # use same version as apiVersion
133+
kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit" } # use same version as apiVersion
134+
# Kotlin/JS has no apiVersion:
135+
# The Kotlin/JS standard library has an older version (2.0.20-release-360) than the compiler (2.1.0). Such a configuration is not supported.
136+
# Please, make sure that the standard library has the version in the range [2.1.0 .. 2.1.255]. Adjust your project's settings if necessary.
137+
kotlin-stdlib-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-js", version.ref = "kotlin-plugin" }
138+
kotlin-stdlib-wasm-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-wasm-js", version.ref = "kotlin-plugin" }
139139
kotlinx-benchmark-runtime = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.4.8"
140140
kotlinx-benchmark = "org.jetbrains.kotlinx:kotlinx-benchmark-plugin:0.4.12"
141141
kotlinx-browser = "org.jetbrains.kotlinx:kotlinx-browser:0.2"

libraries/apollo-compiler/build.gradle.kts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ dependencies {
2424
testImplementation(libs.kotlin.compiletesting)
2525
testImplementation(libs.google.testing.compile)
2626
testImplementation(libs.truth)
27-
testImplementation(libs.kotlin.test.junit.stdlib) {
28-
because("We compile the generated code with Kotlin 1.9, which doesn't understand classes compiled with 2.1")
29-
}
27+
testImplementation(libs.kotlin.test.junit)
3028
testImplementation(libs.google.testparameterinjector)
3129
testImplementation(project(":apollo-api-java")) {
3230
because("Generated Java code references Java and Guava Optionals")
@@ -84,10 +82,3 @@ tasks.withType<Test>().configureEach {
8482
addRelativeInput("usedtypesDir","src/test/usedtypes")
8583
addRelativeInput("validationDir", "src/test/validation")
8684
}
87-
88-
configurations.all {
89-
resolutionStrategy {
90-
// We compile the generated code with Kotlin 1.9, which doesn't understand classes compiled with 2.1
91-
force(libs.kotlin.test.stdlib.get())
92-
}
93-
}

libraries/apollo-gradle-plugin/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ tasks.withType<Test> {
150150
addRelativeInput("testFiles", "testFiles")
151151
addRelativeInput("testProjects", "testProjects")
152152

153+
maxHeapSize = "1g"
154+
153155
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
154156
}
155157

0 commit comments

Comments
 (0)