Lower JVM target from 21 to 17#233
Conversation
Review Summary by QodoLower JVM target to 17 and add Gradle Plugin Portal publishing
WalkthroughsDescription• Lower JVM target from 21 to 17 across all 26 build files • Add Gradle Plugin Portal publishing infrastructure and metadata • Update gradle-daemon-jvm.properties to use foojay resolver • Update Package.swift and CI workflows to reference v1.0.0 release Diagramflowchart LR
A["JVM 21 Configuration"] -- "Downgrade to 17" --> B["JVM 17 Target"]
C["Gradle Plugin"] -- "Add Portal metadata" --> D["Plugin Portal Publishing"]
E["gradle-daemon-jvm.properties"] -- "Remove hardcoded URLs" --> F["Foojay Resolver"]
G["v1.0.0-Beta1"] -- "Release update" --> H["v1.0.0 Release"]
File Changes1. core/build.gradle.kts
|
Code Review by Qodo
1. Duplicate plugin publishing
|
|
@copilot resolve the merge conflicts in this pull request |
Drops jvmToolchain, jvmTarget, source/targetCompatibility, and java-version in CI from 21 to 17 so the compiled bytecode is compatible with JDK 17 runtimes. Gradle 9.4.1 and AGP 9.x both require Java 17 minimum, so no tooling compatibility is lost. gradle-daemon-jvm.properties is reset to toolchainVersion=17 without hard-coded foojay URLs so the resolver picks the right distribution automatically. https://claude.ai/code/session_01P1LST5JR1hpYGdtGxZ5X23
There was a problem hiding this comment.
1 issue found across 29 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/publish-plugin-portal.yml">
<violation number="1" location=".github/workflows/publish-plugin-portal.yml:37">
P1: Manual publish trusts `ref` and `version` inputs with no guard. Wrong commit can be released under a release version. Validate tag/ref and version match before publish.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| # On tag push: check out the triggering tag. | ||
| # On workflow_dispatch: check out the explicit ref input so develop-HEAD | ||
| # (1.1.0-SNAPSHOT) is never published in place of the release tag. | ||
| ref: ${{ inputs.ref || github.ref }} |
There was a problem hiding this comment.
P1: Manual publish trusts ref and version inputs with no guard. Wrong commit can be released under a release version. Validate tag/ref and version match before publish.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/publish-plugin-portal.yml, line 37:
<comment>Manual publish trusts `ref` and `version` inputs with no guard. Wrong commit can be released under a release version. Validate tag/ref and version match before publish.</comment>
<file context>
@@ -0,0 +1,66 @@
+ # On tag push: check out the triggering tag.
+ # On workflow_dispatch: check out the explicit ref input so develop-HEAD
+ # (1.1.0-SNAPSHOT) is never published in place of the release tag.
+ ref: ${{ inputs.ref || github.ref }}
+
+ - uses: ./.github/actions/setup-build-env
</file context>
There was a problem hiding this comment.
Pull request overview
This PR primarily standardizes the project’s build and CI JVM level to Java 17 (from 21) to match current Gradle/AGP minimum requirements, and additionally introduces Gradle Plugin Portal publishing + updates the SwiftPM binary target pointer.
Changes:
- Lower Kotlin/Java compilation toolchains/targets across modules from 21 → 17.
- Update CI to use Java 17 and simplify
gradle-daemon-jvm.propertiestotoolchainVersion=17. - Add Gradle Plugin Portal publishing configuration (plugin metadata + CI workflows) and update
Package.swiftbinary target URL/checksum.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| sample/shared/build.gradle.kts | Switch Kotlin toolchain/target to JVM 17 |
| sample/feature-ui/build.gradle.kts | Switch Kotlin toolchain/target to JVM 17 |
| sample/feature-promotions/build.gradle.kts | Switch Kotlin toolchain/target to JVM 17 |
| sample/feature-checkout/build.gradle.kts | Switch Kotlin toolchain/target to JVM 17 |
| sample/desktop/build.gradle.kts | Switch Kotlin toolchain to JVM 17 |
| sample/android-app/build.gradle.kts | Switch Android compileOptions to Java 17 |
| providers/sharedpreferences/build.gradle.kts | Switch Android/Java toolchain settings to 17 |
| providers/nsuserdefaults/build.gradle.kts | Switch Kotlin toolchain to JVM 17 |
| providers/javaprefs/build.gradle.kts | Switch Kotlin toolchain/target to JVM 17 |
| providers/firebase/build.gradle.kts | Switch Android compileOptions to Java 17 |
| providers/datastore/build.gradle.kts | Switch Kotlin toolchain/target to JVM 17 |
| providers/configcat/build.gradle.kts | Switch Kotlin toolchain/target to JVM 17 |
| featured-testing/build.gradle.kts | Switch Kotlin toolchain/target to JVM 17 |
| featured-shrinker-tests/build.gradle.kts | Switch Kotlin toolchain to JVM 17 |
| featured-platform/build.gradle.kts | Switch Kotlin toolchain/target to JVM 17 |
| featured-lint-rules/build.gradle.kts | Switch Kotlin toolchain to JVM 17 |
| featured-detekt-rules/build.gradle.kts | Switch Kotlin toolchain to JVM 17 |
| featured-debug-ui/build.gradle.kts | Switch Kotlin toolchain/target to JVM 17 |
| featured-compose/build.gradle.kts | Switch Kotlin toolchain/target to JVM 17 |
| core/build.gradle.kts | Switch Kotlin JVM target to 17 |
| gradle/gradle-daemon-jvm.properties | Set daemon toolchain version to 17; remove platform URLs |
| gradle/libs.versions.toml | Add com.gradle.plugin-publish version + plugin alias |
| featured-gradle-plugin/build.gradle.kts | Lower toolchain to 17; add plugin-publish metadata and marker-publication handling |
| .github/actions/setup-build-env/action.yml | Use Java 17 in shared CI setup |
| .github/workflows/ci.yml | Use Java 17 in CI |
| .github/workflows/codeql.yml | Use Java 17 in CodeQL workflow |
| .github/workflows/publish.yml | Use Java 17 for XCFramework job; add Plugin Portal publish step |
| .github/workflows/publish-plugin-portal.yml | New workflow to publish plugin to Gradle Plugin Portal on tags/dispatch |
| Package.swift | Update SwiftPM binary target URL/checksum to v1.0.0 asset |
| - name: Publish plugin to Gradle Plugin Portal | ||
| # Tag-only: the Portal rejects SNAPSHOT versions; branch pushes produce SNAPSHOTs. | ||
| # publishPlugins uploads directly — no manual promotion step unlike Maven Central. | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| env: | ||
| GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} | ||
| GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} | ||
| ORG_GRADLE_PROJECT_VERSION_NAME: ${{ steps.version.outputs.VERSION_NAME }} | ||
| run: ./gradlew --no-daemon :featured-gradle-plugin:publishPlugins --no-configuration-cache |
| env: | ||
| GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} | ||
| GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} | ||
| ORG_GRADLE_PROJECT_VERSION_NAME: ${{ steps.version.outputs.VERSION_NAME }} | ||
| run: ./gradlew --no-daemon :featured-gradle-plugin:publishPlugins --no-configuration-cache |
| push: | ||
| tags: | ||
| - "v[0-9]+.[0-9]+.[0-9]+" | ||
| - "v[0-9]+.[0-9]+.[0-9]+-*" | ||
| # No branches: branch pushes produce SNAPSHOTs; Portal rejects them. |
| // Updated automatically by CI on each release. | ||
| url: "https://github.com/AndroidBroadcast/Featured/releases/download/v1.0.0-Beta1/FeaturedCore.xcframework.zip", | ||
| checksum: "cebaef358e5ec71f0ee2128ae5c91a8a4257e63da4d0b4b93c7c8a74784e373b" | ||
| url: "https://github.com/AndroidBroadcast/Featured/releases/download/v1.0.0/FeaturedCore.xcframework.zip", | ||
| checksum: "aea0c7ba061dc002f801bd4755e17b2e2b2e8760387fa0dd8879bce8c6a5ce54" |
| name: Publish Plugin to Gradle Plugin Portal | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v[0-9]+.[0-9]+.[0-9]+" | ||
| - "v[0-9]+.[0-9]+.[0-9]+-*" | ||
| # No branches: branch pushes produce SNAPSHOTs; Portal rejects them. |
59ee06d to
657e71d
Compare
| - name: Publish plugin to Gradle Plugin Portal | ||
| # Tag-only: the Portal rejects SNAPSHOT versions; branch pushes produce SNAPSHOTs. | ||
| # publishPlugins uploads directly — no manual promotion step unlike Maven Central. | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| env: | ||
| GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} | ||
| GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} | ||
| ORG_GRADLE_PROJECT_VERSION_NAME: ${{ steps.version.outputs.VERSION_NAME }} | ||
| run: ./gradlew --no-daemon :featured-gradle-plugin:publishPlugins --no-configuration-cache |
There was a problem hiding this comment.
1. Duplicate plugin publishing 🐞 Bug ☼ Reliability
On a release tag push, both publish.yml and the new publish-plugin-portal.yml run :featured-gradle-plugin:publishPlugins, causing a double-publish race where one workflow is likely to fail (already published) and break releases.
Agent Prompt
## Issue description
A tag push triggers two independent workflows that both call `:featured-gradle-plugin:publishPlugins`, resulting in duplicate publishing attempts.
## Issue Context
- `publish.yml` runs on tag pushes and now includes a tag-gated `publishPlugins` step.
- `publish-plugin-portal.yml` is newly added and also runs on tag pushes and executes `publishPlugins`.
## Fix
Pick a single source of truth for Plugin Portal publishing:
- Option A (recommended): keep the dedicated `publish-plugin-portal.yml` workflow and remove the `publishPlugins` step from `publish.yml`.
- Option B: delete `publish-plugin-portal.yml` and keep the `publishPlugins` step in `publish.yml`.
## Fix Focus Areas
- .github/workflows/publish.yml[55-64]
- .github/workflows/publish-plugin-portal.yml[3-8]
- .github/workflows/publish-plugin-portal.yml[55-66]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| env: | ||
| GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} | ||
| GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} | ||
| ORG_GRADLE_PROJECT_VERSION_NAME: ${{ steps.version.outputs.VERSION_NAME }} | ||
| run: ./gradlew --no-daemon :featured-gradle-plugin:publishPlugins --no-configuration-cache |
There was a problem hiding this comment.
3. Missing signing env 🐞 Bug ☼ Reliability
The publish.yml Plugin Portal step doesn’t set the in-memory GPG signing env vars, but the Gradle plugin build config enables signAllPublications(), so publishPlugins can fail during signing when run from publish.yml.
Agent Prompt
## Issue description
`publish.yml` runs `:featured-gradle-plugin:publishPlugins` without providing the signing environment variables required when `signAllPublications()` is enabled.
## Issue Context
- The plugin build enables signing for all publications.
- The dedicated `publish-plugin-portal.yml` workflow already passes the signing env vars, but `publish.yml` does not.
## Fix
If `publish.yml` continues to publish to the Plugin Portal, add these env vars to that step (or set them at job level):
- `ORG_GRADLE_PROJECT_signingInMemoryKey`
- `ORG_GRADLE_PROJECT_signingInMemoryKeyId`
- `ORG_GRADLE_PROJECT_signingInMemoryKeyPassword`
(If you remove the `publishPlugins` step from `publish.yml` per the “Duplicate plugin publishing” fix, this issue is resolved implicitly.)
## Fix Focus Areas
- .github/workflows/publish.yml[55-64]
- featured-gradle-plugin/build.gradle.kts[39-42]
- .github/workflows/publish-plugin-portal.yml[55-66]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
I checked and synced this branch with |
Robolectric 4.16.1 requires JDK 21 to run tests against SDK 36. Without an explicit sdk in @config, Robolectric picks compileSdk (36), which fails when the test JVM is JDK 17. Pinning to SDK 34 fixes the UnsupportedOperationException from DefaultSdkProvider and keeps tests consistent with JDK 17+. https://claude.ai/code/session_01P1LST5JR1hpYGdtGxZ5X23
| @RunWith(AndroidJUnit4::class) | ||
| @Config(manifest = Config.NONE) | ||
| @Config(manifest = Config.NONE, sdk = [34]) |
| with: | ||
| distribution: temurin | ||
| java-version: 21 | ||
| java-version: 17 |
The action description still advertised Java 21 after the JDK version was lowered to 17. https://claude.ai/code/session_01P1LST5JR1hpYGdtGxZ5X23
Summary
jvmToolchain,jvmTarget,sourceCompatibility/targetCompatibility, andjava-versionin CI from 21 → 17 across all 26 affected build filesgradle/gradle-daemon-jvm.propertiestotoolchainVersion=17without hard-coded foojay platform URLs so the foojay-resolver-convention plugin resolves the correct JDK 17 distribution automaticallySharedPreferencesProviderConfigTestto Robolectric SDK 34: Robolectric 4.16.1 requires JDK 21 to instrument SDK 36, so tests targeting the default SDK (compileSdk = 36) fail when the test JVM is JDK 17. SDK 34 is fully compatible with JDK 17 and the SharedPreferences behaviour under test is SDK-level agnosticGradle 9.4.1 requires Java 17 minimum and AGP 9.x requires Java 17 minimum, so no tooling compatibility is lost.
Test plan
./gradlew assemble— full build succeeds./gradlew test— all JVM unit tests pass./gradlew :featured-gradle-plugin:test— plugin tests pass./gradlew :core:koverVerify— ≥90% coverage gate passes./gradlew spotlessCheck— code style cleanhttps://claude.ai/code/session_01P1LST5JR1hpYGdtGxZ5X23