Skip to content

Fix icon resolution in app bundling by using jdeploy-bundle jar#442

Merged
shannah merged 7 commits intomasterfrom
claude/fix-bundle-publishing-urls-Zzn3y
Mar 15, 2026
Merged

Fix icon resolution in app bundling by using jdeploy-bundle jar#442
shannah merged 7 commits intomasterfrom
claude/fix-bundle-publishing-urls-Zzn3y

Conversation

@shannah
Copy link
Copy Markdown
Owner

@shannah shannah commented Mar 14, 2026

Summary

This change improves icon resolution during app bundling by preferring the jar file from the jdeploy-bundle directory, which has the icon.png file co-located alongside it. This ensures the Bundler can correctly resolve icon resources relative to the app URL.

Key Changes

  • Modified loadAppInfo() in PublishBundleService: Updated jar URL resolution logic to:

    • First check if a bundled jar exists in the jdeploy-bundle directory and use it if available
    • Fall back to the original jar path if no bundled jar exists
    • When falling back, automatically copy icon.png from the project root to the jar's directory if it doesn't already exist there
  • Added comprehensive test coverage:

    • buildBundles_usesJdeployBundleJar_whenAvailable(): Verifies that the bundled jar from jdeploy-bundle is used for icon resolution when available
    • buildBundles_copiesIcon_whenNoJdeployBundle(): Verifies that icon.png is copied next to the jar when the bundled version doesn't exist

Implementation Details

The change implements a two-tier approach:

  1. Primary path: Use the jar from jdeploy-bundle (created by PackageService.bundleIcon during makePackage), which already has icon.png co-located
  2. Fallback path: If no bundled jar exists, copy icon.png from the project root to the jar's directory to ensure it's available for the Bundler to resolve

This ensures icon resources are always accessible relative to the app URL, regardless of whether the bundled version is available.

https://claude.ai/code/session_01AfV1do5j6ChgV2nA5BePer

claude added 7 commits March 14, 2026 14:57
The Bundler resolves icon.png relative to the app URL (jar path).
When jdeploy.jar points to target/myapp.jar, the Bundler looked for
target/icon.png which doesn't exist (icon.png is in the project root).
This caused all platform bundle builds to fail silently, resulting in
no bundle JARs uploaded and no url/sha256 fields in published artifacts.

Fix: use the jar from jdeploy-bundle/ directory (created by makePackage)
which already has icon.png co-located. Falls back to copying icon.png
from the project root to the jar's directory when jdeploy-bundle is
unavailable.

https://claude.ai/code/session_01AfV1do5j6ChgV2nA5BePer
The JSONParser (codename1) parses JSON `true` as the String "true" by
default, not as Boolean.TRUE. This caused `Boolean.TRUE.equals(enabled)`
to always return false, so no artifact platforms were ever detected as
enabled and no bundles were built at publish time.

https://claude.ai/code/session_01AfV1do5j6ChgV2nA5BePer
Adds a direct unit test proving that com.codename1.io.JSONParser
returns String "true" (not Boolean.TRUE) for JSON boolean values.
This confirms the root cause of the bundle publishing bug where
Boolean.TRUE.equals("true") silently returned false.

https://claude.ai/code/session_01AfV1do5j6ChgV2nA5BePer
The bundle download URLs were constructed using the bare version (e.g.
"1.0.4") but the GitHub release tag includes a "v" prefix (e.g.
"v1.0.4"), causing 404 errors when downloading bundles.

Changed maybePublishBundles() to use getRefName() which returns the
actual release tag (from GITHUB_REF_NAME) instead of getVersion().

Also added a wiremock integration test that verifies bundle URLs use the
git tag (with v-prefix) when githubRefName is set, and strengthened
the existing URL assertions to verify the complete download path.

https://claude.ai/code/session_01AfV1do5j6ChgV2nA5BePer
PublishBundleService.loadAppInfo() was not setting the jdeployRegistryUrl
on AppInfo, causing app.xml in native bundles to contain
registry-url='null'. This broke the auto-update mechanism in installed
apps.

Added PackagingConfig dependency to PublishBundleService and set the
registry URL from the jdeploy section of package.json (or fallback to
the default https://www.jdeploy.com/), matching the logic in
PackageService.loadAppInfo().

Added unit tests verifying both default and custom registry URL values
are correctly passed through to Bundler.runit() via AppInfo.

https://claude.ai/code/session_01AfV1do5j6ChgV2nA5BePer
JAR (ZIP-based) format does not preserve POSIX file permissions, causing
the Client4JLauncher binary in macOS .app bundles to lose its executable
bit. This resulted in "permission denied" errors when opening installed apps.

- PublishBundleService: Mac/Linux bundles now use tar.gz with permission
  preservation; Windows bundles continue using JAR
- PrebuiltBundleDownloader: detects archive format by URL extension and
  uses appropriate extraction (tar.gz with permission restore, or JAR)
- BundleArtifact: renamed jarFile->file and getJarFile()->getFile()
  since artifacts are no longer always JARs
- Old JAR-format Mac bundles still work (backward compatible URL detection)

https://claude.ai/code/session_01AfV1do5j6ChgV2nA5BePer
Use tar.gz consistently for all bundle artifacts (Windows, Mac, Linux)
instead of only Mac/Linux. Removes the now-unused wrapInJar and
addDirectoryToJar methods and JAR-related imports.

https://claude.ai/code/session_01AfV1do5j6ChgV2nA5BePer
@shannah shannah merged commit 143528d into master Mar 15, 2026
18 checks passed
@shannah shannah deleted the claude/fix-bundle-publishing-urls-Zzn3y branch March 15, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants