| ... | ... | @@ -89,6 +89,7 @@ dep_prefix: []const u8 = "", |
| 89 | 89 | modules: std.StringArrayHashMap(*Module), |
| 90 | 90 | |
| 91 | 91 | named_writefiles: std.StringArrayHashMap(*Step.WriteFile), |
| 92 | named_lazy_paths: std.StringArrayHashMap(LazyPath), |
| 92 | 93 | /// A map from build root dirs to the corresponding `*Dependency`. This is shared with all child |
| 93 | 94 | /// `Build`s. |
| 94 | 95 | initialized_deps: *InitializedDepMap, |
| ... | ... | @@ -300,8 +301,9 @@ pub fn create( |
| 300 | 301 | .install_path = undefined, |
| 301 | 302 | .args = null, |
| 302 | 303 | .host = graph.host, |
| 303 | | .modules = std.StringArrayHashMap(*Module).init(arena), |
| 304 | | .named_writefiles = std.StringArrayHashMap(*Step.WriteFile).init(arena), |
| 304 | .modules = .init(arena), |
| 305 | .named_writefiles = .init(arena), |
| 306 | .named_lazy_paths = .init(arena), |
| 305 | 307 | .initialized_deps = initialized_deps, |
| 306 | 308 | .pkg_hash = "", |
| 307 | 309 | .available_deps = available_deps, |
| ... | ... | @@ -393,8 +395,9 @@ fn createChildOnly( |
| 393 | 395 | .glibc_runtimes_dir = parent.glibc_runtimes_dir, |
| 394 | 396 | .host = parent.host, |
| 395 | 397 | .dep_prefix = parent.fmt("{s}{s}.", .{ parent.dep_prefix, dep_name }), |
| 396 | | .modules = std.StringArrayHashMap(*Module).init(allocator), |
| 397 | | .named_writefiles = std.StringArrayHashMap(*Step.WriteFile).init(allocator), |
| 398 | .modules = .init(allocator), |
| 399 | .named_writefiles = .init(allocator), |
| 400 | .named_lazy_paths = .init(allocator), |
| 398 | 401 | .initialized_deps = parent.initialized_deps, |
| 399 | 402 | .pkg_hash = pkg_hash, |
| 400 | 403 | .available_deps = pkg_deps, |
| ... | ... | @@ -1060,6 +1063,10 @@ pub fn addNamedWriteFiles(b: *Build, name: []const u8) *Step.WriteFile { |
| 1060 | 1063 | return wf; |
| 1061 | 1064 | } |
| 1062 | 1065 | |
| 1066 | pub fn addNamedLazyPath(b: *Build, name: []const u8, lp: LazyPath) void { |
| 1067 | b.named_lazy_paths.put(b.dupe(name), lp.dupe(b)) catch @panic("OOM"); |
| 1068 | } |
| 1069 | |
| 1063 | 1070 | pub fn addWriteFiles(b: *Build) *Step.WriteFile { |
| 1064 | 1071 | return Step.WriteFile.create(b); |
| 1065 | 1072 | } |
| ... | ... | @@ -1902,6 +1909,12 @@ pub const Dependency = struct { |
| 1902 | 1909 | }; |
| 1903 | 1910 | } |
| 1904 | 1911 | |
| 1912 | pub fn namedLazyPath(d: *Dependency, name: []const u8) LazyPath { |
| 1913 | return d.builder.named_lazy_paths.get(name) orelse { |
| 1914 | panic("unable to find named lazypath '{s}'", .{name}); |
| 1915 | }; |
| 1916 | } |
| 1917 | |
| 1905 | 1918 | pub fn path(d: *Dependency, sub_path: []const u8) LazyPath { |
| 1906 | 1919 | return .{ |
| 1907 | 1920 | .dependency = .{ |