Skip to content

Rust implementation: single static binary, argv[0]-dispatch shims#1

Merged
dave-oneapp merged 7 commits into
mainfrom
rust
Jul 24, 2026
Merged

Rust implementation: single static binary, argv[0]-dispatch shims#1
dave-oneapp merged 7 commits into
mainfrom
rust

Conversation

@dave-oneapp

@dave-oneapp dave-oneapp commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Full port of jolta from POSIX sh to dependency-free Rust (std only — downloads still shell out to curl/tar, keeping the supply chain empty).

  • One binary, two personalities: invoked as jolta it's the CLI; invoked through a shim symlink (java, javac, …) it dispatches on argv[0], resolves the pinned JDK, sets JAVA_HOME, and execs the real tool — the Volta architecture, with zero script parsing on the hot path.
  • ~7× faster resolution: ~1.7ms vs ~12ms for the sh version; total shim'd java -version is indistinguishable from bare java.
  • JDK distro selection: corretto@21 / graalvm-25 in pins and installs; temurin (default), corretto, graalvm, oracle downloadable; zulu/openjdk recognized when matching installed JDKs. Distro-qualified pins are strict.
  • Terminal UI: colored, glyphed output and an animated download progress bar (spinner, bar, percent, throughput); plain when piped, NO_COLOR respected.
  • Full command parity with the sh version, plus jolta jdks (machine-readable listing).
  • Shared conformance suite: test/smoke.sh drives any binary via JOLTA_BIN — both implementations pass the identical checks (now 21), including live Corretto and Temurin installs from the real vendor endpoints.
  • install.sh builds from source (needs cargo) until prebuilt release binaries are published.

Test plan

  • cargo build --release && ./test/smoke.sh — offline checks
  • JOLTA_TEST_NETWORK=1 ./test/smoke.sh — including real Adoptium/Corretto downloads
  • Live install on macOS arm64 (jolta setup, jolta doctor, pinned-project resolution)

dave-oneapp and others added 3 commits July 24, 2026 09:29
Full port of the sh implementation to dependency-free Rust (std only;
downloads still shell out to curl/tar). One binary is both the CLI and
every shim — shims are symlinks to it, dispatched on argv[0], like
Volta. Resolution is ~1.7ms vs ~12ms for the sh version.

test/smoke.sh stays as the shared conformance suite (now driving the
binary via JOLTA_BIN, with a machine-readable 'jolta jdks' command);
all 19 checks pass including live Adoptium auto-install. install.sh
builds from source until prebuilt binaries are published.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Pins and installs can name a distro: corretto@21 / graalvm-25 (also in
.java-version). Downloadable: temurin (default), corretto, graalvm,
oracle — plus zulu/openjdk recognized when matching installed JDKs via
release IMPLEMENTOR and path. A distro-qualified pin only matches that
distro and auto-installs it when missing.

Terminal UI: colored, glyphed output across commands and an animated
download progress bar (spinner, bar, percent, size, throughput) drawn
by polling the file against the redirect chain's Content-Length; plain
output when piped, NO_COLOR and TERM=dumb respected. Fixes the
content-length probe (curl -w has no such variable; parse the header).

Conformance suite grows to 21 checks: distro-aware resolution (corretto
pin prefers corretto over same-major openjdk; wrong-distro pin fails
offline) plus live corretto@21 and temurin@25 installs verified.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dave-oneapp

dave-oneapp commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

Added to this PR: JDK distro selection (corretto@21, graalvm-25 in pins and installs; temurin/corretto/graalvm/oracle downloadable, zulu/openjdk recognized for matching) and a terminal UI — colored glyphed output plus an animated download progress bar with live throughput. Conformance suite is now 21 checks including live Corretto and Temurin installs.

ui (terminal styling), paths, jdk (spec parsing + discovery), resolve
(matching/cache/pin/auto-install), download (progress bar), install
(vendor URLs + install), commands (CLI handlers), and a slim main.rs
for dispatch and shim mode. Pure code movement; no behavior change.
@dave-oneapp
dave-oneapp merged commit 41b5f01 into main Jul 24, 2026
@dave-oneapp
dave-oneapp deleted the rust branch July 24, 2026 18:05
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.

1 participant