mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Compilation: write CACHEDIR.TAG
Write a CACHEDIR.TAG file in the global and local cache directories. See #8210 for context and #14875 for a previous attempt. Co-authored-by: Manlio Perillo <manlio.perillo@gmail.com>
This commit is contained in:
parent
93957de6f4
commit
310625e290
1 changed files with 26 additions and 0 deletions
|
|
@ -1415,6 +1415,7 @@ pub const MiscTask = enum {
|
||||||
analyze_mod,
|
analyze_mod,
|
||||||
docs_copy,
|
docs_copy,
|
||||||
docs_wasm,
|
docs_wasm,
|
||||||
|
cachedir_tag,
|
||||||
|
|
||||||
@"musl crt1.o",
|
@"musl crt1.o",
|
||||||
@"musl rcrt1.o",
|
@"musl rcrt1.o",
|
||||||
|
|
@ -4601,6 +4602,8 @@ fn performAllTheWork(
|
||||||
comp.link_prog_node.increaseEstimatedTotalItems(comp.link_task_queue.queued_prelink.items.len);
|
comp.link_prog_node.increaseEstimatedTotalItems(comp.link_task_queue.queued_prelink.items.len);
|
||||||
comp.link_task_queue.start(comp);
|
comp.link_task_queue.start(comp);
|
||||||
|
|
||||||
|
comp.thread_pool.spawnWg(&work_queue_wait_group, workerTagCacheDirs, .{comp});
|
||||||
|
|
||||||
if (comp.emit_docs != null) {
|
if (comp.emit_docs != null) {
|
||||||
dev.check(.docs_emit);
|
dev.check(.docs_emit);
|
||||||
comp.thread_pool.spawnWg(&work_queue_wait_group, workerDocsCopy, .{comp});
|
comp.thread_pool.spawnWg(&work_queue_wait_group, workerDocsCopy, .{comp});
|
||||||
|
|
@ -5493,6 +5496,29 @@ fn workerDocsWasmFallible(comp: *Compilation, prog_node: std.Progress.Node) SubU
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn workerTagCacheDirs(comp: *Compilation) void {
|
||||||
|
for (&[_]Cache.Directory{ comp.dirs.global_cache, comp.dirs.local_cache }) |dir| {
|
||||||
|
tagCacheDir(dir.handle) catch |err| {
|
||||||
|
return comp.lockAndSetMiscFailure(
|
||||||
|
.cachedir_tag,
|
||||||
|
"unable to create CACHEDIR.TAG file in '{f}': {s}",
|
||||||
|
.{ dir, @errorName(err) },
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn tagCacheDir(dir: fs.Dir) !void {
|
||||||
|
const file = try dir.createFile("CACHEDIR.TAG", .{});
|
||||||
|
defer file.close();
|
||||||
|
try file.writeAll(
|
||||||
|
\\Signature: 8a477f597d28d172789f06886806bc55
|
||||||
|
\\# This file is a cache directory tag created by Zig.
|
||||||
|
\\# For information about cache directory tags, see: http://www.brynosaurus.com/cachedir/
|
||||||
|
\\
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
fn workerUpdateFile(
|
fn workerUpdateFile(
|
||||||
tid: usize,
|
tid: usize,
|
||||||
comp: *Compilation,
|
comp: *Compilation,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue