Skip to content

Commit d3c293d

Browse files
BoDAnka
authored andcommitted
Use compilerOptions instead of deprecated kotlinOptions
1 parent 262472c commit d3c293d

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

libraries/apollo-gradle-plugin/src/test/kotlin/test/LanguageVersionTests.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import kotlin.test.assertEquals
1515
class LanguageVersionTests {
1616
@Test
1717
fun `compiling with 1_5 features with Kotlin 1_5 is working`() {
18-
withProject(kotlinLanguageVersion = "1.5", apolloLanguageVersion = "1.5") { dir ->
18+
withProject(kotlinLanguageVersion = "org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_5", apolloLanguageVersion = "1.5") { dir ->
1919
dir.disableIsolatedProjects() // old KGP versions do not support isolated projects
2020
TestUtils.executeGradleWithVersion(dir, "8.10", ":assemble").apply {
2121
assertEquals(TaskOutcome.SUCCESS, task(":assemble")!!.outcome)
@@ -25,7 +25,7 @@ class LanguageVersionTests {
2525

2626
@Test
2727
fun `compiling with 1_5 features with Kotlin 1_4 is not working`() {
28-
withProject(kotlinLanguageVersion = "1.4", apolloLanguageVersion = "1.5") { dir ->
28+
withProject(kotlinLanguageVersion = "org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_4", apolloLanguageVersion = "1.5") { dir ->
2929
try {
3030
TestUtils.executeGradleWithVersion(dir, "8.10", ":assemble")
3131
Assert.fail("Compiling with incompatible languageVersion should fail")
@@ -37,7 +37,7 @@ class LanguageVersionTests {
3737

3838
@Test
3939
fun `using bogus languageVersion fails`() {
40-
withProject(kotlinLanguageVersion = "1.5", apolloLanguageVersion = "3.14") { dir ->
40+
withProject(kotlinLanguageVersion = "org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_5", apolloLanguageVersion = "3.14") { dir ->
4141
try {
4242
TestUtils.executeGradleWithVersion(dir, "8.10", ":assemble")
4343
Assert.fail("Compiling with incompatible languageVersion should fail")
@@ -98,9 +98,9 @@ class LanguageVersionTests {
9898
): String {
9999
val kotlinConfiguration = """
100100
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
101-
kotlinOptions {
102-
${if (kotlinLanguageVersion == null) "" else "languageVersion = \"$kotlinLanguageVersion\""}
103-
${if (kotlinApiVersion == null) "" else "apiVersion = \"$kotlinApiVersion\""}
101+
compilerOptions {
102+
${if (kotlinLanguageVersion == null) "" else "languageVersion.set($kotlinLanguageVersion)"}
103+
${if (kotlinApiVersion == null) "" else "apiVersion.set(\"$kotlinApiVersion\")"}
104104
}
105105
}
106106
""".trimIndent()

libraries/apollo-gradle-plugin/testProjects/kotlin-android-plugin-version/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ java.toolchain {
3636
}
3737

3838
tasks.withType<KotlinCompile>().configureEach {
39-
kotlinOptions {
39+
compilerOptions {
4040
// Required for Kotlin < 1.6.10
4141
// See https://kotlinlang.org/docs/whatsnew1620.html#compatibility-changes-in-the-xjvm-default-modes
42-
freeCompilerArgs += "-Xjvm-default=all"
43-
freeCompilerArgs += "-Xskip-prerelease-check"
42+
freeCompilerArgs.add("-Xjvm-default=all")
43+
freeCompilerArgs.add("-Xskip-prerelease-check")
4444
}
4545
}

libraries/apollo-gradle-plugin/testProjects/kotlin-plugin-version-min/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ configure<ApolloExtension> {
1717
}
1818

1919
tasks.withType<KotlinCompile>().configureEach {
20-
kotlinOptions {
20+
compilerOptions {
2121
// Required for Kotlin < 1.6.10
2222
// See https://kotlinlang.org/docs/whatsnew1620.html#compatibility-changes-in-the-xjvm-default-modes
23-
freeCompilerArgs += "-Xjvm-default=all"
23+
freeCompilerArgs.add("-Xjvm-default=all")
2424
}
2525
}

libraries/apollo-gradle-plugin/testProjects/language-version/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ dependencies {
1111
}
1212

1313
tasks.withType<KotlinCompile>().configureEach {
14-
kotlinOptions {
14+
compilerOptions {
1515
// Required for Kotlin < 1.6.10
1616
// See https://kotlinlang.org/docs/whatsnew1620.html#compatibility-changes-in-the-xjvm-default-modes
17-
freeCompilerArgs += "-Xjvm-default=all"
17+
freeCompilerArgs.add("-Xjvm-default=all")
1818
}
1919
}

0 commit comments

Comments
 (0)