diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index cfe984f03..f854fa3be 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -7,7 +7,7 @@ jobs: runs-on: [ubuntu-latest] strategy: matrix: - java: [11, 21] + java: [25] steps: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 @@ -24,7 +24,7 @@ jobs: runs-on: [macos-latest] strategy: matrix: - java: [11, 21] + java: [25] steps: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 @@ -42,7 +42,7 @@ jobs: runs-on: [windows-latest] strategy: matrix: - java: [11, 21] + java: [25] steps: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 diff --git a/.gitignore b/.gitignore index d729876c7..109ce2f76 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,17 @@ /out/ /js/node_modules -/lib/javafx* +/lib/* +/deps/* +!/deps/manual/ /.idea/workspace.xml /.idea/misc.xml /.idea/uiDesigner.xml /.idea/compiler.xml +/reports/ /fx.zip /README.md /provision.json .DS_Store windows-debug-launcher.nsi.in -/ant/private/qz.ks \ No newline at end of file +/ant/private/qz.ks +/ant/deps/ivy \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 60e310cfc..1e3e0503a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,5 +8,5 @@ - + \ No newline at end of file diff --git a/.idea/runConfigurations/App.xml b/.idea/runConfigurations/App.xml index 1f8e8173a..8c751d2be 100644 --- a/.idea/runConfigurations/App.xml +++ b/.idea/runConfigurations/App.xml @@ -3,7 +3,7 @@ \ No newline at end of file diff --git a/ant/apple/apple.properties b/ant/apple/apple.properties index 63ee4a267..ce2c8f54a 100644 --- a/ant/apple/apple.properties +++ b/ant/apple/apple.properties @@ -1,6 +1,4 @@ # Apple build properties apple.packager.signid=P5DMU6659X -# jdk9+ flags -# - Tray icon requires workaround https://github.com/dyorgio/macos-tray-icon-fixer/issues/9 -# - Dark theme requires workaround https://github.com/bobbylight/Darcula/issues/8 -apple.launch.jigsaw=--add-opens java.desktop/sun.lwawt.macosx=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-exports java.desktop/com.apple.laf=ALL-UNNAMED \ No newline at end of file +# Apple launcher options +apple.launch.opts= \ No newline at end of file diff --git a/ant/apple/installer.xml b/ant/apple/installer.xml index 1d74f977b..14b5acc6d 100644 --- a/ant/apple/installer.xml +++ b/ant/apple/installer.xml @@ -324,6 +324,8 @@ + + diff --git a/ant/deps/ivy-ant.xml b/ant/deps/ivy-ant.xml new file mode 100644 index 000000000..38dbe6844 --- /dev/null +++ b/ant/deps/ivy-ant.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ant/deps/manual/ivy-2.5.3.jar b/ant/deps/manual/ivy-2.5.3.jar new file mode 100644 index 000000000..88d88d492 Binary files /dev/null and b/ant/deps/manual/ivy-2.5.3.jar differ diff --git a/ant/ivy-deps.properties b/ant/ivy-deps.properties new file mode 100644 index 000000000..23fa65d96 --- /dev/null +++ b/ant/ivy-deps.properties @@ -0,0 +1,35 @@ +# Dependency versions +#darcula.version=0.0.0 +bouncycastle.version=1.82 +flatlaf.version=3.6.2 +#hid4java.version=0.8.0 +icu4j.version=77.1 +jaiimageio.version=1.4.0 +javafx.version=26-ea+12 +#javasemver.version=0.9.0 +#jettison.version=1.5.4 +jbig2.version=3.0.4 +jetty.version=10.0.26 +jna.version=5.18.1 +jssc.version=2.10.2 +libusb4java.version=1.2.0 +log4j.version=2.25.2 +#mslinks.version=1.1.0 +pdfbox.version=2.0.35 +purejavahidapi.version=0.0.10 +servlet-api.version=4.0.6 +twelvemonkeys.version=3.12.0 +usb-api.version=1.0.2 +usb4java.version=1.2.0 +websocket-api.version=1.1 + +commons-codec.version=1.19.0 +commons-io.version=2.20.0 +commons-pool2.version=2.12.1 +commons-ssl.version=0.3.20 + +# Dependency versions for ant only +jsign.version=7.3 + +# General configuration +ivy.report.todir=${basedir}/reports \ No newline at end of file diff --git a/ant/ivy-settings.xml b/ant/ivy-settings.xml new file mode 100644 index 000000000..a66f8a67b --- /dev/null +++ b/ant/ivy-settings.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ant/ivy.xml b/ant/ivy.xml new file mode 100644 index 000000000..964633e1b --- /dev/null +++ b/ant/ivy.xml @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ant/javafx.xml b/ant/javafx.xml deleted file mode 100644 index bab48ccc0..000000000 --- a/ant/javafx.xml +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${host.fx.message} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${target.fx.message} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JavaFX host platform: - Version: ${host.fx.ver} (${host.os}, ${host.arch}) - Major Version: ${host.fx.majver} - URLs: "${host.fx.urlver}" - - JavaFX target platform: - Version: ${target.fx.ver} (${target.os}, ${target.arch}) - Major Version: ${target.fx.majver} - URLs: ""${target.fx.urlver}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Downloading JavaFX from ${fx.url} - Temporarily saving JavaFX to ${fx.zip} - - - - - - - diff --git a/ant/lib/jsign-7.1.jar b/ant/lib/jsign-7.1.jar deleted file mode 100644 index 38924c687..000000000 Binary files a/ant/lib/jsign-7.1.jar and /dev/null differ diff --git a/ant/lib/slim-icu.py b/ant/lib/slim-icu.py deleted file mode 100644 index 1bd9e357f..000000000 --- a/ant/lib/slim-icu.py +++ /dev/null @@ -1,109 +0,0 @@ -# 2018 Yohanes Nugroho (@yohanes) -# -# 1. Download icu4j source code, build using ant. -# It will generate icu4j.jar and icu4j-charset.jar -# -# 2. Run slim-icu.py to generate slim version. -# -# To invoke from ant, add python to $PATH -# and add the following to build.xml: -# -# -# -# -# -# -# -# ... then call: ant distill-icu -# -# 3. Overwrite files in lib/charsets/ - -# slim ICU -import sys -import os -from pathlib import Path -import zipfile -from zipfile import ZipFile - -directory = str(Path(__file__).resolve().parent) -if len(sys.argv) > 1: - directory = sys.argv[1] - -mode = zipfile.ZIP_DEFLATED - - -def keep_file(filename): - # skip all break iterators - if filename.endswith(".brk") \ - or filename.endswith(".dict") \ - or filename.endswith("unames.icu") \ - or filename.endswith("ucadata.icu") \ - or filename.endswith(".spp"): - return False - - # keep english and arabic - if filename.startswith("en") \ - or filename.startswith("ar") \ - or not filename.endswith(".res"): - return True - - return False - - -zin = ZipFile(os.path.join(directory, 'icu4j.jar'), 'r') -zout = ZipFile(os.path.join(directory, 'icu4j-slim.jar'), 'w', mode) - -for item in zin.infolist(): - buff = zin.read(item.filename) - print(item.filename) - - if keep_file(item.filename): - print("Keep") - zout.writestr(item, buff) - else: - print("Remove") - -zout.close() -zin.close() - - -def keep_charset_file(filename): - to_remove = [ - "cns-11643-1992.cnv", - "ebcdic-xml-us.cnv", - "euc-jp-2007.cnv", - "euc-tw-2014.cnv", - "gb18030.cnv", - "ibm-1363_P11B-1998.cnv", - "ibm-1364_P110-2007.cnv", - "ibm-1371_P100-1999.cnv", - "ibm-1373_P100-2002.cnv", - "ibm-1375_P100-2008.cnv", - "ibm-1383_P110-1999.cnv", - "ibm-1386_P100-2001.cnv", - "ibm-1388_P103-2001.cnv", - "ibm-1390_P110-2003.cnv" - ] - - for i in to_remove: - if i in filename: - return False - - return True - - -zin = ZipFile(os.path.join(directory, 'icu4j-charset.jar'), 'r') -zout = ZipFile(os.path.join(directory, 'icu4j-charset-slim.jar'), 'w', mode) - -for item in zin.infolist(): - buff = zin.read(item.filename) - print(item.filename, end=' ') - - if keep_charset_file(item.filename): - print("Keep") - zout.writestr(item, buff) - else: - print("Remove") - -zout.close() -zin.close() diff --git a/ant/linux/installer.xml b/ant/linux/installer.xml index 08477c153..e037b3235 100644 --- a/ant/linux/installer.xml +++ b/ant/linux/installer.xml @@ -63,6 +63,8 @@ + + diff --git a/ant/linux/linux.properties b/ant/linux/linux.properties index 5f060324f..2353ed1b3 100644 --- a/ant/linux/linux.properties +++ b/ant/linux/linux.properties @@ -1,2 +1,3 @@ -# Expose UNIXToolkit.getGtkVersion -linux.launch.jigsaw=--add-opens java.desktop/sun.awt=ALL-UNNAMED \ No newline at end of file +# Linux launcher options +# 1. Expose UNIXToolkit.getGtkVersion +linux.launch.opts=--add-opens java.desktop/sun.awt=ALL-UNNAMED \ No newline at end of file diff --git a/ant/platform-detect.xml b/ant/platform-detect.xml index 16feb06b3..65549d203 100644 --- a/ant/platform-detect.xml +++ b/ant/platform-detect.xml @@ -1,17 +1,18 @@ + - + @@ -19,6 +20,7 @@ + @@ -27,6 +29,7 @@ + @@ -52,6 +55,7 @@ ${prefix}.os: "${prefix.os}" ${prefix}.arch: "${prefix.arch}" ${prefix}.libext: "${prefix.libext}" + ${prefix}.javafx.platform: "${prefix.javafx}" ${os.echo}: true ${arch.echo}: true @@ -251,4 +255,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ant/project.properties b/ant/project.properties index e0178c445..fe7c53c40 100644 --- a/ant/project.properties +++ b/ant/project.properties @@ -10,9 +10,6 @@ project.datadir=qz install.opts=-Djna.nosys=true launch.opts=-Xms512m ${install.opts} install.log=/tmp/${project.datadir}-install.log -# jdk9+ flags -# - Dark theme requires workaround https://github.com/bobbylight/Darcula/issues/8 -launch.jigsaw=--add-exports java.desktop/sun.swing=ALL-UNNAMED launch.overrides=QZ_OPTS src.dir=${basedir}/src @@ -20,6 +17,8 @@ out.dir=${basedir}/out build.dir=${out.dir}/build dist.dir=${out.dir}/dist +lib.dir=${basedir}/deps +ivy.lib.dir=${lib.dir}/ivy sign.lib.dir=${out.dir}/jar-signed jar.compress=true @@ -36,7 +35,7 @@ java.download=https://bell-sw.com/pages/downloads/#/java-11-lts # Java vendor to bundle into software (e.g. "*BellSoft|Adoptium|Microsoft|Amazon|IBM") jlink.java.vendor="BellSoft" # Java vendor to bundle into software (e.g. "11.0.17+7") -jlink.java.version="11.0.27+9" +jlink.java.version="25+37" # Java garbage collector flavor to use (e.g. "hotspot|openj9") jlink.java.gc="hotspot" # Java garbage collector version to use (e.g. openj9: "0.35.0", zulu: "11.62.17") @@ -47,10 +46,6 @@ jlink.java.gc.version="gc-ver-is-empty" # Skip bundling the java runtime # jre.skip=true -# JavaFX version -javafx.version=19_monocle -javafx.mirror=https://download2.gluonhq.com/openjfx - # Provisioning # provision.file=${basedir}/provision.json provision.dir=${dist.dir}/provision diff --git a/ant/signing.xml b/ant/signing.xml index 1b0b9b119..e9337c2b3 100644 --- a/ant/signing.xml +++ b/ant/signing.xml @@ -1,5 +1,6 @@ + @@ -10,7 +11,7 @@ - + diff --git a/ant/unix/unix-launcher.sh.in b/ant/unix/unix-launcher.sh.in index b56ea5c0a..aa45f9c97 100644 --- a/ant/unix/unix-launcher.sh.in +++ b/ant/unix/unix-launcher.sh.in @@ -110,18 +110,10 @@ else echo -e "$SUCCESS Java $curver was detected" fi -jigsaw=$(echo -e "9.0\n$curver") -actual=$(echo "$jigsaw" |sort -t '.' -k 1,1 -k 2,2 -n) -if [ "$jigsaw" != "$actual" ]; then - echo -e "$SUCCESS Java < 9.0, skipping jigsaw options" +if [[ "$OSTYPE" == "darwin"* ]]; then + LAUNCH_OPTS="$LAUNCH_OPTS ${apple.launch.opts}" else - echo -e "$SUCCESS Java >= 9.0, adding jigsaw options" - LAUNCH_OPTS="$LAUNCH_OPTS ${launch.jigsaw}" - if [[ "$OSTYPE" == "darwin"* ]]; then - LAUNCH_OPTS="$LAUNCH_OPTS ${apple.launch.jigsaw}" - else - LAUNCH_OPTS="$LAUNCH_OPTS ${linux.launch.jigsaw}" - fi + LAUNCH_OPTS="$LAUNCH_OPTS ${linux.launch.opts}" fi if command -v java &>/dev/null; then diff --git a/ant/windows/installer.xml b/ant/windows/installer.xml index e75077996..f6d7d3016 100644 --- a/ant/windows/installer.xml +++ b/ant/windows/installer.xml @@ -1,5 +1,6 @@ + @@ -105,6 +106,8 @@ + + diff --git a/ant/windows/windows-launcher.nsi.in b/ant/windows/windows-launcher.nsi.in index 905149113..9c8f3079f 100644 --- a/ant/windows/windows-launcher.nsi.in +++ b/ant/windows/windows-launcher.nsi.in @@ -44,11 +44,7 @@ Section Call FindJava Var /GLOBAL opts - StrCpy $opts "${launch.opts}" - ; Handle jdk9+ flags - ${If} $java_major >= 9 - StrCpy $opts "${launch.opts} ${launch.jigsaw}" - ${EndIf} + StrCpy $opts "${launch.opts} ${windows.launch.opts}" ; Check for user overridable launch options ClearErrors diff --git a/ant/windows/windows.properties b/ant/windows/windows.properties new file mode 100644 index 000000000..6a72cff1b --- /dev/null +++ b/ant/windows/windows.properties @@ -0,0 +1,2 @@ +# Windows launcher options +windows.launch.opts= \ No newline at end of file diff --git a/build.xml b/build.xml index 944c26e78..547c82649 100644 --- a/build.xml +++ b/build.xml @@ -1,14 +1,23 @@ - + + - + + + + + + + + + @@ -24,42 +33,42 @@ + + + + + + + + + + + + + + + + + + + - - + - + - - - - - - - - - - - - - - - - - - - + @@ -76,7 +85,7 @@ - + Building jar @@ -122,30 +131,23 @@ - - - - - - - - + + + + + + - - - - - - - Copying ${target.fx.dir} - - + + + + @@ -160,12 +162,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + @@ -174,8 +208,8 @@ - - + + @@ -187,12 +221,22 @@ - + + + + + + + + + + + - - + + @@ -201,8 +245,8 @@ - - + + @@ -210,7 +254,7 @@ - + diff --git a/lib/charsets/TCVN-3.jar b/deps/manual/TCVN-3.jar similarity index 100% rename from lib/charsets/TCVN-3.jar rename to deps/manual/TCVN-3.jar diff --git a/deps/manual/hid4java-0.7.2-SNAPSHOT.jar b/deps/manual/hid4java-0.7.2-SNAPSHOT.jar new file mode 100644 index 000000000..d14601884 Binary files /dev/null and b/deps/manual/hid4java-0.7.2-SNAPSHOT.jar differ diff --git a/deps/manual/java-semver-0.10.0.jar b/deps/manual/java-semver-0.10.0.jar new file mode 100644 index 000000000..55d21741d Binary files /dev/null and b/deps/manual/java-semver-0.10.0.jar differ diff --git a/lib/websocket/jettison-1.3.3-SNAPSHOT.jar b/deps/manual/jettison-1.3.3-SNAPSHOT.jar similarity index 100% rename from lib/websocket/jettison-1.3.3-SNAPSHOT.jar rename to deps/manual/jettison-1.3.3-SNAPSHOT.jar diff --git a/lib/mslinks-1.1.0.jar b/deps/manual/mslinks-1.1.0.jar similarity index 100% rename from lib/mslinks-1.1.0.jar rename to deps/manual/mslinks-1.1.0.jar diff --git a/lib/communication/purejavahidapi-0.0.10-SNAPSHOT.jar b/deps/manual/purejavahidapi-0.0.10-SNAPSHOT.jar similarity index 100% rename from lib/communication/purejavahidapi-0.0.10-SNAPSHOT.jar rename to deps/manual/purejavahidapi-0.0.10-SNAPSHOT.jar diff --git a/lib/charsets/icu4j-charset-slim.jar b/lib/charsets/icu4j-charset-slim.jar deleted file mode 100644 index 288fa3cf0..000000000 Binary files a/lib/charsets/icu4j-charset-slim.jar and /dev/null differ diff --git a/lib/charsets/icu4j-slim.jar b/lib/charsets/icu4j-slim.jar deleted file mode 100644 index ae9b9af26..000000000 Binary files a/lib/charsets/icu4j-slim.jar and /dev/null differ diff --git a/lib/communication/libusb4java-1.3.0-darwin-x86-64.jar b/lib/communication/libusb4java-1.3.0-darwin-x86-64.jar deleted file mode 100644 index 41f939c1e..000000000 Binary files a/lib/communication/libusb4java-1.3.0-darwin-x86-64.jar and /dev/null differ diff --git a/lib/communication/libusb4java-1.3.0-linux-aarch64.jar b/lib/communication/libusb4java-1.3.0-linux-aarch64.jar deleted file mode 100644 index 0f53f1c16..000000000 Binary files a/lib/communication/libusb4java-1.3.0-linux-aarch64.jar and /dev/null differ diff --git a/lib/communication/libusb4java-1.3.0-linux-arm.jar b/lib/communication/libusb4java-1.3.0-linux-arm.jar deleted file mode 100644 index 635a77b4b..000000000 Binary files a/lib/communication/libusb4java-1.3.0-linux-arm.jar and /dev/null differ diff --git a/lib/communication/libusb4java-1.3.0-linux-x86-64.jar b/lib/communication/libusb4java-1.3.0-linux-x86-64.jar deleted file mode 100644 index 1e4de5e0d..000000000 Binary files a/lib/communication/libusb4java-1.3.0-linux-x86-64.jar and /dev/null differ diff --git a/lib/communication/libusb4java-1.3.0-linux-x86.jar b/lib/communication/libusb4java-1.3.0-linux-x86.jar deleted file mode 100644 index 6ccb81562..000000000 Binary files a/lib/communication/libusb4java-1.3.0-linux-x86.jar and /dev/null differ diff --git a/lib/communication/libusb4java-1.3.0-win32-x86-64.jar b/lib/communication/libusb4java-1.3.0-win32-x86-64.jar deleted file mode 100644 index bf306c78a..000000000 Binary files a/lib/communication/libusb4java-1.3.0-win32-x86-64.jar and /dev/null differ diff --git a/lib/communication/libusb4java-1.3.0-win32-x86.jar b/lib/communication/libusb4java-1.3.0-win32-x86.jar deleted file mode 100644 index f711d8091..000000000 Binary files a/lib/communication/libusb4java-1.3.0-win32-x86.jar and /dev/null differ diff --git a/lib/communication/usb-api-1.0.2.jar b/lib/communication/usb-api-1.0.2.jar deleted file mode 100644 index 7abd6f709..000000000 Binary files a/lib/communication/usb-api-1.0.2.jar and /dev/null differ diff --git a/lib/communication/usb4java-1.3.0.jar b/lib/communication/usb4java-1.3.0.jar deleted file mode 100644 index d5ac62c6b..000000000 Binary files a/lib/communication/usb4java-1.3.0.jar and /dev/null differ diff --git a/lib/communication/usb4java-javax-1.3.0.jar b/lib/communication/usb4java-javax-1.3.0.jar deleted file mode 100644 index e9666d295..000000000 Binary files a/lib/communication/usb4java-javax-1.3.0.jar and /dev/null differ diff --git a/lib/darcula-bobbylight.jar b/lib/darcula-bobbylight.jar deleted file mode 100644 index fcb955bff..000000000 Binary files a/lib/darcula-bobbylight.jar and /dev/null differ diff --git a/lib/imaging/common-image-3.8.3.jar b/lib/imaging/common-image-3.8.3.jar deleted file mode 100644 index 07315fcb8..000000000 Binary files a/lib/imaging/common-image-3.8.3.jar and /dev/null differ diff --git a/lib/imaging/common-io-3.8.3.jar b/lib/imaging/common-io-3.8.3.jar deleted file mode 100644 index f1d45cccb..000000000 Binary files a/lib/imaging/common-io-3.8.3.jar and /dev/null differ diff --git a/lib/imaging/common-lang-3.8.3.jar b/lib/imaging/common-lang-3.8.3.jar deleted file mode 100644 index dbebe209f..000000000 Binary files a/lib/imaging/common-lang-3.8.3.jar and /dev/null differ diff --git a/lib/imaging/imageio-core-3.8.3.jar b/lib/imaging/imageio-core-3.8.3.jar deleted file mode 100644 index 6f3083e5c..000000000 Binary files a/lib/imaging/imageio-core-3.8.3.jar and /dev/null differ diff --git a/lib/imaging/imageio-jpeg-3.8.3.jar b/lib/imaging/imageio-jpeg-3.8.3.jar deleted file mode 100644 index 11e085a1d..000000000 Binary files a/lib/imaging/imageio-jpeg-3.8.3.jar and /dev/null differ diff --git a/lib/imaging/imageio-metadata-3.8.3.jar b/lib/imaging/imageio-metadata-3.8.3.jar deleted file mode 100644 index 29ba4750e..000000000 Binary files a/lib/imaging/imageio-metadata-3.8.3.jar and /dev/null differ diff --git a/lib/imaging/jai-imageio-core-1.4.0.jar b/lib/imaging/jai-imageio-core-1.4.0.jar deleted file mode 100644 index eb4594920..000000000 Binary files a/lib/imaging/jai-imageio-core-1.4.0.jar and /dev/null differ diff --git a/lib/imaging/jai-imageio-jpeg2000-1.4.0.jar b/lib/imaging/jai-imageio-jpeg2000-1.4.0.jar deleted file mode 100644 index 2b938167a..000000000 Binary files a/lib/imaging/jai-imageio-jpeg2000-1.4.0.jar and /dev/null differ diff --git a/lib/websocket/jetty-servlet-api-4.0.6.jar b/lib/websocket/jetty-servlet-api-4.0.6.jar deleted file mode 100644 index 99357ea37..000000000 Binary files a/lib/websocket/jetty-servlet-api-4.0.6.jar and /dev/null differ diff --git a/lib/websocket/not-going-to-be-commons-ssl-0.3.20.jar b/lib/websocket/not-going-to-be-commons-ssl-0.3.20.jar deleted file mode 100644 index 54bf4aa84..000000000 Binary files a/lib/websocket/not-going-to-be-commons-ssl-0.3.20.jar and /dev/null differ diff --git a/src/org/jdesktop/swinghelper/tray/JXTrayIcon.java b/src/org/jdesktop/swinghelper/tray/JXTrayIcon.java index 2e14fb6af..a5d597cd0 100644 --- a/src/org/jdesktop/swinghelper/tray/JXTrayIcon.java +++ b/src/org/jdesktop/swinghelper/tray/JXTrayIcon.java @@ -174,15 +174,13 @@ public Dimension getSize() { return new Dimension(iconSize.width * macScale, iconSize.height * macScale); case WINDOWS: - if(Constants.JAVA_VERSION.getMajorVersion() >= 9) { - // JDK9+ required for HiDPI tray icons on Windows - double winScale = WindowsUtilities.getScaleFactor(); - - // Handle undocumented HiDPI icon support - // Requires TrayIcon.setImageAutoSize(true); - iconSize.width *= winScale; - iconSize.height *= winScale; - } + // Required for HiDPI tray icons on Windows + double winScale = WindowsUtilities.getScaleFactor(); + + // Handle undocumented HiDPI icon support + // Requires TrayIcon.setImageAutoSize(true); + iconSize.width *= winScale; + iconSize.height *= winScale; break; } return iconSize; diff --git a/src/qz/build/JLink.java b/src/qz/build/JLink.java index b760c3cb8..0991b52a1 100644 --- a/src/qz/build/JLink.java +++ b/src/qz/build/JLink.java @@ -67,7 +67,7 @@ public JLink(String targetPlatform, String targetArch, String javaVendor, String this.javaVersion = getParam("javaVersion", javaVersion, JAVA_DEFAULT_VERSION); this.gcVersion = getParam("gcVersion", gcVersion, JAVA_DEFAULT_GC_VERSION); - this.javaSemver = SystemUtilities.getJavaVersion(this.javaVersion); + this.javaSemver = SystemUtilities.parseJavaVersion(this.javaVersion); // Optional: Provide the location of a custom JDK on the local filesystem if(!StringUtils.isEmpty(targetJdk)) { @@ -78,7 +78,7 @@ public JLink(String targetPlatform, String targetArch, String javaVendor, String if(customVersion.contains("\"")) { customVersion = customVersion.split("\"")[1]; } - Version customSemver = SystemUtilities.getJavaVersion(customVersion); + Version customSemver = SystemUtilities.parseJavaVersion(customVersion); if(needsDownload(javaSemver, customSemver)) { // The "release" file doesn't have build info, so we can't auto-download :( if(javaSemver.getMajorVersion() != customSemver.getMajorVersion()) { @@ -131,7 +131,7 @@ private static boolean needsDownload(Version want, Version installed) { // Per JDK-8240734: Major versions checks aren't enough starting with 11.0.16+8 // see also https://github.com/adoptium/adoptium-support/issues/557 - Version bad = SystemUtilities.getJavaVersion("11.0.16+8"); + Version bad = SystemUtilities.parseJavaVersion("11.0.16+8"); if(want.greaterThanOrEqualTo(bad) && installed.lessThan(bad) || installed.greaterThanOrEqualTo(bad) && want.lessThan(bad)) { // Force download diff --git a/src/qz/common/AboutInfo.java b/src/qz/common/AboutInfo.java index 87d06c41d..c9013bd81 100644 --- a/src/qz/common/AboutInfo.java +++ b/src/qz/common/AboutInfo.java @@ -100,6 +100,7 @@ private static JSONObject environment() throws JSONException { .put("java", String.format("%s (%s)", Constants.JAVA_VERSION, SystemUtilities.getArch().toString().toLowerCase())) .put("java (location)", System.getProperty("java.home")) .put("java (vendor)", Constants.JAVA_VENDOR) + .put("java (pid)", SystemUtilities.getProcessId()) .put("uptime", DurationFormatUtils.formatDurationWords(uptime, true, false)) .put("uptimeMillis", uptime) .put("sandbox", SystemUtilities.isMac() && MacUtilities.isSandboxed()); diff --git a/src/qz/common/Constants.java b/src/qz/common/Constants.java index c8830855e..3490329b2 100644 --- a/src/qz/common/Constants.java +++ b/src/qz/common/Constants.java @@ -14,7 +14,7 @@ public class Constants { public static final String HEXES = "0123456789ABCDEF"; public static final char[] HEXES_ARRAY = HEXES.toCharArray(); public static final int BYTE_BUFFER_SIZE = 8192; - public static final Version VERSION = Version.valueOf("2.2.6-SNAPSHOT"); + public static final Version VERSION = Version.valueOf("2.3.0-SNAPSHOT"); public static final Version JAVA_VERSION = SystemUtilities.getJavaVersion(); public static final String JAVA_VENDOR = System.getProperty("java.vendor"); diff --git a/src/qz/common/TrayManager.java b/src/qz/common/TrayManager.java index 3b98ab2a5..1d4d4a276 100644 --- a/src/qz/common/TrayManager.java +++ b/src/qz/common/TrayManager.java @@ -294,10 +294,10 @@ private void addMenuItems() { monocleItem.setToolTipText("Use monocle platform for HTML printing (restart required)"); monocleItem.setMnemonic(KeyEvent.VK_U); monocleItem.setState(getPref(TRAY_MONOCLE)); - if(!SystemUtilities.hasMonocle()) { - log.warn("Monocle engine was not detected"); + if(Constants.JAVA_VERSION.getMajorVersion() <= 8) { + log.warn("Monocle engine is not available for this Java version"); monocleItem.setEnabled(false); - monocleItem.setToolTipText("Monocle HTML engine was not detected"); + monocleItem.setToolTipText("Monocle HTML engine is not available."); } monocleItem.addActionListener(monocleListener); diff --git a/src/qz/printer/action/html/WebApp.java b/src/qz/printer/action/html/WebApp.java index b4f1da08f..a83135d97 100644 --- a/src/qz/printer/action/html/WebApp.java +++ b/src/qz/printer/action/html/WebApp.java @@ -181,25 +181,31 @@ public static synchronized void initialize() throws IOException { // Fallback for JDK11+ headless = true; } - if (useMonocle && SystemUtilities.hasMonocle()) { - log.trace("Initializing monocle platform"); - System.setProperty("javafx.platform", "monocle"); - // Don't set glass.platform on Linux per https://github.com/qzind/tray/issues/702 - switch(SystemUtilities.getOs()) { - case WINDOWS: - case MAC: - System.setProperty("glass.platform", "Monocle"); - break; - default: - // don't set "glass.platform" - } + if (useMonocle) { + if(SystemUtilities.hasMonocle()) { + // Legacy "Monocle" mode + System.setProperty("javafx.platform", "monocle"); + // Don't set glass.platform on Linux per https://github.com/qzind/tray/issues/702 + switch(SystemUtilities.getOs()) { + case WINDOWS: + case MAC: + System.setProperty("glass.platform", "Monocle"); + break; + default: + // don't set "glass.platform" + } - //software rendering required headless environments - if (headless) { - System.setProperty("prism.order", "sw"); + //software rendering required headless environments + if (headless) { + System.setProperty("prism.order", "sw"); + } + } else { + // Assume newer "Headless" mode is available + System.setProperty("glass.platform", "Headless"); } + log.trace("Initializing {} glass.platform", SystemUtilities.hasMonocle() ? "monocle" : "headless"); } else { - log.warn("Monocle platform will not be used"); + log.warn("{} glass.platform will not be used", SystemUtilities.hasMonocle() ? "Monocle" : "Headless"); } } diff --git a/src/qz/ui/component/CertificateTable.java b/src/qz/ui/component/CertificateTable.java index b5b24b864..7b28f34fc 100644 --- a/src/qz/ui/component/CertificateTable.java +++ b/src/qz/ui/component/CertificateTable.java @@ -102,7 +102,7 @@ public void mousePressed(MouseEvent e) { int x = target.getSelectedColumn(); int y = target.getSelectedRow(); // Only trigger after the cell is click AND highlighted. - if (loc.distance(x, y) == 0) { + if (x > 0 && y > 0 && loc.distance(x, y) == 0) { CertificateField rowKey = (CertificateField)target.getValueAt(y, 0); switch(rowKey) { case VALID_FROM: diff --git a/src/qz/ui/component/LinkLabel.java b/src/qz/ui/component/LinkLabel.java index 67d3c6cbf..29a579b41 100644 --- a/src/qz/ui/component/LinkLabel.java +++ b/src/qz/ui/component/LinkLabel.java @@ -79,6 +79,7 @@ private void initialize() { public void refresh() { setForeground(Constants.TRUSTED_COLOR); setBorderPainted(false); + setContentAreaFilled(false); setBorder(null); setOpaque(false); setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); diff --git a/src/qz/utils/ShellUtilities.java b/src/qz/utils/ShellUtilities.java index d7821e403..6fd483226 100644 --- a/src/qz/utils/ShellUtilities.java +++ b/src/qz/utils/ShellUtilities.java @@ -262,11 +262,9 @@ public static void browseDirectory(File directory) { File[] files = directory.listFiles(); if (files != null && files.length > 0) { try { - // Use browseFileDirectory (JDK9+) via reflection - Method m = Desktop.class.getDeclaredMethod("browseFileDirectory", File.class); - m.invoke(Desktop.getDesktop(), files[0].getCanonicalFile()); + Desktop.getDesktop().browseFileDirectory(files[0].getCanonicalFile()); } - catch(ReflectiveOperationException e) { + catch(IOException e) { // Fallback to open -R ShellUtilities.execute("open", "-R", files[0].getCanonicalPath()); } diff --git a/src/qz/utils/SystemUtilities.java b/src/qz/utils/SystemUtilities.java index 6bbffccbb..489742b38 100644 --- a/src/qz/utils/SystemUtilities.java +++ b/src/qz/utils/SystemUtilities.java @@ -29,7 +29,6 @@ import java.awt.geom.Area; import java.io.File; import java.io.UnsupportedEncodingException; -import java.lang.reflect.Method; import java.net.URLDecoder; import java.nio.Buffer; import java.nio.ByteBuffer; @@ -70,6 +69,7 @@ public class SystemUtilities { private static Boolean darkDesktop; private static Boolean darkTaskbar; + @Deprecated private static Boolean hasMonocle; private static String classProtocol; private static Version osVersion; @@ -193,52 +193,28 @@ public static String whoami() { } public static Version getJavaVersion() { - return getJavaVersion(System.getProperty("java.version")); + Runtime.Version ver = Runtime.version(); + return Version.forIntegers(ver.feature(), ver.interim(), ver.patch()).setBuildMetadata("" + ver.update()); } /** * Call a java command (e.g. java) with "--version" and parse the output - * The double dash "--" is since JDK9 but important to send the command output to stdout */ public static Version getJavaVersion(Path javaCommand) { - return getJavaVersion(ShellUtilities.executeRaw(javaCommand.toString(), "--version")); + return parseJavaVersion(ShellUtilities.executeRaw(javaCommand.toString(), "--version")); } public static int getProcessId() { if(pid == null) { - // Try Java 9+ - if(Constants.JAVA_VERSION.getMajorVersion() >= 9) { - pid = getProcessIdJigsaw(); - } - // Try JNA - if(pid == null || pid == -1) { - pid = SystemUtilities.isWindows() ? WindowsUtilities.getProcessId() : UnixUtilities.getProcessId(); - } + pid = (int)ProcessHandle.current().pid(); } return pid; } - private static int getProcessIdJigsaw() { - try { - Class processHandle = Class.forName("java.lang.ProcessHandle"); - Method current = processHandle.getDeclaredMethod("current"); - Method pid = processHandle.getDeclaredMethod("pid"); - Object processHandleInstance = current.invoke(processHandle); - Object pidValue = pid.invoke(processHandleInstance); - if(pidValue instanceof Long) { - return ((Long)pidValue).intValue(); - } - } catch(Throwable t) { - log.warn("Could not get process ID using Java 9+, will attempt to fallback to JNA", t); - } - return -1; - } - /** - * Handle Java versioning nuances - * To eventually be replaced with java.lang.Runtime.Version (JDK9+) + * Parse a Java version while handling Java versioning and formatting nuances */ - public static Version getJavaVersion(String version) { + public static Version parseJavaVersion(String version) { String[] parts = version.trim().split("\\D+"); int major = 1; @@ -266,7 +242,7 @@ public static Version getJavaVersion(String version) { } } } catch(NumberFormatException e) { - log.warn("Could not parse Java version \"{}\"", e); + log.warn("Could not parse Java version \"{}\"", version, e); } if(meta.trim().isEmpty()) { return Version.forIntegers(major, minor, patch); @@ -447,7 +423,7 @@ public static boolean setSystemLookAndFeel(boolean headless) { darculaThemeNeeded = false; } if(isDarkDesktop() && darculaThemeNeeded) { - UIManager.setLookAndFeel("com.bulenkov.darcula.DarculaLaf"); + UIManager.setLookAndFeel("com.formdev.flatlaf.FlatDarculaLaf"); } else { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } @@ -655,6 +631,7 @@ public static boolean isJDK() { return false; } + @Deprecated public static boolean hasMonocle() { if(hasMonocle == null) { try { diff --git a/test/qz/printer/action/WebAppTest.java b/test/qz/printer/action/WebAppTest.java index 61e09b589..83a8f0888 100644 --- a/test/qz/printer/action/WebAppTest.java +++ b/test/qz/printer/action/WebAppTest.java @@ -222,7 +222,8 @@ private static WebAppModel buildModel(String index, double width, double height, } private static PrinterJob buildVectorJob(String name) throws Throwable { - Printer defaultPrinter = Printer.getDefaultPrinter(); + // Get "PDF" printer + Printer defaultPrinter = Printer.getAllPrinters().stream().filter(printer -> printer.getName().contains("PDF")).findFirst().get(); PrinterJob job = PrinterJob.createPrinterJob(defaultPrinter); // All this to remove margins