Skip to content

Commit

Permalink
Migrate to Java 21
Browse files Browse the repository at this point in the history
  • Loading branch information
ravinperera00 committed Nov 12, 2024
1 parent b05f6be commit 5c146ca
Show file tree
Hide file tree
Showing 18 changed files with 240 additions and 192 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-timestamped-master.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: 'temurin'
java-version: 17.0.7
java-version: 21.0.3
- name: Change to Timestamped Version
run: |
initialVersion=$((grep -w 'version' | cut -d= -f2) < gradle.properties )
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-with-bal-test-graalvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/central-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
4 changes: 2 additions & 2 deletions .github/workflows/publish-release.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: 'temurin'
java-version: 17.0.7
java-version: 21.0.3
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-snapshot-nexus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,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: 'temurin'
java-version: 17.0.7
java-version: 21.0.3
- name: Build with Gradle
env:
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ 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
with:
additional-windows-test-flags: "-x test"
2 changes: 1 addition & 1 deletion .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,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/)

Expand Down
10 changes: 5 additions & 5 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ keywords = ["persist", "sql", "mysql", "mssql", "sql-server"]
repository = "https://github.com/ballerina-platform/module-ballerinax-persist.sql"
icon = "icon.png"
license = ["Apache-2.0"]
distribution = "2201.10.0"
distribution = "2201.10.0-20241011-161100-51978649"

[platform.java17]
[platform.java21]
graalvmCompatible = true

