Skip to content

Commit

Permalink
feat(superchain): switch to JDK 20 (#4082)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rix0rrr authored May 12, 2023
1 parent fc7ab7c commit f0a1dfc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
19 changes: 11 additions & 8 deletions superchain/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ RUN apt-get update
&& rm -rf $(pip cache dir) \
&& rm -rf /var/lib/apt/lists/*

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

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

# Add the source used to build this Docker image (to facilitate re-builds, forensics)
COPY superchain /docker-source

# Create the attributions document
RUN RUST_DOCS="${RUSTUP_HOME}/toolchains/$(rustup show active-toolchain | cut -d' ' -f 1)/share/doc" \
&& RUSTUP_VERSION=$(rustup --version 2>/dev/null | cut -d' ' -f2) \
Expand Down Expand Up @@ -289,13 +286,13 @@ RUN RUST_DOCS="${RUSTUP_HOME}/toolchains/$(rustup show active-toolchain | cut -d
&& echo "------------------------------------ PATENTS ------------------------------------" >> /NOTICE \
&& cat ${GOROOT}/PATENTS >> /NOTICE \
&& echo "################################################################################" >> /NOTICE \
&& echo "java-1.8.0-amazon-corretto-jdk:" >> /NOTICE \
&& echo "java-20-amazon-corretto-jdk:" >> /NOTICE \
&& echo "" >> /NOTICE \
&& echo "------------------------------------ LICENSE ------------------------------------" >> /NOTICE \
&& cat /usr/lib/jvm/java-1.8.0-amazon-corretto/LICENSE >> /NOTICE \
&& cat /usr/lib/jvm/java-20-amazon-corretto/LICENSE >> /NOTICE \
&& echo "" >> /NOTICE \
&& echo "------------------------------------ THIRD-PARTY NOTICES ------------------------------------" >> /NOTICE \
&& cat /usr/lib/jvm/java-1.8.0-amazon-corretto/THIRD_PARTY_README >> /NOTICE \
&& cat /usr/lib/jvm/java-20-amazon-corretto/ADDITIONAL_LICENSE_INFO >> /NOTICE \
&& echo "################################################################################" >> /NOTICE \
&& echo "maven:" >> /NOTICE \
&& echo "" >> /NOTICE \
Expand Down Expand Up @@ -346,6 +343,10 @@ RUN RUST_DOCS="${RUSTUP_HOME}/toolchains/$(rustup show active-toolchain | cut -d
;fi \
;done

# Add the source used to build this Docker image (to facilitate re-builds, forensics)
# Keep this at the end for max caching.
COPY superchain /docker-source

CMD ["/bin/bash"]

########################################################################################################################
Expand All @@ -357,6 +358,8 @@ ENV LANG="C.UTF-8"
LC_ALL="C.UTF-8" \
CHARSET="UTF-8" \
\
JAVA_HOME="/usr/lib/jvm/java-20-amazon-corretto" \
\
DOTNET_CLI_TELEMETRY_OPTOUT="true" \
DOTNET_RUNNING_IN_CONTAINER="true" \
DOTNET_NOLOGO="true" \
Expand Down
19 changes: 17 additions & 2 deletions superchain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ required in order to package [jsii] projects in all supported languages.

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

## Building

This docker image must be built from the package root with the Dockerfile set to
`superchain/Dockerfile`:

```
jsii$ docker build . -f superchain/Dockerfile -t jsii/superchain:local
```

In case the tests fail, skip the tests and inspect the image manually:

```
jsii$ docker build . -f superchain/Dockerfile -t jsii/superchain:local --target=superchain
```

## NodeJS and NPM

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

```
docker build [...] --build-arg NODE_MAJOR_VERSION=14 .
jsii$ docker build [...] --build-arg NODE_MAJOR_VERSION=16
```

## Included Tools & Utilities
Expand Down

0 comments on commit f0a1dfc

Please sign in to comment.