| ... | @@ -89,6 +89,7 @@ dep_prefix: []const u8 = "", | ... | @@ -89,6 +89,7 @@ dep_prefix: []const u8 = "", |
| 89 | modules: std.StringArrayHashMap(*Module), | 89 | modules: std.StringArrayHashMap(*Module), |
| 90 | | 90 | |
| 91 | named_writefiles: std.StringArrayHashMap(*Step.WriteFile), | 91 | named_writefiles: std.StringArrayHashMap(*Step.WriteFile), |
| | 92 | named_lazy_paths: std.StringArrayHashMap(LazyPath), |
| 92 | /// A map from build root dirs to the corresponding `*Dependency`. This is shared with all child | 93 | /// A map from build root dirs to the corresponding `*Dependency`. This is shared with all child |
| 93 | /// `Build`s. | 94 | /// `Build`s. |
| 94 | initialized_deps: *InitializedDepMap, | 95 | initialized_deps: *InitializedDepMap, |
| ... | @@ -300,8 +301,9 @@ pub fn create( | ... | @@ -300,8 +301,9 @@ pub fn create( |
| 300 | .install_path = undefined, | 301 | .install_path = undefined, |
| 301 | .args = null, | 302 | .args = null, |
| 302 | .host = graph.host, | 303 | .host = graph.host, |
| 303 | .modules = std.StringArrayHashMap(*Module).init(arena), | 304 | .modules = .init(arena), |
| 304 | .named_writefiles = std.StringArrayHashMap(*Step.WriteFile).init(arena), | 305 | .named_writefiles = .init(arena), |
| | 306 | .named_lazy_paths = .init(arena), |
| 305 | .initialized_deps = initialized_deps, | 307 | .initialized_deps = initialized_deps, |
| 306 | .pkg_hash = "", | 308 | .pkg_hash = "", |
| 307 | .available_deps = available_deps, | 309 | .available_deps = available_deps, |
| ... | @@ -393,8 +395,9 @@ fn createChildOnly( | ... | @@ -393,8 +395,9 @@ fn createChildOnly( |
| 393 | .glibc_runtimes_dir = parent.glibc_runtimes_dir, | 395 | .glibc_runtimes_dir = parent.glibc_runtimes_dir, |
| 394 | .host = parent.host, | 396 | .host = parent.host, |
| 395 | .dep_prefix = parent.fmt("{s}{s}.", .{ parent.dep_prefix, dep_name }), | 397 | .dep_prefix = parent.fmt("{s}{s}.", .{ parent.dep_prefix, dep_name }), |
| 396 | .modules = std.StringArrayHashMap(*Module).init(allocator), | 398 | .modules = .init(allocator), |
| 397 | .named_writefiles = std.StringArrayHashMap(*Step.WriteFile).init(allocator), | 399 | .named_writefiles = .init(allocator), |
| | 400 | .named_lazy_paths = .init(allocator), |
| 398 | .initialized_deps = parent.initialized_deps, | 401 | .initialized_deps = parent.initialized_deps, |
| 399 | .pkg_hash = pkg_hash, | 402 | .pkg_hash = pkg_hash, |
| 400 | .available_deps = pkg_deps, | 403 | .available_deps = pkg_deps, |
| ... | @@ -1060,6 +1063,10 @@ pub fn addNamedWriteFiles(b: *Build, name: []const u8) *Step.WriteFile { | ... | @@ -1060,6 +1063,10 @@ pub fn addNamedWriteFiles(b: *Build, name: []const u8) *Step.WriteFile { |
| 1060 | return wf; | 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 | pub fn addWriteFiles(b: *Build) *Step.WriteFile { | 1070 | pub fn addWriteFiles(b: *Build) *Step.WriteFile { |
| 1064 | return Step.WriteFile.create(b); | 1071 | return Step.WriteFile.create(b); |
| 1065 | } | 1072 | } |
| ... | @@ -1902,6 +1909,12 @@ pub const Dependency = struct { | ... | @@ -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 | pub fn path(d: *Dependency, sub_path: []const u8) LazyPath { | 1918 | pub fn path(d: *Dependency, sub_path: []const u8) LazyPath { |
| 1906 | return .{ | 1919 | return .{ |
| 1907 | .dependency = .{ | 1920 | .dependency = .{ |