Skip to content

New Command: "sync"

Compare
Choose a tag to compare
@tristanisham tristanisham released this 13 May 01:01
· 347 commits to master since this release

Full Changelog: v0.2.1...v0.2.2

New Command: "sync"

Have you tried to build a Zig program only to realize that the build.zig, standard library, or other API has gone through too many breaking changes and you have no idea what version you'll need to build it? Now, with zvm sync you can lock your repo to a specific Zig version, allowing your users to continue to work with the Zig files in your repo without you having to update your compatibility by hand. This feature is great for open source developers, package maintainers, and anyone who's not on the bleeding edge.

How to use

To setup your repo to support zvm sync, prepend a configuration variable to your zig.build file, like: //! zvm-lock: 0.10.1

Example: (Look at the first line)

//! zvm-lock: 0.10.1
const std = @import("std");

// Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external
// runner.
pub fn build(b: *std.Build) void {
    // Standard target options allows the person running `zig build` to choose
    // what target to build for. Here we do not override the defaults, which
    // means any target is allowed, and the default is native. Other options
    // for restricting supported target set are available.
    const target = b.standardTargetOptions(.{});
    //...

Then, when user's run zvm sync zvm will switch or download (after the user accepts a prompt) the correct Zig version.