Skip to content

Commit

Permalink
Merge pull request #658 from gabilang/java17_migration
Browse files Browse the repository at this point in the history
Migrate to Java 17
  • Loading branch information
warunalakshitha committed Aug 15, 2023
2 parents f1a5c80 + 961ce65 commit 2eab830
Show file tree
Hide file tree
Showing 29 changed files with 326 additions and 203 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
12 changes: 6 additions & 6 deletions .github/workflows/build-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,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: 'adopt'
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 All @@ -29,8 +29,8 @@ jobs:
run: chmod +x gradlew
- uses: graalvm/setup-graalvm@v1
with:
version: '22.2.0'
java-version: '11'
java-version: '17.0.7'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
set-java-home: 'false'
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
if: github.repository_owner == 'ballerina-platform'
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: 'adopt'
java-version: 11
java-version: 17.0.7

- name: Set environment variable
if: github.event.action == 'check_connector_for_breaking_changes'
Expand All @@ -30,8 +30,8 @@ jobs:

- uses: graalvm/setup-graalvm@v1
with:
version: '22.2.0'
java-version: '11'
java-version: '17.0.7'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
set-java-home: 'false'
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 @@ -9,12 +9,12 @@ jobs:
if: github.repository_owner == 'ballerina-platform'
steps:
- name: Checkout Repository
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: 'adopt'
java-version: 11
java-version: 17.0.7
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ jobs:
packagePAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Repository
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: 'adopt'
java-version: 11
java-version: 17.0.7
- uses: graalvm/setup-graalvm@v1
with:
version: '22.2.0'
java-version: '11'
java-version: '17.0.7'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
set-java-home: 'false'
Expand All @@ -46,16 +46,16 @@ jobs:
packagePAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Repository
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: 'adopt'
java-version: 11
java-version: 17.0.7
- uses: graalvm/setup-graalvm@v1
with:
version: '22.2.0'
java-version: '11'
java-version: '17.0.7'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
set-java-home: 'false'
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Annotation based Azure Functions extension implementation for Ballerina.
## Azure Function App Setup

* An Azure "Function App" needs to be created in a given resource group with the following requirements
- Runtime stack - "Java 11"
- Runtime stack - "Java 17"
- Hosting operating system - "Windows" (default; Linux is not supported in Azure for custom handlers at the moment)

## Supported Triggers and bindings:
Expand Down Expand Up @@ -77,9 +77,9 @@ Generating executable

### Set Up the prerequisites

1. Download and install Java SE Development Kit (JDK) version 11 (from one of the following locations).
1. Download and install Java SE Development Kit (JDK) version 17 (from one of the following locations).

