Skip to content

Commit

Permalink
Update to Gradle 8.9
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Redko <[email protected]>
  • Loading branch information
reta committed Jul 5, 2024
1 parent f14b5c8 commit 57de14d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,50 +81,52 @@ public void apply(Project project) {
// tests
Configuration testConfig = project.getConfigurations().create("restTestConfig");
project.getConfigurations().create("restTests");

if (BuildParams.isInternal()) {
// core
Dependency restTestdependency = project.getDependencies().project(new HashMap<String, String>() {

Check warning on line 87 in buildSrc/src/main/java/org/opensearch/gradle/test/rest/RestResourcesPlugin.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/test/rest/RestResourcesPlugin.java#L87

Added line #L87 was not covered by tests
{
put("path", ":rest-api-spec");
put("configuration", "restTests");
}

Check warning on line 91 in buildSrc/src/main/java/org/opensearch/gradle/test/rest/RestResourcesPlugin.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/test/rest/RestResourcesPlugin.java#L89-L91

Added lines #L89 - L91 were not covered by tests
});
testConfig.withDependencies(s -> s.add(restTestdependency));
} else {
Dependency dependency = project.getDependencies().create("org.opensearch:rest-api-spec:" + VersionProperties.getOpenSearch());
testConfig.withDependencies(s -> s.add(dependency));

Check warning on line 96 in buildSrc/src/main/java/org/opensearch/gradle/test/rest/RestResourcesPlugin.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/test/rest/RestResourcesPlugin.java#L93-L96

Added lines #L93 - L96 were not covered by tests
}

Provider<CopyRestTestsTask> copyRestYamlTestTask = project.getTasks()
.register("copyYamlTestsTask", CopyRestTestsTask.class, task -> {
task.includeCore.set(extension.restTests.getIncludeCore());
task.coreConfig = testConfig;
task.sourceSetName = SourceSet.TEST_SOURCE_SET_NAME;
if (BuildParams.isInternal()) {
// core
Dependency restTestdependency = project.getDependencies().project(new HashMap<String, String>() {
{
put("path", ":rest-api-spec");
put("configuration", "restTests");
}
});
project.getDependencies().add(task.coreConfig.getName(), restTestdependency);
} else {
Dependency dependency = project.getDependencies()
.create("org.opensearch:rest-api-spec:" + VersionProperties.getOpenSearch());
project.getDependencies().add(task.coreConfig.getName(), dependency);
}
task.dependsOn(task.coreConfig);
});

// api
Configuration specConfig = project.getConfigurations().create("restSpec"); // name chosen for passivity
project.getConfigurations().create("restSpecs");

if (BuildParams.isInternal()) {
Dependency restSpecDependency = project.getDependencies().project(new HashMap<String, String>() {

Check warning on line 112 in buildSrc/src/main/java/org/opensearch/gradle/test/rest/RestResourcesPlugin.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/test/rest/RestResourcesPlugin.java#L112

Added line #L112 was not covered by tests
{
put("path", ":rest-api-spec");
put("configuration", "restSpecs");
}

Check warning on line 116 in buildSrc/src/main/java/org/opensearch/gradle/test/rest/RestResourcesPlugin.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/test/rest/RestResourcesPlugin.java#L114-L116

Added lines #L114 - L116 were not covered by tests
});
specConfig.withDependencies(s -> s.add(restSpecDependency));
} else {
Dependency dependency = project.getDependencies().create("org.opensearch:rest-api-spec:" + VersionProperties.getOpenSearch());
specConfig.withDependencies(s -> s.add(dependency));

Check warning on line 121 in buildSrc/src/main/java/org/opensearch/gradle/test/rest/RestResourcesPlugin.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/test/rest/RestResourcesPlugin.java#L118-L121

Added lines #L118 - L121 were not covered by tests
}

Provider<CopyRestApiTask> copyRestYamlSpecTask = project.getTasks()
.register("copyRestApiSpecsTask", CopyRestApiTask.class, task -> {
task.includeCore.set(extension.restApi.getIncludeCore());
task.dependsOn(copyRestYamlTestTask);
task.coreConfig = specConfig;
task.sourceSetName = SourceSet.TEST_SOURCE_SET_NAME;
if (BuildParams.isInternal()) {
Dependency restSpecDependency = project.getDependencies().project(new HashMap<String, String>() {
{
put("path", ":rest-api-spec");
put("configuration", "restSpecs");
}
});
project.getDependencies().add(task.coreConfig.getName(), restSpecDependency);
} else {
Dependency dependency = project.getDependencies()
.create("org.opensearch:rest-api-spec:" + VersionProperties.getOpenSearch());
project.getDependencies().add(task.coreConfig.getName(), dependency);
}
task.dependsOn(task.coreConfig);
});

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-rc-2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=f8b4f4772d302c8ff580bc40d0f56e715de69b163546944f787c87abf209c961
distributionSha256Sum=82b21feab243f6b50d05ee21daa704b71d2171234556668b32126986e4f80c64

0 comments on commit 57de14d

Please sign in to comment.