From ccb488a89e8327981c8cd6b05bc954bd5026785e Mon Sep 17 00:00:00 2001 From: ravinperera00 Date: Mon, 30 Sep 2024 16:07:15 +0530 Subject: [PATCH 1/3] Migrate to Java 21 --- .github/workflows/build-timestamped-master.yml | 2 +- .github/workflows/build-with-bal-test-graalvm.yml | 2 +- .github/workflows/central-publish.yml | 2 +- .github/workflows/publish-release.yml | 2 +- .github/workflows/pull-request.yml | 2 +- .github/workflows/trivy-scan.yml | 2 +- README.md | 2 +- ballerina/Ballerina.toml | 14 +++++++------- ballerina/Dependencies.toml | 2 +- build-config/resources/Ballerina.toml | 8 ++++---- gradle.properties | 6 +++--- native/build.gradle | 7 +++++-- test-utils/build.gradle | 7 +++++-- 13 files changed, 32 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build-timestamped-master.yml b/.github/workflows/build-timestamped-master.yml index 4337022b..6ef21eb5 100644 --- a/.github/workflows/build-timestamped-master.yml +++ b/.github/workflows/build-timestamped-master.yml @@ -12,5 +12,5 @@ jobs: call_workflow: name: Run Build Workflow if: ${{ github.repository_owner == 'ballerina-platform' }} - uses: ballerina-platform/ballerina-library/.github/workflows/build-timestamp-master-template.yml@main + uses: ballerina-platform/ballerina-library/.github/workflows/build-timestamp-master-template.yml@java21 secrets: inherit diff --git a/.github/workflows/build-with-bal-test-graalvm.yml b/.github/workflows/build-with-bal-test-graalvm.yml index 51f000d6..5d890f5a 100644 --- a/.github/workflows/build-with-bal-test-graalvm.yml +++ b/.github/workflows/build-with-bal-test-graalvm.yml @@ -30,7 +30,7 @@ jobs: call_stdlib_workflow: name: Run StdLib Workflow if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'ballerina-platform') }} - uses: ballerina-platform/ballerina-library/.github/workflows/build-with-bal-test-graalvm-template.yml@main + uses: ballerina-platform/ballerina-library/.github/workflows/build-with-bal-test-graalvm-template.yml@java21 with: lang_tag: ${{ inputs.lang_tag }} lang_version: ${{ inputs.lang_version }} diff --git a/.github/workflows/central-publish.yml b/.github/workflows/central-publish.yml index 11922b55..ebe213e7 100644 --- a/.github/workflows/central-publish.yml +++ b/.github/workflows/central-publish.yml @@ -15,7 +15,7 @@ jobs: call_workflow: name: Run Central Publish Workflow if: ${{ github.repository_owner == 'ballerina-platform' }} - uses: ballerina-platform/ballerina-library/.github/workflows/central-publish-template.yml@main + uses: ballerina-platform/ballerina-library/.github/workflows/central-publish-template.yml@java21 secrets: inherit with: environment: ${{ github.event.inputs.environment }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index d0409f9b..45a42388 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -9,7 +9,7 @@ jobs: call_workflow: name: Run Release Workflow if: ${{ github.repository_owner == 'ballerina-platform' }} - uses: ballerina-platform/ballerina-library/.github/workflows/release-package-template.yml@main + uses: ballerina-platform/ballerina-library/.github/workflows/release-package-template.yml@java21 secrets: inherit with: package-name: os diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 1e06a675..47987806 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -10,4 +10,4 @@ jobs: call_workflow: name: Run PR Build Workflow if: ${{ github.repository_owner == 'ballerina-platform' }} - uses: ballerina-platform/ballerina-library/.github/workflows/pull-request-build-template.yml@main + uses: ballerina-platform/ballerina-library/.github/workflows/pull-request-build-template.yml@java21 diff --git a/.github/workflows/trivy-scan.yml b/.github/workflows/trivy-scan.yml index c02c8ff4..41e8f6ad 100644 --- a/.github/workflows/trivy-scan.yml +++ b/.github/workflows/trivy-scan.yml @@ -9,5 +9,5 @@ jobs: call_workflow: name: Run Trivy Scan Workflow if: ${{ github.repository_owner == 'ballerina-platform' }} - uses: ballerina-platform/ballerina-library/.github/workflows/trivy-scan-template.yml@main + uses: ballerina-platform/ballerina-library/.github/workflows/trivy-scan-template.yml@java21 secrets: inherit diff --git a/README.md b/README.md index b127c82a..9ede79b6 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ This repository only contains the source code for the package. ### Set up the prerequisites -1. Download and install Java SE Development Kit (JDK) version 17 (from one of the following locations). +1. Download and install Java SE Development Kit (JDK) version 21 (from one of the following locations). * [Oracle](https://www.oracle.com/java/technologies/downloads/) * [OpenJDK](https://adoptium.net/) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index c048ea36..154e5c7a 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerina" name = "os" -version = "1.8.1" +version = "1.8.2" authors = ["Ballerina"] keywords = ["environment"] repository = "https://github.com/ballerina-platform/module-ballerina-os" @@ -9,22 +9,22 @@ icon = "icon.png" license = ["Apache-2.0"] distribution = "2201.8.0" -[platform.java17] +[platform.java21] graalvmCompatible = true -[[platform.java17.dependency]] +[[platform.java21.dependency]] groupId = "io.ballerina.stdlib" artifactId = "os-native" -version = "1.8.1" -path = "../native/build/libs/os-native-1.8.1-SNAPSHOT.jar" +version = "1.8.2" +path = "../native/build/libs/os-native-1.8.2-SNAPSHOT.jar" -[[platform.java17.dependency]] +[[platform.java21.dependency]] groupId = "io.ballerina.stdlib" artifactId = "io-native" version = "1.6.0" path = "./lib/io-native-1.6.0.jar" -[[platform.java17.dependency]] +[[platform.java21.dependency]] groupId = "io.ballerina.stdlib" artifactId = "os-test-utils" version = "1.8.1" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 3d14e3be..c66c4b76 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,7 +5,7 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.8.0" +distribution-version = "2201.10.0-SNAPSHOT" [[package]] org = "ballerina" diff --git a/build-config/resources/Ballerina.toml b/build-config/resources/Ballerina.toml index 3559cc3d..7e4a6c3d 100644 --- a/build-config/resources/Ballerina.toml +++ b/build-config/resources/Ballerina.toml @@ -9,22 +9,22 @@ icon = "icon.png" license = ["Apache-2.0"] distribution = "2201.8.0" -[platform.java17] +[platform.java21] graalvmCompatible = true -[[platform.java17.dependency]] +[[platform.java21.dependency]] groupId = "io.ballerina.stdlib" artifactId = "os-native" version = "@toml.version@" path = "../native/build/libs/os-native-@project.version@.jar" -[[platform.java17.dependency]] +[[platform.java21.dependency]] groupId = "io.ballerina.stdlib" artifactId = "io-native" version = "@io.version@" path = "./lib/io-native-@io.native.version@.jar" -[[platform.java17.dependency]] +[[platform.java21.dependency]] groupId = "io.ballerina.stdlib" artifactId = "os-test-utils" version = "@toml.version@" diff --git a/gradle.properties b/gradle.properties index ff5cc4f9..6db73e79 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,11 +3,11 @@ group=io.ballerina.stdlib version=1.8.1-SNAPSHOT ballerinaGradlePluginVersion=2.0.1 -githubSpotBugsVersion=5.0.14 +githubSpotBugsVersion=6.0.18 shadowJarVersion=7.1.2 undercouchDownloadVersion=5.4.0 researchgateReleaseVersion=2.8.0 puppycrawlCheckstyleVersion=10.12.0 -ballerinaLangVersion=2201.8.0 -stdlibIoVersion=1.6.0 +ballerinaLangVersion=2201.10.0-20240926-231800-8a5a4343 +stdlibIoVersion=1.6.2-20240928-084100-656404f diff --git a/native/build.gradle b/native/build.gradle index 1767f564..4d0114d9 100644 --- a/native/build.gradle +++ b/native/build.gradle @@ -30,9 +30,12 @@ dependencies { } spotbugsMain { + def classLoader = plugins["com.github.spotbugs"].class.classLoader + def SpotBugsConfidence = classLoader.findLoadedClass("com.github.spotbugs.snom.Confidence") + def SpotBugsEffort = classLoader.findLoadedClass("com.github.spotbugs.snom.Effort") ignoreFailures = true - effort = "max" - reportLevel = "low" + effort = SpotBugsEffort.MAX + reportLevel = SpotBugsConfidence.LOW reportsDir = file("$project.buildDir/reports/spotbugs") def excludeFile = file("${rootDir}/build-config/spotbugs-exclude.xml") if (excludeFile.exists()) { diff --git a/test-utils/build.gradle b/test-utils/build.gradle index e2ec3580..5a4d6789 100644 --- a/test-utils/build.gradle +++ b/test-utils/build.gradle @@ -30,9 +30,12 @@ dependencies { } spotbugsMain { + def classLoader = plugins["com.github.spotbugs"].class.classLoader + def SpotBugsConfidence = classLoader.findLoadedClass("com.github.spotbugs.snom.Confidence") + def SpotBugsEffort = classLoader.findLoadedClass("com.github.spotbugs.snom.Effort") ignoreFailures = true - effort = "max" - reportLevel = "low" + effort = SpotBugsEffort.MAX + reportLevel = SpotBugsConfidence.LOW reportsDir = file("$project.buildDir/reports/spotbugs") def excludeFile = file("${rootDir}/build-config/spotbugs-exclude.xml") if (excludeFile.exists()) { From d1e5c5e1520b3c60f4c75b2cfccc8ff538d282e6 Mon Sep 17 00:00:00 2001 From: ravinperera00 Date: Mon, 30 Sep 2024 16:13:26 +0530 Subject: [PATCH 2/3] Change JAVA_HOME --- .../main/java/io/ballerina/stdlib/os/testutils/OSTestUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-utils/src/main/java/io/ballerina/stdlib/os/testutils/OSTestUtils.java b/test-utils/src/main/java/io/ballerina/stdlib/os/testutils/OSTestUtils.java index 8c83c18e..43ab01ba 100644 --- a/test-utils/src/main/java/io/ballerina/stdlib/os/testutils/OSTestUtils.java +++ b/test-utils/src/main/java/io/ballerina/stdlib/os/testutils/OSTestUtils.java @@ -29,7 +29,7 @@ public final class OSTestUtils { private OSTestUtils() {} public static BString testValidEnv() { - return StringUtils.fromString(System.getenv("JAVA_HOME")); + return StringUtils.fromString(System.getenv("java.home")); } public static BString testGetUserHome() { From d6ec9d2798dbb65a0eefd12f0e05500c2ca6f413 Mon Sep 17 00:00:00 2001 From: Ravin Perera <62183347+ravinperera00@users.noreply.github.com> Date: Mon, 30 Sep 2024 20:41:09 +0530 Subject: [PATCH 3/3] Add suggested code review changes Co-authored-by: Waruna Lakshitha --- ballerina/Dependencies.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index c66c4b76..b7e202ae 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,7 +5,7 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.10.0-SNAPSHOT" +distribution-version = "2201.10.0-20240926-231800-8a5a4343" [[package]] org = "ballerina"