Skip to content

Support native-aware wrapper install/update flows#8

Open
realhaley wants to merge 4 commits into
maxandersen:mainfrom
realhaley:feature/native-wrapper-bundle-2458
Open

Support native-aware wrapper install/update flows#8
realhaley wants to merge 4 commits into
maxandersen:mainfrom
realhaley:feature/native-wrapper-bundle-2458

Conversation

@realhaley
Copy link
Copy Markdown

@realhaley realhaley commented May 15, 2026

Closes jbangdev#2458

What this changes

This PR adds a first pass at native-aware wrapper install/update behavior.

Wrapper behavior

  • when JBANG_USE_NATIVE=true, wrapper scripts now:
    • look for a native binary first
    • try downloading an OS/arch-specific native bundle if the binary is missing
    • fall back to the generic bundle if no native bundle is available
    • fall back to jbang.jar execution if the installed bundle does not contain a native binary

Native-aware update/install path

  • jbang version --update and install flow now:
    • use the same native-aware bundle resolution when JBANG_USE_NATIVE=true
    • copy native binaries when present
    • write jbang.bin(.exe).new alongside jbang.jar.new for existing installs
  • wrapper startup now promotes pending native .new files into place

Configurable base URL

  • added JBANG_DOWNLOAD_BASEURL to override the release base URL
  • this is used for:
    • wrapper bootstrap downloads
    • Java-side install/update downloads
    • version check (version.txt)
  • intended to make local testing possible against a fake release tree or local HTTP server

Build / CI / release bits

  • adds native bundle tasks:
    • nativeDistZip
    • nativeDistTar
  • adds CI steps to build and upload native bundles
  • tag/release workflow downloads those bundles before release
  • JReleaser config updated toward including native bundle artifacts

Notes

Current public releases do not yet publish the new OS/arch-specific native bundles, so wrapper fallback to generic bundles is still expected until release artifacts are wired all the way through.

This PR also adds:

  • docs/native-wrapper-testing.md

with a local file:// and local HTTP testing flow for the new behavior.

Tested

  • ./gradlew -q compileJava
  • bash -n src/main/scripts/jbang
  • local smoke test using JBANG_DOWNLOAD_BASEURL=file://...
  • local native-requested fallback flow when no native bundle exists

- Native bundles now respect JBANG_DOWNLOAD_VERSION (consistent with generic bundles)
- Added JBANG_DOWNLOAD_BASEURL support to jbang.cmd (was missing)
- Fixed unreachable code in VersionChecker.retrieveLatestVersion()
- Improved exception logging in native bundle fallback
- Replaced Stream.forEach with for-loop (Java best practice for side effects)
- Fixed continue/return bug in copyJBangFiles loop
- Used Arrays.asList for Java 8 compatibility
- Added cross-reference comments to keep Java/bash/PS1 implementations in sync
- Documented new env vars in installation.adoc with comprehensive table
- Created comprehensive test plan in docs/native-wrapper-test-plan.md

All changes compile and pass spotless formatting checks.
- Remove docs/native-wrapper-test-plan.md
- Remove docs/native-wrapper-testing.md

Test documentation should not be in main documentation tree.
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.

support native install/update/run in scripts

2 participants