diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 78b1da8..0b952a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: java-version: '17' distribution: 'temurin' - name: Build - uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2 + uses: gradle/gradle-build-action@40b6781dcdec2762ad36556682ac74e31030cfe2 # v2.5.1 with: arguments: build --stacktrace - name: Upload test results @@ -29,7 +29,7 @@ jobs: name: test-reports path: processor/build/reports/tests/test - name: Build Maven artifact - uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2 + uses: gradle/gradle-build-action@40b6781dcdec2762ad36556682ac74e31030cfe2 # v2.5.1 with: arguments: publishAllPublicationsToMavenLocalRepository --stacktrace - name: Upload Maven artifact diff --git a/.github/workflows/dokka.yml b/.github/workflows/dokka.yml index 53a8457..f2a761b 100644 --- a/.github/workflows/dokka.yml +++ b/.github/workflows/dokka.yml @@ -30,7 +30,7 @@ jobs: java-version: '17' distribution: 'temurin' - name: Dokka - uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2 + uses: gradle/gradle-build-action@40b6781dcdec2762ad36556682ac74e31030cfe2 # v2.5.1 with: arguments: dokkaHtml - uses: actions/configure-pages@v3.0.6 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d287b2c..45d0ca8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,7 +18,7 @@ jobs: java-version: '17' distribution: 'temurin' - name: Publish - uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2 + uses: gradle/gradle-build-action@40b6781dcdec2762ad36556682ac74e31030cfe2 # v2.5.1 with: arguments: publish env: diff --git a/.github/workflows/publish_to_repositories.yml b/.github/workflows/publish_to_repositories.yml index e4cc9cb..2a7493e 100644 --- a/.github/workflows/publish_to_repositories.yml +++ b/.github/workflows/publish_to_repositories.yml @@ -32,12 +32,12 @@ jobs: java-version: '17' distribution: 'temurin' - name: Build - uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2 + uses: gradle/gradle-build-action@40b6781dcdec2762ad36556682ac74e31030cfe2 # v2.5.1 with: arguments: build --stacktrace - name: Publish to MavenLocal if: ${{ inputs.MavenLocal }} - uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2 + uses: gradle/gradle-build-action@40b6781dcdec2762ad36556682ac74e31030cfe2 # v2.5.1 with: arguments: publishAllPublicationsToMavenLocalRepository env: @@ -51,7 +51,7 @@ jobs: path: build/.m2/repository - name: Publish to GitHub if: ${{ inputs.GitHub }} - uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2 + uses: gradle/gradle-build-action@40b6781dcdec2762ad36556682ac74e31030cfe2 # v2.5.1 with: arguments: publishAllPublicationsToGitHubRepository env: @@ -60,7 +60,7 @@ jobs: ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSWORD }} - name: Publish to OSSRH if: ${{ inputs.OSSRH }} - uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2 + uses: gradle/gradle-build-action@40b6781dcdec2762ad36556682ac74e31030cfe2 # v2.5.1 with: arguments: publishAllPublicationsToOSSRHRepository env: diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 485ce26..3bf879a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,7 +8,8 @@ ktlint = "0.49.1" [libraries] junitApi = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" } junitRuntime = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" } -kotlinCompileTestingKsp = { module = "com.github.tschuchortdev:kotlin-compile-testing-ksp", version = "1.5.0" } +# https://github.com/ZacSweers/kotlin-compile-testing +kotlinCompileTestingKsp = { module = "dev.zacsweers.kctfork:ksp", version = "0.3.0" } kotlinReflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } kotlinTest = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } kspApi = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index c1962a7..033e24c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2c3425d..a7c2bd1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,8 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=e111cb9948407e26351227dabce49822fb88c37ee72f1d1582a69c68af2e702f -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionSha256Sum=38f66cd6eef217b4c35855bb11ea4e9fbc53594ccccb5fb82dfd317ef8c2c5a3 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index aeb74cb..fcb6fca 100755 --- a/gradlew +++ b/gradlew @@ -130,10 +130,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. diff --git a/processor/build.gradle.kts b/processor/build.gradle.kts index 6526bd6..95214a2 100644 --- a/processor/build.gradle.kts +++ b/processor/build.gradle.kts @@ -181,6 +181,7 @@ dependencies { compileOnly(libs.kotlinReflect) kspTest(projects.processor) testRuntimeOnly(libs.junitRuntime) + testImplementation(libs.kspApi) testImplementation(libs.kotlinTest) testImplementation(libs.junitApi) testImplementation(libs.kotlinCompileTestingKsp) diff --git a/processor/src/test/kotlin/fr/smarquis/sealed/CustomFileNameTest.kt b/processor/src/test/kotlin/fr/smarquis/sealed/CustomFileNameTest.kt index cd8f7b0..776c239 100644 --- a/processor/src/test/kotlin/fr/smarquis/sealed/CustomFileNameTest.kt +++ b/processor/src/test/kotlin/fr/smarquis/sealed/CustomFileNameTest.kt @@ -22,12 +22,14 @@ import com.tschuchort.compiletesting.kspWithCompilation import com.tschuchort.compiletesting.symbolProcessorProviders import fr.smarquis.sealed.SealedObjectInstances.RawType.Array import fr.smarquis.sealed.SealedObjectInstances.RawType.List +import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import org.junit.jupiter.api.Test import java.io.File.separator import kotlin.test.Ignore import kotlin.test.assertContains import kotlin.test.assertEquals +@OptIn(ExperimentalCompilerApi::class) class CustomFileNameTest { @SealedObjectInstances diff --git a/processor/src/test/kotlin/fr/smarquis/sealed/DuplicatedNamesTest.kt b/processor/src/test/kotlin/fr/smarquis/sealed/DuplicatedNamesTest.kt index f5f2ea5..5951511 100644 --- a/processor/src/test/kotlin/fr/smarquis/sealed/DuplicatedNamesTest.kt +++ b/processor/src/test/kotlin/fr/smarquis/sealed/DuplicatedNamesTest.kt @@ -20,10 +20,12 @@ import com.tschuchort.compiletesting.KotlinCompilation.ExitCode import com.tschuchort.compiletesting.SourceFile import com.tschuchort.compiletesting.kspWithCompilation import com.tschuchort.compiletesting.symbolProcessorProviders +import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import org.junit.jupiter.api.Test import kotlin.test.assertContains import kotlin.test.assertEquals +@OptIn(ExperimentalCompilerApi::class) class DuplicatedNamesTest { @Test diff --git a/processor/src/test/kotlin/fr/smarquis/sealed/ReturnTypeTest.kt b/processor/src/test/kotlin/fr/smarquis/sealed/ReturnTypeTest.kt index d02beca..b8fd09e 100644 --- a/processor/src/test/kotlin/fr/smarquis/sealed/ReturnTypeTest.kt +++ b/processor/src/test/kotlin/fr/smarquis/sealed/ReturnTypeTest.kt @@ -15,15 +15,18 @@ */ package fr.smarquis.sealed +import com.tschuchort.compiletesting.JvmCompilationResult import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.KotlinCompilation.ExitCode import com.tschuchort.compiletesting.SourceFile import com.tschuchort.compiletesting.kspWithCompilation import com.tschuchort.compiletesting.symbolProcessorProviders +import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import org.junit.jupiter.api.Test import kotlin.test.Ignore import kotlin.test.assertEquals +@OptIn(ExperimentalCompilerApi::class) class ReturnTypeTest { @Test @@ -97,6 +100,6 @@ class ReturnTypeTest { inheritClassPath = true }.compile() - private fun KotlinCompilation.Result.resolve(relative: String) = + private fun JvmCompilationResult.resolve(relative: String) = outputDirectory.parentFile.resolve("ksp/sources/kotlin/$relative") } diff --git a/processor/src/test/kotlin/fr/smarquis/sealed/SealedClassesNameCollisionTest.kt b/processor/src/test/kotlin/fr/smarquis/sealed/SealedClassesNameCollisionTest.kt index d3c55cc..f565b7e 100644 --- a/processor/src/test/kotlin/fr/smarquis/sealed/SealedClassesNameCollisionTest.kt +++ b/processor/src/test/kotlin/fr/smarquis/sealed/SealedClassesNameCollisionTest.kt @@ -20,11 +20,13 @@ import com.tschuchort.compiletesting.KotlinCompilation.ExitCode import com.tschuchort.compiletesting.SourceFile import com.tschuchort.compiletesting.kspWithCompilation import com.tschuchort.compiletesting.symbolProcessorProviders +import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import org.junit.jupiter.api.Test import kotlin.test.Ignore import kotlin.test.assertContains import kotlin.test.assertEquals +@OptIn(ExperimentalCompilerApi::class) class SealedClassesNameCollisionTest { @Test diff --git a/processor/src/test/kotlin/fr/smarquis/sealed/VisibilityModifiersTest.kt b/processor/src/test/kotlin/fr/smarquis/sealed/VisibilityModifiersTest.kt index bdef213..bab2b01 100644 --- a/processor/src/test/kotlin/fr/smarquis/sealed/VisibilityModifiersTest.kt +++ b/processor/src/test/kotlin/fr/smarquis/sealed/VisibilityModifiersTest.kt @@ -21,12 +21,14 @@ import com.tschuchort.compiletesting.kspWithCompilation import com.tschuchort.compiletesting.symbolProcessorProviders import fr.smarquis.sealed.SealedObjectInstances.Visibility.Internal import fr.smarquis.sealed.SealedObjectInstances.Visibility.Public +import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import kotlin.reflect.KVisibility.INTERNAL import kotlin.reflect.KVisibility.PUBLIC import kotlin.test.Test import kotlin.test.assertContains import kotlin.test.assertEquals +@OptIn(ExperimentalCompilerApi::class) class VisibilityModifiersTest { @SealedObjectInstances