Created
February 27, 2020 16:03
-
-
Save mikehearn/b18842d45181ac150ec9e6d0b2bb1e24 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# To use, unpack a regular JDK somewhere and set JDK_HOME to point to it. The default here expects a JDK 15 early access | |
# in the same directory but you can set JDK_HOME to anything. | |
# | |
JDK_HOME=${JDK_HOME:-$PWD/jdk-15.jdk/Contents/Home} | |
# | |
# Set OUT_DIR to where you want the combined JavaFX/JDK to be: | |
# | |
OUT_DIR=$PWD/fxdk.jdk | |
# | |
# Then make sure JavaFX JMODs are unpacked to this path, or edit it | |
# You can get them from here: | |
# | |
# https://gluonhq.com/products/javafx/ | |
# | |
# Or you can compile JavaFX for yourself. Why not, as you're building a custom JDK spin anyway. | |
# | |
JFX_JMODS=jfx/build/jmods | |
echo "Generating to $OUT_DIR" | |
if [ -d $OUT_DIR ]; then | |
rm -rf $OUT_DIR | |
fi | |
# The FXDK is a superset of the JDK, so we want all the modules. | |
# Use --list-modules to print every module in the source JDK, but they come with @something tacked | |
# on the end, so use awk to strip that off and then paste to join them to a comma separated list. | |
ALL_MODULES=$( $JDK_HOME/bin/java --list-modules | awk -F@ '{print $1}' | paste -s -d , - ) | |
# And now build the new JDK with all modules + the listed javafx modules | |
$JDK_HOME/bin/jlink --module-path $JFX_JMODS \ | |
--add-modules javafx.fxml,javafx.web,javafx.media,javafx.swing,$ALL_MODULES \ | |
--bind-services \ | |
--compress=1 \ | |
--order-resources=/module-info.class,@classlist,/java.base/java/lang/ \ | |
--output $OUT_DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment