Skip to content

Commit 29e3392

Browse files
fvarruiclaude
andcommitted
Fix the bugs found while documenting 2.0.0
- #501 iconFile is used when no platform icon is set and it has the target platform's format; forwarded by the Gradle PackageTask - #502 Gradle forwards zipballName and tarballName; the zipball name gets .zip like with Maven - #504 stable default msiUpgradeCode (from organization and name), file and product versions derived from version, same-version MSI upgrades - #505 Linux jreMinVersion check compares versions numerically - #506 GDK_BACKEND instead of GDKBACKEND in the pkexec launch - #507 the Linux startup script execs Java, so its exit code is passed on - #508 macOS bundle permission rules point to the .jre bundle folder - #509 notarization zip made with ditto; keyChainProfile is required - #510 jsign gets no "null" keystore when certfile and keyfile are used The smoke tests check the exit code on GNU/Linux and the JRE permissions in the macOS tarball; the docs describe the new behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 3d20c43 commit 29e3392

17 files changed

Lines changed: 183 additions & 65 deletions

File tree

‎.github/scripts/check-linux-app.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ if [ -x "$EXE" ]; then
2929
if echo "$OUTPUT" | grep -qF "args=[--foo, hello world]"; then pass "appArgs received"; else fail "appArgs not received as configured"; fi
3030
if echo "$OUTPUT" | grep -qF "smoke.prop=hello world"; then pass "vmArgs received"; else fail "vmArgs not received as configured"; fi
3131
if echo "$OUTPUT" | grep -qE "^java.class.path=.*:extra$"; then pass "classpath received"; else fail "classpath not received as configured"; fi
32+
# the startup script passes the app's exit code on (#507)
33+
"$EXE" --exit=3 > /dev/null 2>&1
34+
CODE=$?
35+
if [ "$CODE" = 3 ]; then pass "exit code passed on"; else fail "exit code not passed on: expected 3, got $CODE"; fi
3236
fi
3337

3438
# installers

‎.github/scripts/check-macos-app.sh‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ for ext in zip tar.gz; do
6969
if [ -f "$FILE" ]; then pass "$ext bundle generated: $FILE"; else fail "$ext bundle not generated: $FILE"; ls "$TARGET"; fi
7070
done
7171

