diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-10-18 18:30:50 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-10-19 14:24:35 -0400 |
| commit | 10200970bb3700dd36807b4df1b1e327da98bbea (patch) | |
| tree | b9a724cbffc2d25300c86a895f9834d67bef1388 /src | |
| parent | b87353a17f4fe297b83d2f75cbf1c737ebb71c74 (diff) | |
| download | zig-10200970bb3700dd36807b4df1b1e327da98bbea.tar.gz zig-10200970bb3700dd36807b4df1b1e327da98bbea.zip | |
build system: fixups to --seed mechanism
* support 0x prefixed hex code for CLI seed arguments
* don't change the build summary; the printed CLI on build runner
failure is sufficient
* use `std.crypto.random` instead of system time for entropy
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.zig | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig index 02a33a5a9d..b435988f28 100644 --- a/src/main.zig +++ b/src/main.zig @@ -4906,6 +4906,7 @@ pub const usage_build = \\ --global-cache-dir [path] Override path to global Zig cache directory \\ --zig-lib-dir [arg] Override path to Zig lib directory \\ --build-runner [file] Override path to build runner + \\ --seed [integer] For shuffling dependency traversal order (default: random) \\ --fetch Exit after fetching dependency tree \\ -h, --help Print this help and exit \\ @@ -4930,8 +4931,6 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi var reference_trace: ?u32 = null; var debug_compile_errors = false; var fetch_only = false; - const micros: u32 = @truncate(@as(u64, @bitCast(std.time.microTimestamp()))); - var seed: []const u8 = try std.fmt.allocPrint(arena, "{}", .{micros}); const argv_index_exe = child_argv.items.len; _ = try child_argv.addOne(); @@ -4947,7 +4946,10 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi const argv_index_global_cache_dir = child_argv.items.len; _ = try child_argv.addOne(); - try child_argv.appendSlice(&[_][]const u8{ "--seed", seed }); + try child_argv.appendSlice(&.{ + "--seed", + try std.fmt.allocPrint(arena, "0x{x}", .{std.crypto.random.int(u32)}), + }); const argv_index_seed = child_argv.items.len - 1; { |
