feat: bundle platform-specific cmakefmt binaries (draft)#9
Draft
puneetmatharu wants to merge 2 commits into
Draft
feat: bundle platform-specific cmakefmt binaries (draft)#9puneetmatharu wants to merge 2 commits into
puneetmatharu wants to merge 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cmakefmtbinary per platform, embeds it into a platform-specific.vsix, and uploads the result as a workflow artifact.src/extension.tsto 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).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}--targetdarwin-arm64aarch64-apple-darwincmakefmt-{VERSION}-aarch64-apple-darwin.tar.gzdarwin-x64x86_64-apple-darwincmakefmt-{VERSION}-x86_64-apple-darwin.tar.gzlinux-x64x86_64-unknown-linux-gnucmakefmt-{VERSION}-x86_64-unknown-linux-gnu.tar.gzlinux-arm64aarch64-unknown-linux-gnucmakefmt-{VERSION}-aarch64-unknown-linux-gnu.tar.gzalpine-x64x86_64-unknown-linux-muslcmakefmt-{VERSION}-x86_64-unknown-linux-musl.tar.gzwin32-x64x86_64-pc-windows-msvccmakefmt-{VERSION}-x86_64-pc-windows-msvc.zipwin32-arm64aarch64-pc-windows-msvclinux-armhfarmv7-unknown-linux-gnueabihfalpine-arm64aarch64-unknown-linux-muslCMAKEFMT_VERSIONis pinned as a workflow-level env var — bump it in one place when a new upstream release ships.Remaining work checklist
.tar.gz/.ziparchives against actual v1.4.0 release assets. Thefind _extract -name cmakefmtapproach in the workflow is robust but should be smoke-tested against the real download.darwin-*targets.win32-x64.actions/upload-artifactto a commit SHA — currently using@v4tag; pin for supply-chain safety, consistent with the rest of the repo.extension.ts—process.platformreturns"linux"on Alpine, so alpine users fall back to PATH even whenalpine-x64is bundled. Add musl/Alpine detection as a follow-up.ovsx publishstep once.vsixartifacts are inspected and signing is configured.cmakefmt.onSavesetting — already marked deprecated inpackage.json; drop it in a v2.0.0 breaking-change release.cmakefmt/cmakefmtforwin32-arm64,linux-armhf, andalpine-arm64Rust triples.Test plan
cmakefmt_versionblank (uses pinned1.4.0). Confirm all 6 matrix jobs complete and each produces a.vsixartifact..vsix:unzip vscode-cmakefmt-linux-x64.vsix -d out/, confirmextension/bin/cmakefmt-linux-x64exists and is executable (file+chmodcheck).code --install-extension vscode-cmakefmt-linux-x64.vsix, open aCMakeLists.txt, run Format Document — confirm formatting works withoutcmakefmton PATH.cmakefmt.executablePathto a custom binary path, confirm it takes precedence over the bundled binary..vsixon a platform with no bundled binary (e.g.alpine-arm64), confirm it falls back tocmakefmton PATH and shows a clear error if not found.npm run package(the existing CI job) still produces a valid universal.vsixwith an emptybin/directory — no regressions.