Skip to content
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

Migrate to Java 21 #1788

Merged
merged 3 commits into from
Nov 23, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/build-ballerina-to-openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21.0.3
- name: Change to Timestamped Version
run: |
startTime=$(TZ="Asia/Kolkata" date +'%Y%m%d-%H%M00')
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-timestamped-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21.0.3
- name: Change to Timestamped Version
run: |
startTime=$(TZ="Asia/Kolkata" date +'%Y%m%d-%H%M00')
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/central-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21.0.3
- name: Grant execute permission for gradlew
run: chmod +x gradlew

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-ballerina-to-openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21.0.3
- name: Set version env variable
run: echo "VERSION=$((grep -w "ballerinaToOpenAPIVersion" | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)" >> $GITHUB_ENV
- name: Pre release dependency version update
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21.0.3
- name: Check for Ballerina to OpenAPI release
run: |
BAL_TO_OPENAPI_VERSION=$(grep -w "ballerinaToOpenAPIVersion" gradle.properties | cut -d= -f2)
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21.0.3
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand All @@ -32,11 +32,11 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21.0.3
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ For more information on the supported operations, go to [Using the OpenAPI Tools

### Setting Up the Prerequisites

1. OpenJDK 11 ([Adopt OpenJDK](https://adoptopenjdk.net/) or any other OpenJDK distribution)
1. OpenJDK 21 ([Adopt OpenJDK](https://adoptopenjdk.net/) or any other OpenJDK distribution)

>**Info:** You can also use [Oracle JDK](https://www.oracle.com/java/technologies/javase-downloads.html). Set the JAVA_HOME environment variable to the pathname of the directory into which you installed JDK.

Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
plugins {
id "base"
id 'maven-publish'
id "com.github.spotbugs" version "5.0.14"
id "com.github.johnrengelman.shadow" version "8.1.1"
id "de.undercouch.download" version "5.4.0"
id "net.researchgate.release" version "2.8.0"
id "com.github.spotbugs" version "${spotbugsPluginVersion}"
id "com.github.johnrengelman.shadow" version "${shadowJarPluginVersion}"
id "de.undercouch.download" version "${downloadPluginVersion}"
id "net.researchgate.release" version "${releasePluginVersion}"
id 'org.javamodularity.moduleplugin' version '1.7.0' apply false
id "org.sonarqube" version "4.0.0.2929"
}
Expand Down Expand Up @@ -54,7 +54,7 @@ ext.stdlibTaskVersion = project.stdlibTaskVersion
ext.stdlibFileVersion = project.stdlibFileVersion
ext.stdlibHttpVersion = project.stdlibHttpVersion
ext.stdlibUrlVersion = project.stdlibUrlVersion
ext.stdlibXmldataVersion = project.stdlibXmldataVersion
ext.stdlibDataXmldataVersion = project.stdlibDataXmldataVersion
ext.stdlibGraphqlVersion = project.stdlibGraphqlVersion
ext.stdlibGrpcVersion = project.stdlibGrpcVersion
ext.stdlibWebsubVersion = project.stdlibWebsubVersion
Expand Down Expand Up @@ -129,7 +129,7 @@ subprojects {
ballerinaStdLibs "io.ballerina.stdlib:oauth2-ballerina:${stdlibOAuth2Version}"
ballerinaStdLibs "io.ballerina.stdlib:uuid-ballerina:${stdlibUuidVersion}"
ballerinaStdLibs "io.ballerina.stdlib:url-ballerina:${stdlibUrlVersion}"
ballerinaStdLibs "io.ballerina.lib:data.xmldata-ballerina:${stdlibXmldataVersion}"
ballerinaStdLibs "io.ballerina.lib:data.xmldata-ballerina:${stdlibDataXmldataVersion}"
ballerinaStdLibs "io.ballerina.stdlib:observe-ballerina:${observeVersion}"
ballerinaStdLibs "io.ballerina:observe-ballerina:${observeInternalVersion}"
ballerinaStdLibs "io.ballerina.stdlib:graphql-ballerina:${stdlibGraphqlVersion}"
Expand Down
57 changes: 31 additions & 26 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ version=2.1.1-SNAPSHOT

ballerinaToOpenAPIVersion=2.1.1-SNAPSHOT

spotbugsPluginVersion=6.0.18
shadowJarPluginVersion=8.1.1
downloadPluginVersion=5.4.0
releasePluginVersion=2.8.0

# Client Native Version
clientNativeVersion=1.0.1-SNAPSHOT
# Mark this as false to skip publishing the client native artifacts
clientNativePublish=false

#dependency
ballerinaLangVersion=2201.11.0-20241008-112400-81975006
ballerinaLangVersion=2201.11.0-20241117-133400-a3054b77
testngVersion=7.6.1
slf4jVersion=1.7.30
org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8
Expand All @@ -24,45 +29,45 @@ puppycrawlCheckstyleVersion = 10.12.1
commonsCodecVersion=1.16.0

# Stdlib Level 01
stdlibIoVersion=1.6.1
stdlibRegexVersion=1.4.3
stdlibTimeVersion=2.4.0
stdlibUrlVersion=2.4.0
stdlibXmldataVersion=1.0.0
stdlibIoVersion=1.6.2-20241112-233100-995cf5f
stdlibRegexVersion=1.4.4-20241108-130200-fcd3fce
stdlibTimeVersion=2.6.0-20241113-073800-201b904
stdlibUrlVersion=2.4.1-20241113-073900-335ff51
stdlibDataXmldataVersion=1.0.1-20241113-122800-f4e815c

# Stdlib Level 02
stdlibConstraintVersion=1.5.0
stdlibCryptoVersion=2.7.2
stdlibLogVersion=2.10.0
stdlibOsVersion=1.8.0
stdlibTaskVersion=2.5.0
stdlibConstraintVersion=1.6.0-20241113-090900-d276ad5
stdlibCryptoVersion=2.7.3-20241113-081400-d015a39
stdlibLogVersion=2.10.1-20241113-120000-4577868
stdlibOsVersion=1.8.1-20241113-122000-cca973b
stdlibTaskVersion=2.5.1-20241113-123500-f905281

# Stdlib Level 03
stdlibCacheVersion=3.8.0
stdlibFileVersion=1.10.0
stdlibMimeVersion=2.10.0
stdlibUuidVersion=1.8.0
stdlibCacheVersion=3.8.1-20241113-125700-b75a1bf
stdlibFileVersion=1.10.1-20241113-151700-e1a2e38
stdlibMimeVersion=2.10.2-20241113-154200-d953747
stdlibUuidVersion=1.8.1-20241113-154400-443c67b

# Stdlib Level 04
stdlibAuthVersion=2.12.0
stdlibDataJsonDataVersion=0.3.0-20241105-101100-661d11f
stdlibJwtVersion=2.13.0
stdlibOAuth2Version=2.12.0
stdlibAuthVersion=2.12.1-20241113-162300-ded40eb
stdlibDataJsonDataVersion=0.3.0-20241114-143900-285d739
stdlibJwtVersion=2.13.1-20241113-162400-b59ccfa
stdlibOAuth2Version=2.12.1-20241113-162400-4c6ddfe

# Stdlib Level 05
stdlibHttpVersion=2.13.0-20241106-120000-d375c3b
stdlibHttpVersion=2.13.0-20241114-182900-7e9f66a

# Stdlib Level 06
stdlibGrpcVersion=1.12.0
stdlibWebsocketVersion=2.12.0
stdlibWebsubVersion=2.12.0
stdlibGrpcVersion=1.13.0-20241114-195700-5188f60
stdlibWebsocketVersion=2.13.0-20241116-202000-ddd958d
stdlibWebsubVersion=2.13.0-20241114-233100-73205d6

# Stdlib Level 07
stdlibGraphqlVersion=1.14.0
stdlibGraphqlVersion=1.15.0-20241117-164000-4d95b39

# Ballerinax Observer
observeVersion=1.3.0
observeInternalVersion=1.3.0
observeVersion=1.4.0-20241113-092000-b83ae74
observeInternalVersion=1.3.1-20241113-101700-265054d

# Enabled publishing insecure checksums, due to fail to publish to maven central
# Refer https://github.com/gradle/gradle/issues/11308
Expand Down
9 changes: 6 additions & 3 deletions gradle/javaProject.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dependencies {
checkstyle "com.puppycrawl.tools:checkstyle:${project.puppycrawlCheckstyleVersion}"
}

sourceCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21

def excludePattern = '**/module-info.java'
tasks.withType(Checkstyle) {
Expand Down Expand Up @@ -140,9 +140,12 @@ checkstyle {
}

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")
effort = SpotBugsEffort.MAX
reportLevel = SpotBugsConfidence.LOW
ignoreFailures = true
effort = "max"
reportLevel = "low"
reportsDir = file("$project.buildDir/reports/spotbugs")
def excludeFile = file("${rootDir}/spotbugs-exclude.xml")
if (excludeFile.exists()) {
Expand Down
2 changes: 1 addition & 1 deletion module-ballerina-openapi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jar {

def packageName = "openapi"
def packageOrg = "ballerina"
def platform = "java17"
def platform = "java21"
def tomlVersion = stripBallerinaExtensionVersion("${project.version}")
def ballerinaConfigFilePlaceHolder = new File("${project.rootDir}/config/resources/Ballerina.toml")
def ballerinaCompileConfigFilePlaceHolder = new File("${project.rootDir}/config/resources/CompilerPlugin.toml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ private boolean clientNativeDependencyAlreadyExist(String version, ToolContext t
project = BuildProject.load(path);

Map<String, PackageManifest.Platform> platforms = project.currentPackage().manifest().platforms();
if (Objects.nonNull(platforms) && platforms.containsKey("java17")) {
Optional<Map<String, Object>> nativeDependency = platforms.get("java17").dependencies().stream().filter(
if (Objects.nonNull(platforms) && platforms.containsKey("java21")) {
Optional<Map<String, Object>> nativeDependency = platforms.get("java21").dependencies().stream().filter(
dependency -> dependency.containsKey("groupId") &&
dependency.get("groupId").equals("io.ballerina.openapi")
&& dependency.containsKey("artifactId") &&
Expand All @@ -439,7 +439,7 @@ private boolean clientNativeDependencyAlreadyExist(String version, ToolContext t
private NodeList<DocumentMemberDeclarationNode> populateClientNativeDependency(
NodeList<DocumentMemberDeclarationNode> tomlMembers, String version) {
String desc = "This dependency is added automatically by the OpenAPI tool. DO NOT REMOVE UNLESS REQUIRED";
tomlMembers = tomlMembers.add(SampleNodeGenerator.createTableArray("platform.java17.dependency", desc));
tomlMembers = tomlMembers.add(SampleNodeGenerator.createTableArray("platform.java21.dependency", desc));
tomlMembers = tomlMembers.add(SampleNodeGenerator.createStringKV("groupId", "io.ballerina.openapi", null));
tomlMembers = tomlMembers.add(SampleNodeGenerator.createStringKV("artifactId", "client-native", null));
tomlMembers = tomlMembers.add(SampleNodeGenerator.createStringKV("version", version, null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,8 @@ private void updateBallerinaTomlWithClientNativeDependency() {
private boolean clientNativeDependencyAlreadyExist(String version) {
Project project = ProjectLoader.loadProject(executionPath);
Map<String, Platform> platforms = project.currentPackage().manifest().platforms();
if (Objects.nonNull(platforms) && platforms.containsKey("java17")) {
Optional<Map<String, Object>> nativeDependency = platforms.get("java17").dependencies().stream().filter(
if (Objects.nonNull(platforms) && platforms.containsKey("java21")) {
Optional<Map<String, Object>> nativeDependency = platforms.get("java21").dependencies().stream().filter(
dependency -> dependency.containsKey("groupId") &&
dependency.get("groupId").equals("io.ballerina.openapi")
&& dependency.containsKey("artifactId") &&
Expand Down Expand Up @@ -565,7 +565,7 @@ private boolean clientNativeDependencyAlreadyExist(String version) {
private NodeList<DocumentMemberDeclarationNode> populateClientNativeDependency(
NodeList<DocumentMemberDeclarationNode> tomlMembers, String version) {
String desc = "This dependency is added automatically by the OpenAPI tool. DO NOT REMOVE UNLESS REQUIRED";
tomlMembers = tomlMembers.add(SampleNodeGenerator.createTableArray("platform.java17.dependency", desc));
tomlMembers = tomlMembers.add(SampleNodeGenerator.createTableArray("platform.java21.dependency", desc));
tomlMembers = tomlMembers.add(SampleNodeGenerator.createStringKV("groupId", "io.ballerina.openapi", null));
tomlMembers = tomlMembers.add(SampleNodeGenerator.createStringKV("artifactId", "client-native", null));
tomlMembers = tomlMembers.add(SampleNodeGenerator.createStringKV("version", version, null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ paths:
"201":
description: Created
headers:
Last-Modified:
schema:
type: string
Cache-Control:
schema:
type: string
default: "must-revalidate,public,max-age=3600"
ETag:
schema:
type: string
Last-Modified:
schema:
type: string
content:
text/plain:
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ paths:
"200":
description: Ok
headers:
Last-Modified:
schema:
type: string
Cache-Control:
schema:
type: string
default: "must-revalidate,private,max-age=3600"
ETag:
schema:
type: string
Last-Modified:
schema:
type: string
content:
text/plain:
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ paths:
"200":
description: Ok
headers:
Last-Modified:
schema:
type: string
Cache-Control:
schema:
type: string
Expand All @@ -28,6 +25,9 @@ paths:
ETag:
schema:
type: string
Last-Modified:
schema:
type: string
content:
text/plain:
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ paths:
"200":
description: Ok
headers:
Last-Modified:
schema:
type: string
Cache-Control:
schema:
type: string
default: "must-revalidate,public"
ETag:
schema:
type: string
Last-Modified:
schema:
type: string
content:
text/plain:
schema:
Expand Down
Loading
Loading