Skip to content

Commit 702aa13

Browse files
committed
Merge branch 'issue-403' into devel
2 parents 7cd3763 + 7de5a56 commit 702aa13

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/main/java/io/github/fvarrui/javapackager/packagers/GenerateDmg.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected File doApply(MacPackager packager) throws Exception {
8787
// creates image
8888
Logger.info("Creating image: " + tempDmgFile.getAbsolutePath());
8989
String osArchitecture = System.getProperty("os.arch");
90-
boolean isAarch64 = osArchitecture.toLowerCase().equals("aarch64");
90+
boolean isAarch64 = osArchitecture.equalsIgnoreCase("aarch64");
9191
String fileSystem = isAarch64 ? "APFS" : "HFS+";
9292
Logger.warn(osArchitecture + " architecture detected. Using " + fileSystem + " filesystem");
9393
execute("hdiutil", "create", "-srcfolder", appFolder, "-volname", volumeName, "-ov", "-fs", fileSystem, "-format", "UDRW", tempDmgFile);
@@ -100,10 +100,9 @@ protected File doApply(MacPackager packager) throws Exception {
100100
// mounts image
101101
Logger.info("Mounting image: " + tempDmgFile.getAbsolutePath());
102102
String result = execute("hdiutil", "attach", "-readwrite", "-noverify", "-noautoopen", tempDmgFile);
103-
Optional<String> optDeviceName = Arrays.asList(result.split("\n"))
104-
.stream()
103+
Optional<String> optDeviceName = Arrays.stream(result.split("\n"))
105104
.filter(s -> s.contains(mountFolder.getAbsolutePath()))
106-
.map(s -> StringUtils.normalizeSpace(s))
105+
.map(StringUtils::normalizeSpace)
107106
.map(s -> s.split(" ")[0])
108107
.findFirst();
109108
optDeviceName.ifPresent(deviceName -> Logger.info("- Device name: " + deviceName));

src/main/java/io/github/fvarrui/javapackager/packagers/Packager.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public abstract class Packager extends PackagerSettings {
2525

2626
// artifact generators
2727
protected List<ArtifactGenerator<?>> installerGenerators = new ArrayList<>();
28-
private BundleJre generateJre = new BundleJre();
28+
private final BundleJre generateJre = new BundleJre();
2929

3030
// internal generic properties (setted in "createAppStructure/createApp")
3131
protected File appFolder;
@@ -395,13 +395,15 @@ public File createApp() throws Exception {
395395
Logger.infoUnindent("Dependencies copied to " + libsFolder + "!");
396396

397397
// creates a runnable jar file
398-
if (runnableJar != null && runnableJar.exists()) {
399-
Logger.info("Using runnable JAR: " + runnableJar);
400-
jarFile = runnableJar;
401-
} else {
398+
if (runnableJar == null) {
402399
Logger.infoIndent("Creating runnable JAR...");
403400
jarFile = Context.getContext().createRunnableJar(this);
404401
Logger.infoUnindent("Runnable jar created in " + jarFile + "!");
402+
} else if (runnableJar.exists()) {
403+
Logger.info("Using runnable JAR: " + runnableJar);
404+
jarFile = runnableJar;
405+
} else {
406+
throw new Exception("Runnable JAR doesn't exist: " + runnableJar);
405407
}
406408

407409
// embeds a JRE if is required

0 commit comments

Comments
 (0)