diff --git a/README.md b/README.md index 3b22f72..f37698d 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ To build and deploy the function run the following: serverless deploy ``` -Invoke the function running the `java8` runtime +Invoke the function running the `java11` runtime ``` http https:///dev/hello/sample ``` diff --git a/build.gradle.kts b/build.gradle.kts index 7ad26a7..9a3caef 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,8 +2,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { - kotlin("jvm") version "1.3.21" - id("com.github.johnrengelman.shadow") version "4.0.3" + kotlin("jvm") version "1.3.61" + id("com.github.johnrengelman.shadow") version "5.1.0" } group = "com.github.com.github.md" @@ -34,5 +34,5 @@ dependencies { } tasks.withType { - kotlinOptions.jvmTarget = "1.8" + kotlinOptions.jvmTarget = "11" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 87b738c..5c2d1cf 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 44e7c4d..9492014 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index af6708f..b0d6d0a 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # 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"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/gradlew.bat b/gradlew.bat index 0f8d593..15e1ee3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/package.sh b/package.sh index 33e95aa..a724044 100755 --- a/package.sh +++ b/package.sh @@ -4,13 +4,14 @@ rm -rf build/package mkdir build/package -docker run --rm --name graal -v $(pwd):/working oracle/graalvm-ce:1.0.0-rc16 \ - /bin/bash -c "native-image --enable-url-protocols=http \ +docker run --rm --name graal -v $(pwd):/working oracle/graalvm-ce:19.3.0.2-java11 \ + /bin/bash -c "gu install native-image; \ + native-image --enable-url-protocols=http \ -Djava.net.preferIPv4Stack=true \ -H:ReflectionConfigurationFiles=/working/reflect.json \ - -H:+ReportUnsupportedElementsAtRuntime --no-server -jar /working/build/libs/package-1.0.jar \ + -H:+ReportUnsupportedElementsAtRuntime --no-server -jar /working/build/libs/package-1.0-all.jar \ ; \ - cp package-1.0 /working/build/package/server" + cp package-1.0-all /working/build/package/server" cp runtime/bootstrap build/package diff --git a/serverless.yml b/serverless.yml index 0d41068..534281a 100644 --- a/serverless.yml +++ b/serverless.yml @@ -3,7 +3,7 @@ service: kotlin-graalvm-custom-runtime-talk provider: name: aws - runtime: java8 + runtime: java11 region: eu-central-1 package: @@ -17,7 +17,7 @@ functions: path: hello/{name} method: get package: - artifact: build/libs/package-1.0.jar + artifact: build/libs/package-1.0-all.jar hello-runtime: handler: com.github.md.Handler runtime: provided diff --git a/src/main/kotlin/com/github/md/Application.kt b/src/main/kotlin/com/github/md/Application.kt index 3735df9..37223be 100644 --- a/src/main/kotlin/com/github/md/Application.kt +++ b/src/main/kotlin/com/github/md/Application.kt @@ -27,7 +27,7 @@ val json = jacksonObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_ fun main() { val runtimeApiEndpoint = System.getenv(runtimeApiEndpointVariableName) val handler = System.getenv(handlerVariableName) - val handlerInstance = Class.forName(handler).newInstance() as RequestHandler + val handlerInstance = Class.forName(handler).getDeclaredConstructor().newInstance() as RequestHandler while(true) { val invocationResponse: Response =