Skip to content

Commit d9b44f0

Browse files
authored
Merge pull request #1501 from lesserwhirls/gradle-kt
Upgrade to Gradle 9 and migrate to Kotlin DSL
2 parents e514b82 + df275e2 commit d9b44f0

File tree

132 files changed

+2615
-2875
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+2615
-2875
lines changed

.github/workflows/deps.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v4
9-
- name: Set up JDK 11
10-
uses: actions/setup-java@v4
9+
- name: Set up JDK 17
10+
uses: actions/setup-java@v5
1111
with:
1212
distribution: 'temurin'
13-
java-version: '11'
13+
java-version: |
14+
8
15+
17
1416
- name: Build with Gradle (refresh dependencies)
1517
run: ./gradlew clean classes testClasses assemble --refresh-dependencies
1618
- name: Build sourceJars

.github/workflows/docs-tutorials.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v4
10-
- name: Setup Java 8
11-
uses: actions/setup-java@v4
10+
- name: Setup Java 8, 17
11+
uses: actions/setup-java@v5
1212
with:
1313
distribution: 'temurin'
14-
java-version: '8'
14+
java-version: |
15+
8
16+
17
1517
- name: Cache Gradle packages
1618
uses: actions/cache@v4
1719
with:

.github/workflows/docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14-
- name: Set up JDK 11
15-
uses: actions/setup-java@v4
14+
- name: Set up JDK 17
15+
uses: actions/setup-java@v5
1616
with:
1717
distribution: 'temurin'
18-
java-version: '11'
18+
java-version: '17'
1919
- name: Cache Gradle packages
2020
uses: actions/cache@v4
2121
with:

.github/workflows/style.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v4
9-
- name: Set up JDK 11
10-
uses: actions/setup-java@v4
9+
- name: Set up JDK 17
10+
uses: actions/setup-java@v5
1111
with:
1212
distribution: 'temurin'
13-
java-version: '11'
13+
java-version: '17'
1414
- name: Cache Gradle packages
1515
uses: actions/cache@v4
1616
with:
@@ -20,5 +20,7 @@ jobs:
2020
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
2121
restore-keys: |
2222
${{ runner.os }}-gradle-
23-
- name: Code Style Check with Gradle and Spotless
23+
- name: build-logic Code Style Check with Gradle and Spotless
24+
run: ./gradlew :build-logic:clean :build-logic:spotlessCheck
25+
- name: netCDF-Java Code Style Check with Gradle and Spotless
2426
run: ./gradlew clean spotlessCheck

.github/workflows/test-native-compression.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
ubuntu-24.04,
1616
ubuntu-24.04-arm,
1717
windows-2022,
18-
windows-11-arm,
1918
macos-13,
2019
macos-14,
2120
macos-15
@@ -24,15 +23,17 @@ jobs:
2423
runs-on: ${{ matrix.os }}
2524
steps:
2625
- uses: actions/checkout@v4
27-
- name: Set up JDK 11
28-
if: ${{ matrix.os != 'windows-11-arm' }}
29-
uses: actions/setup-java@v4
26+
- name: Setup JDK 8, 17
27+
if: ${{ matrix.os == 'ubuntu-24.04' || matrix.os == 'macos-13' }}
28+
uses: actions/setup-java@v5
3029
with:
3130
distribution: 'temurin'
32-
java-version: '11'
33-
- name: Set up JDK 21
34-
if: ${{ matrix.os == 'windows-11-arm' }}
35-
uses: actions/setup-java@v4
31+
java-version: |
32+
8
33+
17
34+
- name: Setup JDK 21
35+
if: ${{ matrix.os != 'ubuntu-24.04' && matrix.os != 'macos-13' }}
36+
uses: actions/setup-java@v5
3637
with:
3738
distribution: 'temurin'
3839
java-version: '21'
@@ -46,7 +47,13 @@ jobs:
4647
restore-keys: |
4748
${{ runner.os }}-gradle-
4849
- name: Run libaec JNA tests
49-
run: ./gradlew clean :native-compression:libaec-jna:simpleTests
50+
if: ${{ matrix.os == 'ubuntu-24.04' || matrix.os == 'macos-13' }}
51+
run: ./gradlew -Dorg.gradle.java.installations.auto-detect=true clean :libaec-jna:test
52+
env:
53+
JDK8: /usr/thredds-test-environment/temurin8
54+
- name: Run libaec JNA tests (JDK 21 tests)
55+
if: ${{ matrix.os != 'ubuntu-24.04' && matrix.os != 'macos-13' }}
56+
run: ./gradlew clean :libaec-jna:test21
5057
- uses: actions/upload-artifact@v4
5158
if: failure()
5259
with:

