Skip to content

Commit

Permalink
Merge pull request #43087 from warunalakshitha/java21_initial_configs
Browse files Browse the repository at this point in the history
[Java 21] Support ballerina lang to build with Java 21
  • Loading branch information
HindujaB authored Sep 3, 2024
2 parents dab12c8 + 8f6d65d commit 9806c01
Show file tree
Hide file tree
Showing 236 changed files with 735 additions and 543 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/daily_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize sub-modules
run: git submodule update --init
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.7'
java-version: '21.0.3'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -69,11 +69,11 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize sub-modules
run: git submodule update --init
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/daily_spec_conformance_test_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
ref: spec-conformance-test-runner

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: "temurin"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly_publish_timestamped_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
with:
ref: ${{ matrix.branch }}

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize Sub Modules
run: git submodule update --init
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/observe_package_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
fetch-depth: 0
- name: Checkout Tag
run: git checkout ${{ github.event.inputs.repoTag }}
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Build with Gradle
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'
- name: Set version env variable
run: |
echo "VERSION=$(./gradlew properties | grep ^version: | cut -d\ -f2 | sed 's@-SNAPSHOT@@')" >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_timestamped_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Checkout To Lang Branch
run: |
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pull_request_full_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Checkout To Lang Branch
run: |
Expand Down Expand Up @@ -64,11 +64,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Setup NodeJs
uses: actions/setup-node@v4
Expand All @@ -94,7 +94,7 @@ jobs:
# - name: Checkout non-default branch
# run: |
# for module_name in $(jq -r '.standard_library| .[] | select(.level==${{ matrix.level }}) | .name' extensions.json); do \
# cd $module_name && git fetch origin && git checkout -t origin/java_17_migration && cd ..; \
# cd $module_name && git fetch origin && git checkout -t origin/java_21_migration && cd ..; \
# done

- name: Update Lang Version in Module
Expand Down Expand Up @@ -131,11 +131,11 @@ jobs:
with:
repository: 'ballerina-platform/ballerina-distribution'

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Download Ballerina Lang Artifacts
uses: actions/download-artifact@v4
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pull_request_ubuntu_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize sub-modules
run: git submodule update --init
Expand All @@ -49,7 +49,7 @@ jobs:
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.7'
java-version: '21.0.3'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -88,11 +88,11 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize sub-modules
run: git submodule update --init
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pull_request_windows_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: configure Pagefile
uses: al-cheb/[email protected]
Expand All @@ -55,7 +55,7 @@ jobs:
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.7'
java-version: '21.0.3'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/push_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize sub-modules
run: git submodule update --init
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.7'
java-version: '21.0.3'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -63,11 +63,11 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: configure Pagefile
uses: al-cheb/[email protected]
Expand All @@ -89,7 +89,7 @@ jobs:
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.7'
java-version: '21.0.3'
distribution: 'graalvm'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -113,11 +113,11 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize sub-modules
run: git submodule update --init
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17.0.7'
java-version: '21.0.3'

