From c9f6c5c0f590d9e2c49808af4f6337fa1773ffb1 Mon Sep 17 00:00:00 2001 From: Dan McNulty Date: Fri, 27 Feb 2026 11:20:22 -0600 Subject: [PATCH 1/2] ci: fix jitpack build - Update the Gradle build to skip some tasks if JITPACK=TRUE. This environment variable is set by the runner that JITPACK uses to build the artifacts that it serves. This avoids an issue with the jitpack build environment not being able to run google-java-format due to GLIBC issues. - Add a jitpack build smoke test to the test workflow to validate that the gradle build used by jitpack works. --- .changeset/nine-plums-end.md | 5 +++++ .github/workflows/test.yml | 14 +++++++++++++- build.gradle.kts | 8 ++++++++ sdk/sdk.gradle.kts | 20 ++++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .changeset/nine-plums-end.md diff --git a/.changeset/nine-plums-end.md b/.changeset/nine-plums-end.md new file mode 100644 index 00000000..d5d1c3e0 --- /dev/null +++ b/.changeset/nine-plums-end.md @@ -0,0 +1,5 @@ +--- +"java-sdk": patch +--- + +Update build to support jitpack build environment diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2631448b..9c7d3fb7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,10 +18,22 @@ jobs: name: Java ${{ matrix.java }} strategy: matrix: - java: [ '11', '17', '21', '25' ] + java: ['11', '17', '21', '25'] steps: - uses: actions/checkout@v4 # Gradle will detect the JVM installation from the ubuntu-latest image and use it # includes execution of unit tests - run: ./gradlew build -PjavaVersion=${{ matrix.java }} --stacktrace + + jitpack-build: + runs-on: ubuntu-latest + name: Jitpack build smoke test + steps: + - uses: actions/checkout@v4 + - run: ./gradlew clean build -PjavaVersion=11 --stacktrace + env: + JITPACK: TRUE + - run: ./gradlew sdk:publishToMavenLocal --stacktrace + env: + JITPACK: TRUE diff --git a/build.gradle.kts b/build.gradle.kts index be3b220c..b1ab6a6c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -39,6 +39,10 @@ tasks.register("downloadGoogleJavaFormat") { val downloadUrl = "https://github.com/google/google-java-format/releases/download/v$googleJavaFormatVersion/google-java-format_${osSuffix}-${archSuffix}${binarySuffix}" outputs.file(googleJavaFormatExeFile) + onlyIf { + System.getenv("JITPACK") != "TRUE" + } + doLast { val file = googleJavaFormatExeFile.get().asFile if (!file.exists()) { @@ -62,6 +66,10 @@ fun Project.registerFormatTasks() { tasks.register("format") { dependsOn(rootProject.tasks.named("downloadGoogleJavaFormat")) + onlyIf { + System.getenv("JITPACK") != "TRUE" + } + doLast { // First, fix the imports exec { diff --git a/sdk/sdk.gradle.kts b/sdk/sdk.gradle.kts index 77a58d65..74842e0b 100644 --- a/sdk/sdk.gradle.kts +++ b/sdk/sdk.gradle.kts @@ -84,6 +84,10 @@ openApiGenerate { } tasks.register("removeDocs") { + onlyIf { + System.getenv("JITPACK") != "TRUE" + } + doLast { fileTree("$rootDir/docs").files .filter { it.isFile && it.name != "DecryptionKey.md" && it.name != "Sealed.md" } @@ -94,6 +98,10 @@ tasks.register("removeDocs") { } tasks.register("removeClasses") { + onlyIf { + System.getenv("JITPACK") != "TRUE" + } + doLast { File("$rootDir/sdk/src/main/java/com/fingerprint/v4/model").deleteRecursively() File("$rootDir/sdk/src/main/java/com/fingerprint/v4/api").deleteRecursively() @@ -101,11 +109,19 @@ tasks.register("removeClasses") { } tasks.register("copyOpenApiGeneratorIgnore") { + onlyIf { + System.getenv("JITPACK") != "TRUE" + } + from("$rootDir/.openapi-generator-ignore") into(layout.buildDirectory.dir("generated")) } tasks.register("copyGeneratedArtifacts") { + onlyIf { + System.getenv("JITPACK") != "TRUE" + } + finalizedBy("format") doLast { copy { @@ -126,6 +142,10 @@ tasks.register("copyGeneratedArtifacts") { } tasks.openApiGenerate { + onlyIf { + System.getenv("JITPACK") != "TRUE" + } + dependsOn("removeDocs", "removeClasses", "copyOpenApiGeneratorIgnore") finalizedBy("copyGeneratedArtifacts") } From 756e9eaf9e07bdff0ba6a4056670ccc477eba064 Mon Sep 17 00:00:00 2001 From: Dan McNulty Date: Fri, 27 Feb 2026 11:28:51 -0600 Subject: [PATCH 2/2] chore: maintain casing in JITPACK env value --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9c7d3fb7..ef74a7fa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: - uses: actions/checkout@v4 - run: ./gradlew clean build -PjavaVersion=11 --stacktrace env: - JITPACK: TRUE + JITPACK: 'TRUE' - run: ./gradlew sdk:publishToMavenLocal --stacktrace env: - JITPACK: TRUE + JITPACK: 'TRUE'