Skip to content

Commit f0a1dfc

Browse files
authored
feat(superchain): switch to JDK 20 (#4082)
Switch to a more recent version of the JDK. `jsii-pacmak` will keep on targeting Java 1.8, so this doesn't affect compatibility of the generated class files. What this will gain us is access to a more recent, optimized `javadoc` tool, which completes a lot faster than the one from JDK 8. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
1 parent fc7ab7c commit f0a1dfc

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

superchain/Dockerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,13 @@ RUN apt-get update
157157
&& rm -rf $(pip cache dir) \
158158
&& rm -rf /var/lib/apt/lists/*
159159

160-
# Install JDK8 (Amazon Corretto 8)
160+
# Install JDK20 (Amazon Corretto 20)
161161
COPY superchain/gpg/corretto.asc /tmp/corretto.asc
162162
RUN apt-key add /tmp/corretto.asc && rm /tmp/corretto.asc \
163163
&& echo "deb https://apt.corretto.aws stable main" > /etc/apt/sources.list.d/amazon-corretto.list \
164164
&& apt-get update \
165165
&& mkdir -p /usr/share/man/man1 \
166-
&& apt-get -y install java-1.8.0-amazon-corretto-jdk \
166+
&& apt-get -y install java-20-amazon-corretto-jdk \
167167
&& rm -rf /usr/share/man/man1 \
168168
&& rm -rf /var/lib/apt/lists/*
169169

@@ -244,9 +244,6 @@ COPY --chown=superchain:superchain superchain/m2-settings.xml /home/superchain/.
244244
COPY --chown=superchain:superchain superchain/ssh_config /home/superchain/.ssh/config
245245
RUN chmod 600 /home/superchain/.ssh/config
246246

247-
# Add the source used to build this Docker image (to facilitate re-builds, forensics)
248-
COPY superchain /docker-source
249-
250247
# Create the attributions document
251248
RUN RUST_DOCS="${RUSTUP_HOME}/toolchains/$(rustup show active-toolchain | cut -d' ' -f 1)/share/doc" \
252249
&& RUSTUP_VERSION=$(rustup --version 2>/dev/null | cut -d' ' -f2) \
@@ -289,13 +286,13 @@ RUN RUST_DOCS="${RUSTUP_HOME}/toolchains/$(rustup show active-toolchain | cut -d
289286
&& echo "------------------------------------ PATENTS ------------------------------------" >> /NOTICE \
290287
&& cat ${GOROOT}/PATENTS >> /NOTICE \
291288
&& echo "################################################################################" >> /NOTICE \
292-
&& echo "java-1.8.0-amazon-corretto-jdk:" >> /NOTICE \
289+
&& echo "java-20-amazon-corretto-jdk:" >> /NOTICE \
293290
&& echo "" >> /NOTICE \
294291
&& echo "------------------------------------ LICENSE ------------------------------------" >> /NOTICE \
295-
&& cat /usr/lib/jvm/java-1.8.0-amazon-corretto/LICENSE >> /NOTICE \
292+
&& cat /usr/lib/jvm/java-20-amazon-corretto/LICENSE >> /NOTICE \
296293
&& echo "" >> /NOTICE \
297294
&& echo "------------------------------------ THIRD-PARTY NOTICES ------------------------------------" >> /NOTICE \
298-
&& cat /usr/lib/jvm/java-1.8.0-amazon-corretto/THIRD_PARTY_README >> /NOTICE \
295+
&& cat /usr/lib/jvm/java-20-amazon-corretto/ADDITIONAL_LICENSE_INFO >> /NOTICE \
299296
&& echo "################################################################################" >> /NOTICE \
300297
&& echo "maven:" >> /NOTICE \
301298
&& echo "" >> /NOTICE \
@@ -346,6 +343,10 @@ RUN RUST_DOCS="${RUSTUP_HOME}/toolchains/$(rustup show active-toolchain | cut -d
346343
;fi \
347344
;done
348345

346+
# Add the source used to build this Docker image (to facilitate re-builds, forensics)
347+
# Keep this at the end for max caching.
348+
COPY superchain /docker-source
349+
349350
CMD ["/bin/bash"]
350351

351352
########################################################################################################################
@@ -357,6 +358,8 @@ ENV LANG="C.UTF-8"
357358
LC_ALL="C.UTF-8" \
358359
CHARSET="UTF-8" \
359360
\
361+
JAVA_HOME="/usr/lib/jvm/java-20-amazon-corretto" \
362+
\
360363
DOTNET_CLI_TELEMETRY_OPTOUT="true" \
361364
DOTNET_RUNNING_IN_CONTAINER="true" \
362365
DOTNET_NOLOGO="true" \

superchain/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ required in order to package [jsii] projects in all supported languages.
1010

1111
SDK | Version
1212
----------------|-------------------------------------------
13-
`OpenJDK 8` | Amazon Corretto `>= 8.242.08.1`
13+
`OpenJDK 20` | Amazon Corretto `>= 20.0.0`
1414
`.NET SDK` | `>= 6.0.14`
1515
`mono` | `>= 6.8.0.105`
1616
`Javascript` | see [NodeJS and NPM](#nodejs-and-npm)
@@ -48,6 +48,21 @@ The previous image tags have been discontinued:
4848
- `:node14` (users shoudl migrate to `:1-buster-slim-node14`)
4949
- `:node14-nightly` (users shoudl migrate to `:1-buster-slim-node14-nightly`)
5050

51+
## Building
52+
53+
This docker image must be built from the package root with the Dockerfile set to
54+
`superchain/Dockerfile`:
55+
56+
```
57+
jsii$ docker build . -f superchain/Dockerfile -t jsii/superchain:local
58+
```
59+
60+
In case the tests fail, skip the tests and inspect the image manually:
61+
62+
```
63+
jsii$ docker build . -f superchain/Dockerfile -t jsii/superchain:local --target=superchain
64+
```
65+
5166
## NodeJS and NPM
5267

5368
We build multiple versions of this image, for different versions of Node. They are available as:
@@ -60,7 +75,7 @@ If you are building this image from source, you can control the Node version wit
6075
`NODE_MAJOR_VERSION` build argument:
6176

6277
```
63-
docker build [...] --build-arg NODE_MAJOR_VERSION=14 .
78+
jsii$ docker build [...] --build-arg NODE_MAJOR_VERSION=16
6479
```
6580

6681
## Included Tools & Utilities

0 commit comments

Comments
 (0)