- name: Initialize sub-modules
run: git submodule update --init
Expand Down
6 changes: 5 additions & 1 deletion ballerina-shell/modules/shell-cli/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
</Match>
<Match>
<Class name="io.ballerina.shell.cli.handlers.help.BbeTopicsProvider"/>
<Bug pattern="MS_EXPOSE_REP"/>
<Bug pattern="MS_EXPOSE_REP,CT_CONSTRUCTOR_THROW"/>
</Match>
<Match>
<Class name="io.ballerina.shell.cli.PropertiesLoader"/>
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ private boolean containsModuleNotFoundError(PackageCompilation compilation) {
protected void executeProject(ClassLoadContext context, String templateName) throws InvokerException {
Project project = getProject(context, templateName);
PackageCompilation compilation = compile(project);
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(compilation, JvmTarget.JAVA_17);
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(compilation, JvmTarget.JAVA_21);
executeProject(jBallerinaBackend);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public void initialize() throws InvokerException {
anyTypeSymbol = runFunctionType.returnTypeDescriptor().orElseThrow();
}
}
JBallerinaBackend.from(compilation, JvmTarget.JAVA_17);
JBallerinaBackend.from(compilation, JvmTarget.JAVA_21);
this.initialized.set(true);
addDebugDiagnostic("Added initial identifiers: " + initialIdentifiers);
}
Expand Down
4 changes: 4 additions & 0 deletions bvm/ballerina-profiler/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@
<Class name="io.ballerina.runtime.profiler.ui.JsonParser$Data"/>
<Bug pattern="URF_UNREAD_FIELD"/>
</Match>
<Match>
<Class name="io.ballerina.runtime.profiler.runtime.Data"/>
<Bug pattern="PA_PUBLIC_PRIMITIVE_ATTRIBUTE"/>
</Match>
</FindBugsFilter>
4 changes: 4 additions & 0 deletions cli/ballerina-cli/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,8 @@
<Match>
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
<Class name="io.ballerina.cli.cmd.CommandUtil" />
<Bug pattern="UUF_UNUSED_FIELD" />
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ static boolean pullDependencyPackages(String orgName, String packageName, String
return true;
}
if (!hasProvidedPlatformDeps(balaProject.currentPackage())) {
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_17);
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_21);
Collection<Diagnostic> backendDiagnostics = jBallerinaBackend.diagnosticResult().diagnostics(false);
if (!backendDiagnostics.isEmpty()) {
printDiagnostics(backendDiagnostics);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private void deprecateInCentral(String packageInfo) {
settings.getCentral().getReadTimeout(), settings.getCentral().getWriteTimeout(),
settings.getCentral().getCallTimeout(), settings.getCentral().getMaxRetries());
client.deprecatePackage(packageValue, deprecationMsg,
JvmTarget.JAVA_17.code(),
JvmTarget.JAVA_21.code(),
RepoUtils.getBallerinaVersion(), this.undoFlag);
} catch (CentralClientException e) {
String errorMessage = e.getMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ private void pushBalaToRemote(Path balaPath, CentralAPIClient client) {
}

try {
client.pushPackage(balaPath, org, name, version, JvmTarget.JAVA_17.code(),
client.pushPackage(balaPath, org, name, version, JvmTarget.JAVA_21.code(),
RepoUtils.getBallerinaVersion());
} catch (CentralClientException e) {
String errorMessage = e.getMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public void execute(Project project) {
BuildTime.getInstance().packageCompilationDuration = System.currentTimeMillis() - start;
start = System.currentTimeMillis();
}
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_17);
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_21);
if (project.buildOptions().dumpBuildTime()) {
BuildTime.getInstance().codeGenDuration = System.currentTimeMillis() - start;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void execute(Project project) {

try {
PackageCompilation packageCompilation = project.currentPackage().getCompilation();
jBallerinaBackend = JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_17);
jBallerinaBackend = JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_21);
long start = 0;
if (project.buildOptions().dumpBuildTime()) {
start = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void execute(Project project) {
Path executablePath = getExecutablePath(project, target);
try {
PackageCompilation pkgCompilation = project.currentPackage().getCompilation();
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(pkgCompilation, JvmTarget.JAVA_17);
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(pkgCompilation, JvmTarget.JAVA_21);
long start = 0;
if (project.buildOptions().dumpBuildTime()) {
start = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void execute(Project project) {
Target target = getTarget(project);
try {
PackageCompilation pkgCompilation = project.currentPackage().getCompilation();
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(pkgCompilation, JvmTarget.JAVA_17);
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(pkgCompilation, JvmTarget.JAVA_21);
List<Diagnostic> emitDiagnostics = new ArrayList<>();
Path testCachePath = target.getTestsCachePath();
long start = 0;
Expand Down
Loading

0 comments on commit 9806c01

Please sign in to comment.