Skip to content

Commit b0cfbc7

Browse files
committed
better Xcode installation check
1 parent 443cec4 commit b0cfbc7

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

java/src/processing/mode/java/JavaBuild.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ protected boolean exportApplication(File destFolder,
11861186
pw.close();
11871187

11881188
// attempt to code sign if the Xcode tools appear to be installed
1189-
if (Platform.isMacOS() && new File("/usr/bin/codesign_allocate").exists()) {
1189+
if (Platform.isMacOS() && isXcodeInstalled()) {
11901190
if (embedJava) {
11911191
ProcessHelper.ffs("codesign", "--force", "--sign", "-", jdkPath);
11921192
}
@@ -1334,6 +1334,21 @@ protected boolean exportApplication(File destFolder,
13341334
}
13351335

13361336

1337+
static Boolean xcodeInstalled;
1338+
1339+
static protected boolean isXcodeInstalled() {
1340+
if (xcodeInstalled == null) {
1341+
Process p = PApplet.launch("xcode-select", "-p");
1342+
int result = -1;
1343+
try {
1344+
result = p.waitFor();
1345+
} catch (InterruptedException e) { }
1346+
xcodeInstalled = (result == 0);
1347+
}
1348+
return xcodeInstalled;
1349+
}
1350+
1351+
13371352
/**
13381353
* Run the launch4j build.xml file through ant to create the exe.
13391354
* Most of this code was lifted from Android mode.

0 commit comments

Comments
 (0)