This is an automated email from the ASF dual-hosted git repository.

slawrence pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil-infrastructure.git


The following commit(s) were added to refs/heads/main by this push:
     new 73c6ae3  Use Java 17 for building Daffodil release candidates
73c6ae3 is described below

commit 73c6ae307547df2461d968713e148ad58e11f680
Author: Steve Lawrence <[email protected]>
AuthorDate: Fri Aug 29 13:21:12 2025 -0400

    Use Java 17 for building Daffodil release candidates
    
    The VS Code extension and SBT plugin still support Java 8, so we install
    both jdk8 and jdk17 and then add a new function to set all java
    binaries use the correct version.
    
    DAFFODIL-3017
---
 containers/build-release/Dockerfile                 |  1 +
 containers/build-release/src/daffodil-build-release | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/containers/build-release/Dockerfile 
b/containers/build-release/Dockerfile
index 07a1bfe..a904df2 100644
--- a/containers/build-release/Dockerfile
+++ b/containers/build-release/Dockerfile
@@ -40,6 +40,7 @@ RUN \
     llvm \
     npm \
     openjdk-8-jdk-headless \
+    openjdk-17-jdk-headless \
     rpm \
     unzip \
     wine32 \
diff --git a/containers/build-release/src/daffodil-build-release 
b/containers/build-release/src/daffodil-build-release
index 1b4c820..3dce8a3 100755
--- a/containers/build-release/src/daffodil-build-release
+++ b/containers/build-release/src/daffodil-build-release
@@ -17,6 +17,21 @@
 
 set -e
 
+set_java_version() {
+  # There are a number of standard ways to change the java version. One is to
+  # set JAVA_HOME and PATH, but its possible a build tool could execute
+  # /usr/bin/java* directly and use the wrong version. Another option is to use
+  # update-alternatives, but that needs slightly different commands for java 8
+  # vs java 17, so would make this function more complicated. Instead, we just
+  # manually overwrite the java* bin symlinks. This is really only fine because
+  # this is always expected to be run in a container.
+  JAVA_BIN_ROOT="/usr/lib/jvm/java-$1-openjdk-amd64/bin"
+  ln -sf $JAVA_BIN_ROOT/java    /usr/bin/java
+  ln -sf $JAVA_BIN_ROOT/javac   /usr/bin/javac
+  ln -sf $JAVA_BIN_ROOT/javadoc /usr/bin/javadoc
+  ln -sf $JAVA_BIN_ROOT/jar     /usr/bin/jar
+}
+
 export WIX=/opt/wix/
 export LANG=en_US.UTF-8
 export CC=clang
@@ -65,6 +80,7 @@ echo "==== Building binary artifacts ===="
 
 case $PROJECT in
   "daffodil")
+    set_java_version 17
     mkdir -p $DIST_DIR/bin
     sbt \
       +compile \
@@ -82,12 +98,14 @@ case $PROJECT in
     ;;
 
   "daffodil-sbt")
+    set_java_version 8
     sbt \
       "^compile" \
       "^publish"
     ;;
 
   "daffodil-vscode")
+    set_java_version 8
     mkdir -p $DIST_DIR/bin/
     yarn package
     cp *.vsix $DIST_DIR/bin/

Reply via email to