Skip to content

Commit 28da933

Browse files
committed
Extract check for empty config files
1 parent 2fb7c58 commit 28da933

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

tests/tck-build-logic/src/main/java/org/graalvm/internal/tck/ContributionTask.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,13 +464,13 @@ private void removeEmptyConfigFiles() throws IOException {
464464

465465
Path resourceConfigPath = metadataDirectory.resolve(CONFIG_FILES.RESOURCE.get());
466466
ResourceConfigModel resourceConfig = objectMapper.readValue(new File(resourceConfigPath.toUri()), new TypeReference<>() {});
467-
if (resourceConfig.bundles().isEmpty() && resourceConfig.resources().toString().equalsIgnoreCase("{}")) {
467+
if (resourceConfig.isEmpty()) {
468468
removeConfigFile(resourceConfigPath, CONFIG_FILES.RESOURCE, remainingFiles);
469469
}
470470

471471
Path serializationConfigPath = metadataDirectory.resolve(CONFIG_FILES.SERIALIZATION.get());
472472
SerializationConfigModel serializationConfig = objectMapper.readValue(new File(serializationConfigPath.toUri()), new TypeReference<>() {});
473-
if (serializationConfig.lambdaCapturingTypes().isEmpty() && serializationConfig.types().isEmpty() && serializationConfig.proxies().isEmpty()) {
473+
if (serializationConfig.isEmpty()) {
474474
removeConfigFile(serializationConfigPath, CONFIG_FILES.SERIALIZATION, remainingFiles);
475475
}
476476

@@ -495,7 +495,7 @@ private void removeEmptyConfigFiles() throws IOException {
495495
Path predefinedClassesConfigPath = metadataDirectory.resolve(CONFIG_FILES.PREDEFINED_CLASSES.get());
496496
List<PredefinedClassesConfigModel> predefinedClassesConfig = objectMapper.readValue(new File(predefinedClassesConfigPath.toUri()), new TypeReference<>() {});
497497
if (predefinedClassesConfig.size() == 1) {
498-
if (predefinedClassesConfig.get(0).type().equalsIgnoreCase("agent-extracted") && predefinedClassesConfig.get(0).classes().isEmpty()) {
498+
if (predefinedClassesConfig.get(0).isEmpty()) {
499499
removeConfigFile(predefinedClassesConfigPath, CONFIG_FILES.PREDEFINED_CLASSES, remainingFiles);
500500
}
501501
}

tests/tck-build-logic/src/main/java/org/graalvm/internal/tck/model/contributing/PredefinedClassesConfigModel.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ public record PredefinedClassesConfigModel(
66
String type,
77
List<Object> classes
88
) {
9+
public boolean isEmpty() {
10+
return this.type().equalsIgnoreCase("agent-extracted") && this.classes().isEmpty();
11+
}
912
}

tests/tck-build-logic/src/main/java/org/graalvm/internal/tck/model/contributing/ResourceConfigModel.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ public record ResourceConfigModel(
55
Object resources,
66
List<Object> bundles
77
) {
8+
public boolean isEmpty() {
9+
return this.bundles().isEmpty() && this.resources().toString().equalsIgnoreCase("{}");
10+
}
811
}

tests/tck-build-logic/src/main/java/org/graalvm/internal/tck/model/contributing/SerializationConfigModel.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ public record SerializationConfigModel(
88
List<Object> proxies,
99
List<Object> lambdaCapturingTypes
1010
) {
11+
public boolean isEmpty() {
12+
return this.lambdaCapturingTypes().isEmpty() && this.types().isEmpty() && this.proxies().isEmpty();
13+
}
1114
}

tests/tck-build-logic/src/main/resources/contributing/questions.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
{
88
"question-key": "testsLocation",
9-
"question": "Where are your tests implemented? Absolute path to the directory containing java packages where you implemented tests: ",
9+
"question": "Where did you implemented tests for this library? Absolute path to the directory containing java packages where you implemented tests: ",
1010
"help": "An absolute path to the directory that contains your tests. This path must be on your system and not some online location. Be aware that for all tests where you are not the sole author, you have to add a comment that proves that you may publish them under the specified license manually"
1111
},
1212
{
@@ -27,11 +27,11 @@
2727
{
2828
"question-key": "additionalDependencies",
2929
"question": "What additional testImplementation dependencies you want to include? Enter the next dependency (to stop type \"-\")",
30-
"help": "Enter the testImplementation dependencies (pres enter after each dependency) you want to include use in tests. Provide dependencies in form of Maven coordinates. Maven coordinates consist of three parts in the following format \"groupId:artifactId:version\". For more information visit: https://maven.apache.org/repositories/artifacts.html When you finish adding dependencies, type \"-\" to terminate the inclusion process"
30+
"help": "Enter the testImplementation dependencies (press enter after each dependency) you want to include use in tests. Provide dependencies in form of Maven coordinates. Maven coordinates consist of three parts in the following format \"groupId:artifactId:version\". For more information visit: https://maven.apache.org/repositories/artifacts.html When you finish adding dependencies, type \"-\" to terminate the inclusion process"
3131
},
3232
{
3333
"question-key": "shouldCreatePullRequest",
3434
"question": "Do you want to create a pull request to the reachability metadata repository [Y/n]:",
35-
"help": "In case you want to open a pull request to Reachability metadata repository automatically, type \"y\". This way the task will create a new branch for you, commit changes with a proper message, and push the branch remotly. At the end, the task will give you a link to the Github repository where you should fill in a pull request checkslist and complete the process."
35+
"help": "In case you want to open a pull request to Reachability metadata repository automatically, type \"y\". This way the task will create a new branch for you, commit changes with a proper message, and push the branch remotely. At the end, the task will give you a link to the Github repository where you should fill in a pull request checklist and complete the process."
3636
}
3737
]

0 commit comments

Comments
 (0)