Skip to content

Upgrade to gradle 8.13 #1441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# test against latest 8, 11, 17 of zulu and temurin java
java-version: [8, 11, 17]
# test against latest 8, 11, 17, 21 of zulu and temurin java
java-version: [8, 11, 17, 21]
java-vendor: ['zulu', 'temurin', 'corretto']
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ gradle.projectsEvaluated {

tasks.named('wrapper') {
distributionType = Wrapper.DistributionType.ALL
gradleVersion = '6.9.1'
gradleVersion = '8.13'
}

// Set up properties needed for all testing, adds "testAll" task to root
apply from: "$rootDir/gradle/root/testing.gradle"
// Generates coverage report for testAll
apply from: "$rootDir/gradle/root/coverage.gradle"
//apply from: "$rootDir/gradle/root/coverage.gradle"
// Attaches fatJar tasks to root project (makes toolsUI, ncIdv, etc.)
apply from: "$rootDir/gradle/root/fatJars.gradle"
// Creates pubs for artifacts created in fatJars.gradle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ private void testArrayStructureByRecno(ArrayStructure as) {
List<StructureMembers.Member> members = sdata.getMembers();
for (StructureMembers.Member m : members) {
Array sdataArray = sdata.getArray(m);
assert (sdataArray.getElementType() == m.getDataType().getPrimitiveClassType()) : sdataArray.getElementType()
+ " != " + m.getDataType().getPrimitiveClassType();
assert (sdataArray.getElementType() == m.getDataType().getPrimitiveClassType())
: sdataArray.getElementType() + " != " + m.getDataType().getPrimitiveClassType();

Array sdataArray2 = sdata.getArray(m.getName());
UtilsMa2Test.testEquals(sdataArray, sdataArray2);
Expand Down
4 changes: 2 additions & 2 deletions cdm-test/src/test/java/ucar/nc2/dataset/TestTransforms.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ private VerticalTransform test(NetcdfDataset ncd, String levName, String varName
// should be compatible with vunit
if (vunit != null) {
String vertCoordUnit = vt.getUnitString();
assert vunit.isCompatible(vertCoordUnit) : vertCoordUnit + " not udunits compatible with "
+ vunit.getUnitString();
assert vunit.isCompatible(vertCoordUnit)
: vertCoordUnit + " not udunits compatible with " + vunit.getUnitString();
}

return vt;
Expand Down
4 changes: 2 additions & 2 deletions cdm-test/src/test/java/ucar/nc2/ncml/TestNcMLStrides.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public void testStride(String stride) throws IOException, InvalidRangeException
Index ci = correct.getIndex();
Index di = data.getIndex();
for (int i = 0; i < data.getSize(); i++)
assert (data.getInt(di.set(i)) == correct.getInt(ci.set(i))) : stride + " index " + i + " = "
+ data.getInt(di.set(i)) + " != " + correct.getInt(ci.set(i));
assert (data.getInt(di.set(i)) == correct.getInt(ci.set(i)))
: stride + " index " + i + " = " + data.getInt(di.set(i)) + " != " + correct.getInt(ci.set(i));
}

}
6 changes: 3 additions & 3 deletions cdm/core/src/main/java/ucar/ma2/ArrayStructureMA.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ public static ArrayStructureMA factoryMA(ArrayStructure from) throws IOException
if (numRecords == -1) {
numRecords = firstDimLen;
} else {
assert numRecords == firstDimLen : String.format(
"Expected all structure members to have the same first" + "dimension length, but %d != %d.", numRecords,
firstDimLen);
assert numRecords == firstDimLen
: String.format("Expected all structure members to have the same first" + "dimension length, but %d != %d.",
numRecords, firstDimLen);
}

memberArrayMap.put(m.getName(), array);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ protected TableConfig getTimeSeriesProfileConfig(NetcdfDataset ds, EncodingInfo
// zDim = z.getDimension(0);
}
} else { // 1d time
assert z.getRank() != 1
|| !time.getDimension(0).equals(z.getDimension(0)) : "time and z dimensions must be different";
assert z.getRank() != 1 || !time.getDimension(0).equals(z.getDimension(0))
: "time and z dimensions must be different";
}

TableConfig profileTable = makeMultidimInner(ds, stationTable, info.childDim, info, errlog);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,8 @@ private static int calcStride(int numTotal, int maxToInclude) {
int stride = Math.max(1, (int) Math.ceil(numTotal / (double) maxToInclude));
int numIncluded = (int) Math.ceil(numTotal / (double) stride);

assert numIncluded <= maxToInclude : String.format("We're set to include %d points, but we wanted a max of %d.",
numIncluded, maxToInclude);
assert numIncluded <= maxToInclude
: String.format("We're set to include %d points, but we wanted a max of %d.", numIncluded, maxToInclude);
return stride;
}

