@@ -89,6 +89,7 @@ dep_prefix: []const u8 = "",
8989modules : std .StringArrayHashMap (* Module ),
9090
9191named_writefiles : std .StringArrayHashMap (* Step .WriteFile ),
92+ named_lazy_paths : std .StringArrayHashMap (LazyPath ),
9293/// A map from build root dirs to the corresponding `*Dependency`. This is shared with all child
9394/// `Build`s.
9495initialized_deps : * InitializedDepMap ,
@@ -300,8 +301,9 @@ pub fn create(
300301 .install_path = undefined ,
301302 .args = null ,
302303 .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 ),
305307 .initialized_deps = initialized_deps ,
306308 .pkg_hash = "" ,
307309 .available_deps = available_deps ,
@@ -393,8 +395,9 @@ fn createChildOnly(
393395 .glibc_runtimes_dir = parent .glibc_runtimes_dir ,
394396 .host = parent .host ,
395397 .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 ),
398401 .initialized_deps = parent .initialized_deps ,
399402 .pkg_hash = pkg_hash ,
400403 .available_deps = pkg_deps ,
@@ -1060,6 +1063,10 @@ pub fn addNamedWriteFiles(b: *Build, name: []const u8) *Step.WriteFile {
10601063 return wf ;
10611064}
10621065
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+
10631070pub fn addWriteFiles (b : * Build ) * Step.WriteFile {
10641071 return Step .WriteFile .create (b );
10651072}
@@ -1902,6 +1909,12 @@ pub const Dependency = struct {
19021909 };
19031910 }
19041911
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+
19051918 pub fn path (d : * Dependency , sub_path : []const u8 ) LazyPath {
19061919 return .{
19071920 .dependency = .{
0 commit comments