72+
# the bundled JRE's executables keep mode 755 in the tarball (#508)
73+
TARBALL="$TARGET/${NAME}-${VERSION}-mac.tar.gz"
74+
if [ -f "$TARBALL" ]; then
75+
for f in bin/java lib/jspawnhelper; do
76+
MODE="$(tar -tvzf "$TARBALL" | grep "jre.jre/Contents/Home/$f\$" | awk '{print $1}')"
77+
if [[ "$MODE" == -rwxr-xr-x* ]]; then pass "tarball JRE $f is executable ($MODE)"; else fail "tarball JRE $f is not executable: '$MODE'"; fi
78+
done
79+
fi
80+
7281
# install the app like a user and open it through Launch Services, as the Finder does
7382
# (based on javapackager/JavaPackager#487 by Jacob Burroughs). CI only: needs sudo and writes to /Applications
7483
INSTALLED="/Applications/$NAME.app"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Release 2.0.1
2+
3+
## Goal
4+
5+
Fix the bugs found while documenting 2.0.0 (#501, #502, #504 to #510), clear the Dependabot alerts (#500) and validate the Velocity templates in CI, then release 2.0.1.
6+
7+
## Context
8+
9+
- The docs review (2026-10-11) checked every property against the code and found the bugs below; each one has its own issue.
10+
- `dependabot-alerts.md` and `ci-velocity-template-check.md` hold the other two parts.
11+
12+
## Changes
13+
14+
| Issue | Fix | Verified by |
15+
| --- | --- | --- |
16+
| #501 | `iconFile` is used when no platform icon is set and it has the target platform's format (`.png`, `.icns`, `.ico`); otherwise a warning. Forwarded by the Gradle `PackageTask`. | Code review |
17+
| #502 | Gradle `PackageTask` forwards `zipballName` and `tarballName`; Gradle `CreateZipball` appends `.zip` like Maven. | Code review |
18+
| #504 | `msiUpgradeCode` defaults to a name-based UUID (organization and name), logged; `fileVersion`/`productVersion` default to `version` as `x.x.x.x` (or `1.0.0.0` with a warning if it doesn't fit an MSI version); `AllowSameVersionUpgrades="yes"`. | jshell test of the version conversion; Windows smoke tests build the MSI |
19+
| #505 | Linux `compareVersions()` compares the leading digits of each part numerically, `1.x` as `x`; wrapped in `#[[ ]]#`. | Bash test of 9 cases (17 vs 8, 9 vs 11, 1.8 vs 8...) |
20+
| #506 | `GDK_BACKEND=x11` in the `pkexec` launch. | Code review |
21+
| #507 | The Linux script `exec`s Java instead of `exit 0`. | Linux smoke test: `--exit=3` returns 3 (the sample exits with the code given) |
22+
| #508 | macOS bundle permission rules use `${jreDirectoryName}.jre` (Gradle tasks and `mac/assembly.xml.vtl`); Gradle also sets 755 on `lib/jspawnhelper`. | macOS smoke test: `bin/java` and `jspawnhelper` are 755 in the tarball |
23+
| #509 | Notarization zip built with `ditto -c -k --keepParent`; a blank `keyChainProfile` fails early. | Code review (notarization needs an Apple account) |
24+
| #510 | `WindowsSigner` passes the keystore to jsign only when set. | Code review |
25+
26+
## Acceptance
27+
28+
- Smoke tests green on every platform with the new checks.
29+
- Each issue gets a "fixed in devel" comment and the `fixed` label; closed when 2.0.1 is released.
30+
- The release notes list the behaviour changes: `iconFile` now applies, MSI upgrade code and Windows versions derived from the app.

‎docs/content/configuration/common.md‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ When a default differs between Maven and Gradle, both are given.
2222
| `organizationName` | Maven: the project's organization, or `ACME` | Organization: DEB maintainer, Windows publisher and version info, macOS copyright. |
2323
| `organizationUrl` | Maven: the project's organization URL | Organization website (Setup). |
2424
| `organizationEmail` | | Organization email (DEB maintainer). |
25+
| `iconFile` | | App icon, used on the platforms whose format it has (`.png` GNU/Linux, `.icns` macOS, `.ico` Windows) when the platform's icon property isn't set. See [icons and assets](../guides/icons-and-assets.md). |
2526
| `licenseFile` | Maven: the project's first license URL (downloaded), or `LICENSE`. Gradle: `LICENSE` in the root project | License copied into the app and shown by the Windows installers. |
2627

2728
## Packaging
@@ -35,9 +36,9 @@ When a default differs between Maven and Gradle, both are given.
3536
| `generateInstaller` | `true` | Generates the installers. Each one can also be disabled in its platform config. |
3637
| `forceInstaller` | `false` | Builds the AppImage, DMG, PKG, Setup, MSI and MSM even when the target platform isn't the one running the build. They need their native tools, so it rarely works. |
3738
| `createZipball` | `false` | Creates `${name}-${version}-${platform}.zip` with the app folder. |
38-
| `zipballName` | `${name}-${version}-${platform}` | Zipball name, without extension. Maven only. |
39+
| `zipballName` | `${name}-${version}-${platform}` | Zipball name, without extension. |
3940
| `createTarball` | `false` | Creates `${name}-${version}-${platform}.tar.gz` with the app folder. |
40-
| `tarballName` | `${name}-${version}-${platform}` | Tarball name, without extension. Maven only. |
41+
| `tarballName` | `${name}-${version}-${platform}` | Tarball name, without extension. |
4142

4243
## App contents
4344

@@ -144,8 +145,3 @@ The script is copied into the app's `scripts` folder.
144145
| Windows | A `${name}.vbs` script runs it, and then the EXE; installer shortcuts point to the `.vbs`. |
145146

146147
On Windows, use a script Windows can run (`.bat`, `.cmd`, `.vbs`...). `scripts` also accepts `preInstall` and `postInstall`, but they aren't implemented yet and are ignored.
147-
148-
## Not working as expected
149-
150-
- `iconFile` is ignored: set the icon with `linuxConfig.pngFile`, `macConfig.icnsFile` and `winConfig.icoFile`, or put it in `assetsDir` (see [icons and assets](../guides/icons-and-assets.md)).
151-
- `zipballName` and `tarballName` are ignored by the Gradle plugin.

‎docs/content/configuration/windows.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ javapackager {
5252
| `generateSetup` | `true` | Generates the Inno Setup installer `${name}_${version}.exe`. Needs `iscc`. |
5353
| `generateMsi` | `true` | Generates the MSI installer `${name}_${version}.msi`. Needs WiX. |
5454
| `generateMsm` | `false` | Generates the MSI merge module `${name}_${version}.msm`. It's also generated whenever `generateMsi` is `true`, because the MSI is built from it. |
55-
| `msiUpgradeCode` | random, on every build | `UpgradeCode` of the MSI. Set a fixed GUID so a new MSI upgrades the installed version. |
55+
| `msiUpgradeCode` | derived from `organizationName` and `name` | `UpgradeCode` of the MSI: a new MSI with the same code upgrades the installed version. The build logs it; set it to keep it if the app name or organization change. |
5656
| `signing` | | Code signing configuration. See [code signing](../guides/code-signing.md#windows). |
5757
| `registry` | | Registry values written by the installers. See [Registry entries](#registry-entries). |
5858

@@ -67,9 +67,9 @@ Installers can only be built on Windows; on other platforms they are skipped, un
6767
| `vmLocation` | `bin/client/jvm.dll` or `bin/server/jvm.dll` | `jvm.dll` path relative to the bundled JRE. WinRun4J only, with `bundleJre`. |
6868
| `companyName` | `organizationName` | Company name in the EXE version info. |
6969
| `fileDescription` | `description` | File description in the EXE version info. |
70-
| `fileVersion` | `1.0.0.0` | File version (`x.x.x.x`). |
70+
| `fileVersion` | `version` as `x.x.x.x` | File version (`x.x.x.x`). |
7171
| `txtFileVersion` | `version` | File version as text. Launch4j with Maven only. |
72-
| `productVersion` | `1.0.0.0` | Product version (`x.x.x.x`). Also the MSI version: increase it for MSI upgrades. |
72+
| `productVersion` | `version` as `x.x.x.x` | Product version (`x.x.x.x`). Also the MSI version. |
7373
| `txtProductVersion` | `version` | Product version as text. Launch4j only. |
7474
| `productName` | `name` | Product name. |
7575
| `internalName` | `name` | Internal name. |
@@ -136,7 +136,7 @@ The MSI and the MSM are built with [WiX Toolset](https://wixtoolset.org/). If `w
136136
The MSM (merge module) contains the whole app, a Start menu shortcut and the registry entries; you can merge it into your own MSI. The MSI installs that module for all users in `Program Files` (x64).
137137

138138
:::caution MSI upgrades
139-
For a new MSI to upgrade an installed version, keep the same `msiUpgradeCode` in every release (by default it's a new random GUID on every build) and increase `productVersion` (it defaults to `1.0.0.0`, it isn't taken from `version`). Downgrades and reinstalling the same version are refused.
139+
A new MSI upgrades the installed version when both have the same `msiUpgradeCode`. By default it's derived from `organizationName` and `name`, so it only changes if they do: if you rename the app or the organization, set `msiUpgradeCode` to the previous code (the build logs it). The MSI version is `productVersion`, by default `version` as `x.x.x.x` (e.g. `2.1.0-SNAPSHOT` becomes `2.1.0.0`); if `version` doesn't fit an MSI version (major and minor up to 255), it's `1.0.0.0` and you should set it. Installing an older version over a newer one is refused.
140140
:::
141141

142142
The MSI doesn't create a desktop shortcut nor register file associations.

‎docs/content/guides/icons-and-assets.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ Each platform needs its own icon format:
2525
JavaPackager looks for the icon in this order:
2626

2727
1. The platform's icon property, if set.
28-
2. The file named after the app in `assetsDir`, e.g. `assets/windows/MyApp.ico` for an app named `MyApp`.
29-
3. A default icon (a coffee cup) if there's none.
28+
2. The common `iconFile` property, if it has the platform's format.
29+
3. The file named after the app in `assetsDir`, e.g. `assets/windows/MyApp.ico` for an app named `MyApp`.
30+
4. A default icon (a coffee cup) if there's none.
3031

3132
So the simplest way is to name your icons after your app and put them in `assetsDir`:
3233

@@ -49,7 +50,6 @@ Some tools to create icons:
4950
- ICNS: [MacIcns](https://github.com/EasyG0ing1/MacIcns), or `iconutil` on macOS.
5051
- ICO: most image editors, or online converters.
5152

52-
The common `iconFile` property is not used: set the icon per platform.
5353

5454
## Other assets
5555

‎samples/hello-world/src/main/java/io/github/javapackager/samples/HelloWorld.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ public static void main(String[] args) {
1212
System.out.println("args=" + java.util.Arrays.toString(args));
1313
System.out.println("smoke.prop=" + System.getProperty("smoke.prop"));
1414
System.out.println("java.class.path=" + System.getProperty("java.class.path"));
15+
// --exit=N ends with exit code N, to check that launchers pass it on
16+
for (String arg : args) {
17+
if (arg.startsWith("--exit=")) {
18+
System.exit(Integer.parseInt(arg.substring("--exit=".length())));
19+
}
20+
}
1521
}
1622

1723
}

‎src/main/java/io/github/javapackager/gradle/CreateTarball.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,16 @@ else if (Platform.mac.equals(platform)) {
8484
copySpec.include(appFile.getName() + "/**");
8585
copySpec.exclude(appFile.getName() + "/Contents/MacOS/" + executable.getName());
8686
copySpec.exclude(appFile.getName() + "/Contents/MacOS/universalJavaApplicationStub");
87-
copySpec.exclude(appFile.getName() + "/Contents/PlugIns/" + jreDirectoryName + "/Contents/Home/bin/*");
87+
copySpec.exclude(appFile.getName() + "/Contents/PlugIns/" + jreDirectoryName + ".jre/Contents/Home/bin/*");
88+
copySpec.exclude(appFile.getName() + "/Contents/PlugIns/" + jreDirectoryName + ".jre/Contents/Home/lib/jspawnhelper");
8889
copySpec.exclude(appFile.getName() + "/Contents/Resources/scripts/*");
8990

9091
});
9192
tarTask.from(appFolder, copySpec -> {
9293
copySpec.include(appFile.getName() + "/Contents/MacOS/" + executable.getName());
9394
copySpec.include(appFile.getName() + "/Contents/MacOS/universalJavaApplicationStub");
94-
copySpec.include(appFile.getName() + "/Contents/PlugIns/" + jreDirectoryName + "/Contents/Home/bin/*");
95+
copySpec.include(appFile.getName() + "/Contents/PlugIns/" + jreDirectoryName + ".jre/Contents/Home/bin/*");
96+
copySpec.include(appFile.getName() + "/Contents/PlugIns/" + jreDirectoryName + ".jre/Contents/Home/lib/jspawnhelper");
9597
copySpec.include(appFile.getName() + "/Contents/Resources/scripts/*");
9698
copySpec.filePermissions(p -> p.unix("755"));
9799
});

‎src/main/java/io/github/javapackager/gradle/CreateZipball.java‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ protected File doApply(Packager packager) throws Exception {
3636
File executable = packager.getExecutable();
3737
String jreDirectoryName = packager.getJreDirectoryName();
3838

39-
String zipFileName = packager.getZipballName() != null ? packager.getZipballName() : name + "-" + version + "-" + platform + ".zip";
39+
// zipballName is the name without extension, as with Maven
40+
String zipFileName = (packager.getZipballName() != null ? packager.getZipballName() : name + "-" + version + "-" + platform) + ".zip";
4041
File zipFile = new File(outputDirectory, zipFileName);
4142

4243
Zip zipTask = createZipTask();
@@ -80,13 +81,15 @@ else if (Platform.mac.equals(platform)) {
8081
copySpec.include(appFile.getName() + "/**");
8182
copySpec.exclude(appFile.getName() + "/Contents/MacOS/" + executable.getName());
8283
copySpec.exclude(appFile.getName() + "/Contents/MacOS/universalJavaApplicationStub");
83-
copySpec.exclude(appFile.getName() + "/Contents/PlugIns/" + jreDirectoryName + "/Contents/Home/bin/*");
84+
copySpec.exclude(appFile.getName() + "/Contents/PlugIns/" + jreDirectoryName + ".jre/Contents/Home/bin/*");
85+
copySpec.exclude(appFile.getName() + "/Contents/PlugIns/" + jreDirectoryName + ".jre/Contents/Home/lib/jspawnhelper");
8486
copySpec.exclude(appFile.getName() + "/Contents/Resources/scripts/*");
8587
});
8688
zipTask.from(appFolder, copySpec -> {
8789
copySpec.include(appFile.getName() + "/Contents/MacOS/" + executable.getName());
8890
copySpec.include(appFile.getName() + "/Contents/MacOS/universalJavaApplicationStub");
89-
copySpec.include(appFile.getName() + "/Contents/PlugIns/" + jreDirectoryName + "/Contents/Home/bin/*");
91+
copySpec.include(appFile.getName() + "/Contents/PlugIns/" + jreDirectoryName + ".jre/Contents/Home/bin/*");
92+
copySpec.include(appFile.getName() + "/Contents/PlugIns/" + jreDirectoryName + ".jre/Contents/Home/lib/jspawnhelper");
9093
copySpec.include(appFile.getName() + "/Contents/Resources/scripts/*");
9194
copySpec.filePermissions(p -> p.unix("755"));
9295
});

‎src/main/java/io/github/javapackager/gradle/PackageTask.java‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,46 @@ public void setJrePath(File jrePath) {
281281
this.jrePath = jrePath;
282282
}
283283

284+
@InputFile
285+
@Optional
286+
private File iconFile;
287+
288+
public File getIconFile() {
289+
return iconFile;
290+
}
291+
292+
public void setIconFile(File iconFile) {
293+
this.iconFile = iconFile;
294+
}
295+
296+
@Input
297+
@Optional
298+
private String tarballName;
299+
300+
public String getTarballName() {
301+
return tarballName;
302+
}
303+
304+
public void setTarballName(String tarballName) {
305+
this.tarballName = tarballName;
306+
}
307+
308+
@Input
309+
@Optional
310+
private String zipballName;
311+
312+
public String getZipballName() {
313+
return zipballName;
314+
}
315+
316+
public void setZipballName(String zipballName) {
317+
this.zipballName = zipballName;
318+
}
319+
284320
@InputFile
285321
@Optional
286322
private File licenseFile;
287-
323+
288324
public File getLicenseFile() {
289325
return licenseFile;
290326
}
@@ -666,7 +702,10 @@ protected Packager createPackager() throws Exception {
666702
.classpath(defaultIfNull(classpath, extension.getClasspath()))
667703
.copyDependencies(defaultIfNull(copyDependencies, extension.getCopyDependencies()))
668704
.createTarball(defaultIfNull(createTarball, extension.getCreateTarball()))
705+
.tarballName(defaultIfNull(tarballName, extension.getTarballName()))
669706
.createZipball(defaultIfNull(createZipball, extension.getCreateZipball()))
707+
.zipballName(defaultIfNull(zipballName, extension.getZipballName()))
708+
.iconFile(defaultIfNull(iconFile, extension.getIconFile()))
670709
.customizedJre(defaultIfNull(customizedJre, extension.getCustomizedJre()))
671710
.description(defaultIfNull(appDescription, extension.getDescription()))
672711
.displayName(defaultIfNull(displayName, extension.getDisplayName()))

0 commit comments

Comments
 (0)