From b2d85b6c785591ef9ecde1e01c161b9d8854b3bb Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Tue, 11 Oct 2022 15:12:40 +0200 Subject: [PATCH] detect and configure build for headless environments --- build.gradle | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.gradle b/build.gradle index d901e952..53ca2e7f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,5 @@ +import java.awt.GraphicsEnvironment + plugins { id 'application' id 'org-openjfx-javafxplugin' @@ -17,6 +19,7 @@ if(System.getProperty("os.arch") == "aarch64") { osArch = "aarch64" targetName = "-" + osArch } +def headless = GraphicsEnvironment.isHeadless() group "com.sparrowwallet" version "${sparrowVersion}" @@ -159,6 +162,9 @@ run { applicationDefaultJvmArgs += ["-Dprism.lcdtext=false", "-Xdock:name=Sparrow", "-Xdock:icon=/Users/scy/git/sparrow/src/main/resources/sparrow-large.png", "--add-opens=javafx.graphics/com.sun.glass.ui.mac=centerdevice.nsmenufx"] } + if(headless) { + applicationDefaultJvmArgs += ["-Dglass.platform=Monocle", "-Dmonocle.platform=Headless", "-Dprism.order=sw"] + } } jlink { @@ -211,6 +217,9 @@ jlink { if(os.macOsX) { jvmArgs += ["-Dprism.lcdtext=false", "--add-opens=javafx.graphics/com.sun.glass.ui.mac=com.sparrowwallet.merged.module"] } + if(headless) { + jvmArgs += ["-Dglass.platform=Monocle", "-Dmonocle.platform=Headless", "-Dprism.order=sw"] + } } addExtraDependencies("javafx") jpackage {