Skip to content

Commit 9f25247

Browse files
authored
Add contributing task (#605)
* Move check new libraries task into a separate package * Register contributing task * Collect information and generate stubs * Replace stubs with implemented tests * Generate user-code-filter.json * Copy resources required for tests * Add additional dependencies to build.gradle * Add agent block in build.gradle * Perform agent run * Update native build tools version * Move generated metadata to metadata location * Collect pull request info and add colored output * Add command invocation with list of args * Add required docker images * Don't use absolute path for detecting tests and metadata directories * Add check for packages in java files * Invoke metadataCopy from the command line * Make scaffold task able to update existing libraries with newer versions * Move contributing questions into a separate file * Use template for agent block in build.gradle file * Enable github pr creation * Fix broken collecting of default answer * Remove empty config files and trim metadata/index.json * Fix yes/no question not waiting for input * Enable PR creation * Fix latest label updates * Remove allowed packages that scaffold generates * Skip adding new entry when the same entry already exists * Fail when user wants to provided metadata for already existing library version * Use gradle wrapper for invoking commands * Extract check for empty config files * Ask for permission to delete files * Ensure metadata files belongs to project * Use FileSystemOperations * Use object mapper instead of ConfigurationStringBuilder * Add contributing task guide * Avoid deleting in contributing task * Add custom exception for user errors in contribute task * Extract recuring questions mechanism into a function * Minor refactoring * Use project layout instead of getProject
1 parent 63df871 commit 9f25247

18 files changed

+970
-37
lines changed

CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,24 @@ Then, point to the local repository in the configuration of either
2121

2222
## Contribute Metadata
2323

24+
The suggested way to contribute to Reachability metadata repository is by using the `contribute` task.
25+
Before you start the task, you should have your tests implemented somewhere locally on your machine (please verify that tests are working on Java).
26+
27+
In order to start this task, run (we suggest using `--console=plain` to reduce amount of gradle logging):
28+
29+
```shell
30+
./gradlew contribute --console=plain
31+
```
32+
33+
When started, the task will ask you few simple questions (like: where are your tests implemented, do your tests need resources, do your tests need docker images...).
34+
In case you don't understand the question, just type "help".
35+
36+
After it collects your answers, the task will:
37+
- generate necessary boilerplate code
38+
- copy your tests to the proper location
39+
- generate metadata and store it in the proper location
40+
- ask you if you want to create a pull request, or you want to keep working on it locally
41+
2442
### Checklist
2543
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.
2644
`org.example:library` project is also included as a template for new libraries.

tests/src/index.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -179,28 +179,28 @@
179179
"versions" : [ "2.16.11" ]
180180
} ]
181181
}, {
182-
"test-project-path" : "io.netty/netty-common/4.1.80.Final",
182+
"test-project-path" : "io.netty/netty-common/4.1.115.Final",
183183
"libraries" : [ {
184184
"name" : "io.netty:netty-common",
185-
"versions" : [ "4.1.80.Final" ]
185+
"versions" : [ "4.1.115.Final" ]
186186
} ]
187187
}, {
188-
"test-project-path" : "io.netty/netty-transport/4.1.80.Final",
188+
"test-project-path" : "io.netty/netty-common/4.1.80.Final",
189189
"libraries" : [ {
190-
"name" : "io.netty:netty-transport",
190+
"name" : "io.netty:netty-common",
191191
"versions" : [ "4.1.80.Final" ]
192192
} ]
193193
}, {
194-
"test-project-path" : "io.netty/netty-common/4.1.115.Final",
194+
"test-project-path" : "io.netty/netty-transport/4.1.115.Final",
195195
"libraries" : [ {
196-
"name" : "io.netty:netty-common",
196+
"name" : "io.netty:netty-transport",
197197
"versions" : [ "4.1.115.Final" ]
198198
} ]
199199
}, {
200-
"test-project-path" : "io.netty/netty-transport/4.1.115.Final",
200+
"test-project-path" : "io.netty/netty-transport/4.1.80.Final",
201201
"libraries" : [ {
202202
"name" : "io.netty:netty-transport",
203-
"versions" : [ "4.1.115.Final" ]
203+
"versions" : [ "4.1.80.Final" ]
204204
} ]
205205
}, {
206206
"test-project-path" : "io.opentelemetry/opentelemetry-exporter-jaeger/1.19.0",
@@ -449,16 +449,16 @@
449449
"versions" : [ "10.15.0" ]
450450
} ]
451451
}, {
452-
"test-project-path": "org.flywaydb/flyway-core/10.20.0",
453-
"libraries": [ {
454-
"name": "org.flywaydb:flyway-core",
455-
"versions": [ "10.20.0" ]
452+
"test-project-path" : "org.flywaydb/flyway-core/10.20.0",
453+
"libraries" : [ {
454+
"name" : "org.flywaydb:flyway-core",
455+
"versions" : [ "10.20.0" ]
456456
} ]
457457
}, {
458-
"test-project-path": "org.flywaydb/flyway-core/10.20.1",
459-
"libraries": [ {
460-
"name": "org.flywaydb:flyway-core",
461-
"versions": [ "10.20.1" ]
458+
"test-project-path" : "org.flywaydb/flyway-core/10.20.1",
459+
"libraries" : [ {
460+
"name" : "org.flywaydb:flyway-core",
461+
"versions" : [ "10.20.1" ]
462462
} ]
463463
}, {
464464
"test-project-path" : "org.flywaydb/flyway-core/9.0.1",
@@ -700,4 +700,4 @@
700700
"name" : "samples:docker",
701701
"versions" : [ "image-pull" ]
702702
} ]
703-
} ]
703+
} ]

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

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ plugins {
1010
}
1111

