Treat not-for-native-image metadata as covered#884
Open
jormundur00 wants to merge 1 commit intograalvm:masterfrom
Open
Treat not-for-native-image metadata as covered#884jormundur00 wants to merge 1 commit intograalvm:masterfrom
jormundur00 wants to merge 1 commit intograalvm:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #883.
This change teaches
list-libraries-missing-metadatato treat reachability metadata repository entries marked with"not-for-native-image": trueas covered, even though those entries intentionally do not provide metadata configuration files to copy.The motivating case is artifacts such as Netty's
io.netty:netty-transport-native-io_uring. The repository can contain anindex.jsonentry explaining that the artifact is not itself a native-image metadata target and, optionally, pointing users/tools to the replacement artifact that carries the JVM classes.New acceptable index.json shape
Normal metadata entries still use the existing shape with
metadata-versionand version matching fields:[ { "tested-versions": ["3.1.2"], "metadata-version": "3.1.2", "latest": true } ]Those entries resolve to an actual metadata directory and continue to return
DirectoryConfigurationinstances as before.This PR adds support for a special marker-only entry:
[ { "not-for-native-image": true, "reason": "The main JAR contains only module metadata, and platform classifier JARs carry native libraries; the JVM io_uring transport classes are published separately.", "replacement": "io.netty:netty-transport-classes-io_uring:4.2.1.Final" } ]Supported fields for this special shape:
not-for-native-image: required boolean marker. Whentrue, the repository is explicitly saying this artifact should not have native-image metadata files.reason: optional human-readable explanation.replacement: optional Maven coordinates for a replacement or related artifact that should be considered instead.The marker can also be scoped with existing index matching fields:
[ { "not-for-native-image": true, "tested-versions": ["4.2.1.Final"], "reason": "Only this version is known to be a marker artifact.", "replacement": "io.netty:netty-transport-classes-io_uring:4.2.1.Final" } ][ { "not-for-native-image": true, "default-for": "4\\.2\\..*", "reason": "All 4.2.x native transport marker artifacts are covered by the replacement classes artifact." } ][ { "not-for-native-image": true, "latest": true, "reason": "Use this as the latest known marker entry when the requested version is untested." } ]If no version matching field is present, the marker applies generally to that artifact.
Why this change is needed
Before this PR,
MissingMetadataCommandSupporttreated a dependency as supported only when:returned a non-empty set.
That conflates two different cases:
For case 2, returning a fake
DirectoryConfigurationwould be the wrong abstraction because metadata copy and native-image configuration paths should not copy anything. There are no config files for marker-only entries.This PR separates the two questions:
findConfigurationsFor(...): returns real metadata directories to copy, unchanged.isCoveredByRepository(...): answers whether the repository covers the artifact for reporting purposes.The default
isCoveredByRepository(...)implementation preserves existing behavior by checking whetherfindConfigurationsFor(...)is non-empty.FileSystemRepositoryoverrides it to also recognizenot-for-native-imageentries.Implementation details
GraalVMReachabilityMetadataRepository.isCoveredByRepository(...)with default behavior based onfindConfigurationsFor(...).MissingMetadataCommandSupportto callisCoveredByRepository(...)when deciding whether to report a dependency as supported or missing.not-for-native-imagein the artifact index model.VersionToConfigDirectoryIndex.isNotForNativeImage(...)so the filesystem repository can identify marker-only coverage.FileSystemRepository.isCoveredByRepository(...)so it checks normal metadata matches first, then falls back to marker-only coverage.Important behavior preserved:
findConfigurationsFor(...)still returns no configuration fornot-for-native-imagemarker entries. This means metadata-copy/native-image configuration materialization remains unchanged.Testing
Ran the focused shared metadata tests and Gradle plugin compile check with JDK 17:
The test run passed and covered:
not-for-native-imageindex entries;findConfigurationsFor(...)still returns no config directories for marker-only entries;MissingMetadataCommandSupportreports marker-only entries assupported;isCoveredByRepository(...).Note: the currently active Java 25 runtime fails during Gradle/Kotlin DSL initialization in this checkout, so the verification command was run with the installed JDK 17.