Skip to content

Commit

Permalink
Run Gradle LanguageVersion tests with Kotlin min version
Browse files Browse the repository at this point in the history
  • Loading branch information
BoD authored and Anka committed Nov 27, 2024
1 parent 9554653 commit 6819f7b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,19 @@ class LanguageVersionTests {
graphqlPath: String = "hero",
block: (File) -> Unit,
) {
TestUtils.withProject(
usesKotlinDsl = true,
plugins = listOf(TestUtils.kotlinJvmPlugin, TestUtils.apolloPlugin),
apolloConfiguration = getConfiguration(
kotlinLanguageVersion = kotlinLanguageVersion,
kotlinApiVersion = kotlinApiVersion,
apolloLanguageVersion = apolloLanguageVersion,
),
graphqlPath = graphqlPath,
block = block
)
TestUtils.withTestProject("language-version") { dir ->
dir.resolve("build.gradle.kts").appendText(
getConfiguration(
kotlinLanguageVersion = kotlinLanguageVersion,
kotlinApiVersion = kotlinApiVersion,
apolloLanguageVersion = apolloLanguageVersion,
)
)

TestUtils.fixturesDirectory().resolve(graphqlPath).copyRecursively(dir.resolve("src/main/graphql/com/example"))

block(dir)
}
}

private fun getConfiguration(
Expand All @@ -90,7 +92,7 @@ class LanguageVersionTests {
""".trimIndent()

val apolloConfiguration = """
apollo {
configure<ApolloExtension> {
service("service") {
packageNamesFromFilePaths()
codegenModels.set(com.apollographql.apollo.compiler.MODELS_RESPONSE_BASED)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import com.apollographql.apollo.gradle.api.ApolloExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
alias(libs.plugins.kotlin.jvm.min)
alias(libs.plugins.apollo)
}

dependencies {
add("implementation", libs.apollo.api)
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
// Required for Kotlin < 1.6.10
// See https://kotlinlang.org/docs/whatsnew1620.html#compatibility-changes-in-the-xjvm-default-modes
freeCompilerArgs += "-Xjvm-default=all"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apply(from = "../../../../gradle/test.settings.gradle.kts")

0 comments on commit 6819f7b

Please sign in to comment.