Skip to content

Commit

Permalink
Update AdService to Java version 21
Browse files Browse the repository at this point in the history
  • Loading branch information
Juliano Costa committed Oct 17, 2023
1 parent bd34424 commit e649bae
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/adservice/.java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.0
21.0
7 changes: 3 additions & 4 deletions src/adservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0


FROM eclipse-temurin:17-jdk AS builder
FROM eclipse-temurin:21-jdk as builder

WORKDIR /usr/src/app/

Expand All @@ -18,14 +18,13 @@ RUN ./gradlew installDist -PprotoSourceDir=./proto

# -----------------------------------------------------------------------------

FROM eclipse-temurin:17-jre
FROM eclipse-temurin:21-jre

ARG version=1.30.0
ARG version=1.31.0
WORKDIR /usr/src/app/

COPY --from=builder /usr/src/app/ ./
ADD https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$version/opentelemetry-javaagent.jar /usr/src/app/opentelemetry-javaagent.jar
RUN chmod 644 /usr/src/app/opentelemetry-javaagent.jar
ENV JAVA_TOOL_OPTIONS=-javaagent:/usr/src/app/opentelemetry-javaagent.jar

EXPOSE ${AD_SERVICE_PORT}
Expand Down
25 changes: 13 additions & 12 deletions src/adservice/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@ description = 'Ad Service'
group = "adservice"
version = "0.1.0-SNAPSHOT"

def opentelemetryVersion = "1.28.0"
def opentelemetryInstrumentationAlphaVersion = "1.28.0-alpha"
def grpcVersion = "1.56.1"
def jacksonVersion = "2.15.2"
def protocVersion = "3.20.0"

tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
def opentelemetryVersion = "1.31.0"
def opentelemetryInstrumentationAlphaVersion = "1.31.0-alpha"
def grpcVersion = "1.58.0"
def jacksonVersion = "2.15.3"
def protocVersion = "3.24.4"

tasks.withType(JavaCompile).configureEach {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

ext {
speed = project.hasProperty('speed') ? project.getProperty('speed') : false
offlineCompile = new File("$buildDir/output/lib")
Provider<Directory> output = layout.buildDirectory.dir("outputLocation")
offlineCompile = output.get().asFile
}

dependencies {
Expand All @@ -48,11 +49,11 @@ dependencies {
"io.opentelemetry:opentelemetry-api",
"io.opentelemetry:opentelemetry-sdk",
"io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations",
"org.apache.logging.log4j:log4j-core:2.20.0"
"org.apache.logging.log4j:log4j-core:2.21.0"

runtimeOnly "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}",
"com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}",
"io.netty:netty-tcnative-boringssl-static:2.0.61.Final"
"io.netty:netty-tcnative-boringssl-static:2.0.62.Final"
}
}

Expand Down
Binary file modified src/adservice/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 4 additions & 3 deletions src/adservice/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Wed Jul 19 11:27:42 EDT 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
24 changes: 16 additions & 8 deletions src/adservice/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${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" "-Xms64m"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +130,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
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
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
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done
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
Expand Down
1 change: 1 addition & 0 deletions src/adservice/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down

0 comments on commit e649bae

Please sign in to comment.