[[platform.java17.dependency]]
[[platform.java21.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "persist.sql-native"
version = "1.4.0"
path = "../native/build/libs/persist.sql-native-1.4.0.jar"

[[platform.java17.dependency]]
[[platform.java21.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "persist-native"
version = "1.4.0"
path = "./lib/persist-native-1.4.0.jar"

[[platform.java17.dependency]]
[[platform.java21.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "sql-native"
version = "1.14.0"
Expand Down
8 changes: 4 additions & 4 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.10.0"
distribution-version = "2201.10.0-20241011-161100-51978649"

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -66,7 +66,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.12.0"
version = "2.13.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -366,7 +366,7 @@ dependencies = [
[[package]]
org = "ballerinai"
name = "transaction"
version = "0.0.0"
version = "1.10.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "cache"},
Expand Down Expand Up @@ -453,7 +453,7 @@ modules = [
[[package]]
org = "ballerinax"
name = "mysql.driver"
version = "1.6.0"
version = "1.7.1"
scope = "testOnly"
modules = [
{org = "ballerinax", packageName = "mysql.driver", moduleName = "mysql.driver"}
Expand Down
10 changes: 5 additions & 5 deletions build-config/resources/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ keywords = ["persist", "sql", "mysql", "mssql", "sql-server"]
repository = "https://github.com/ballerina-platform/module-ballerinax-persist.sql"
icon = "icon.png"
license = ["Apache-2.0"]
distribution = "2201.10.0"
distribution = "2201.10.0-20241011-161100-51978649"

[platform.java17]
[platform.java21]
graalvmCompatible = true

[[platform.java17.dependency]]
[[platform.java21.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "persist.sql-native"
version = "@toml.version@"
path = "../native/build/libs/[email protected]@.jar"

[[platform.java17.dependency]]
[[platform.java21.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "persist-native"
version = "@persist.version@"
path = "./lib/[email protected]@.jar"

[[platform.java17.dependency]]
[[platform.java21.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "sql-native"
version = "@sql.native.version@"
Expand Down
7 changes: 5 additions & 2 deletions compiler-plugin-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ jacocoTestReport {
}

spotbugsMain {
effort "max"
reportLevel "low"
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
reportsDir = file("$project.buildDir/reports/spotbugs")
reports {
html.enabled true
Expand Down
7 changes: 5 additions & 2 deletions compiler-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ checkstyle {
checkstyleMain.dependsOn(":checkstyle:downloadCheckstyleRuleFiles")

spotbugsMain {
effort "max"
reportLevel "low"
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
reportsDir = file("$project.buildDir/reports/spotbugs")
reports {
html.enabled true
Expand Down
62 changes: 31 additions & 31 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version=1.4.1-SNAPSHOT

puppycrawlCheckstyleVersion=10.12.1
checkstyleToolVersion=10.12.1
githubSpotbugsVersion=5.0.14
githubSpotbugsVersion=6.0.18
githubJohnrengelmanShadowVersion=8.1.1
underCouchDownloadVersion=5.4.0
researchgateReleaseVersion=2.8.0
Expand All @@ -12,63 +12,63 @@ gsonVersion=2.10
ballerinaGradlePluginVersion=2.0.1
jacocoVersion=0.8.10

ballerinaLangVersion=2201.10.0
ballerinaLangVersion=2201.10.0-20241011-161100-51978649

# Direct Dependencies
# Level 01
stdlibIoVersion=1.6.1
stdlibTimeVersion=2.4.0
stdlibUrlVersion=2.4.0
stdlibIoVersion=1.6.2-20240928-084100-656404f
stdlibTimeVersion=2.5.1-20240930-120200-e59222b
stdlibUrlVersion=2.4.1-20240930-120200-b7fb9e1

# Level 02
stdlibLogVersion=2.10.0
stdlibOsVersion=1.8.0
stdlibPersistVersion=1.4.0
stdlibLogVersion=2.10.1-20240930-154200-5ab2aa4
stdlibOsVersion=1.8.1-20241001-120600-dd1626e
stdlibPersistVersion=1.4.1-20241001-120600-2395f0f

# Level 03
stdlibFileVersion=1.10.0
stdlibFileVersion=1.10.1-20241007-160900-03f7b64

# Level 05
stdlibHttpVersion=2.12.0
stdlibHttpVersion=2.13.0-20241029-110700-30ed05b

# Level 07
stdlibSqlVersion=1.14.0
stdlibSqlVersion=1.14.2-20241028-114300-2672942

# Ballerina external dependency
stdlibH2DriverVersion=1.1.0
stdlibMysqlDriverVersion=1.6.0
stdlibMssqlDriverVersion=1.6.0
stdlibPostgresqlDriverVersion=1.5.1
stdlibH2DriverVersion=1.1.1-20241029-101900-1c0e6d6
stdlibMysqlDriverVersion=1.7.1-20241029-084000-27ab4f3
stdlibMssqlDriverVersion=1.6.1-20241106-145800-4b72adb
stdlibPostgresqlDriverVersion=1.5.2-20241106-162800-582e4be

# Ballerinax Observer
observeVersion=1.3.0
observeInternalVersion=1.3.0
observeVersion=1.3.1-20241007-161000-645452d
observeInternalVersion=1.3.1-20241015-172900-cdc3cb3

# Transitive Dependencies

#Level 02
stdlibConstraintVersion=1.5.0
stdlibCryptoVersion=2.7.2
stdlibTaskVersion=2.5.0
stdlibConstraintVersion=1.5.1-20240930-123400-5ecd396
stdlibCryptoVersion=2.7.3-20240930-132000-5ecc9ab
stdlibTaskVersion=2.5.1-20241002-145700-5bdb843

# Level 03
stdlibCacheVersion=3.8.0
stdlibMimeVersion=2.10.0
stdlibUuidVersion=1.8.0
stdlibCacheVersion=3.8.1-20241007-154900-63f4403
stdlibMimeVersion=2.10.1-20241009-141200-8b6c9f0
stdlibUuidVersion=1.8.1-20241009-134600-a05012b

# Level 04
stdlibAuthVersion=2.12.0
stdlibJwtVersion=2.13.0
stdlibOAuth2Version=2.12.0
stdlibAuthVersion=2.12.1-20241010-130800-733dbef
stdlibJwtVersion=2.13.1-20241010-123600-5ea6a94
stdlibOAuth2Version=2.12.1-20241029-084800-d7ba9e5

# Level 06
stdlibTransactionVersion=1.10.0
stdlibTransactionVersion=1.10.1-20241021-105400-f7e16a8

# Test Dependencies
stdlibMysqlVersion=1.13.0
stdlibMssqlVersion=1.13.0
stdlibPostgresqlVersion=1.13.0
stdlibJdbcVersion=1.12.0
stdlibMysqlVersion=1.13.2-20240929-114700-5b8f54c
stdlibMssqlVersion=1.13.2-20241109-095800-f1487c0
stdlibPostgresqlVersion=1.13.2-20241109-095900-cd7d96a
stdlibJdbcVersion=1.12.2-20241112-200300-c77e1bc

# 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 native/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

sourceCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21

test {
testLogging {
Expand All @@ -60,9 +60,12 @@ test {
}

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}/build-config/spotbugs-exclude.xml")
if (excludeFile.exists()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.ballerina.stdlib.persist.sql;

import io.ballerina.runtime.api.values.BError;

public interface Handler {
void notifySuccess(Object result);

void notifyFailure(BError bError);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

import io.ballerina.runtime.api.Environment;
import io.ballerina.runtime.api.Module;
import io.ballerina.runtime.api.creators.ErrorCreator;

import java.util.concurrent.CompletableFuture;

/**
* Utility functions relevant to module operations.
Expand All @@ -40,4 +43,12 @@ public static void setModule(Environment env) {
public static Module getModule() {
return sqlModule;
}

public static Object getResult(CompletableFuture<Object> balFuture) {
try {
return balFuture.get();
} catch (Throwable throwable) {
throw ErrorCreator.createError(throwable);
}
}
}
Loading

0 comments on commit 5c146ca

Please sign in to comment.