authorgravatar for xhxnna@proton.meHanna <xhxnna@proton.me> 2022-05-26 19:32:28-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-05-26 19:32:28-04:00
log4e918873e7667e8d74b009cb34cbdd4df3305462
treefc55f8d0c6327e680eb2ced740ec89789d3c26ec
parent67d5bfefba48d28c02e2841f1a47a213d28d4693
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Rename `std.build.Pkg.path` to `std.build.Pkg.source` (#11557)


2 files changed, 12 insertions(+), 12 deletions(-)

lib/std/build.zig+11-11
...@@ -385,7 +385,7 @@ pub const Builder = struct {...@@ -385,7 +385,7 @@ pub const Builder = struct {
385 pub fn dupePkg(self: *Builder, package: Pkg) Pkg {385 pub fn dupePkg(self: *Builder, package: Pkg) Pkg {
386 var the_copy = Pkg{386 var the_copy = Pkg{
387 .name = self.dupe(package.name),387 .name = self.dupe(package.name),
388 .path = package.path.dupe(self),388 .source = package.source.dupe(self),
389 };389 };
390390
391 if (package.dependencies) |dependencies| {391 if (package.dependencies) |dependencies| {
...@@ -1353,7 +1353,7 @@ pub const Target = @compileError("deprecated; Use `std.zig.CrossTarget`");...@@ -1353,7 +1353,7 @@ pub const Target = @compileError("deprecated; Use `std.zig.CrossTarget`");
13531353
1354pub const Pkg = struct {1354pub const Pkg = struct {
1355 name: []const u8,1355 name: []const u8,
1356 path: FileSource,1356 source: FileSource,
1357 dependencies: ?[]const Pkg = null,1357 dependencies: ?[]const Pkg = null,
1358};1358};
13591359
...@@ -2228,7 +2228,7 @@ pub const LibExeObjStep = struct {...@@ -2228,7 +2228,7 @@ pub const LibExeObjStep = struct {
2228 }2228 }
22292229
2230 fn addRecursiveBuildDeps(self: *LibExeObjStep, package: Pkg) void {2230 fn addRecursiveBuildDeps(self: *LibExeObjStep, package: Pkg) void {
2231 package.path.addStepDependencies(&self.step);2231 package.source.addStepDependencies(&self.step);
2232 if (package.dependencies) |deps| {2232 if (package.dependencies) |deps| {
2233 for (deps) |dep| {2233 for (deps) |dep| {
2234 self.addRecursiveBuildDeps(dep);2234 self.addRecursiveBuildDeps(dep);
...@@ -2239,7 +2239,7 @@ pub const LibExeObjStep = struct {...@@ -2239,7 +2239,7 @@ pub const LibExeObjStep = struct {
2239 pub fn addPackagePath(self: *LibExeObjStep, name: []const u8, pkg_index_path: []const u8) void {2239 pub fn addPackagePath(self: *LibExeObjStep, name: []const u8, pkg_index_path: []const u8) void {
2240 self.addPackage(Pkg{2240 self.addPackage(Pkg{
2241 .name = self.builder.dupe(name),2241 .name = self.builder.dupe(name),
2242 .path = .{ .path = self.builder.dupe(pkg_index_path) },2242 .source = .{ .path = self.builder.dupe(pkg_index_path) },
2243 });2243 });
2244 }2244 }
22452245
...@@ -2300,7 +2300,7 @@ pub const LibExeObjStep = struct {...@@ -2300,7 +2300,7 @@ pub const LibExeObjStep = struct {
23002300
2301 try zig_args.append("--pkg-begin");2301 try zig_args.append("--pkg-begin");
2302 try zig_args.append(pkg.name);2302 try zig_args.append(pkg.name);
2303 try zig_args.append(builder.pathFromRoot(pkg.path.getPath(self.builder)));2303 try zig_args.append(builder.pathFromRoot(pkg.source.getPath(self.builder)));
23042304
2305 if (pkg.dependencies) |dependencies| {2305 if (pkg.dependencies) |dependencies| {
2306 for (dependencies) |sub_pkg| {2306 for (dependencies) |sub_pkg| {
...@@ -3560,11 +3560,11 @@ test "Builder.dupePkg()" {...@@ -3560,11 +3560,11 @@ test "Builder.dupePkg()" {
35603560
3561 var pkg_dep = Pkg{3561 var pkg_dep = Pkg{
3562 .name = "pkg_dep",3562 .name = "pkg_dep",
3563 .path = .{ .path = "/not/a/pkg_dep.zig" },3563 .source = .{ .path = "/not/a/pkg_dep.zig" },
3564 };3564 };
3565 var pkg_top = Pkg{3565 var pkg_top = Pkg{
3566 .name = "pkg_top",3566 .name = "pkg_top",
3567 .path = .{ .path = "/not/a/pkg_top.zig" },3567 .source = .{ .path = "/not/a/pkg_top.zig" },
3568 .dependencies = &[_]Pkg{pkg_dep},3568 .dependencies = &[_]Pkg{pkg_dep},
3569 };3569 };
3570 const dupe = builder.dupePkg(pkg_top);3570 const dupe = builder.dupePkg(pkg_top);
...@@ -3583,9 +3583,9 @@ test "Builder.dupePkg()" {...@@ -3583,9 +3583,9 @@ test "Builder.dupePkg()" {
3583 // the same as those in stack allocated package's fields3583 // the same as those in stack allocated package's fields
3584 try std.testing.expect(dupe_deps.ptr != original_deps.ptr);3584 try std.testing.expect(dupe_deps.ptr != original_deps.ptr);
3585 try std.testing.expect(dupe.name.ptr != pkg_top.name.ptr);3585 try std.testing.expect(dupe.name.ptr != pkg_top.name.ptr);
3586 try std.testing.expect(dupe.path.path.ptr != pkg_top.path.path.ptr);3586 try std.testing.expect(dupe.source.path.ptr != pkg_top.source.path.ptr);
3587 try std.testing.expect(dupe_deps[0].name.ptr != pkg_dep.name.ptr);3587 try std.testing.expect(dupe_deps[0].name.ptr != pkg_dep.name.ptr);
3588 try std.testing.expect(dupe_deps[0].path.path.ptr != pkg_dep.path.path.ptr);3588 try std.testing.expect(dupe_deps[0].source.path.ptr != pkg_dep.source.path.ptr);
3589}3589}
35903590
3591test "LibExeObjStep.addPackage" {3591test "LibExeObjStep.addPackage" {
...@@ -3605,11 +3605,11 @@ test "LibExeObjStep.addPackage" {...@@ -3605,11 +3605,11 @@ test "LibExeObjStep.addPackage" {
36053605
3606 const pkg_dep = Pkg{3606 const pkg_dep = Pkg{
3607 .name = "pkg_dep",3607 .name = "pkg_dep",
3608 .path = .{ .path = "/not/a/pkg_dep.zig" },3608 .source = .{ .path = "/not/a/pkg_dep.zig" },
3609 };3609 };
3610 const pkg_top = Pkg{3610 const pkg_top = Pkg{
3611 .name = "pkg_dep",3611 .name = "pkg_dep",
3612 .path = .{ .path = "/not/a/pkg_top.zig" },3612 .source = .{ .path = "/not/a/pkg_top.zig" },
3613 .dependencies = &[_]Pkg{pkg_dep},3613 .dependencies = &[_]Pkg{pkg_dep},
3614 };3614 };
36153615
lib/std/build/OptionsStep.zig+1-1
...@@ -200,7 +200,7 @@ pub fn addOptionArtifact(self: *OptionsStep, name: []const u8, artifact: *LibExe...@@ -200,7 +200,7 @@ pub fn addOptionArtifact(self: *OptionsStep, name: []const u8, artifact: *LibExe
200}200}
201201
202pub fn getPackage(self: *OptionsStep, package_name: []const u8) build.Pkg {202pub fn getPackage(self: *OptionsStep, package_name: []const u8) build.Pkg {
203 return .{ .name = package_name, .path = self.getSource() };203 return .{ .name = package_name, .source = self.getSource() };
204}204}
205205
206pub fn getSource(self: *OptionsStep) FileSource {206pub fn getSource(self: *OptionsStep) FileSource {