mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-04 21:36:45 +00:00
explicitly detect java.awt.headless in build
This commit is contained in:
parent
85166635b4
commit
9325a1968b
3 changed files with 9 additions and 6 deletions
|
@ -19,7 +19,7 @@ if(System.getProperty("os.arch") == "aarch64") {
|
||||||
osArch = "aarch64"
|
osArch = "aarch64"
|
||||||
targetName = "-" + osArch
|
targetName = "-" + osArch
|
||||||
}
|
}
|
||||||
def headless = GraphicsEnvironment.isHeadless()
|
def headless = "true".equals(System.getProperty("java.awt.headless")) || GraphicsEnvironment.isHeadless()
|
||||||
|
|
||||||
group "com.sparrowwallet"
|
group "com.sparrowwallet"
|
||||||
version "${sparrowVersion}"
|
version "${sparrowVersion}"
|
||||||
|
|
|
@ -66,7 +66,7 @@ public enum JavaFXPlatform {
|
||||||
|
|
||||||
String osClassifier = project.getExtensions().getByType(OsDetector.class).getClassifier();
|
String osClassifier = project.getExtensions().getByType(OsDetector.class).getClassifier();
|
||||||
|
|
||||||
if(GraphicsEnvironment.isHeadless()) {
|
if("true".equals(System.getProperty("java.awt.headless")) || GraphicsEnvironment.isHeadless()) {
|
||||||
osClassifier += "-monocle";
|
osClassifier += "-monocle";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,13 @@ public enum Interface {
|
||||||
|
|
||||||
public static Interface get() {
|
public static Interface get() {
|
||||||
if(currentInterface == null) {
|
if(currentInterface == null) {
|
||||||
if(java.awt.GraphicsEnvironment.isHeadless()) {
|
boolean headless = java.awt.GraphicsEnvironment.isHeadless();
|
||||||
if("Monocle".equalsIgnoreCase(System.getProperty("glass.platform"))) {
|
boolean monocle = "Monocle".equalsIgnoreCase(System.getProperty("glass.platform"));
|
||||||
|
|
||||||
|
if(headless || monocle) {
|
||||||
currentInterface = TERMINAL;
|
currentInterface = TERMINAL;
|
||||||
} else {
|
|
||||||
|
if(headless && !monocle) {
|
||||||
throw new UnsupportedOperationException("Headless environment detected but Monocle platform not found");
|
throw new UnsupportedOperationException("Headless environment detected but Monocle platform not found");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue