diff --git a/build-logic/src/main/kotlin/CompilerOptions.kt b/build-logic/src/main/kotlin/CompilerOptions.kt index 70b8b45b89..134e84aed4 100644 --- a/build-logic/src/main/kotlin/CompilerOptions.kt +++ b/build-logic/src/main/kotlin/CompilerOptions.kt @@ -1,7 +1,7 @@ - import com.android.build.gradle.BaseExtension import org.gradle.api.JavaVersion import org.gradle.api.Project +import org.gradle.api.artifacts.ExternalDependency import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.testing.Test @@ -29,6 +29,7 @@ fun KotlinCommonCompilerOptions.configure(target: Int, kotlinCompilerOptions: Ko // D8 can dex Java17 bytecode 17 } + else -> target } @@ -67,7 +68,7 @@ fun KotlinCommonCompilerOptions.configure(target: Int, kotlinCompilerOptions: Ko } private fun Int.toJvmTarget(): JvmTarget { - return when(this) { + return when (this) { 8 -> JvmTarget.JVM_1_8 else -> JvmTarget.fromTarget(this.toString()) } @@ -107,7 +108,7 @@ val Project.androidExtensionOrNull: BaseExtension? fun Project.configureJavaAndKotlinCompilers(jvmTarget: Int?, kotlinCompilerOptions: KotlinCompilerOptions) { @Suppress("NAME_SHADOWING") - val jvmTarget = jvmTarget?: 8 + val jvmTarget = jvmTarget ?: 8 kotlinExtensionOrNull?.forEachCompilerOptions { isAndroid -> configure(jvmTarget, kotlinCompilerOptions, isAndroid) @@ -147,6 +148,7 @@ fun Project.configureJavaAndKotlinCompilers(jvmTarget: Int?, kotlinCompilerOptio toolchain.languageVersion.set(JavaLanguageVersion.of(17)) } + kotlinExtensionOrNull?.coreLibrariesVersion = "${kotlinCompilerOptions.version.version}.0" /** * Required because of: * diff --git a/gradle/libraries.toml b/gradle/libraries.toml index 2467d036c0..713bf2bcec 100644 --- a/gradle/libraries.toml +++ b/gradle/libraries.toml @@ -30,7 +30,6 @@ junit = "4.13.2" kotlin-plugin-min = "1.9.0" kotlin-plugin = "2.1.0" kotlin-plugin-max = "2.1.0" -kotlin-stdlib = "2.0.0" kotlinx-coroutines = "1.8.0" kotlinx-datetime = "0.5.0" kotlinx-serialization-runtime = "1.6.2" @@ -118,7 +117,7 @@ intellij-changelog = "org.jetbrains.intellij.plugins:gradle-changelog-plugin:2.0 jetbrains-annotations = { group = "org.jetbrains", name = "annotations", version.ref = "jetbrains-annotations" } junit = { group = "junit", name = "junit", version.ref = "junit" } kotlin-allopen = { group = "org.jetbrains.kotlin", name = "kotlin-allopen", version.ref = "kotlin-plugin" } -kotlin-compiletesting = { group = "dev.zacsweers.kctfork", name = "core", version = "0.4.0" } +kotlin-compiletesting = { group = "dev.zacsweers.kctfork", name = "core", version = "0.6.0" } graphql-java = "com.graphql-java:graphql-java:20.4" # The main kotlin version for build-logic and Gradle tests kotlin-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-plugin" } @@ -126,16 +125,17 @@ kotlin-plugin-compose = { group = "org.jetbrains.kotlin", name = "compose-compil # For Gradle integration tests to make sure we stay compatible with 1.5.0 kotlin-plugin-min = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-plugin-min" } kotlin-plugin-max = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin-plugin-max" } -kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect" } # the Kotlin plugin resolves the version -kotlin-stdlib-common = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-common", version.ref = "kotlin-stdlib" } -kotlin-stdlib-jvm = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin-stdlib" } -kotlin-stdlib-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-js", version.ref = "kotlin-stdlib" } -kotlin-stdlib-wasm-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-wasm-js", version.ref = "kotlin-stdlib" } -kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test" } # the Kotlin plugin resolves the version -kotlin-test-js = { group = "org.jetbrains.kotlin", name = "kotlin-test-js" } # the Kotlin plugin resolves the version -kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit" } # the Kotlin plugin resolves the version -kotlin-test-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin-stdlib" } # use the same version as the stdlib -kotlin-test-junit-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin-stdlib" } # use the same version as the stdlib +kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect" } # use same version as apiVersion +kotlin-stdlib-common = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-common" } # use same version as apiVersion +kotlin-stdlib-jvm = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib" } # use same version as apiVersion +kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test" } # use same version as apiVersion +kotlin-test-js = { group = "org.jetbrains.kotlin", name = "kotlin-test-js" } # use same version as apiVersion +kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit" } # use same version as apiVersion +# Kotlin/JS has no apiVersion: +# 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. +# 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. +kotlin-stdlib-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-js", version.ref = "kotlin-plugin" } +kotlin-stdlib-wasm-js = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-wasm-js", version.ref = "kotlin-plugin" } kotlinx-benchmark-runtime = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime:0.4.8" kotlinx-benchmark = "org.jetbrains.kotlinx:kotlinx-benchmark-plugin:0.4.12" kotlinx-browser = "org.jetbrains.kotlinx:kotlinx-browser:0.2" diff --git a/libraries/apollo-compiler/build.gradle.kts b/libraries/apollo-compiler/build.gradle.kts index 6ad9804084..cf2c44e288 100644 --- a/libraries/apollo-compiler/build.gradle.kts +++ b/libraries/apollo-compiler/build.gradle.kts @@ -24,9 +24,7 @@ dependencies { testImplementation(libs.kotlin.compiletesting) testImplementation(libs.google.testing.compile) testImplementation(libs.truth) - testImplementation(libs.kotlin.test.junit.stdlib) { - because("We compile the generated code with Kotlin 1.9, which doesn't understand classes compiled with 2.1") - } + testImplementation(libs.kotlin.test.junit) testImplementation(libs.google.testparameterinjector) testImplementation(project(":apollo-api-java")) { because("Generated Java code references Java and Guava Optionals") @@ -84,10 +82,3 @@ tasks.withType().configureEach { addRelativeInput("usedtypesDir","src/test/usedtypes") addRelativeInput("validationDir", "src/test/validation") } - -configurations.all { - resolutionStrategy { - // We compile the generated code with Kotlin 1.9, which doesn't understand classes compiled with 2.1 - force(libs.kotlin.test.stdlib.get()) - } -} diff --git a/libraries/apollo-gradle-plugin/build.gradle.kts b/libraries/apollo-gradle-plugin/build.gradle.kts index b6ebafcb5e..0b3e3a5e9a 100644 --- a/libraries/apollo-gradle-plugin/build.gradle.kts +++ b/libraries/apollo-gradle-plugin/build.gradle.kts @@ -150,6 +150,8 @@ tasks.withType { addRelativeInput("testFiles", "testFiles") addRelativeInput("testProjects", "testProjects") + maxHeapSize = "1g" + maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1 }