build: fix WriteFile and addCSourceFiles not adding LazyPath deps

Adds a missing call to addLazyPathDependenciesOnly in
std.Build.Module.addCSourceFiles.  Also fixes an issue in
std.Build.Step.WriteFile where it wasn't updating all the GeneratedFile
instances for every directory.  To fix the second issue, I removed
all the GeneratedFile instances and now all files/directories reference
the steps main GeneratedFile via sub paths.
This commit is contained in:
Jonathan Marler
2024-07-02 06:15:29 -06:00
committed by Andrew Kelley
parent b67caf72e3
commit d9f1a952b8
12 changed files with 96 additions and 47 deletions

View File

@@ -51,10 +51,11 @@ fn addExpect(
if (mem.indexOf(u8, annotated_case_name, test_filter)) |_| break;
} else if (self.test_filters.len > 0) return;
const write_src = b.addWriteFile("source.zig", source);
const write_files = b.addWriteFiles();
const source_zig = write_files.add("source.zig", source);
const exe = b.addExecutable(.{
.name = "test",
.root_source_file = write_src.files.items[0].getPath(),
.root_source_file = source_zig,
.optimize = optimize_mode,
.target = b.graph.host,
.error_tracing = mode_config.error_tracing,