Skip to content

Commit 257b7aa

Browse files
committed
[GR-70727] Add dynamic access metadata JSON file schema
PullRequest: graal/22517
2 parents b4f3706 + 97c8e7f commit 257b7aa

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

docs/reference-manual/native-image/BuildReport.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,10 @@ After building your application, open the generated report (for example, _target
203203

204204
This section of the report highlights code that may require review to ensure your application runs successfully as a native executable. For example, classes loaded via `Class.forName(...)` must be included in the executable.
205205

206-
**Understanding the Dynamic Access tab:**
206+
### Understanding the Dynamic Access Tab
207207

208208
- If no dynamic calls are detected for a class or module path entry, no further action is needed.
209+
- If another entry provides metadata for this entry, no further investigation is needed.
209210
- If the entry includes `native-image.properties` or `reachability-metadata.json`, or these files are provided externally, no further investigation is required.
210211
- If integrated configuration or external metadata (such as `reflect-config.json`) exists for each detected call type, no further investigation is required.
211212
- If none of the above apply, the entry may require further investigation.
@@ -214,6 +215,19 @@ For each entry with detected dynamic calls, you can expand the entry in the repo
214215

215216
> Only dynamic calls found in reachable code are reported. Some entries may have existing metadata but no reported dynamic calls.
216217
218+
### Dynamic Access Metadata
219+
220+
The Dynamic Access tab uses a `dynamic-access-metadata.json` file that maps which classpath entries provide reachability metadata for other entries. Place this file on your classpath for the Build Report to automatically discover metadata relationships between different classpath entries.
221+
222+
The schema includes the following keys:
223+
224+
* `metadataProvider`: The absolute path to the JAR or directory that provides reachability metadata
225+
* `providesFor`: An array of classpath entries that receive metadata from this provider
226+
227+
For the complete JSON schema specification, see the [_dynamic-access-metadata-v1.0.0.json_ file](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/dynamic-access-metadata-v1.0.0.json){:target="_blank"}.
228+
229+
The Build Report uses this information to create a comprehensive view of metadata relationships and highlight potential coverage gaps.
230+
217231
For a practical demonstration of running and using the `-H:+ReportDynamicAccess` option, see the [preserve-package demo](https://github.com/graalvm/graalvm-demos/tree/master/native-image/preserve-package).
218232

219233
## Related Documentation
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2019-09/schema",
3+
"$id": "https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/dynamic-access-metadata-v1.0.0.json",
4+
"title": "JSON schema for library support metadata used by the Dynamic Access tab of the GraalVM Native Image Build Report",
5+
"version": "1.0.0",
6+
"type": "array",
7+
"default": [],
8+
"items": {
9+
"type": "object",
10+
"required": ["metadataProvider", "providesFor"],
11+
"properties": {
12+
"metadataProvider": {
13+
"type": "string",
14+
"title": "The classpath entry (JAR or directory) providing reachability metadata",
15+
"pattern": "^/.+"
16+
},
17+
"providesFor": {
18+
"type": "array",
19+
"title": "List of classpath entries that this provider contributes metadata for",
20+
"default": [],
21+
"items": {
22+
"type": "string",
23+
"pattern": "^/.+"
24+
}
25+
}
26+
},
27+
"additionalProperties": false
28+
},
29+
"examples": [
30+
[
31+
{
32+
"metadataProvider": "/home/user/.m2/repository/org/springframework/boot/spring-boot-starter-web/3.5.6/spring-boot-starter-web-3.5.6.jar",
33+
"providesFor": [
34+
"/home/user/.m2/repository/org/slf4j/slf4j-api/2.0.17/slf4j-api-2.0.17.jar",
35+
"/home/user/.m2/repository/org/springframework/spring-context/6.2.11/spring-context-6.2.11.jar"
36+
]
37+
},
38+
{
39+
"metadataProvider": "/home/user/.m2/repository/org/springframework/boot/spring-boot-starter-data-jpa/3.5.6/spring-boot-starter-data-jpa-3.5.6.jar",
40+
"providesFor": [
41+
"/home/user/.m2/repository/org/hibernate/orm/hibernate-core/6.6.29.Final/hibernate-core-6.6.29.Final.jar"
42+
]
43+
}
44+
]
45+
]
46+
}

0 commit comments

Comments
 (0)