aboutsummaryrefslogtreecommitdiff
path: root/test/src/RunTranslatedC.zig
diff options
context:
space:
mode:
authorJonathan Marler <johnnymarler@gmail.com>2024-07-02 06:15:29 -0600
committerAndrew Kelley <andrew@ziglang.org>2024-07-04 13:34:17 -0400
commitd9f1a952b8b0e19aafcf568b35cc220adbb4a7b5 (patch)
treed7333d6953a0fe37ac11b12a2456efebffd2a4c0 /test/src/RunTranslatedC.zig
parentb67caf72e31eefe08fe2dc8b17b4bca16e0e3cc6 (diff)
downloadzig-d9f1a952b8b0e19aafcf568b35cc220adbb4a7b5.tar.gz
zig-d9f1a952b8b0e19aafcf568b35cc220adbb4a7b5.zip
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.
Diffstat (limited to 'test/src/RunTranslatedC.zig')
-rw-r--r--test/src/RunTranslatedC.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/src/RunTranslatedC.zig b/test/src/RunTranslatedC.zig
index e437a33ba4..59f87c6a82 100644
--- a/test/src/RunTranslatedC.zig
+++ b/test/src/RunTranslatedC.zig
@@ -72,11 +72,13 @@ pub fn addCase(self: *RunTranslatedCContext, case: *const TestCase) void {
} else if (self.test_filters.len > 0) return;
const write_src = b.addWriteFiles();
- for (case.sources.items) |src_file| {
+ const first_case = case.sources.items[0];
+ const root_source_file = write_src.add(first_case.filename, first_case.source);
+ for (case.sources.items[1..]) |src_file| {
_ = write_src.add(src_file.filename, src_file.source);
}
const translate_c = b.addTranslateC(.{
- .root_source_file = write_src.files.items[0].getPath(),
+ .root_source_file = root_source_file,
.target = b.graph.host,
.optimize = .Debug,
});