diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-05-16 20:00:47 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-05-16 20:39:01 -0700 |
| commit | 728ce2d7c18e23ca6c36d86f4ee1ea4ce3ac81e2 (patch) | |
| tree | b84ffae450a01a7fa2cf22d87176fb633125b359 /lib/std/Build/Cache.zig | |
| parent | df5085bde012773b974f58e8ee28ed90ff686468 (diff) | |
| download | zig-728ce2d7c18e23ca6c36d86f4ee1ea4ce3ac81e2.tar.gz zig-728ce2d7c18e23ca6c36d86f4ee1ea4ce3ac81e2.zip | |
tweaks to --build-id
* build.zig: the result of b.option() can be assigned directly in many
cases thanks to the return type being an optional
* std.Build: make the build system aware of the
std.Build.Step.Compile.BuildId type when used as an option.
- remove extraneous newlines in error logs
* simplify caching logic
* simplify hexstring parsing tests and use a doc test
* simplify hashing logic. don't use an optional when the `none` tag
already provides this meaning.
* CLI: fix incorrect linker arg parsing
Diffstat (limited to 'lib/std/Build/Cache.zig')
| -rw-r--r-- | lib/std/Build/Cache.zig | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/std/Build/Cache.zig b/lib/std/Build/Cache.zig index 17429c0370..e991aff5b5 100644 --- a/lib/std/Build/Cache.zig +++ b/lib/std/Build/Cache.zig @@ -235,6 +235,10 @@ pub const HashHelper = struct { .none => {}, } }, + std.Build.Step.Compile.BuildId => switch (x) { + .none, .fast, .uuid, .sha1, .md5 => hh.add(std.meta.activeTag(x)), + .hexstring => |hex_string| hh.addBytes(hex_string.toSlice()), + }, else => switch (@typeInfo(@TypeOf(x))) { .Bool, .Int, .Enum, .Array => hh.addBytes(mem.asBytes(&x)), else => @compileError("unable to hash type " ++ @typeName(@TypeOf(x))), |
