Skip to content

feat: bundle platform-specific cmakefmt binaries (draft)#9

Draft
puneetmatharu wants to merge 2 commits into
mainfrom
feat/bundle-platform-binaries
Draft

feat: bundle platform-specific cmakefmt binaries (draft)#9
puneetmatharu wants to merge 2 commits into
mainfrom
feat/bundle-platform-binaries

Conversation

@puneetmatharu
Copy link
Copy Markdown
Contributor

@puneetmatharu puneetmatharu commented May 10, 2026

Summary

  • Replace the single-platform publish workflow with a 6-target matrix that downloads the upstream cmakefmt binary per platform, embeds it into a platform-specific .vsix, and uploads the result as a workflow artifact.
  • Teach src/extension.ts to prefer the bundled binary (bin/cmakefmt-<target>[.exe]) over PATH, with a clean three-step resolution: user override → bundled binary → PATH fallback.
  • bin/ is gitignored (binaries never committed) but not excluded from .vscodeignore (so it is included in the .vsix).
  • README updated with a TENTATIVE note that most users won't need a manual install.

This PR does not publish anything. The workflow only produces .vsix artifacts for local inspection. Publishing steps are intentionally omitted — see checklist below.


VS Code target → Rust triple mapping

Verified against cmakefmt v1.4.0 (released 2026-05-02).
Asset URL pattern: https://github.com/cmakefmt/cmakefmt/releases/download/v{VERSION}/cmakefmt-{VERSION}-{TRIPLE}.{tar.gz|zip}

VS Code --target Rust triple Archive Status
darwin-arm64 aarch64-apple-darwin cmakefmt-{VERSION}-aarch64-apple-darwin.tar.gz ✅ available
darwin-x64 x86_64-apple-darwin cmakefmt-{VERSION}-x86_64-apple-darwin.tar.gz ✅ available
linux-x64 x86_64-unknown-linux-gnu cmakefmt-{VERSION}-x86_64-unknown-linux-gnu.tar.gz ✅ available
linux-arm64 aarch64-unknown-linux-gnu cmakefmt-{VERSION}-aarch64-unknown-linux-gnu.tar.gz ✅ available
alpine-x64 x86_64-unknown-linux-musl cmakefmt-{VERSION}-x86_64-unknown-linux-musl.tar.gz ✅ available
win32-x64 x86_64-pc-windows-msvc cmakefmt-{VERSION}-x86_64-pc-windows-msvc.zip ✅ available
win32-arm64 aarch64-pc-windows-msvc ❌ blocked: needs upstream support
linux-armhf armv7-unknown-linux-gnueabihf ❌ blocked: needs upstream support
alpine-arm64 aarch64-unknown-linux-musl ❌ blocked: needs upstream support

CMAKEFMT_VERSION is pinned as a workflow-level env var — bump it in one place when a new upstream release ships.


Remaining work checklist

  • Verify archive structure — confirm the exact binary path inside .tar.gz/.zip archives against actual v1.4.0 release assets. The find _extract -name cmakefmt approach in the workflow is robust but should be smoke-tested against the real download.
  • macOS code signing / notarization — embedded binaries must be signed/notarized before macOS users can run them without a Gatekeeper prompt. This is the main blocker before shipping darwin-* targets.
  • Windows Authenticode signing — similar requirement for win32-x64.
  • Pin actions/upload-artifact to a commit SHA — currently using @v4 tag; pin for supply-chain safety, consistent with the rest of the repo.
  • Alpine detection in extension.tsprocess.platform returns "linux" on Alpine, so alpine users fall back to PATH even when alpine-x64 is bundled. Add musl/Alpine detection as a follow-up.
  • Open VSX publishing — add an ovsx publish step once .vsix artifacts are inspected and signing is configured.
  • Remove deprecated cmakefmt.onSave setting — already marked deprecated in package.json; drop it in a v2.0.0 breaking-change release.
  • Bump extension to v2.0.0 — signal the new zero-config install model once platform bundles ship publicly.
  • Upstream gaps — open or track issues in cmakefmt/cmakefmt for win32-arm64, linux-armhf, and alpine-arm64 Rust triples.

Test plan

  1. Trigger the workflow manually: Actions → Release → Run workflow, leave cmakefmt_version blank (uses pinned 1.4.0). Confirm all 6 matrix jobs complete and each produces a .vsix artifact.
  2. Inspect a .vsix: unzip vscode-cmakefmt-linux-x64.vsix -d out/, confirm extension/bin/cmakefmt-linux-x64 exists and is executable (file + chmod check).
  3. Install locally: code --install-extension vscode-cmakefmt-linux-x64.vsix, open a CMakeLists.txt, run Format Document — confirm formatting works without cmakefmt on PATH.
  4. User override: set cmakefmt.executablePath to a custom binary path, confirm it takes precedence over the bundled binary.
  5. PATH fallback: install the .vsix on a platform with no bundled binary (e.g. alpine-arm64), confirm it falls back to cmakefmt on PATH and shows a clear error if not found.
  6. Non-platform CI build: confirm npm run package (the existing CI job) still produces a valid universal .vsix with an empty bin/ directory — no regressions.

claude and others added 2 commits May 10, 2026 09:08
Add a matrix release workflow that downloads the matching cmakefmt
binary for each VS Code target (darwin-arm64/x64, linux-arm64/x64,
win32-x64) from GitHub Releases and packages it into a platform-specific
.vsix. Teach the extension to prefer the bundled binary over PATH when
cmakefmt.executablePath is left at its default.

Publishing is intentionally omitted from the new workflow; .vsix files
are uploaded as workflow artifacts for inspection only.
Add a matrix release workflow that downloads the upstream cmakefmt
binary for each supported VS Code target and packages it into a
platform-specific .vsix. The bundled binary is resolved at runtime
before falling back to PATH, giving users a zero-config install.

- .github/workflows/release.yml: replace single-platform publish job
  with a 6-target matrix (darwin-arm64/x64, linux-x64/arm64,
  alpine-x64, win32-x64); publishing intentionally omitted pending
  inspection and code-signing setup.
- src/extension.ts: add resolveBinary() / platformTarget() helpers;
  thread ExtensionContext into format() so the bundled binary under
  bin/cmakefmt-<target>[.exe] is preferred over PATH.
- package.json: update executablePath description to mention bundling.
- .gitignore: exclude bin/ so downloaded binaries are never committed.
- README.md: add TENTATIVE note that most users need no manual install.
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