* [Oracle](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html)
* [Oracle](https://www.oracle.com/java/technologies/downloads/)

* [OpenJDK](https://adoptium.net/)

Expand Down
2 changes: 1 addition & 1 deletion ballerina-tests/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org = "ballerinax"
name = "azure.functions.tests"
version = "4.1.0"

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

[build-options]
Expand Down
2 changes: 2 additions & 0 deletions ballerina-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ task ballerinaTest {
dependsOn(":${packageName}-ballerina-${moduleName}:compileJava")
dependsOn(":${packageName}-ballerina-${moduleName}:jar")
dependsOn(":${packageName}-ballerina-${moduleName}:processResources")
dependsOn(":${packageName}-ballerina-${moduleName}:compileTestJava")
dependsOn(":${packageName}-ballerina-${moduleName}:processTestResources")
finalizedBy(commitTomlFiles)

doLast {
Expand Down
8 changes: 6 additions & 2 deletions ballerina-tests/tests/test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,9 @@ function testHttpBlobInputOptional() returns error? {
}


@test:Config {}
@test:Config {
enable: false
}
function testMultipartFormData() returns error? {
final http:Client clientEndpoint = check new ("http://localhost:3000");
string jsonFilePath = "./tests/resources/http-multipart-formdata.json";
Expand All @@ -1065,7 +1067,9 @@ function testMultipartFormData() returns error? {
test:assertEquals(resp, expectedResp);
}

@test:Config {}
@test:Config {
enable: false
}
function testMultipartMimeFormData() returns error? {
final http:Client clientEndpoint = check new ("http://localhost:3000");
string jsonFilePath = "./tests/resources/http-multipart-formdata-mime.json";
Expand Down
6 changes: 3 additions & 3 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ repository = "https://github.com/ballerina-platform/module-ballerinax-azure.func
license = ["Apache-2.0"]
keywords = ["azure", "functions", "serverless", "cloud"]

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

[[platform.java11.dependency]]
[[platform.java17.dependency]]
path = "../native/build/libs/azure.functions-native-4.1.0-SNAPSHOT.jar"

[[platform.java11.dependency]]
[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "mime-native"
version = "2.8.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.7.0"
distribution-version = "2201.8.0-20230726-145300-b2bdf796"

[[package]]
org = "ballerina"
Expand Down Expand Up @@ -50,7 +50,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "file"
version = "1.8.0"
version = "1.8.1"
dependencies = [
{org = "ballerina", name = "io"},
{org = "ballerina", name = "jballerina.java"},
Expand All @@ -61,7 +61,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.9.0"
version = "2.9.1"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "cache"},
Expand Down Expand Up @@ -201,7 +201,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "log"
version = "2.8.0"
version = "2.8.1"
dependencies = [
{org = "ballerina", name = "io"},
{org = "ballerina", name = "jballerina.java"},
Expand Down
2 changes: 1 addition & 1 deletion ballerina/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This module provides an annotation-based [Azure Functions](https://azure.microso
### Azure Setup

* An Azure "Function App" needs to be created in a given resource group with the following requirements
- Runtime stack - "Java 11"
- Runtime stack - "Java 17"
- Hosting operating system - "Windows" (This is the default and Linux is not supported in Azure for custom handlers at the moment)

## Supported Triggers and bindings:
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 @@ -7,13 +7,13 @@ repository = "https://github.com/ballerina-platform/module-ballerinax-azure.func
license = ["Apache-2.0"]
keywords = ["azure", "functions", "serverless", "cloud"]

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

[[platform.java11.dependency]]
[[platform.java17.dependency]]
path = "../native/build/libs/azure.functions-native-@project.version@.jar"

[[platform.java11.dependency]]
[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "mime-native"
version = "@stdlib.mimenative.version@"
Expand Down
2 changes: 1 addition & 1 deletion build-config/resources/BallerinaTest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org = "ballerinax"
name = "azure.functions.tests"
version = "@toml.version@"

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

[build-options]
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
*/

plugins {
id "com.github.spotbugs" version "4.2.3"
id "com.github.johnrengelman.shadow" version "5.2.0"
id "de.undercouch.download" version "4.0.4"
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"
}

ext.ballerinaLangVersion = project.ballerinaLangVersion
ext.testngVersion = "6.14.3"
ext.testngVersion = "7.6.1"
ext.commomsIOVersion = "2.6"
ext.commonsLoggingVersion = "1.2"
ext.googleGsonVersion = "2.7"
ext.slf4jVersion = "1.7.26"
ext.stdlibMimeVersion = project.stdlibMimeVersion

ext.puppycrawlCheckstyleVersion = "8.18"
ext.puppycrawlCheckstyleVersion = "10.12.1"

ext.projectBuildSourceEncoding = "UTF-8"
ext.projectReportingOutputEncoding = "UTF-8"
Expand Down
10 changes: 7 additions & 3 deletions compiler-plugin-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ checkstyleMain {
enabled false
}

checkstyleTest {
enabled false
}

compileJava {
doFirst {
options.compilerArgs = [
Expand Down Expand Up @@ -72,9 +76,9 @@ jacocoTestReport {
def classFiles = new File("${rootDir}/compiler-plugin/build/classes/java/main/org/ballerinax/azurefunctions")
additionalClassDirs(classFiles)
reports {
xml.enabled = true
html.enabled = true
csv.enabled = true
xml.required = true
html.required = true
csv.required= true
xml.destination = new File("${buildDir}/reports/jacoco/report.xml")
html.destination = new File("${buildDir}/reports/jacoco/report.html")
csv.destination = new File("${buildDir}/reports/jacoco/report.csv")
Expand Down
4 changes: 4 additions & 0 deletions compiler-plugin/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,9 @@
<Match>
<Bug pattern="SF_SWITCH_NO_DEFAULT"/>
</Match>

<Match>
<Bug pattern="EI_EXPOSE_REP, EI_EXPOSE_REP2"/>
</Match>

</FindBugsFilter>
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ org.gradle.jvmargs='-Dfile.encoding=UTF-8'
group=org.ballerinax.azurefunctions
version=4.1.0-SNAPSHOT
systemProp.org.gradle.internal.publish.checksums.insecure=true
ballerinaLangVersion=2201.7.0
ballerinaLangVersion=2201.8.0-20230726-145300-b2bdf796
stdlibConstraintVersion=1.3.0
stdlibIoVersion=1.5.0
stdlibLogVersion=2.8.0
stdlibLogVersion=2.8.1-20230718-085900-36c385c
stdlibHttpVersion=2.9.0
stdlibAuthVersion=2.9.0
stdlibFileVersion=1.8.0
Expand All @@ -23,4 +23,4 @@ stdlibUuidVersion=1.6.0
stdlibUrlVersion=2.3.0
observeVersion=1.1.0
observeInternalVersion=1.1.0
ballerinaGradlePluginVersion=0.14.3
ballerinaGradlePluginVersion=2.0.1
Loading

0 comments on commit 2eab830

Please sign in to comment.