| author | |
| committer | |
| log | 7bc0b74b6d57ff1a350a4f430f7d9e799a90edd0 |
| tree | 5e251595d497f7eacd44673ecf61370f28d0c3cc |
| parent | 8778dc4bb2bb20779bee3fc964f79437ff3ef9fe |
6 files changed, 166 insertions(+), 170 deletions(-)
lib/std/Build/Cache.zig+1| ... | @@ -17,6 +17,7 @@ mutex: std.Thread.Mutex = .{}, | ... | @@ -17,6 +17,7 @@ mutex: std.Thread.Mutex = .{}, |
| 17 | prefixes_buffer: [4]Directory = undefined, | 17 | prefixes_buffer: [4]Directory = undefined, |
| 18 | prefixes_len: usize = 0, | 18 | prefixes_len: usize = 0, |
| 19 | 19 | ||
| 20 | pub const Path = @import("Cache/Path.zig"); | ||
| 20 | pub const Directory = @import("Cache/Directory.zig"); | 21 | pub const Directory = @import("Cache/Directory.zig"); |
| 21 | pub const DepTokenizer = @import("Cache/DepTokenizer.zig"); | 22 | pub const DepTokenizer = @import("Cache/DepTokenizer.zig"); |
| 22 | 23 |
lib/std/Build/Cache/Path.zig created+154| ... | @@ -0,0 +1,154 @@ | ||
| 1 | root_dir: Cache.Directory, | ||
| 2 | /// The path, relative to the root dir, that this `Path` represents. | ||
| 3 | /// Empty string means the root_dir is the path. | ||
| 4 | sub_path: []const u8 = "", | ||
| 5 | |||
| 6 | pub fn clone(p: Path, arena: Allocator) Allocator.Error!Path { | ||
| 7 | return .{ | ||
| 8 | .root_dir = try p.root_dir.clone(arena), | ||
| 9 | .sub_path = try arena.dupe(u8, p.sub_path), | ||
| 10 | }; | ||
| 11 | } | ||
| 12 | |||
| 13 | pub fn cwd() Path { | ||
| 14 | return .{ .root_dir = Cache.Directory.cwd() }; | ||
| 15 | } | ||
| 16 | |||
| 17 | pub fn join(p: Path, arena: Allocator, sub_path: []const u8) Allocator.Error!Path { | ||
| 18 | if (sub_path.len == 0) return p; | ||
| 19 | const parts: []const []const u8 = | ||
| 20 | if (p.sub_path.len == 0) &.{sub_path} else &.{ p.sub_path, sub_path }; | ||
| 21 | return .{ | ||
| 22 | .root_dir = p.root_dir, | ||
| 23 | .sub_path = try fs.path.join(arena, parts), | ||
| 24 | }; | ||
| 25 | } | ||
| 26 | |||
| 27 | pub fn resolvePosix(p: Path, arena: Allocator, sub_path: []const u8) Allocator.Error!Path { | ||
| 28 | if (sub_path.len == 0) return p; | ||
| 29 | return .{ | ||
| 30 | .root_dir = p.root_dir, | ||
| 31 | .sub_path = try fs.path.resolvePosix(arena, &.{ p.sub_path, sub_path }), | ||
| 32 | }; | ||
| 33 | } | ||
| 34 | |||
| 35 | pub fn joinString(p: Path, allocator: Allocator, sub_path: []const u8) Allocator.Error![]u8 { | ||
| 36 | const parts: []const []const u8 = | ||
| 37 | if (p.sub_path.len == 0) &.{sub_path} else &.{ p.sub_path, sub_path }; | ||
| 38 | return p.root_dir.join(allocator, parts); | ||
| 39 | } | ||
| 40 | |||
| 41 | pub fn joinStringZ(p: Path, allocator: Allocator, sub_path: []const u8) Allocator.Error![:0]u8 { | ||
| 42 | const parts: []const []const u8 = | ||
| 43 | if (p.sub_path.len == 0) &.{sub_path} else &.{ p.sub_path, sub_path }; | ||
| 44 | return p.root_dir.joinZ(allocator, parts); | ||
| 45 | } | ||
| 46 | |||
| 47 | pub fn openFile( | ||
| 48 | p: Path, | ||
| 49 | sub_path: []const u8, | ||
| 50 | flags: fs.File.OpenFlags, | ||
| 51 | ) !fs.File { | ||
| 52 | var buf: [fs.MAX_PATH_BYTES]u8 = undefined; | ||
| 53 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { | ||
| 54 | break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{ | ||
| 55 | p.sub_path, sub_path, | ||
| 56 | }) catch return error.NameTooLong; | ||
| 57 | }; | ||
| 58 | return p.root_dir.handle.openFile(joined_path, flags); | ||
| 59 | } | ||
| 60 | |||
| 61 | pub fn makeOpenPath(p: Path, sub_path: []const u8, opts: fs.OpenDirOptions) !fs.Dir { | ||
| 62 | var buf: [fs.MAX_PATH_BYTES]u8 = undefined; | ||
| 63 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { | ||
| 64 | break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{ | ||
| 65 | p.sub_path, sub_path, | ||
| 66 | }) catch return error.NameTooLong; | ||
| 67 | }; | ||
| 68 | return p.root_dir.handle.makeOpenPath(joined_path, opts); | ||
| 69 | } | ||
| 70 | |||
| 71 | pub fn statFile(p: Path, sub_path: []const u8) !fs.Dir.Stat { | ||
| 72 | var buf: [fs.MAX_PATH_BYTES]u8 = undefined; | ||
| 73 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { | ||
| 74 | break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{ | ||
| 75 | p.sub_path, sub_path, | ||
| 76 | }) catch return error.NameTooLong; | ||
| 77 | }; | ||
| 78 | return p.root_dir.handle.statFile(joined_path); | ||
| 79 | } | ||
| 80 | |||
| 81 | pub fn atomicFile( | ||
| 82 | p: Path, | ||
| 83 | sub_path: []const u8, | ||
| 84 | options: fs.Dir.AtomicFileOptions, | ||
| 85 | buf: *[fs.MAX_PATH_BYTES]u8, | ||
| 86 | ) !fs.AtomicFile { | ||
| 87 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { | ||
| 88 | break :p std.fmt.bufPrint(buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{ | ||
| 89 | p.sub_path, sub_path, | ||
| 90 | }) catch return error.NameTooLong; | ||
| 91 | }; | ||
| 92 | return p.root_dir.handle.atomicFile(joined_path, options); | ||
| 93 | } | ||
| 94 | |||
| 95 | pub fn access(p: Path, sub_path: []const u8, flags: fs.File.OpenFlags) !void { | ||
| 96 | var buf: [fs.MAX_PATH_BYTES]u8 = undefined; | ||
| 97 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { | ||
| 98 | break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{ | ||
| 99 | p.sub_path, sub_path, | ||
| 100 | }) catch return error.NameTooLong; | ||
| 101 | }; | ||
| 102 | return p.root_dir.handle.access(joined_path, flags); | ||
| 103 | } | ||
| 104 | |||
| 105 | pub fn makePath(p: Path, sub_path: []const u8) !void { | ||
| 106 | var buf: [fs.MAX_PATH_BYTES]u8 = undefined; | ||
| 107 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { | ||
| 108 | break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{ | ||
| 109 | p.sub_path, sub_path, | ||
| 110 | }) catch return error.NameTooLong; | ||
| 111 | }; | ||
| 112 | return p.root_dir.handle.makePath(joined_path); | ||
| 113 | } | ||
| 114 | |||
| 115 | pub fn format( | ||
| 116 | self: Path, | ||
| 117 | comptime fmt_string: []const u8, | ||
| 118 | options: std.fmt.FormatOptions, | ||
| 119 | writer: anytype, | ||
| 120 | ) !void { | ||
| 121 | if (fmt_string.len == 1) { | ||
| 122 | // Quote-escape the string. | ||
| 123 | const stringEscape = std.zig.stringEscape; | ||
| 124 | const f = switch (fmt_string[0]) { | ||
| 125 | 'q' => "", | ||
| 126 | '\'' => '\'', | ||
| 127 | else => @compileError("unsupported format string: " ++ fmt_string), | ||
| 128 | }; | ||
| 129 | if (self.root_dir.path) |p| { | ||
| 130 | try stringEscape(p, f, options, writer); | ||
| 131 | if (self.sub_path.len > 0) try stringEscape(fs.path.sep_str, f, options, writer); | ||
| 132 | } | ||
| 133 | if (self.sub_path.len > 0) { | ||
| 134 | try stringEscape(self.sub_path, f, options, writer); | ||
| 135 | } | ||
| 136 | return; | ||
| 137 | } | ||
| 138 | if (fmt_string.len > 0) | ||
| 139 | std.fmt.invalidFmtError(fmt_string, self); | ||
| 140 | if (self.root_dir.path) |p| { | ||
| 141 | try writer.writeAll(p); | ||
| 142 | try writer.writeAll(fs.path.sep_str); | ||
| 143 | } | ||
| 144 | if (self.sub_path.len > 0) { | ||
| 145 | try writer.writeAll(self.sub_path); | ||
| 146 | try writer.writeAll(fs.path.sep_str); | ||
| 147 | } | ||
| 148 | } | ||
| 149 | |||
| 150 | const Path = @This(); | ||
| 151 | const std = @import("../../std.zig"); | ||
| 152 | const fs = std.fs; | ||
| 153 | const Allocator = std.mem.Allocator; | ||
| 154 | const Cache = std.Build.Cache; | ||
src/Package.zig-159| ... | @@ -2,162 +2,3 @@ pub const Module = @import("Package/Module.zig"); | ... | @@ -2,162 +2,3 @@ pub const Module = @import("Package/Module.zig"); |
| 2 | pub const Fetch = @import("Package/Fetch.zig"); | 2 | pub const Fetch = @import("Package/Fetch.zig"); |
| 3 | pub const build_zig_basename = "build.zig"; | 3 | pub const build_zig_basename = "build.zig"; |
| 4 | pub const Manifest = @import("Package/Manifest.zig"); | 4 | pub const Manifest = @import("Package/Manifest.zig"); |
| 5 | |||
| 6 | pub const Path = struct { | ||
| 7 | root_dir: Cache.Directory, | ||
| 8 | /// The path, relative to the root dir, that this `Path` represents. | ||
| 9 | /// Empty string means the root_dir is the path. | ||
| 10 | sub_path: []const u8 = "", | ||
| 11 | |||
| 12 | pub fn clone(p: Path, arena: Allocator) Allocator.Error!Path { | ||
| 13 | return .{ | ||
| 14 | .root_dir = try p.root_dir.clone(arena), | ||
| 15 | .sub_path = try arena.dupe(u8, p.sub_path), | ||
| 16 | }; | ||
| 17 | } | ||
| 18 | |||
| 19 | pub fn cwd() Path { | ||
| 20 | return .{ .root_dir = Cache.Directory.cwd() }; | ||
| 21 | } | ||
| 22 | |||
| 23 | pub fn join(p: Path, arena: Allocator, sub_path: []const u8) Allocator.Error!Path { | ||
| 24 | if (sub_path.len == 0) return p; | ||
| 25 | const parts: []const []const u8 = | ||
| 26 | if (p.sub_path.len == 0) &.{sub_path} else &.{ p.sub_path, sub_path }; | ||
| 27 | return .{ | ||
| 28 | .root_dir = p.root_dir, | ||
| 29 | .sub_path = try fs.path.join(arena, parts), | ||
| 30 | }; | ||
| 31 | } | ||
| 32 | |||
| 33 | pub fn resolvePosix(p: Path, arena: Allocator, sub_path: []const u8) Allocator.Error!Path { | ||
| 34 | if (sub_path.len == 0) return p; | ||
| 35 | return .{ | ||
| 36 | .root_dir = p.root_dir, | ||
| 37 | .sub_path = try fs.path.resolvePosix(arena, &.{ p.sub_path, sub_path }), | ||
| 38 | }; | ||
| 39 | } | ||
| 40 | |||
| 41 | pub fn joinString(p: Path, allocator: Allocator, sub_path: []const u8) Allocator.Error![]u8 { | ||
| 42 | const parts: []const []const u8 = | ||
| 43 | if (p.sub_path.len == 0) &.{sub_path} else &.{ p.sub_path, sub_path }; | ||
| 44 | return p.root_dir.join(allocator, parts); | ||
| 45 | } | ||
| 46 | |||
| 47 | pub fn joinStringZ(p: Path, allocator: Allocator, sub_path: []const u8) Allocator.Error![:0]u8 { | ||
| 48 | const parts: []const []const u8 = | ||
| 49 | if (p.sub_path.len == 0) &.{sub_path} else &.{ p.sub_path, sub_path }; | ||
| 50 | return p.root_dir.joinZ(allocator, parts); | ||
| 51 | } | ||
| 52 | |||
| 53 | pub fn openFile( | ||
| 54 | p: Path, | ||
| 55 | sub_path: []const u8, | ||
| 56 | flags: fs.File.OpenFlags, | ||
| 57 | ) !fs.File { | ||
| 58 | var buf: [fs.MAX_PATH_BYTES]u8 = undefined; | ||
| 59 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { | ||
| 60 | break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{ | ||
| 61 | p.sub_path, sub_path, | ||
| 62 | }) catch return error.NameTooLong; | ||
| 63 | }; | ||
| 64 | return p.root_dir.handle.openFile(joined_path, flags); | ||
| 65 | } | ||
| 66 | |||
| 67 | pub fn makeOpenPath(p: Path, sub_path: []const u8, opts: fs.OpenDirOptions) !fs.Dir { | ||
| 68 | var buf: [fs.MAX_PATH_BYTES]u8 = undefined; | ||
| 69 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { | ||
| 70 | break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{ | ||
| 71 | p.sub_path, sub_path, | ||
| 72 | }) catch return error.NameTooLong; | ||
| 73 | }; | ||
| 74 | return p.root_dir.handle.makeOpenPath(joined_path, opts); | ||
| 75 | } | ||
| 76 | |||
| 77 | pub fn statFile(p: Path, sub_path: []const u8) !fs.Dir.Stat { | ||
| 78 | var buf: [fs.MAX_PATH_BYTES]u8 = undefined; | ||
| 79 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { | ||
| 80 | break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{ | ||
| 81 | p.sub_path, sub_path, | ||
| 82 | }) catch return error.NameTooLong; | ||
| 83 | }; | ||
| 84 | return p.root_dir.handle.statFile(joined_path); | ||
| 85 | } | ||
| 86 | |||
| 87 | pub fn atomicFile( | ||
| 88 | p: Path, | ||
| 89 | sub_path: []const u8, | ||
| 90 | options: fs.Dir.AtomicFileOptions, | ||
| 91 | buf: *[fs.MAX_PATH_BYTES]u8, | ||
| 92 | ) !fs.AtomicFile { | ||
| 93 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { | ||
| 94 | break :p std.fmt.bufPrint(buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{ | ||
| 95 | p.sub_path, sub_path, | ||
| 96 | }) catch return error.NameTooLong; | ||
| 97 | }; | ||
| 98 | return p.root_dir.handle.atomicFile(joined_path, options); | ||
| 99 | } | ||
| 100 | |||
| 101 | pub fn access(p: Path, sub_path: []const u8, flags: fs.File.OpenFlags) !void { | ||
| 102 | var buf: [fs.MAX_PATH_BYTES]u8 = undefined; | ||
| 103 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { | ||
| 104 | break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{ | ||
| 105 | p.sub_path, sub_path, | ||
| 106 | }) catch return error.NameTooLong; | ||
| 107 | }; | ||
| 108 | return p.root_dir.handle.access(joined_path, flags); | ||
| 109 | } | ||
| 110 | |||
| 111 | pub fn makePath(p: Path, sub_path: []const u8) !void { | ||
| 112 | var buf: [fs.MAX_PATH_BYTES]u8 = undefined; | ||
| 113 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { | ||
| 114 | break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{ | ||
| 115 | p.sub_path, sub_path, | ||
| 116 | }) catch return error.NameTooLong; | ||
| 117 | }; | ||
| 118 | return p.root_dir.handle.makePath(joined_path); | ||
| 119 | } | ||
| 120 | |||
| 121 | pub fn format( | ||
| 122 | self: Path, | ||
| 123 | comptime fmt_string: []const u8, | ||
| 124 | options: std.fmt.FormatOptions, | ||
| 125 | writer: anytype, | ||
| 126 | ) !void { | ||
| 127 | if (fmt_string.len == 1) { | ||
| 128 | // Quote-escape the string. | ||
| 129 | const stringEscape = std.zig.stringEscape; | ||
| 130 | const f = switch (fmt_string[0]) { | ||
| 131 | 'q' => "", | ||
| 132 | '\'' => '\'', | ||
| 133 | else => @compileError("unsupported format string: " ++ fmt_string), | ||
| 134 | }; | ||
| 135 | if (self.root_dir.path) |p| { | ||
| 136 | try stringEscape(p, f, options, writer); | ||
| 137 | if (self.sub_path.len > 0) try stringEscape(fs.path.sep_str, f, options, writer); | ||
| 138 | } | ||
| 139 | if (self.sub_path.len > 0) { | ||
| 140 | try stringEscape(self.sub_path, f, options, writer); | ||
| 141 | } | ||
| 142 | return; | ||
| 143 | } | ||
| 144 | if (fmt_string.len > 0) | ||
| 145 | std.fmt.invalidFmtError(fmt_string, self); | ||
| 146 | if (self.root_dir.path) |p| { | ||
| 147 | try writer.writeAll(p); | ||
| 148 | try writer.writeAll(fs.path.sep_str); | ||
| 149 | } | ||
| 150 | if (self.sub_path.len > 0) { | ||
| 151 | try writer.writeAll(self.sub_path); | ||
| 152 | try writer.writeAll(fs.path.sep_str); | ||
| 153 | } | ||
| 154 | } | ||
| 155 | }; | ||
| 156 | |||
| 157 | const Package = @This(); | ||
| 158 | const builtin = @import("builtin"); | ||
| 159 | const std = @import("std"); | ||
| 160 | const fs = std.fs; | ||
| 161 | const Allocator = std.mem.Allocator; | ||
| 162 | const assert = std.debug.assert; | ||
| 163 | const Cache = std.Build.Cache; |
src/Package/Fetch.zig+6-6| ... | @@ -33,7 +33,7 @@ location_tok: std.zig.Ast.TokenIndex, | ... | @@ -33,7 +33,7 @@ location_tok: std.zig.Ast.TokenIndex, |
| 33 | hash_tok: std.zig.Ast.TokenIndex, | 33 | hash_tok: std.zig.Ast.TokenIndex, |
| 34 | name_tok: std.zig.Ast.TokenIndex, | 34 | name_tok: std.zig.Ast.TokenIndex, |
| 35 | lazy_status: LazyStatus, | 35 | lazy_status: LazyStatus, |
| 36 | parent_package_root: Package.Path, | 36 | parent_package_root: Cache.Path, |
| 37 | parent_manifest_ast: ?*const std.zig.Ast, | 37 | parent_manifest_ast: ?*const std.zig.Ast, |
| 38 | prog_node: *std.Progress.Node, | 38 | prog_node: *std.Progress.Node, |
| 39 | job_queue: *JobQueue, | 39 | job_queue: *JobQueue, |
| ... | @@ -50,7 +50,7 @@ allow_missing_paths_field: bool, | ... | @@ -50,7 +50,7 @@ allow_missing_paths_field: bool, |
| 50 | 50 | ||
| 51 | /// This will either be relative to `global_cache`, or to the build root of | 51 | /// This will either be relative to `global_cache`, or to the build root of |
| 52 | /// the root package. | 52 | /// the root package. |
| 53 | package_root: Package.Path, | 53 | package_root: Cache.Path, |
| 54 | error_bundle: ErrorBundle.Wip, | 54 | error_bundle: ErrorBundle.Wip, |
| 55 | manifest: ?Manifest, | 55 | manifest: ?Manifest, |
| 56 | manifest_ast: std.zig.Ast, | 56 | manifest_ast: std.zig.Ast, |
| ... | @@ -263,7 +263,7 @@ pub const JobQueue = struct { | ... | @@ -263,7 +263,7 @@ pub const JobQueue = struct { |
| 263 | pub const Location = union(enum) { | 263 | pub const Location = union(enum) { |
| 264 | remote: Remote, | 264 | remote: Remote, |
| 265 | /// A directory found inside the parent package. | 265 | /// A directory found inside the parent package. |
| 266 | relative_path: Package.Path, | 266 | relative_path: Cache.Path, |
| 267 | /// Recursive Fetch tasks will never use this Location, but it may be | 267 | /// Recursive Fetch tasks will never use this Location, but it may be |
| 268 | /// passed in by the CLI. Indicates the file contents here should be copied | 268 | /// passed in by the CLI. Indicates the file contents here should be copied |
| 269 | /// into the global package cache. It may be a file relative to the cwd or | 269 | /// into the global package cache. It may be a file relative to the cwd or |
| ... | @@ -564,7 +564,7 @@ fn checkBuildFileExistence(f: *Fetch) RunError!void { | ... | @@ -564,7 +564,7 @@ fn checkBuildFileExistence(f: *Fetch) RunError!void { |
| 564 | } | 564 | } |
| 565 | 565 | ||
| 566 | /// This function populates `f.manifest` or leaves it `null`. | 566 | /// This function populates `f.manifest` or leaves it `null`. |
| 567 | fn loadManifest(f: *Fetch, pkg_root: Package.Path) RunError!void { | 567 | fn loadManifest(f: *Fetch, pkg_root: Cache.Path) RunError!void { |
| 568 | const eb = &f.error_bundle; | 568 | const eb = &f.error_bundle; |
| 569 | const arena = f.arena.allocator(); | 569 | const arena = f.arena.allocator(); |
| 570 | const manifest_bytes = pkg_root.root_dir.handle.readFileAllocOptions( | 570 | const manifest_bytes = pkg_root.root_dir.handle.readFileAllocOptions( |
| ... | @@ -722,7 +722,7 @@ fn queueJobsForDeps(f: *Fetch) RunError!void { | ... | @@ -722,7 +722,7 @@ fn queueJobsForDeps(f: *Fetch) RunError!void { |
| 722 | } | 722 | } |
| 723 | 723 | ||
| 724 | pub fn relativePathDigest( | 724 | pub fn relativePathDigest( |
| 725 | pkg_root: Package.Path, | 725 | pkg_root: Cache.Path, |
| 726 | cache_root: Cache.Directory, | 726 | cache_root: Cache.Directory, |
| 727 | ) Manifest.MultiHashHexDigest { | 727 | ) Manifest.MultiHashHexDigest { |
| 728 | var hasher = Manifest.Hash.init(.{}); | 728 | var hasher = Manifest.Hash.init(.{}); |
| ... | @@ -1658,7 +1658,7 @@ const Filter = struct { | ... | @@ -1658,7 +1658,7 @@ const Filter = struct { |
| 1658 | }; | 1658 | }; |
| 1659 | 1659 | ||
| 1660 | pub fn depDigest( | 1660 | pub fn depDigest( |
| 1661 | pkg_root: Package.Path, | 1661 | pkg_root: Cache.Path, |
| 1662 | cache_root: Cache.Directory, | 1662 | cache_root: Cache.Directory, |
| 1663 | dep: Manifest.Dependency, | 1663 | dep: Manifest.Dependency, |
| 1664 | ) ?Manifest.MultiHashHexDigest { | 1664 | ) ?Manifest.MultiHashHexDigest { |
src/Package/Module.zig+3-3| ... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
| 3 | //! to Zcu. https://github.com/ziglang/zig/issues/14307 | 3 | //! to Zcu. https://github.com/ziglang/zig/issues/14307 |
| 4 | 4 | ||
| 5 | /// Only files inside this directory can be imported. | 5 | /// Only files inside this directory can be imported. |
| 6 | root: Package.Path, | 6 | root: Cache.Path, |
| 7 | /// Relative to `root`. May contain path separators. | 7 | /// Relative to `root`. May contain path separators. |
| 8 | root_src_path: []const u8, | 8 | root_src_path: []const u8, |
| 9 | /// Name used in compile errors. Looks like "root.foo.bar". | 9 | /// Name used in compile errors. Looks like "root.foo.bar". |
| ... | @@ -69,7 +69,7 @@ pub const CreateOptions = struct { | ... | @@ -69,7 +69,7 @@ pub const CreateOptions = struct { |
| 69 | builtin_modules: ?*std.StringHashMapUnmanaged(*Module), | 69 | builtin_modules: ?*std.StringHashMapUnmanaged(*Module), |
| 70 | 70 | ||
| 71 | pub const Paths = struct { | 71 | pub const Paths = struct { |
| 72 | root: Package.Path, | 72 | root: Cache.Path, |
| 73 | /// Relative to `root`. May contain path separators. | 73 | /// Relative to `root`. May contain path separators. |
| 74 | root_src_path: []const u8, | 74 | root_src_path: []const u8, |
| 75 | }; | 75 | }; |
| ... | @@ -463,7 +463,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module { | ... | @@ -463,7 +463,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module { |
| 463 | 463 | ||
| 464 | /// All fields correspond to `CreateOptions`. | 464 | /// All fields correspond to `CreateOptions`. |
| 465 | pub const LimitedOptions = struct { | 465 | pub const LimitedOptions = struct { |
| 466 | root: Package.Path, | 466 | root: Cache.Path, |
| 467 | root_src_path: []const u8, | 467 | root_src_path: []const u8, |
| 468 | fully_qualified_name: []const u8, | 468 | fully_qualified_name: []const u8, |
| 469 | }; | 469 | }; |
src/main.zig+2-2| ... | @@ -6133,7 +6133,7 @@ fn cmdAstCheck( | ... | @@ -6133,7 +6133,7 @@ fn cmdAstCheck( |
| 6133 | } | 6133 | } |
| 6134 | 6134 | ||
| 6135 | file.mod = try Package.Module.createLimited(arena, .{ | 6135 | file.mod = try Package.Module.createLimited(arena, .{ |
| 6136 | .root = Package.Path.cwd(), | 6136 | .root = Cache.Path.cwd(), |
| 6137 | .root_src_path = file.sub_file_path, | 6137 | .root_src_path = file.sub_file_path, |
| 6138 | .fully_qualified_name = "root", | 6138 | .fully_qualified_name = "root", |
| 6139 | }); | 6139 | }); |
| ... | @@ -6306,7 +6306,7 @@ fn cmdChangelist( | ... | @@ -6306,7 +6306,7 @@ fn cmdChangelist( |
| 6306 | }; | 6306 | }; |
| 6307 | 6307 | ||
| 6308 | file.mod = try Package.Module.createLimited(arena, .{ | 6308 | file.mod = try Package.Module.createLimited(arena, .{ |
| 6309 | .root = Package.Path.cwd(), | 6309 | .root = Cache.Path.cwd(), |
| 6310 | .root_src_path = file.sub_file_path, | 6310 | .root_src_path = file.sub_file_path, |
| 6311 | .fully_qualified_name = "root", | 6311 | .fully_qualified_name = "root", |
| 6312 | }); | 6312 | }); |