| author | |
| committer | |
| log | 3f8f63b132566683ffc1d3ec51e7f49346d88f2e |
| tree | 0165781535b45ef67714d583107b1e124c055b3c |
| parent | d97042ad2e41b173334ec542eb4b07e81864d10e |
This makes it so that when there is a tree of std.Build objects, only
one zig-cache is used (the top-level application) instead of polluting
package directories with zig-cache folders.3 files changed, 5 insertions(+), 6 deletions(-)
lib/build_runner.zig+2-2| ... | @@ -49,12 +49,12 @@ pub fn main() !void { | ... | @@ -49,12 +49,12 @@ pub fn main() !void { |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | const local_cache_directory: std.Build.Cache.Directory = .{ | 51 | const local_cache_directory: std.Build.Cache.Directory = .{ |
| 52 | .path = try std.fs.path.relative(allocator, build_root, cache_root), | 52 | .path = cache_root, |
| 53 | .handle = try std.fs.cwd().makeOpenPath(cache_root, .{}), | 53 | .handle = try std.fs.cwd().makeOpenPath(cache_root, .{}), |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | const global_cache_directory: std.Build.Cache.Directory = .{ | 56 | const global_cache_directory: std.Build.Cache.Directory = .{ |
| 57 | .path = try std.fs.path.relative(allocator, build_root, global_cache_root), | 57 | .path = global_cache_root, |
| 58 | .handle = try std.fs.cwd().makeOpenPath(global_cache_root, .{}), | 58 | .handle = try std.fs.cwd().makeOpenPath(global_cache_root, .{}), |
| 59 | }; | 59 | }; |
| 60 | 60 |
lib/std/Build.zig-1| ... | @@ -1644,7 +1644,6 @@ pub const GeneratedFile = struct { | ... | @@ -1644,7 +1644,6 @@ pub const GeneratedFile = struct { |
| 1644 | }; | 1644 | }; |
| 1645 | 1645 | ||
| 1646 | /// A file source is a reference to an existing or future file. | 1646 | /// A file source is a reference to an existing or future file. |
| 1647 | /// | ||
| 1648 | pub const FileSource = union(enum) { | 1647 | pub const FileSource = union(enum) { |
| 1649 | /// A plain file path, relative to build root or absolute. | 1648 | /// A plain file path, relative to build root or absolute. |
| 1650 | path: []const u8, | 1649 | path: []const u8, |
lib/std/Build/CompileStep.zig+3-3| ... | @@ -1350,10 +1350,10 @@ fn make(step: *Step) !void { | ... | @@ -1350,10 +1350,10 @@ fn make(step: *Step) !void { |
| 1350 | } | 1350 | } |
| 1351 | 1351 | ||
| 1352 | try zig_args.append("--cache-dir"); | 1352 | try zig_args.append("--cache-dir"); |
| 1353 | try zig_args.append(builder.pathFromRoot(builder.cache_root.path orelse ".")); | 1353 | try zig_args.append(builder.cache_root.path orelse "."); |
| 1354 | 1354 | ||
| 1355 | try zig_args.append("--global-cache-dir"); | 1355 | try zig_args.append("--global-cache-dir"); |
| 1356 | try zig_args.append(builder.pathFromRoot(builder.global_cache_root.path orelse ".")); | 1356 | try zig_args.append(builder.global_cache_root.path orelse "."); |
| 1357 | 1357 | ||
| 1358 | try zig_args.append("--name"); | 1358 | try zig_args.append("--name"); |
| 1359 | try zig_args.append(self.name); | 1359 | try zig_args.append(self.name); |
| ... | @@ -1786,7 +1786,7 @@ fn make(step: *Step) !void { | ... | @@ -1786,7 +1786,7 @@ fn make(step: *Step) !void { |
| 1786 | 1786 | ||
| 1787 | const resolved_args_file = try mem.concat(builder.allocator, u8, &.{ | 1787 | const resolved_args_file = try mem.concat(builder.allocator, u8, &.{ |
| 1788 | "@", | 1788 | "@", |
| 1789 | builder.pathFromRoot(try builder.cache_root.join(builder.allocator, &.{args_file})), | 1789 | try builder.cache_root.join(builder.allocator, &.{args_file}), |
| 1790 | }); | 1790 | }); |
| 1791 | 1791 | ||
| 1792 | zig_args.shrinkRetainingCapacity(2); | 1792 | zig_args.shrinkRetainingCapacity(2); |