Skip to content

Commit eb349c5

Browse files
committed
Merge branch 'master' into issue-115
2 parents bde5ca0 + af60767 commit eb349c5

File tree

6 files changed

+29
-3
lines changed

6 files changed

+29
-3
lines changed

src/main/java/io/github/fvarrui/javapackager/model/LinuxConfig.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class LinuxConfig implements Serializable {
1515
private boolean generateRpm = true;
1616
private File pngFile;
1717
private File xpmFile;
18+
private boolean wrapJar = true;
1819

1920
public boolean isGenerateDeb() {
2021
return generateDeb;
@@ -47,11 +48,19 @@ public File getXpmFile() {
4748
public void setXpmFile(File xpmFile) {
4849
this.xpmFile = xpmFile;
4950
}
51+
52+
public boolean isWrapJar() {
53+
return wrapJar;
54+
}
55+
56+
public void setWrapJar(boolean wrapJar) {
57+
this.wrapJar = wrapJar;
58+
}
5059

5160
@Override
5261
public String toString() {
5362
return "LinuxConfig [generateDeb=" + generateDeb + ", generateRpm=" + generateRpm + ", pngFile=" + pngFile
54-
+ ", xpmFile=" + xpmFile + "]";
63+
+ ", xpmFile=" + xpmFile + ", wrapJar=" + wrapJar + "]";
5564
}
5665

5766
/**

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ protected File doApply(Packager packager) throws Exception {
133133

134134
}
135135

136-
// removes jre/legal folder
136+
// removes jre/legal folder as it causes problems when codesigning from Mac OS
137137
File legalFolder = new File(destinationFolder, "legal");
138138
if (legalFolder.exists()) {
139139
FileUtils.removeFolder(legalFolder);
@@ -144,6 +144,10 @@ protected File doApply(Packager packager) throws Exception {
144144
} else {
145145
Logger.infoUnindent("JRE bundling skipped!");
146146
}
147+
148+
// updates bundle jre property value, as this artifact generator could disable this option
149+
// (e.g. when bundling a jre from a different platform than the current one)
150+
packager.bundleJre(bundleJre);
147151

148152
return destinationFolder;
149153
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ public File doCreateApp() throws Exception {
6565
Logger.info("Startup script generated in " + startupFile.getAbsolutePath());
6666

6767
// concats linux startup.sh script + generated jar in executable (binary)
68-
FileUtils.concat(executable, startupFile, jarFile);
68+
if (getLinuxConfig().isWrapJar())
69+
FileUtils.concat(executable, startupFile, jarFile);
70+
else {
71+
FileUtils.copyFileToFile(startupFile, executable);
72+
FileUtils.copyFileToFolder(jarFile, appFolder);
73+
}
6974

7075
// sets execution permissions
7176
executable.setExecutable(true, false);

src/main/resources/linux/assembly.xml.vtl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<exclude>${info.executable.name}</exclude>
1414
#if ($info.bundleJre)
1515
<exclude>${info.jreDirectoryName}/bin/*</exclude>
16+
<exclude>${info.jreDirectoryName}/lib/jspawnhelper</exclude>
1617
#end
1718
</excludes>
1819
</fileSet>
@@ -23,6 +24,7 @@
2324
<include>${info.executable.name}</include>
2425
#if ($info.bundleJre)
2526
<include>${info.jreDirectoryName}/bin/*</include>
27+
<include>${info.jreDirectoryName}/lib/jspawnhelper</include>
2628
#end
2729
</includes>
2830
<fileMode>0755</fileMode>

src/main/resources/linux/startup.sh.vtl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ fi
5353
#end
5454
#end
5555

56+
#if ($info.linuxConfig.wrapJar)
5657
BINARY="$SCRIPTPATH/${info.executable.name}"
58+
#else
59+
BINARY="$SCRIPTPATH/${info.jarFile.name}"
60+
#end
5761

5862
#if ($info.envPath)
5963
export PATH=${info.envPath}

src/main/resources/mac/assembly.xml.vtl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<exclude>Contents/MacOS/universalJavaApplicationStub</exclude>
1515
#if ($info.bundleJre)
1616
<exclude>Contents/PlugIns/${info.jreDirectoryName}/Contents/Home/bin/*</exclude>
17+
<exclude>Contents/PlugIns/${info.jreDirectoryName}/Contents/Home/lib/jspawnhelper</exclude>
1718
#end
1819
</excludes>
1920
</fileSet>
@@ -25,6 +26,7 @@
2526
<include>Contents/MacOS/universalJavaApplicationStub</include>
2627
#if ($info.bundleJre)
2728
<include>Contents/PlugIns/${info.jreDirectoryName}/Contents/Home/bin/*</include>
29+
<include>Contents/PlugIns/${info.jreDirectoryName}/Contents/Home/lib/jspawnhelper</include>
2830
#end
2931
</includes>
3032
<fileMode>0755</fileMode>

0 commit comments

Comments
 (0)