Skip to content

Commit d0beff9

Browse files
dnestorofniephaus
andauthored
Add explanation how to use metadata repository locally (#306)
* Add explanation how to use metadata repository locally * Refactor explanation and move it to contributing page * Update CONTRIBUTING.md Co-authored-by: Fabio Niephaus <[email protected]> * Update CONTRIBUTING.md Co-authored-by: Fabio Niephaus <[email protected]> * Update CONTRIBUTING.md Co-authored-by: Fabio Niephaus <[email protected]> * Update checklist docs * Remove you from steps --------- Co-authored-by: Fabio Niephaus <[email protected]>
1 parent b69aa68 commit d0beff9

File tree

2 files changed

+42
-24
lines changed

2 files changed

+42
-24
lines changed

CONTRIBUTING.md

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,44 @@
11
# Contributing
22

3-
Before contributing to this repository, please try to include the reachability metadata directly into the library. If that does not work, open a ticket on the target library issue tracker so the community can upvote and discuss metadata addition. Only after these steps, follow the checklist for adding the metadata to this repository.
3+
Before contributing to this repository, please consider including reachability metadata
4+
directly in the library or the framework (see an [example](https://github.com/netty/netty/pull/12738/files)).
5+
This is the best way to provide support for GraalVM Native Image as it makes an out-of-the-box experience for users (no additional work required) and allows you to continuously test and maintain the metadata as part of your project.
6+
If that is not an option (for example, you are not a maintainer), we encourage you to open a ticket on the issue tracker
7+
of the corresponding library or framework, so that the community can up-vote and discuss the inclusion of reachability metadata
8+
(see an [example](https://github.com/h2database/h2database/issues/3606))
49

5-
## Checklist
10+
## How to Test or Use This Repository Locally
11+
12+
You can test the reachability metadata from this repository locally against your project or with additional changes.
13+
14+
First, clone the repository:
15+
```shell
16+
git clone [email protected]:oracle/graalvm-reachability-metadata.git
17+
```
18+
Then, point to the local repository in the configuration of either
19+
[Gradle](https://graalvm.github.io/native-build-tools/latest/gradle-plugin.html#metadata-support) or
20+
[Maven](https://graalvm.github.io/native-build-tools/latest/maven-plugin.html#metadata-support)
21+
22+
## Contribute Metadata
23+
24+
### Checklist
625
In order to ensure that all contributions follow the same standards of quality we have devised a following list of requirements for each new added library.
726
`org.example:library` project is also included as a template for new libraries.
827

9-
> ℹ️ **Note** :
10-
>
11-
> GraalVM Reachability Metadata in this repo only contains JSON files as described
12-
> in [Manual Configuration](https://www.graalvm.org/latest/reference-manual/native-image/dynamic-features/Reflection/#manual-configuration)
13-
> section of the Native Image documentation.
14-
>
15-
> All other library tweaks (such as build time initialization through `native-image.properties`) must not be included
16-
> here. By default, it should be assumed that all user libraries are runtime initialized. Build-time initialization can
17-
> not be included as it does not compose and can break code in unpredictable ways.
18-
>
19-
> Make sure that you are
20-
> using [Conditional Configuration](https://www.graalvm.org/latest/reference-manual/native-image/metadata/#specifying-reflection-metadata-in-json)
21-
> in order to precisely define the metadata scope. This is a hard requirement as it prevents unnecessary bloating of
22-
> images.
23-
>
24-
> To learn more about collecting metadata, see [How To Collect Metadata](docs/CollectingMetadata.md).
25-
26-
### Contribute Metadata
28+
* GraalVM Reachability Metadata in this repo only contains JSON files as described
29+
in [Manual Configuration](https://www.graalvm.org/latest/reference-manual/native-image/dynamic-features/Reflection/#manual-configuration)
30+
section of the Native Image documentation.
31+
* All other library tweaks (such as build time initialization through `native-image.properties`) must not be included
32+
here. By default, it should be assumed that all user libraries are runtime initialized. Build-time initialization can
33+
not be included as it does not compose and can break code in unpredictable ways.
34+
* Make sure that you are using [Conditional Configuration](https://www.graalvm.org/latest/reference-manual/native-image/metadata/#specifying-reflection-metadata-in-json)
35+
in order to precisely define the metadata scope. This is a hard requirement as it prevents unnecessary bloating of
36+
images.
37+
* Once you want to create a pull request, you will be asked to fill out the [following list](./pull_request_template.md).
38+
39+
ℹ️ To learn more about collecting metadata, see [How To Collect Metadata](docs/CollectingMetadata.md).
40+
41+
### Generate Metadata and Test
2742

2843
Use the `scaffold` task to generate metadata and test stubs:
2944

@@ -41,7 +56,7 @@ to execute the tests.
4156

4257
It's expected that they fail, because the scaffold task only generated a stub which you need to implement.
4358

44-
#### Metadata structure
59+
### Metadata structure
4560

4661
Metadata lives in a folder structure in the `metadata` directory in root of this repository.
4762
Per convention, it should be like this: `org.example:library` metadata should be located
@@ -134,6 +149,8 @@ example `metadata/org.example/library/0.0.1/index.json` would contain:
134149
]
135150
```
136151

152+
### Format Metadata Files
153+
137154
Metadata must be correctly formatted.
138155
This can be done by running following command from root of the repository, and then following instructions from command
139156
output if necessary:
@@ -142,7 +159,7 @@ output if necessary:
142159
./gradlew check
143160
```
144161

145-
### Tests
162+
## Tests
146163

147164
Every submitted library must feature tests that serve as a safeguard against regressions.
148165
For easier test development we've provided a TCK plugin that automatically configures

pull_request_template.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33

44
## Checklist before merging
5-
- [ ] I have properly formatted metadata files (see [CONTRIBUTING](/oracle/graalvm-reachability-metadata/blob/master/CONTRIBUTING.md) document)
6-
- [ ] I have added thorough tests. (see [this](/oracle/graalvm-reachability-metadata/blob/master/CONTRIBUTING.md#Tests))
5+
- [ ] I have considered including reachability metadata directly in the library or the framework (see [this](./CONTRIBUTING.md))
6+
- [ ] I have properly formatted metadata files (see [this](https://github.com/oracle/graalvm-reachability-metadata/blob/master/CONTRIBUTING.md#format-metadata-files))
7+
- [ ] I have added thorough tests (see [this](https://github.com/oracle/graalvm-reachability-metadata/blob/master/CONTRIBUTING.md#Tests))

0 commit comments

Comments
 (0)