Skip to content

Commit

Permalink
Update gradle, java and graal
Browse files Browse the repository at this point in the history
  • Loading branch information
mduesterhoeft committed Jan 8, 2020
1 parent b43a543 commit cac44fa
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://<function-host>/dev/hello/sample
```
Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -34,5 +34,5 @@ dependencies {
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "11"
}
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,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
18 changes: 17 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"
Expand Down
18 changes: 17 additions & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
9 changes: 5 additions & 4 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ service: kotlin-graalvm-custom-runtime-talk

provider:
name: aws
runtime: java8
runtime: java11
region: eu-central-1

package:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/github/md/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<ApiGatewayRequest, ApiGatewayResponse>
val handlerInstance = Class.forName(handler).getDeclaredConstructor().newInstance() as RequestHandler<ApiGatewayRequest, ApiGatewayResponse>

while(true) {
val invocationResponse: Response =
Expand Down

0 comments on commit cac44fa

Please sign in to comment.