Skip to content

Commit e597c5d

Browse files
authored
GenerateMetadataTask introduction. (#686)
Created MetadataGenerationUtils utility class for operations shared by ContributionTask and GenerateMetadataTask.
1 parent 4c4a5a3 commit e597c5d

File tree

7 files changed

+327
-137
lines changed

7 files changed

+327
-137
lines changed

docs/CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ After it collects your answers, the task will:
3939
- generate metadata and store it in the proper location
4040
- ask you if you want to create a pull request, or you want to keep working on it locally
4141

42+
If you already have the test project structure in this repository and need to generate or regenerate metadata, use the `generateMetadata` task:
43+
44+
```shell
45+
./gradlew generateMetadata --coordinates=com.example:my-library:1.0.0
46+
```
47+
48+
To change the user-code-filter used during collection, pass `--allowedPackages` with a comma-separated list of packages:
49+
50+
```shell
51+
./gradlew generateMetadata --coordinates=com.example:my-library:1.0.0 --allowedPackages=com.example.pkg,org.acme.lib
52+
```
53+
4254
### Checklist
4355
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.
4456
`org.example:library` project is also included as a template for new libraries.

docs/DEVELOPING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,19 @@ Each stage of the testing can be run with `-Pcoordinates=[group:artifact:version
9393
./gradlew test -Pcoordinates=[group:artifact:version|k/n|all]
9494
```
9595

96+
### Generating Metadata
97+
98+
Generates metadata for a single library coordinate. If `agentAllowedPackages` is provided, a new user-code-filter.json will be created or updated to include those packages.
99+
100+
- `coordinates`: group:artifact:version (single coordinate only)
101+
- `agentAllowedPackages`: comma-separated package list; use `-` for none
102+
103+
Examples:
104+
```console
105+
./gradlew generateMetadata -Pcoordinates=org.postgresql:postgresql:42.7.3
106+
./gradlew generateMetadata -Pcoordinates=org.postgresql:postgresql:42.7.3 --agentAllowedPackages=org.example.app,com.acme.service
107+
```
108+
96109
### Docker image vulnerability scanning
97110

98111
1. Scan only images affected in a commit range:
@@ -136,6 +149,7 @@ These tasks support the scheduled workflow that checks newer upstream library ve
136149
- Format apply: `./gradlew spotlessApply`
137150
- Pull images (single lib): `./gradlew pullAllowedDockerImages -Pcoordinates=[group:artifact:version|k/n|all]`
138151
- Check metadata (single lib): `./gradlew checkMetadataFiles -Pcoordinates=[group:artifact:version|k/n|all]`
152+
- Generate metadata (single lib): `./gradlew generateMetadata -Pcoordinates=group:artifact:version`
139153
- Test (single lib): `./gradlew test -Pcoordinates=[group:artifact:version|k/n|all]`
140154
- Scan changed Docker images: `./gradlew checkAllowedDockerImages --baseCommit=<sha1> --newCommit=<sha2>`
141155
- Scan all Docker images: `./gradlew checkAllowedDockerImages`

tests/tck-build-logic/src/main/groovy/org.graalvm.internal.tck-harness.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import org.graalvm.internal.tck.MetadataFilesCheckerTask
1717
import org.graalvm.internal.tck.DockerUtils
1818
import org.graalvm.internal.tck.ScaffoldTask
1919
import org.graalvm.internal.tck.GrypeTask
20+
import org.graalvm.internal.tck.GenerateMetadataTask
2021
import org.graalvm.internal.tck.TestedVersionUpdaterTask
2122
import org.graalvm.internal.tck.harness.tasks.TestInvocationTask
2223
import org.graalvm.internal.tck.harness.tasks.CheckstyleInvocationTask
@@ -321,3 +322,9 @@ tasks.register("contribute", ContributionTask.class) { task ->
321322
task.setDescription("Generates metadata and prepares pull request for contibuting on metadata repository based on provided tests.")
322323
task.setGroup(METADATA_GROUP)
323324
}
325+
326+
// gradle generateMetadata --coordinates=<maven-coordinates> [or -Pcoordinates=<maven-coordinates>] --agentAllowedPackages=<comma-separated list of packages>
327+
tasks.register("generateMetadata", GenerateMetadataTask.class) { task ->
328+
task.setDescription("Generates metadata based on provided tests.")
329+
task.setGroup(METADATA_GROUP)
330+
}

0 commit comments

Comments
 (0)