From 1789e29bb08af63210c964fa557a8a1414a2d344 Mon Sep 17 00:00:00 2001 From: tresf Date: Thu, 31 Jan 2019 01:05:31 -0500 Subject: [PATCH] Detect bundled native lib path, add notarized signing --- .gitignore | 1 + build.xml | 33 ++++++++++++++++++++++------ src/qz/printer/action/PrintHTML.java | 9 ++++++++ src/qz/utils/SystemUtilities.java | 12 ++++++++++ 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index efc497c1d..a46a0ea4d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /out/ /js/node_modules +/lib/javafx* /.idea/workspace.xml /.idea/uiDesigner.xml /.idea/compiler.xml diff --git a/build.xml b/build.xml index e76ae7f41..5fd21af43 100644 --- a/build.xml +++ b/build.xml @@ -2,7 +2,7 @@ - + @@ -154,6 +154,22 @@ Size: ${build.size} KB + + + + + + + + + + + + + + + + Using internal cert for signing auth @@ -248,11 +264,6 @@ - - - - - @@ -389,7 +400,7 @@ - + @@ -420,6 +431,14 @@ + + + + + + + + diff --git a/src/qz/printer/action/PrintHTML.java b/src/qz/printer/action/PrintHTML.java index 6d743705f..7fcccfa26 100644 --- a/src/qz/printer/action/PrintHTML.java +++ b/src/qz/printer/action/PrintHTML.java @@ -10,6 +10,7 @@ package qz.printer.action; +import com.github.zafarkhaja.semver.Version; import org.apache.commons.io.IOUtils; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONException; @@ -17,9 +18,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import qz.common.Constants; +import qz.deploy.DeployUtilities; import qz.printer.PrintOptions; import qz.printer.PrintOutput; import qz.utils.PrintingUtilities; +import qz.utils.SystemUtilities; import javax.print.attribute.PrintRequestAttributeSet; import javax.swing.*; @@ -28,6 +31,7 @@ import java.awt.print.Printable; import java.awt.print.PrinterException; import java.awt.print.PrinterJob; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URL; @@ -46,6 +50,11 @@ public class PrintHTML extends PrintImage implements PrintProcessor, Printable { public PrintHTML() { super(); + //JavaFX native libs + if (SystemUtilities.isJar() && Constants.JAVA_VERSION.greaterThanOrEqualTo(Version.valueOf("11.0.0"))) { + System.setProperty("java.library.path", new File(DeployUtilities.detectJarPath()).getParent() + "/libs/"); + } + models = new ArrayList<>(); } diff --git a/src/qz/utils/SystemUtilities.java b/src/qz/utils/SystemUtilities.java index 318716170..a928410b3 100644 --- a/src/qz/utils/SystemUtilities.java +++ b/src/qz/utils/SystemUtilities.java @@ -33,6 +33,7 @@ public class SystemUtilities { private static String uname; private static String linuxRelease; + private static String classProtocol; /** @@ -247,4 +248,15 @@ public static void centerDialog(Dialog dialog, Point position) { private static double getDpiScale() { return SystemUtilities.isMac() ? 1 : Toolkit.getDefaultToolkit().getScreenResolution() / 96.0; } + + /** + * Detects if running from IDE or jar + * @return true if running from a jar, false if running from IDE + */ + public static boolean isJar() { + if (classProtocol == null) { + classProtocol = SystemUtilities.class.getResource("").getProtocol(); + } + return "jar".equals(classProtocol); + } }