|
I've been using github actions and jpackage to make releases of my apps.
Recently noticed that jpackage doesn't know how to tell users they have an old version of java. I was told the solution is to use jlink. jlink won't run wtihout knowing which dependencies to add. That leads to jdep. - name: Build installation package shell: bash run: | set -x set -o pipefail APP_VERSION=$(ls -1 target/package/RobotOverlord-*-with-dependencies.jar | sed "s/.*RobotOverlord-\([^-]*\)-with-dependencies.jar/\1/") sed -i.bak "s/\(--app-version\).*/\1 $APP_VERSION/" src/main/package/jpackage.cfg APP_NAME="Makelangelo-${{ matrix.os_label }}" # copy runtime dependencies into `target/dependency` mvn dependency:copy-dependencies -DincludeScope=runtime -DoutputDirectory=target/dependency # compute module list from the fat jar, ignore missing deps to avoid failure on unknown automatic modules JAR="target/package/RobotOverlord-$APP_VERSION-with-dependencies.jar" MODULES=$(jdeps --multi-release ${{ env.JAVA_VERSION }} --module-path target/dependency --print-module-deps --ignore-missing-deps "$JAR") echo "jdeps modules: $MODULES" # add any known extras (e.g. jdk.zipfs) and run jlink EXTRAS="jdk.zipfs" jlink --add-modules "${MODULES},${EXTRAS}" --output img jpackage "@src/main/package/jpackage.cfg" "@src/main/package/jpackage-${{matrix.runs_on}}.cfg" \ --main-jar "RobotOverlord-$APP_VERSION-with-dependencies.jar" \ --runtime-image img \ --name "$APP_NAME" BINARY=$(find . -maxdepth 1 -iname 'robotoverlord*' | grep -E '(msi$|dmg$|deb$)' | sed "s,./,," | head -1) BINARY_NIGHTLY=$(echo $BINARY | sed 's/\(.*\)\.\(.*\)/\1-nightly-$$.\2/') EXT="${BINARY##*.}" DATE=$(date +%Y%m%d) BINARY_NIGHTLY="$APP_NAME-$DATE.$EXT" mv "$BINARY" "$BINARY_NIGHTLY" echo "BINARY_NIGHTLY=$BINARY_NIGHTLY" >> $GITHUB_ENV The expanded jdep line would read jdeps --multi-release 22 --module-path dependency --print-module-deps --ignore-missing-deps .\RobotOverlord-3.122.0.jar while produces the error Error: Two versions of module gluegen.rt found in dependency (gluegen-rt-2.6.0-natives-android-x86_64.jar and gluegen-rt-2.6.0-natives-android-aarch64.jar) I'm not good at this package overhead stuff. If this is the wrong forum, I apologize. I figured you've run across this long ago and know what to do. Please advise. Thank you! |
| Free forum by Nabble | Edit this page |
