Skip to content

Commit

Permalink
Merge pull request #794 from ballerina-platform/java_17_migration
Browse files Browse the repository at this point in the history
Sync Java 17 migration branch with main
  • Loading branch information
warunalakshitha authored Aug 14, 2023
2 parents 3e10fd6 + 7dc6d66 commit 2ea547d
Show file tree
Hide file tree
Showing 35 changed files with 289 additions and 209 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ensure all Java files use LF.
*.java eol=lf
8 changes: 4 additions & 4 deletions .github/workflows/build-timestamped-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
java-version: 17.0.7
- name: Change to Timestamped Version
run: |
startTime=$(TZ="Asia/Kolkata" date +'%Y%m%d-%H%M00')
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/central-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
java-version: 17.0.7
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
java-version: 17.0.7

- name: Set environment variable
if: github.event.action == 'check_connector_for_breaking_changes'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
java-version: 17.0.7
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
name: Build on Ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
java-version: 17.0.7
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand All @@ -32,12 +32,12 @@ jobs:
name: Build on Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
java-version: 17.0.7
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
name: Build on Ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
java-version: 17.0.7
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ Follow one of the following ways to add the JAR in the file:

* Download the JAR and update the path
```
[[platform.java11.dependency]]
[[platform.java17.dependency]]
path = "PATH"
```
* Add JAR with a maven dependency params
```
[[platform.java11.dependency]]
[[platform.java17.dependency]]
groupId = "org.postgresql"
artifactId = "postgresql"
version = "42.2.20"
Expand Down
12 changes: 6 additions & 6 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[package]
org = "ballerinax"
name = "postgresql"
version = "1.10.0"
version = "1.10.1"
authors = ["Ballerina"]
keywords = ["database", "client", "network", "SQL", "RDBMS", "PostgreSQL"]
repository = "https://github.com/ballerina-platform/module-ballerinax-postgresql"
icon = "icon.png"
license = ["Apache-2.0"]
distribution = "2201.7.0"

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

[[platform.java11.dependency]]
[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "postgresql-native"
version = "1.10.0"
path = "../native/build/libs/postgresql-native-1.10.0.jar"
version = "1.10.1"
path = "../native/build/libs/postgresql-native-1.10.1-SNAPSHOT.jar"

[[platform.java11.dependency]]
[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "sql-native"
version = "1.10.0"
Expand Down
2 changes: 1 addition & 1 deletion ballerina/CompilerPlugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ id = "postgresql-compiler-plugin"
class = "io.ballerina.stdlib.postgresql.compiler.PostgreSQLCompilerPlugin"

[[dependency]]
path = "../compiler-plugin/build/libs/postgresql-compiler-plugin-1.10.0.jar"
path = "../compiler-plugin/build/libs/postgresql-compiler-plugin-1.10.1-SNAPSHOT.jar"
6 changes: 3 additions & 3 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.7.0"
distribution-version = "2201.8.0-20230726-145300-b2bdf796"

[[package]]
org = "ballerina"
Expand All @@ -22,7 +22,7 @@ modules = [
[[package]]
org = "ballerina"
name = "file"
version = "1.8.0"
version = "1.8.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
Expand Down Expand Up @@ -161,7 +161,7 @@ modules = [
[[package]]
org = "ballerinax"
name = "postgresql"
version = "1.10.0"
version = "1.10.1"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "file"},
Expand Down
4 changes: 2 additions & 2 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ Follow one of the following ways to add the JAR in the file:

* Download the JAR and update the path
```
[[platform.java11.dependency]]
[[platform.java17.dependency]]
path = "PATH"
```
* Add JAR with a maven dependency params
```
[[platform.java11.dependency]]
[[platform.java17.dependency]]
groupId = "org.postgresql"
artifactId = "postgresql"
version = "42.2.20"
Expand Down
4 changes: 2 additions & 2 deletions ballerina/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ Follow one of the following ways to add the JAR in the file:

