diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-12-30 17:05:17 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-01-02 13:16:17 -0700 |
| commit | d6c5602d4665ba4e9e7c0b7f42bd00b2489d420c (patch) | |
| tree | c234262f9c98e834ed470fd5fddf18c04cad94d2 /src/Compilation.zig | |
| parent | e36718165cdc29b777392a3a343d92ccd1c6acf3 (diff) | |
| download | zig-d6c5602d4665ba4e9e7c0b7f42bd00b2489d420c.tar.gz zig-d6c5602d4665ba4e9e7c0b7f42bd00b2489d420c.zip | |
stage2: fix CLI not populating output binary files
This fixes a regression in this branch that can be reproduced with the
following steps:
1. `zig build-exe hello.zig`
2. delete the "hello" binary
3. `zig build-exe hello.zig`
4. observe that the "hello" binary is missing
This happened because it was a cache hit, but nothing got copied to the
output directory.
This commit sets CacheMode to incremental - even for stage1 - when the
CLI requests `disable_lld_caching` (this option should be renamed),
resulting in the main Compilation to be repeated (uncached) for stage1,
populating the binary into the cwd as expected.
For stage2 the result is even better: the incremental compilation system
will look for build artifacts to incrementally compile, and start fresh
if not found.
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index ac48804848..ddf331d4f3 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -899,7 +899,10 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { break :blk build_options.is_stage1; }; - const cache_mode = if (use_stage1) CacheMode.whole else options.cache_mode; + const cache_mode = if (use_stage1 and !options.disable_lld_caching) + CacheMode.whole + else + options.cache_mode; // Make a decision on whether to use LLVM or our own backend. const use_llvm = build_options.have_llvm and blk: { @@ -1951,8 +1954,6 @@ pub fn update(comp: *Compilation) !void { }; } - comp.emitOthers(); - assert(comp.bin_file.lock == null); comp.bin_file.lock = man.toOwnedLock(); return; |