.github/workflows/tests.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,21 @@ jobs:
1111
java-vendor: ['zulu', 'temurin', 'corretto']
1212
steps:
1313
- uses: actions/checkout@v4
14-
- name: Build and test with Gradle (${{ matrix.java-vendor }} ${{ matrix.java-version }})
14+
- name: Build with ${{ matrix.java-vendor }} 17 and run tests with ${{ matrix.java-vendor }} ${{ matrix.java-version }}
1515
uses: Unidata/thredds-test-action@v3
1616
with:
1717
java-vendor: ${{ matrix.java-vendor }}
18-
java-version: ${{ matrix.java-version }}
18+
java-version: 17
1919
build-tool: 'gradlew'
20-
test-command: '--info --stacktrace testAll'
20+
test-command: '-Dorg.gradle.java.installations.fromEnv=JDK8 --info --stacktrace test'
21+
env:
22+
JDK8: /usr/thredds-test-environment/${{ matrix.java-vendor }}8
23+
- name: Prep for artifact upload
24+
if: failure()
25+
run: rm -rf build-logic/build/tmp
2126
- uses: actions/upload-artifact@v4
2227
if: failure()
2328
with:
2429
name: netCDF-Java_JUnit_Results_${{ github.sha }}_${{ matrix.java-vendor }}-${{ matrix.java-version }}
25-
path: build/reports/allTests
30+
path: |
31+
${{ github.workspace }}/**/build/reports/tests/**/*

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ bin/
3232

3333
# Ignore the Gradle cache directory.
3434
.gradle/
35+
36+
# Ignore .kotlin directories
37+
.kotlin/
38+
3539
# Ignore the output that Gradle generates in the "build/" directories...
3640
build/
41+
3742
# ...but not the source code in the "edu.ucar.build" package inside buildSrc
3843
!**/src/**/edu/ucar/build/
3944

bufr/build.gradle

Lines changed: 0 additions & 25 deletions
This file was deleted.

bufr/build.gradle.kts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2025 University Corporation for Atmospheric Research/Unidata
3+
* See LICENSE for license information.
4+
*/
5+
6+
plugins {
7+
id("java-library-conventions")
8+
id("protobuf-conventions")
9+
}
10+
11+
description = "Reading BUFR files with the NetCDF-java library."
12+
13+
extra["project.title"] = "BUFR IOSP"
14+
15+
dependencies {
16+
implementation(platform(project(":netcdf-java-platform")))
17+
18+
api(project(":cdm-core"))
19+
20+
implementation(libs.beust.jcommander)
21+
implementation(libs.findbugs.jsr305)
22+
implementation(libs.guava)
23+
implementation(libs.jdom2)
24+
implementation(libs.protobuf)
25+
implementation(libs.re2j)
26+
implementation(libs.slf4j.api)
27+
28+
testImplementation(platform(project(":netcdf-java-testing-platform")))
29+
30+
testImplementation(project(":cdm-test-utils"))
31+
32+
testImplementation(libs.google.truth)
33+
34+
testCompileOnly(libs.junit4)
35+
36+
testRuntimeOnly(libs.junit5.platformLauncher)
37+
testRuntimeOnly(libs.junit5.vintageEngine)
38+
}

build-logic/build.gradle.kts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2025 University Corporation for Atmospheric Research/Unidata
3+
* See LICENSE for license information.
4+
*/
5+
6+
plugins {
7+
`kotlin-dsl`
8+
alias(libs.plugins.protobuf)
9+
alias(libs.plugins.spotless)
10+
}
11+
12+
dependencies {
13+
implementation(plugin(libs.plugins.protobuf))
14+
implementation(plugin(libs.plugins.spotless))
15+
}
16+
17+
spotless {
18+
kotlinGradle {
19+
target("*.gradle.kts", "**/*.gradle.kts")
20+
ktfmt().googleStyle()
21+
}
22+
}
23+
24+
// Helper function that transforms a plugin alias from the version catalog
25+
// into a valid dependency notation
26+
fun plugin(plugin: Provider<PluginDependency>) =
27+
plugin.map { "${it.pluginId}:${it.pluginId}.gradle.plugin:${it.version}" }

0 commit comments

Comments
 (0)