Expand All @@ -766,9 +766,9 @@ private static void assertNotExceedingMaxBoundaryPoints(int numBoundaryPoints, i
// Widen to long to avoid possible overflow, because last two arguments will often be Integer.MAX_VALUE.
long maxBoundaryPoints = 2 * (long) maxPointsInYEdge + 2 * (long) maxPointsInXEdge;

assert numBoundaryPoints <= maxBoundaryPoints : String.format(
"We should be returning a maximum of %d boundary points, but we're returning %d instead.", maxBoundaryPoints,
numBoundaryPoints);
assert numBoundaryPoints <= maxBoundaryPoints
: String.format("We should be returning a maximum of %d boundary points, but we're returning %d instead.",
maxBoundaryPoints, numBoundaryPoints);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public void testResolve() throws IOException {
logger.debug("ACD service= {}", s);

assert getAccessURL(cat, "nest11").equals("http://www.acd.ucar.edu/dods/testServer/flux/CO2.nc");
assert getAccessURL(cat, "nest12").equals(base + "netcdf/data/flux/NO2.nc") : getAccessURL(cat, "nest12") + " != "
+ ClientCatalogUtil.makeFilepath() + "netcdf/data/flux/NO2.nc";
assert getAccessURL(cat, "nest12").equals(base + "netcdf/data/flux/NO2.nc")
: getAccessURL(cat, "nest12") + " != " + ClientCatalogUtil.makeFilepath() + "netcdf/data/flux/NO2.nc";

assert getMetadataURL(cat, "nest1", "NETCDF").equals("any.xml");
assert getMetadataURL(cat, "nest1", "ADN").equals("http://you/corrupt.xml");
Expand Down
1 change: 1 addition & 0 deletions cdm/gcdm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ task startDaemon(type: JavaExecFork) {
stopAfter = test
waitForPort = 16111
waitForOutput = 'Server started, listening on 16111'
dependsOn testClasses
}

test.dependsOn(startDaemon)
2 changes: 1 addition & 1 deletion docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ tasks.withType(JavaCompile).configureEach {
options.compilerArgs = ['-Xlint:deprecation']
}

apply plugin: 'com.diffplug.gradle.spotless'
apply plugin: 'com.diffplug.spotless'
spotless {
java {
// target java files in the test directory
Expand Down
6 changes: 0 additions & 6 deletions gradle/any/coverage.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ tasks.withType(JacocoReport).all { // Will apply to ":<subproject>:jacocoTestRe
group = 'Reports'
dependsOn tasks.withType(Test)

reports {
xml.enabled = false
html.enabled = true
csv.enabled = false
}

// By default, JacocoReport runs onlyIf ALL of the executionData exist. We want it to run if ANY exists.
setOnlyIf {
executionData.any {
Expand Down
2 changes: 1 addition & 1 deletion gradle/any/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ configurations.all {
// +--- org.apache.httpcomponents:httpclient:4.5.12
// | ...
//
substitute module('commons-logging:commons-logging') because 'we want to control JCL logging with slf4j' with module("org.slf4j:jcl-over-slf4j:${depVersion.slf4j}")
substitute module('commons-logging:commons-logging') because 'we want to control JCL logging with slf4j' using module("org.slf4j:jcl-over-slf4j:${depVersion.slf4j}")
}
}
4 changes: 2 additions & 2 deletions gradle/any/java-library.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ apply from: "$rootDir/gradle/any/spotless.gradle"
apply plugin: 'maven-publish'

def sourceJar = tasks.register('sourceJar', Jar) {
classifier 'sources'
setArchiveClassifier('sources')
from sourceSets.main.allJava
}

def javadocJar = tasks.register('javadocJar', Jar) {
dependsOn javadoc
classifier 'javadoc'
setArchiveClassifier('javadoc')
from files(javadoc.destinationDir)
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/any/shared-mvn-coords.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ ext {

// plugin version management
buildPlugins = [:]
buildPlugins.shadow = 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2'
buildPlugins.shadow = 'com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:8.3.5'
buildPlugins.sonarqube = 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.0'
buildPlugins.spotless = 'com.diffplug.spotless:spotless-plugin-gradle:4.5.1'
buildPlugins.spotless = 'com.diffplug.spotless:spotless-plugin-gradle:5.17.1'
buildPlugins.protobuf = 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'
buildPlugins.depcheck = 'org.owasp:dependency-check-gradle:8.2.1'

Expand Down
2 changes: 1 addition & 1 deletion gradle/any/spotless.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'java'
apply plugin: 'com.diffplug.gradle.spotless'
apply plugin: 'com.diffplug.spotless'

spotless {
java {
Expand Down
2 changes: 1 addition & 1 deletion gradle/root/fatJars.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if (!name.equals(rootProject.name)) {

// need this to resolve dependencies defined through the netcdf-java-platform project
apply from: "$rootDir/gradle/any/dependencies.gradle"
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.gradleup.shadow'

// todo: this indicates we need have too much logic in our script plugin
// This script plugin is a candidate for moving into buildSrc.
Expand Down
2 changes: 1 addition & 1 deletion gradle/root/spotless.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if (!name.equals(rootProject.name)) {
throw new GradleException("This script plugin should only be applied to the root project, not '$name'.")
}

apply plugin: 'com.diffplug.gradle.spotless'
apply plugin: 'com.diffplug.spotless'

spotless {
format 'misc', {
Expand Down
4 changes: 2 additions & 2 deletions gradle/root/testing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ gradle.projectsEvaluated {
description = 'Runs all subproject Test tasks'
dependsOn subprojectTestTasks
// If we run testAll, generate coverage report after all of the tests run
finalizedBy jacocoRootReport
//finalizedBy jacocoRootReport
}

task rootTestReport(type: TestReport, group: 'Reports') {
Expand All @@ -137,7 +137,7 @@ gradle.projectsEvaluated {
// ":grib:test" --finalizedBy--> ":rootTestReport" --dependsOn--> "all_subproject_Tests"
// In other words, all subproject tests would get run, no matter what.
// Passing File arguments to reportOn() instead doesn't create that dependency.
reportOn subprojectTestTasks*.binResultsDir
reportOn subprojectTestTasks*.binaryResultsDirectory

// Wait until all Test tasks have run. This creates a task *ordering*, not a dependency.
mustRunAfter subprojectTestTasks
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading