Skip to content

Fix Gradle metadata repository service scoping#942

Open
jormundur00 wants to merge 1 commit into
graalvm:masterfrom
jormundur00:rhei-gradle-metadata-service/issue-415
Open

Fix Gradle metadata repository service scoping#942
jormundur00 wants to merge 1 commit into
graalvm:masterfrom
jormundur00:rhei-gradle-metadata-service/issue-415

Conversation

@jormundur00

@jormundur00 jormundur00 commented Jun 18, 2026

Copy link
Copy Markdown
Member

Fixes #415

What changed

This PR fixes multi-module Gradle builds where different subprojects configure different reachability metadata repositories.

Before this change, Native Build Tools could reuse repository settings from the first subproject that initialized the shared metadata service. That meant later subprojects could silently use the wrong metadata repository.

After this change, each subproject uses its own configured metadata repository.

Why

Multi-project builds can now safely use different metadata repositories per subproject without cross-project leakage.

Example

Before:

project(":app1") {
    graalvmNative {
        metadataRepository {
            uri = uri("file:///tmp/metadata-repo-a")
        }
    }
}

project(":app2") {
    graalvmNative {
        metadataRepository {
            uri = uri("file:///tmp/metadata-repo-b")
        }
    }
}

In some builds, app2 could still end up using the repository configuration from app1.

After:

app1 uses metadata-repo-a and app2 uses metadata-repo-b, matching each subproject's own configuration.

Implementation summary

  • Scope the shared Gradle metadata service per subproject so one project's repository settings do not leak into another.
  • Keep service reuse within a single project while allowing different subprojects to carry different metadata repository parameters.
  • Add a multi-project regression that verifies each subproject resolves metadata from its own configured repository.

Validation

Run from the issue worktree with JAVA_HOME and GRAALVM_HOME set to the installed GraalVM 17 runtime:

  • ./gradlew :native-gradle-plugin:functionalTest --tests "org.graalvm.buildtools.gradle.NativeConfigRepoFunctionalTest.subprojects can use different metadata repositories" passed.
  • ./gradlew :native-gradle-plugin:test :native-gradle-plugin:inspections passed.
  • ./gradlew :native-gradle-plugin:configCacheFunctionalTest --tests "org.graalvm.buildtools.gradle.NativeConfigRepoFunctionalTest.subprojects can use different metadata repositories" passed.
  • grund fmt . --marker --check passed.
  • Targeted grounding checks resolved and found the changed FS-gradle-resources-and-metadata.3 citations.

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jun 18, 2026
@jormundur00 jormundur00 force-pushed the rhei-gradle-metadata-service/issue-415 branch 2 times, most recently from 18bbe05 to 863bdeb Compare June 18, 2026 14:02
@jormundur00 jormundur00 marked this pull request as ready for review July 2, 2026 10:48
@jormundur00 jormundur00 force-pushed the rhei-gradle-metadata-service/issue-415 branch from 863bdeb to 16564c4 Compare July 2, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement. rhei

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native gradle plugin - Metadata repository URL can be set only in the first module being evaluated

1 participant