Skip to content

Redo the public API to be simpler - #7

Merged
MichaelBelousov merged 8 commits into
mainfrom
abstracted-api
Sep 12, 2026
Merged

MichaelBelousov merged 8 commits into
mainfrom
abstracted-api

Conversation

@MichaelBelousov

Copy link
Copy Markdown
Contributor

Replace public API used in graphl with:

  • linkVelopack
  • addVelopackedAppDir

Consumers no longer construct the vpk pack command line, pin vpk in their own .config/dotnet-tools.json, or wire up MSVC for windows cross compilation

  • linkVelopack gains handle_libc for handling libc needed by velopack runtime on windows
  • addVelopackedAppDir runs vpk pack over a staged directory and returns the InstallDir step
  • vpk is installed into <build_root>/.velopack-tools, gated behind an install_vpk build option so users never accidentally install vpk, they must opt-in for the non-zig dependency

linkVelopack + addVelopackedAppDir now cover the whole flow. Consumers no
longer construct the `vpk pack` command line, pin `vpk` in their own
`.config/dotnet-tools.json`, or wire up an MSVC toolchain by hand.

- linkVelopack gains `handle_libc` (default on): for *-windows-msvc it
  resolves a --libc manifest, installs MSVC + the Windows SDK when the host
  has nothing usable, scopes a command-line --libc to the msvc compiles
  instead of leaving it on host-side tools, and applies the manifest to
  every reachable *-windows-msvc compile.
- addVelopackedAppDir runs `vpk pack` over a staged directory and returns
  the InstallDir step. addVelopackStep + outputDir are the escape hatch.
- vpk is installed into <build_root>/.velopack-tools, gated behind
  `install_vpk` so an un-gated build never reaches NuGet, and pinned by
  default to the release the bundled runtime comes from.
- linkVelopack links advapi32; the Rust core needs SystemFunction036.
- trim-velopack-lib deletes every compiler_builtins member, not just the
  first. arm64 ships 237 of them, which broke aarch64-windows-msvc.
- gen_zig_libc_msvc makes the SDK usable on case-sensitive filesystems by
  symlinking the spellings its headers and linker directives actually use.

Verified from a Linux host: x86_64/aarch64 linux-gnu and windows-msvc all
package end to end. macOS targets need a macOS host; vpk refuses otherwise.
extra_args becomes extra_vpk_args, and extra_vpk_path_args joins it for
flags whose value is a file this build produces (--releaseNotes and
friends); the pack step waits on whatever generates it. Between those two
and vpk_argv, anything the modelled options don't cover is reachable.

README gains a section on customizing the vpk command and links into
Velopack's own docs — the CLI reference per platform, signing, channels,
deltas, cross compiling, distributing.

test/sample is a minimal consumer (link the runtime, stage a payload,
package it, exercising both new arg options). test/package.sh builds and
packages it and checks vpk produced a nupkg, a RELEASES feed and an
installable artifact. The workflow is just the platform matrix plus
dotnet/zig setup calling that script.
Comment thread test/package.sh Resolved
Comment thread tools/gen_zig_libc_msvc.zig Resolved
Comment thread build.zig Resolved
Comment thread build.zig Resolved
Comment thread build.zig Resolved
- test/package.sh drops `zig build --fetch=all`; verified with a fresh
  --global-cache-dir that Zig fetches the lazy squashfs dep on its own and
  still builds the AppImage.
- VelopackedAppDirOptions holds a `pack_opts: VelopackOptions` instead of
  restating every field, which drops the comptime field-copy loop.
- FIXME on `depends_on`: needing it at all says the wrapper is too coarse.
- Trim the addVelopackStep doc comment.

The sample now defaults to the MSVC ABI on Windows hosts. Zig's native
Windows default is gnu, so CI was linking Velopack's MSVC-only runtime into
a gnu build and lld-link went looking for libLIBCMT.a. linkVelopack now
rejects a non-MSVC Windows target outright rather than failing at link.
gen_zig_libc_msvc.zig now just describes the SDK's layout and calls
symlink-bad-cased-include-tree.zig, which owns the technique and documents
why it works: the inconsistency is in the references, not the files, so the
pass enumerates every spelling the headers use (exhaustive) and guesses the
few that only exist inside binary /DEFAULTLIB: directives (not).

Verified against a synthetic SDK tree: lowercase aliases, enumerated
#include and comment(lib) spellings, multi-component paths, and the guessed
library variants all resolve.
`push` on every branch duplicated the `pull_request` run; restrict it to
main and cancel superseded runs.

macos-latest is macOS 26, whose SDK Zig 0.15.2 cannot link against — it
failed building its own build runner, before this package was reached.
Pinned to macos-15.
@foxnne

foxnne commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Looks good to me, this is an improvement!

@foxnne foxnne left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MichaelBelousov
MichaelBelousov marked this pull request as ready for review September 12, 2026 15:17
@MichaelBelousov
MichaelBelousov merged commit 539849d into main Sep 12, 2026
3 checks passed
@MichaelBelousov
MichaelBelousov deleted the abstracted-api branch September 12, 2026 15:20
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