1212
import groovy.json.JsonOutput
13+
import org.graalvm.internal.tck.ContributionTask
1314
import org.graalvm.internal.tck.DockerTask
1415
import org.graalvm.internal.tck.ConfigFilesChecker
1516
import org.graalvm.internal.tck.ScaffoldTask
1617
import org.graalvm.internal.tck.GrypeTask
1718
import org.graalvm.internal.tck.TestedVersionUpdaterTask
1819
import org.graalvm.internal.tck.harness.tasks.CheckstyleInvocationTask
19-
import org.graalvm.internal.tck.harness.tasks.FetchExistingLibrariesWithNewerVersionsTask
20-
import org.graalvm.internal.tck.harness.tasks.GroupUnsupportedLibraries
20+
import org.graalvm.internal.tck.updaters.FetchExistingLibrariesWithNewerVersionsTask
21+
import org.graalvm.internal.tck.updaters.GroupUnsupportedLibraries
2122
import org.graalvm.internal.tck.harness.tasks.TestInvocationTask
2223

2324

@@ -164,7 +165,7 @@ Provider<Task> generateMatrixDiffCoordinates = tasks.register("generateMatrixDif
164165
}
165166
}
166167

167-
// groovy tasks
168+
// new library version updaters tasks
168169
tasks.register("fetchExistingLibrariesWithNewerVersions", FetchExistingLibrariesWithNewerVersionsTask.class) { task ->
169170
task.setGroup(METADATA_GROUP)
170171
task.setDescription("Returns list of all libraries coordinates")
@@ -176,7 +177,13 @@ tasks.register("groupLibrariesByName", GroupUnsupportedLibraries.class) { task -
176177
task.setDescription("Extracts groups of libraries from github comments provided in a form of string.")
177178
}
178179

179-
// java tasks
180+
181+
tasks.register("addTestedVersion", TestedVersionUpdaterTask.class) { task ->
182+
task.setDescription("Updates list of tested versions.")
183+
task.setGroup(METADATA_GROUP)
184+
}
185+
186+
// docker tasks
180187
tasks.register("checkAllowedDockerImages", GrypeTask.class) { task ->
181188
task.setDescription("Returns list of allowed docker images")
182189
task.setGroup(METADATA_GROUP)
@@ -187,19 +194,21 @@ tasks.register("pullAllowedDockerImages", DockerTask.class) { task ->
187194
task.setGroup(METADATA_GROUP)
188195
}
189196

197+
198+
// contributing tasks
190199
tasks.register("scaffold", ScaffoldTask.class) { task ->
191200
task.setDescription("Creates a metadata and test scaffold for the given coordindates")
192201
task.setGroup(METADATA_GROUP)
193202
// Format JSON after task has been run
194203
task.finalizedBy("spotlessApply")
195204
}
196205

197-
tasks.register("checkConfigFiles", ConfigFilesChecker.class) { task ->
198-
task.setDescription("Checks content of config files for a new library.")
206+
tasks.register("contribute", ContributionTask.class) { task ->
207+
task.setDescription("Generates metadata and prepares pull request for contibuting on metadata repository based on provided tests.")
199208
task.setGroup(METADATA_GROUP)
200209
}
201210

202-
tasks.register("addTestedVersion", TestedVersionUpdaterTask.class) { task ->
203-
task.setDescription("Updates list of tested versions.")
211+
tasks.register("checkConfigFiles", ConfigFilesChecker.class) { task ->
212+
task.setDescription("Checks content of config files for a new library.")
204213
task.setGroup(METADATA_GROUP)
205214
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@
1818
import org.gradle.api.provider.Property;
1919
import org.gradle.api.provider.Provider;
2020
import org.gradle.process.ExecOperations;
21-
import org.gradle.util.internal.VersionNumber;
2221

2322
import javax.inject.Inject;
2423
import java.io.ByteArrayOutputStream;
25-
import java.io.File;
2624
import java.io.IOException;
2725
import java.net.URI;
2826
import java.nio.charset.StandardCharsets;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.graalvm.internal.tck.harness.tasks
1+
package org.graalvm.internal.tck.updaters
22

33

44
import com.fasterxml.jackson.annotation.JsonInclude
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.graalvm.internal.tck.harness.tasks
1+
package org.graalvm.internal.tck.updaters
22

33
import org.gradle.api.DefaultTask
44
import org.gradle.api.provider.Property

0 commit comments

Comments
 (0)