| author | |
| committer | |
| log | 860d5ab9c41fd64c5150bd7d9f5b87cbcda9f281 |
| tree | e812eef3624f133b8bfd5b0d5848e8290638a393 |
| parent | 35ee3747ebe344b619c66b23053d3f2495956423 |
2 files changed, 16 insertions(+), 8 deletions(-)
lib/compiler/Maker.zig+6-4| ... | ... | @@ -1706,7 +1706,7 @@ pub fn resolveLazyPath( |
| 1706 | 1706 | const c = &maker.scanned_config.configuration; |
| 1707 | 1707 | return switch (lazy_path) { |
| 1708 | 1708 | .source_path => |sp| try packagePath(maker, arena, sp.owner, sp.sub_path.slice(c)), |
| 1709 | .relative => |relative| relativePath(maker, relative), | |
| 1709 | .relative => |relative| relativePath(maker, arena, relative), | |
| 1710 | 1710 | .generated => |gen| { |
| 1711 | 1711 | const base = generatedPath(maker, gen.index).*; |
| 1712 | 1712 | var file_path = base; |
| ... | ... | @@ -1785,11 +1785,10 @@ pub fn packagePath( |
| 1785 | 1785 | }; |
| 1786 | 1786 | } |
| 1787 | 1787 | |
| 1788 | pub fn relativePath(maker: *const Maker, relative: Configuration.LazyPath.Relative) Path { | |
| 1788 | pub fn relativePath(maker: *const Maker, arena: Allocator, relative: Configuration.LazyPath.Relative) Allocator.Error!Path { | |
| 1789 | 1789 | const graph = maker.graph; |
| 1790 | 1790 | const c = &maker.scanned_config.configuration; |
| 1791 | 1791 | const sub_path = relative.sub_path.slice(c); |
| 1792 | if (relative.flags.base == .zig_exe and sub_path.len != 0) @panic("TODO relativePath zig_exe"); | |
| 1793 | 1792 | return switch (relative.flags.base) { |
| 1794 | 1793 | .cwd => .{ |
| 1795 | 1794 | .root_dir = .cwd(), |
| ... | ... | @@ -1809,7 +1808,10 @@ pub fn relativePath(maker: *const Maker, relative: Configuration.LazyPath.Relati |
| 1809 | 1808 | }, |
| 1810 | 1809 | .zig_exe => .{ |
| 1811 | 1810 | .root_dir = .cwd(), |
| 1812 | .sub_path = graph.zig_exe, | |
| 1811 | .sub_path = if (sub_path.len == 0) | |
| 1812 | graph.zig_exe | |
| 1813 | else | |
| 1814 | try Io.Dir.path.join(arena, &.{ graph.zig_exe, sub_path }), | |
| 1813 | 1815 | }, |
| 1814 | 1816 | .zig_lib => .{ |
| 1815 | 1817 | .root_dir = graph.zig_lib_directory, |
lib/compiler/Maker/Step.zig+10-4| ... | ... | @@ -785,7 +785,10 @@ pub fn addWatchInput(step: *Step, maker: *Maker, arena: Allocator, lazy_file: La |
| 785 | 785 | const pkg_path = try maker.packagePath(arena, source_path.owner, sub_path); |
| 786 | 786 | try addWatchInputPath(step, maker, pkg_path); |
| 787 | 787 | }, |
| 788 | .relative => |relative| try addWatchInputPath(step, maker, maker.relativePath(relative)), | |
| 788 | .relative => |relative| { | |
| 789 | const resolved_path = try maker.relativePath(arena, relative); | |
| 790 | try addWatchInputPath(step, maker, resolved_path); | |
| 791 | }, | |
| 789 | 792 | // Nothing to watch because this dependency edge is modeled instead via `dependants`. |
| 790 | 793 | .generated => {}, |
| 791 | 794 | } |
| ... | ... | @@ -799,16 +802,19 @@ pub fn addWatchInput(step: *Step, maker: *Maker, arena: Allocator, lazy_file: La |
| 799 | 802 | /// `addDirectoryWatchInputFromPath` if and only if this function returns |
| 800 | 803 | /// `true`. |
| 801 | 804 | pub fn addDirectoryWatchInput(step: *Step, maker: *Maker, lazy_directory: LazyPath) Allocator.Error!bool { |
| 805 | const graph = maker.graph; | |
| 806 | const arena = graph.arena; // TODO don't leak into the process arena | |
| 802 | 807 | switch (lazy_directory) { |
| 803 | 808 | .source_path => |source_path| { |
| 804 | 809 | const conf = &maker.scanned_config.configuration; |
| 805 | const graph = maker.graph; | |
| 806 | const arena = graph.arena; // TODO don't leak into the process arena | |
| 807 | 810 | const sub_path = source_path.sub_path.slice(conf); |
| 808 | 811 | const pkg_path = try maker.packagePath(arena, source_path.owner, sub_path); |
| 809 | 812 | try addDirectoryWatchInputFromPath(step, maker, pkg_path); |
| 810 | 813 | }, |
| 811 | .relative => |relative| try addDirectoryWatchInputFromPath(step, maker, maker.relativePath(relative)), | |
| 814 | .relative => |relative| { | |
| 815 | const resolved_path = try maker.relativePath(arena, relative); | |
| 816 | try addDirectoryWatchInputFromPath(step, maker, resolved_path); | |
| 817 | }, | |
| 812 | 818 | // Nothing to watch because this dependency edge is modeled instead via `dependants`. |
| 813 | 819 | .generated => return false, |
| 814 | 820 | } |