Skip to content

Commit 336c00b

Browse files
committed
reintroduce version override flag
and prepare for 0.6.1 release
1 parent 4b60dd9 commit 336c00b

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

build.zig

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const std = @import("std");
2+
const zon = @import("build.zig.zon");
23

34
pub fn build(b: *std.Build) !void {
45
const target = b.standardTargetOptions(.{});
56
const optimize = b.standardOptimizeOption(.{});
6-
7-
const version = getVersion(b);
87
const enable_tracy = b.option(bool, "tracy", "Enable Tracy profiling") orelse false;
8+
const version = b.option([]const u8, "version", "Override the version of SuperHTML") orelse zon.version;
99

1010
const tracy = b.dependency("tracy", .{ .enable = enable_tracy });
1111
const scripty = b.dependency("scripty", .{
@@ -59,8 +59,7 @@ pub fn build(b: *std.Build) !void {
5959
const scopes = b.option([]const []const u8, "scope", "Enable this scope (all scopes are enabled when none is specified through this option), can be used multiple times") orelse &[0][]const u8{};
6060
options.addOption(bool, "verbose_logging", verbose_logging);
6161
options.addOption([]const []const u8, "enabled_scopes", scopes);
62-
options.addOption([]const u8, "version", version.string());
63-
options.addOption(Version.Kind, "version_kind", version);
62+
options.addOption([]const u8, "version", version);
6463

6564
const folders = b.dependency("known_folders", .{});
6665
const lsp = b.dependency("lsp_kit", .{});
@@ -72,9 +71,9 @@ pub fn build(b: *std.Build) !void {
7271
setupFetchLanguageSubtagRegistryStep(b, target);
7372

7473
const release = b.step("release", "Create release builds of Zine");
75-
if (version == .tag) {
76-
const zon = @import("build.zig.zon");
77-
if (std.mem.eql(u8, zon.version, version.tag[1..])) {
74+
const git_version = getGitVersion(b);
75+
if (git_version == .tag) {
76+
if (std.mem.eql(u8, version, git_version.tag[1..])) {
7877
setupReleaseStep(
7978
b,
8079
options,
@@ -86,7 +85,7 @@ pub fn build(b: *std.Build) !void {
8685
} else {
8786
release.dependOn(&b.addFail(b.fmt(
8887
"error: git tag does not match zon package version (zon: '{s}', git: '{s}')",
89-
.{ zon.version, version.tag[1..] },
88+
.{ version, git_version.tag[1..] },
9089
)).step);
9190
}
9291
} else {
@@ -386,7 +385,7 @@ const Version = union(Kind) {
386385
};
387386
}
388387
};
389-
fn getVersion(b: *std.Build) Version {
388+
fn getGitVersion(b: *std.Build) Version {
390389
const git_path = b.findProgram(&.{"git"}, &.{}) catch return .unknown;
391390
var out: u8 = undefined;
392391
const git_describe = std.mem.trim(

build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.{
22
.name = .superhtml,
3-
.version = "0.6.0",
3+
.version = "0.6.1",
44
.fingerprint = 0xc5e9aede3c1db363,
55
.minimum_zig_version = "0.15.1",
66
.dependencies = .{

src/html/Ast.zig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const Ast = @This();
22

3+
const builtin = @import("builtin");
34
const std = @import("std");
45
const assert = std.debug.assert;
56
const Allocator = std.mem.Allocator;
@@ -2160,7 +2161,9 @@ test "fuzz" {
21602161
return err;
21612162
};
21622163

2163-
std.debug.print("--begin--\n{s}\n\n", .{out.written()});
2164+
if (builtin.fuzz) {
2165+
std.debug.print("--begin--\n{s}\n\n", .{out.written()});
2166+
}
21642167

21652168
const ast: Ast = try .init(gpa, out.written(), .html, false);
21662169

0 commit comments

Comments
 (0)