From 9468ca70e45a65193a8b644dd6cf5e61cfec80d9 Mon Sep 17 00:00:00 2001 From: Ralf Wondratschek Date: Fri, 15 Nov 2024 10:00:07 -0800 Subject: [PATCH] Use testFixtures for compiler test utils Use Gradle's `testFixtures` API to share testing utilities for the compiler instead of using a separate module. --- compiler-test/build.gradle | 13 ------------- compiler-test/gradle.properties | 2 -- compiler-utils/build.gradle | 8 ++++++++ .../amazon/lastmile/kotlin/inject/anvil/Asserts.kt | 0 .../kotlin/inject/anvil/CommonSourceCode.kt | 0 .../lastmile/kotlin/inject/anvil/Compilation.kt | 0 compiler/build.gradle | 2 +- settings.gradle | 1 - 8 files changed, 9 insertions(+), 17 deletions(-) delete mode 100644 compiler-test/build.gradle delete mode 100644 compiler-test/gradle.properties rename {compiler-test/src/main => compiler-utils/src/testFixtures}/kotlin/software/amazon/lastmile/kotlin/inject/anvil/Asserts.kt (100%) rename {compiler-test/src/main => compiler-utils/src/testFixtures}/kotlin/software/amazon/lastmile/kotlin/inject/anvil/CommonSourceCode.kt (100%) rename {compiler-test/src/main => compiler-utils/src/testFixtures}/kotlin/software/amazon/lastmile/kotlin/inject/anvil/Compilation.kt (100%) diff --git a/compiler-test/build.gradle b/compiler-test/build.gradle deleted file mode 100644 index fa2c3b5..0000000 --- a/compiler-test/build.gradle +++ /dev/null @@ -1,13 +0,0 @@ -plugins { - id 'software.amazon.lib.jvm' -} - -dependencies { - api libs.kotlin.compile.testing.core - api libs.ksp.api - - implementation project(':compiler-utils') - implementation project(':runtime') - implementation libs.assertk - implementation libs.kotlin.compile.testing.ksp -} diff --git a/compiler-test/gradle.properties b/compiler-test/gradle.properties deleted file mode 100644 index 8e3ecbb..0000000 --- a/compiler-test/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -POM_ARTIFACT_ID=compiler-test -POM_NAME=Kotlin Inject Anvil Compiler Test Utilities diff --git a/compiler-utils/build.gradle b/compiler-utils/build.gradle index b71e78e..7edaab4 100644 --- a/compiler-utils/build.gradle +++ b/compiler-utils/build.gradle @@ -1,5 +1,6 @@ plugins { id 'software.amazon.lib.jvm' + id 'java-test-fixtures' } dependencies { @@ -9,4 +10,11 @@ dependencies { implementation project(':runtime') implementation libs.kotlin.poet.ksp implementation libs.kotlin.inject.runtime + + testFixturesApi libs.kotlin.compile.testing.core + testFixturesApi libs.ksp.api + + testFixturesImplementation project(':runtime') + testFixturesImplementation libs.assertk + testFixturesImplementation libs.kotlin.compile.testing.ksp } diff --git a/compiler-test/src/main/kotlin/software/amazon/lastmile/kotlin/inject/anvil/Asserts.kt b/compiler-utils/src/testFixtures/kotlin/software/amazon/lastmile/kotlin/inject/anvil/Asserts.kt similarity index 100% rename from compiler-test/src/main/kotlin/software/amazon/lastmile/kotlin/inject/anvil/Asserts.kt rename to compiler-utils/src/testFixtures/kotlin/software/amazon/lastmile/kotlin/inject/anvil/Asserts.kt diff --git a/compiler-test/src/main/kotlin/software/amazon/lastmile/kotlin/inject/anvil/CommonSourceCode.kt b/compiler-utils/src/testFixtures/kotlin/software/amazon/lastmile/kotlin/inject/anvil/CommonSourceCode.kt similarity index 100% rename from compiler-test/src/main/kotlin/software/amazon/lastmile/kotlin/inject/anvil/CommonSourceCode.kt rename to compiler-utils/src/testFixtures/kotlin/software/amazon/lastmile/kotlin/inject/anvil/CommonSourceCode.kt diff --git a/compiler-test/src/main/kotlin/software/amazon/lastmile/kotlin/inject/anvil/Compilation.kt b/compiler-utils/src/testFixtures/kotlin/software/amazon/lastmile/kotlin/inject/anvil/Compilation.kt similarity index 100% rename from compiler-test/src/main/kotlin/software/amazon/lastmile/kotlin/inject/anvil/Compilation.kt rename to compiler-utils/src/testFixtures/kotlin/software/amazon/lastmile/kotlin/inject/anvil/Compilation.kt diff --git a/compiler/build.gradle b/compiler/build.gradle index 74fb60c..0d6243f 100644 --- a/compiler/build.gradle +++ b/compiler/build.gradle @@ -23,7 +23,7 @@ dependencies { // Gives us access to annotations. implementation libs.kotlin.inject.runtime - testImplementation project(':compiler-test') + testImplementation(testFixtures(project(':compiler-utils'))) testImplementation project(':runtime-optional') testImplementation libs.assertk testImplementation libs.kotlin.compile.testing.core diff --git a/settings.gradle b/settings.gradle index a406984..68cd017 100644 --- a/settings.gradle +++ b/settings.gradle @@ -33,7 +33,6 @@ develocity { rootProject.name = 'kotlin-inject-anvil' include ':compiler' -include ':compiler-test' include ':compiler-utils' include ':runtime' include ':runtime-optional'