Skip to content

Commit

Permalink
Merge pull request #730 from anuruddhal/master
Browse files Browse the repository at this point in the history
Update AWS Lambda to JDK 21
  • Loading branch information
anuruddhal authored Nov 22, 2024
2 parents b318578 + ee92d03 commit f4f87b5
Show file tree
Hide file tree
Showing 18 changed files with 80 additions and 66 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21
- 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/daily-build.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@v3
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21

- 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,11 +10,11 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-layer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
upload:
runs-on: ubuntu-latest
env:
LAYER_NAME: "ballerina-jre17"
LAYER_NAME: "ballerina-jre21"
TEMP_BUCKET_NAME: "layer-bucket-temp1"
strategy:
max-parallel: 1
Expand Down
2 changes: 1 addition & 1 deletion ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ repository = "https://github.com/ballerina-platform/module-ballerinax-aws.lambda
license = ["Apache-2.0"]
keywords = ["aws", "lambda", "serverless", "cloud"]

[platform.java17]
[platform.java21]
graalvmCompatible = true
2 changes: 1 addition & 1 deletion build-config/resources/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ repository = "https://github.com/ballerina-platform/module-ballerinax-aws.lambda
license = ["Apache-2.0"]
keywords = ["aws", "lambda", "serverless", "cloud"]

[platform.java17]
[platform.java21]
graalvmCompatible = true
2 changes: 1 addition & 1 deletion build-config/resources/BallerinaTest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ org = "ballerinax"
name = "aws.lambda.tests"
version = "@toml.version@"

[platform.java17]
[platform.java21]
graalvmCompatible = true
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
*/

plugins {
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-base" version "${spotbugsPluginVersion}"
id "com.github.johnrengelman.shadow" version "${shadowJarPluginVersion}"
id "de.undercouch.download" version "${downloadPluginVersion}"
id "net.researchgate.release" version "${releasePluginVersion}"
}

ext.googleGsonVersion = "2.7"
Expand Down Expand Up @@ -104,6 +104,7 @@ subprojects {
ballerinaStdLibs "io.ballerina.stdlib:http-ballerina:${stdlibHttpVersion}"
ballerinaStdLibs "io.ballerina.stdlib:observe-ballerina:${observeVersion}"
ballerinaStdLibs "io.ballerina:observe-ballerina:${observeInternalVersion}"
ballerinaStdLibs "io.ballerina.lib:data.jsondata-ballerina:${stdlibDataJsonDataVersion}"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class Constants {

public static final String BALLERINA_ORG = "ballerina";
public static final String NATIVE_BUILDER_IMAGE_NAME = "lambda_native_builder";
public static final String BUILDER_TAG = "java17";
public static final String BUILDER_TAG = "java21";
public static final String NATIVE_BUILDER_IMAGE = BALLERINA_ORG + "/" + NATIVE_BUILDER_IMAGE_NAME +
":" + BUILDER_TAG;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class LambdaFunctionHolder {
private static LambdaFunctionHolder instance;
private final List<FunctionDeploymentContext> generatedFunctions;

public LambdaFunctionHolder() {
private LambdaFunctionHolder() {
this.generatedFunctions = new ArrayList<>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void perform(CompilerLifecycleEventContext lifecycleEventContext) {
String version = getResourceFileAsString("layer-version.txt");
String fileName = executablePath.getFileName().toString();
String balxName = fileName.substring(0, fileName.lastIndexOf('.'));
String layer = " --layers arn:aws:lambda:$REGION_ID:134633749276:layer:ballerina-jre17:" + version;
String layer = " --layers arn:aws:lambda:$REGION_ID:134633749276:layer:ballerina-jre21:" + version;
if (isNative) {
layer = "";
}
Expand Down
47 changes: 28 additions & 19 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,32 @@ org.gradle.jvmargs='-Dfile.encoding=UTF-8'
group=org.ballerinax.awslambda
version=3.2.1-SNAPSHOT
systemProp.org.gradle.internal.publish.checksums.insecure=true
ballerinaLangVersion=2201.8.0
stdlibConstraintVersion=1.4.0
stdlibIoVersion=1.6.0
stdlibLogVersion=2.9.0
stdlibHttpVersion=2.10.0
stdlibAuthVersion=2.10.0
stdlibFileVersion=1.9.0
stdlibCacheVersion=3.7.0
stdlibCryptoVersion=2.5.0
stdlibTimeVersion=2.4.0
stdlibMimeVersion=2.9.0
stdlibOsVersion=1.8.0
stdlibTaskVersion=2.5.0
stdlibJwtVersion=2.10.0
stdlibOAuth2Version=2.10.0
stdlibUuidVersion=1.7.0
stdlibUrlVersion=2.4.0
observeVersion=1.2.0
observeInternalVersion=1.2.0
spotbugsPluginVersion=6.0.18
shadowJarPluginVersion=8.1.1
downloadPluginVersion=5.4.0
releasePluginVersion=2.8.0
ballerinaLangVersion=2201.11.0-20241117-133400-a3054b77
stdlibConstraintVersion=1.6.0-20241113-090900-d276ad5
stdlibIoVersion=1.6.2-20241112-233100-995cf5f
stdlibLogVersion=2.10.1-20241113-120000-4577868
stdlibHttpVersion=2.13.0-20241114-182900-7e9f66a
stdlibAuthVersion=2.12.1-20241113-162300-ded40eb
stdlibFileVersion=1.10.1-20241113-151700-e1a2e38
stdlibCacheVersion=3.8.1-20241113-125700-b75a1bf
stdlibCryptoVersion=2.7.3-20241113-081400-d015a39
stdlibTimeVersion=2.6.0-20241113-073800-201b904
stdlibMimeVersion=2.10.2-20241113-154200-d953747
stdlibOsVersion=1.8.1-20241113-122000-cca973b
stdlibTaskVersion=2.5.1-20241113-123500-f905281
stdlibJwtVersion=2.13.1-20241113-162400-b59ccfa
stdlibGrpcVersion=1.13.0-20241114-195700-5188f60
stdlibOAuth2Version=2.12.1-20241113-162400-4c6ddfe
stdlibDataJsonDataVersion=0.3.0-20241114-143900-285d739
stdlibUuidVersion=1.8.1-20241113-154400-443c67b
stdlibGraphqlVersion=1.15.0-20241117-164000-4d95b39
stdlibUrlVersion=2.4.1-20241113-073900-335ff51
stdlibWebsubVersion=2.13.0-20241114-233100-73205d6
stdlibWebsubhubVersion=1.13.0-20241116-124900-2bb76a4
observeVersion=1.4.0-20241113-092000-b83ae74
observeInternalVersion=1.3.1-20241113-101700-265054d
ballerinaGradlePluginVersion=2.0.1
9 changes: 6 additions & 3 deletions gradle/javaProject.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

sourceCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21

jacoco {
toolVersion = "0.8.10"
Expand All @@ -63,8 +63,11 @@ test {

spotbugsMain {
ignoreFailures = true
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")
def excludeFile = file("spotbugs-exclude.xml")
if (excludeFile.exists()) {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
17 changes: 9 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -144,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -201,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down

0 comments on commit f4f87b5

Please sign in to comment.