| ... | ... | @@ -90,6 +90,8 @@ host: ResolvedTarget, |
| 90 | 90 | dep_prefix: []const u8 = "", |
| 91 | 91 | |
| 92 | 92 | modules: std.StringArrayHashMap(*Module), |
| 93 | |
| 94 | named_writefiles: std.StringArrayHashMap(*Step.WriteFile), |
| 93 | 95 | /// A map from build root dirs to the corresponding `*Dependency`. This is shared with all child |
| 94 | 96 | /// `Build`s. |
| 95 | 97 | initialized_deps: *InitializedDepMap, |
| ... | ... | @@ -273,6 +275,7 @@ pub fn create( |
| 273 | 275 | .args = null, |
| 274 | 276 | .host = host, |
| 275 | 277 | .modules = std.StringArrayHashMap(*Module).init(allocator), |
| 278 | .named_writefiles = std.StringArrayHashMap(*Step.WriteFile).init(allocator), |
| 276 | 279 | .initialized_deps = initialized_deps, |
| 277 | 280 | .available_deps = available_deps, |
| 278 | 281 | }; |
| ... | ... | @@ -360,6 +363,7 @@ fn createChildOnly(parent: *Build, dep_name: []const u8, build_root: Cache.Direc |
| 360 | 363 | .host = parent.host, |
| 361 | 364 | .dep_prefix = parent.fmt("{s}{s}.", .{ parent.dep_prefix, dep_name }), |
| 362 | 365 | .modules = std.StringArrayHashMap(*Module).init(allocator), |
| 366 | .named_writefiles = std.StringArrayHashMap(*Step.WriteFile).init(allocator), |
| 363 | 367 | .initialized_deps = parent.initialized_deps, |
| 364 | 368 | .available_deps = pkg_deps, |
| 365 | 369 | }; |
| ... | ... | @@ -981,6 +985,12 @@ pub fn addWriteFile(self: *Build, file_path: []const u8, data: []const u8) *Step |
| 981 | 985 | return write_file_step; |
| 982 | 986 | } |
| 983 | 987 | |
| 988 | pub fn addNamedWriteFiles(b: *Build, name: []const u8) *Step.WriteFile { |
| 989 | const wf = Step.WriteFile.create(b); |
| 990 | b.named_writefiles.put(b.dupe(name), wf) catch @panic("OOM"); |
| 991 | return wf; |
| 992 | } |
| 993 | |
| 984 | 994 | pub fn addWriteFiles(b: *Build) *Step.WriteFile { |
| 985 | 995 | return Step.WriteFile.create(b); |
| 986 | 996 | } |
| ... | ... | @@ -1711,6 +1721,12 @@ pub const Dependency = struct { |
| 1711 | 1721 | }; |
| 1712 | 1722 | } |
| 1713 | 1723 | |
| 1724 | pub fn namedWriteFiles(d: *Dependency, name: []const u8) *Step.WriteFile { |
| 1725 | return d.builder.named_writefiles.get(name) orelse { |
| 1726 | panic("unable to find named writefiles '{s}'", .{name}); |
| 1727 | }; |
| 1728 | } |
| 1729 | |
| 1714 | 1730 | pub fn path(d: *Dependency, sub_path: []const u8) LazyPath { |
| 1715 | 1731 | return .{ |
| 1716 | 1732 | .dependency = .{ |