* Download the JAR and update the path
```
[[platform.java11.dependency]]
[[platform.java17.dependency]]
path = "PATH"
```
* Add JAR with a maven dependency params
```
[[platform.java11.dependency]]
[[platform.java17.dependency]]
groupId = "org.postgresql"
artifactId = "postgresql"
version = "42.2.20"
Expand Down
18 changes: 9 additions & 9 deletions ballerina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,16 @@ task createTestDockerImage(type: Exec) {
commandLine 'sh', '-c', "docker build -f ${project.projectDir}/tests/resources/Dockerfile -t ballerinax-postgresql" +
" -q ${project.projectDir}/tests/resources/"
doLast {
checkExecResult(execResult, 'Error', standardOutput)
checkExecResult(executionResult, 'Error', standardOutput)
sleep(10 * 1000)
}
}
}

def checkExecResult(execResult, failText, standardOutput){
if (execResult) {
if (execResult.getExitValue() != 0) {
throw new GradleException('Non-zero exit value: ' + execResult.getExitValue())
def checkExecResult(executionResult, failText, standardOutput){
if (executionResult) {
if (executionResult.get().getExitValue() != 0) {
throw new GradleException('Non-zero exit value: ' + executionResult.get().getExitValue())
}
if (standardOutput.toString().contains(failText)){
throw new GradleException('"' + failText + '" string in output: ' + standardOutput.toString())
Expand Down Expand Up @@ -168,7 +168,7 @@ task startTestDockerContainer(type: Exec) {
def healthCheck = 1;
def counter = 0;
doLast {
checkExecResult(execResult, 'Error', standardOutput)
checkExecResult(executionResult, 'Error', standardOutput)
while (healthCheck != 0 && counter < 12) {
sleep(5 * 1000)
healthCheck = checkTestDockerContainerStatus(testContainerName)
Expand All @@ -189,7 +189,7 @@ task startTestLimitedDockerContainer(type: Exec) {
def healthCheck = 1;
def counter = 0;
doLast {
checkExecResult(execResult, 'Error', standardOutput)
checkExecResult(executionResult, 'Error', standardOutput)
while (healthCheck != 0 && counter < 12) {
sleep(5 * 1000)
healthCheck = checkTestDockerContainerStatus(testContainerName)
Expand All @@ -210,7 +210,7 @@ task startTestPoolDockerContainer(type: Exec) {
def healthCheck = 1;
def counter = 0;
doLast {
checkExecResult(execResult, 'Error', standardOutput)
checkExecResult(executionResult, 'Error', standardOutput)
while (healthCheck != 0 && counter < 12) {
sleep(5 * 1000)
healthCheck = checkTestDockerContainerStatus(poolContainerName)
Expand All @@ -231,7 +231,7 @@ task startSslDockerContainer(type: Exec) {
def healthCheck = 1;
def counter = 0;
doLast {
checkExecResult(execResult, 'Error', standardOutput)
checkExecResult(executionResult, 'Error', standardOutput)
while (healthCheck != 0 && counter < 12) {
sleep(5 * 1000)
healthCheck = checkTestDockerContainerStatus(sslContainerName)
Expand Down
6 changes: 3 additions & 3 deletions build-config/checkstyle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ plugins {
id "de.undercouch.download"
}

apply plugin: 'java'
apply plugin: 'java-library'

task downloadCheckstyleRuleFiles(type: Download) {
src([
'https://raw.githubusercontent.com/wso2/code-quality-tools/v1.3/checkstyle/checkstyle.xml',
'https://raw.githubusercontent.com/wso2/code-quality-tools/v1.3/checkstyle/suppressions.xml'
'https://raw.githubusercontent.com/wso2/code-quality-tools/v1.4/checkstyle/jdk-17/checkstyle.xml',
'https://raw.githubusercontent.com/wso2/code-quality-tools/v1.4/checkstyle/jdk-17/suppressions.xml'
])
overwrite false
onlyIfNewer true
Expand Down
6 changes: 3 additions & 3 deletions build-config/resources/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ icon = "icon.png"
license = ["Apache-2.0"]
distribution = "2201.7.0"

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

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

[[platform.java11.dependency]]
[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "sql-native"
version = "@sql.version@"
Expand Down
10 changes: 10 additions & 0 deletions build-config/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,14 @@
~ under the License.
-->
<FindBugsFilter>
<Match>
<Class name="io.ballerina.stdlib.postgresql.parameterprocessor.PostgresResultParameterProcessor"/>
<Method name="getBalStreamResultIterator"/>
<Bug pattern="EI_EXPOSE_REP"/>
</Match>
<Match>
<Class name="io.ballerina.stdlib.postgresql.parameterprocessor.PostgresStatementParameterProcessor"/>
<Method name="getInstance"/>
<Bug pattern="MS_EXPOSE_REP"/>
</Match>
</FindBugsFilter>
8 changes: 4 additions & 4 deletions compiler-plugin-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

plugins {
id 'java'
id 'java-library'
id 'checkstyle'
id 'com.github.spotbugs'
id 'jacoco'
Expand All @@ -33,7 +33,7 @@ dependencies {
checkstyle project(':checkstyle')
checkstyle "com.puppycrawl.tools:checkstyle:${puppycrawlCheckstyleVersion}"

jacocoRuntime "org.jacoco:org.jacoco.agent:0.8.6:runtime"
jacocoRuntime "org.jacoco:org.jacoco.agent:0.8.10:runtime"

implementation project(':postgresql-compiler-plugin')

Expand All @@ -48,7 +48,7 @@ tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

sourceCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17

test {
systemProperty "ballerina.offline.flag", "true"
Expand All @@ -73,7 +73,7 @@ test {
jacocoTestReport {
dependsOn test
reports {
xml.enabled true
xml.required = true
}
sourceSets project(':postgresql-compiler-plugin').sourceSets.main
}
Expand Down
2 changes: 1 addition & 1 deletion compiler-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

plugins {
id 'java'
id 'java-library'
id 'checkstyle'
id 'com.github.spotbugs'
}
Expand Down
Loading

0 comments on commit 2ea547d

Please sign in to comment.