| author | |
| committer | |
| log | 3f3b1a6808113fd5f9b2cec1033009cbb17dc969 |
| tree | 7893be58b9b8c8edfffdc8127a6b133ec823e141 |
| parent | 5def162391da5050761beb3e6efb24b99716fc99 |
Follow up to 13eb7251d37759bd47403db304c6120c706fe35327 files changed, 379 insertions(+), 361 deletions(-)
build.zig+6-6| ... | ... | @@ -533,7 +533,7 @@ fn addCompilerStep( |
| 533 | 533 | b: *std.Build, |
| 534 | 534 | optimize: std.builtin.OptimizeMode, |
| 535 | 535 | target: std.zig.CrossTarget, |
| 536 | ) *std.Build.CompileStep { | |
| 536 | ) *std.Build.Step.Compile { | |
| 537 | 537 | const exe = b.addExecutable(.{ |
| 538 | 538 | .name = "zig", |
| 539 | 539 | .root_source_file = .{ .path = "src/main.zig" }, |
| ... | ... | @@ -561,7 +561,7 @@ const exe_cflags = [_][]const u8{ |
| 561 | 561 | fn addCmakeCfgOptionsToExe( |
| 562 | 562 | b: *std.Build, |
| 563 | 563 | cfg: CMakeConfig, |
| 564 | exe: *std.Build.CompileStep, | |
| 564 | exe: *std.Build.Step.Compile, | |
| 565 | 565 | use_zig_libcxx: bool, |
| 566 | 566 | ) !void { |
| 567 | 567 | if (exe.target.isDarwin()) { |
| ... | ... | @@ -640,7 +640,7 @@ fn addCmakeCfgOptionsToExe( |
| 640 | 640 | } |
| 641 | 641 | } |
| 642 | 642 | |
| 643 | fn addStaticLlvmOptionsToExe(exe: *std.Build.CompileStep) !void { | |
| 643 | fn addStaticLlvmOptionsToExe(exe: *std.Build.Step.Compile) !void { | |
| 644 | 644 | // Adds the Zig C++ sources which both stage1 and stage2 need. |
| 645 | 645 | // |
| 646 | 646 | // We need this because otherwise zig_clang_cc1_main.cpp ends up pulling |
| ... | ... | @@ -679,7 +679,7 @@ fn addStaticLlvmOptionsToExe(exe: *std.Build.CompileStep) !void { |
| 679 | 679 | fn addCxxKnownPath( |
| 680 | 680 | b: *std.Build, |
| 681 | 681 | ctx: CMakeConfig, |
| 682 | exe: *std.Build.CompileStep, | |
| 682 | exe: *std.Build.Step.Compile, | |
| 683 | 683 | objname: []const u8, |
| 684 | 684 | errtxt: ?[]const u8, |
| 685 | 685 | need_cpp_includes: bool, |
| ... | ... | @@ -709,7 +709,7 @@ fn addCxxKnownPath( |
| 709 | 709 | } |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | fn addCMakeLibraryList(exe: *std.Build.CompileStep, list: []const u8) void { | |
| 712 | fn addCMakeLibraryList(exe: *std.Build.Step.Compile, list: []const u8) void { | |
| 713 | 713 | var it = mem.tokenize(u8, list, ";"); |
| 714 | 714 | while (it.next()) |lib| { |
| 715 | 715 | if (mem.startsWith(u8, lib, "-l")) { |
| ... | ... | @@ -723,7 +723,7 @@ fn addCMakeLibraryList(exe: *std.Build.CompileStep, list: []const u8) void { |
| 723 | 723 | } |
| 724 | 724 | |
| 725 | 725 | const CMakeConfig = struct { |
| 726 | llvm_linkage: std.Build.CompileStep.Linkage, | |
| 726 | llvm_linkage: std.Build.Step.Compile.Linkage, | |
| 727 | 727 | cmake_binary_dir: []const u8, |
| 728 | 728 | cmake_prefix_path: []const u8, |
| 729 | 729 | cmake_static_library_prefix: []const u8, |
lib/init-exe/build.zig+1-1| ... | ... | @@ -29,7 +29,7 @@ pub fn build(b: *std.Build) void { |
| 29 | 29 | // step when running `zig build`). |
| 30 | 30 | b.installArtifact(exe); |
| 31 | 31 | |
| 32 | // This *creates* a RunStep in the build graph, to be executed when another | |
| 32 | // This *creates* a Run step in the build graph, to be executed when another | |
| 33 | 33 | // step is evaluated that depends on it. The next line below will establish |
| 34 | 34 | // such a dependency. |
| 35 | 35 | const run_cmd = b.addRunArtifact(exe); |
lib/std/Build.zig+76-74| ... | ... | @@ -21,27 +21,41 @@ const Build = @This(); |
| 21 | 21 | |
| 22 | 22 | pub const Cache = @import("Build/Cache.zig"); |
| 23 | 23 | |
| 24 | /// deprecated: use `CompileStep`. | |
| 25 | pub const LibExeObjStep = CompileStep; | |
| 24 | /// deprecated: use `Step.Compile`. | |
| 25 | pub const LibExeObjStep = Step.Compile; | |
| 26 | 26 | /// deprecated: use `Build`. |
| 27 | 27 | pub const Builder = Build; |
| 28 | /// deprecated: use `InstallDirStep.Options` | |
| 29 | pub const InstallDirectoryOptions = InstallDirStep.Options; | |
| 28 | /// deprecated: use `Step.InstallDir.Options` | |
| 29 | pub const InstallDirectoryOptions = Step.InstallDir.Options; | |
| 30 | 30 | |
| 31 | 31 | pub const Step = @import("Build/Step.zig"); |
| 32 | /// deprecated: use `Step.CheckFile`. | |
| 32 | 33 | pub const CheckFileStep = @import("Build/Step/CheckFile.zig"); |
| 34 | /// deprecated: use `Step.CheckObject`. | |
| 33 | 35 | pub const CheckObjectStep = @import("Build/Step/CheckObject.zig"); |
| 36 | /// deprecated: use `Step.ConfigHeader`. | |
| 34 | 37 | pub const ConfigHeaderStep = @import("Build/Step/ConfigHeader.zig"); |
| 38 | /// deprecated: use `Step.Fmt`. | |
| 35 | 39 | pub const FmtStep = @import("Build/Step/Fmt.zig"); |
| 40 | /// deprecated: use `Step.InstallArtifact`. | |
| 36 | 41 | pub const InstallArtifactStep = @import("Build/Step/InstallArtifact.zig"); |
| 42 | /// deprecated: use `Step.InstallDir`. | |
| 37 | 43 | pub const InstallDirStep = @import("Build/Step/InstallDir.zig"); |
| 44 | /// deprecated: use `Step.InstallFile`. | |
| 38 | 45 | pub const InstallFileStep = @import("Build/Step/InstallFile.zig"); |
| 46 | /// deprecated: use `Step.ObjCopy`. | |
| 39 | 47 | pub const ObjCopyStep = @import("Build/Step/ObjCopy.zig"); |
| 48 | /// deprecated: use `Step.Compile`. | |
| 40 | 49 | pub const CompileStep = @import("Build/Step/Compile.zig"); |
| 50 | /// deprecated: use `Step.Options`. | |
| 41 | 51 | pub const OptionsStep = @import("Build/Step/Options.zig"); |
| 52 | /// deprecated: use `Step.RemoveDir`. | |
| 42 | 53 | pub const RemoveDirStep = @import("Build/Step/RemoveDir.zig"); |
| 54 | /// deprecated: use `Step.Run`. | |
| 43 | 55 | pub const RunStep = @import("Build/Step/Run.zig"); |
| 56 | /// deprecated: use `Step.TranslateC`. | |
| 44 | 57 | pub const TranslateCStep = @import("Build/Step/TranslateC.zig"); |
| 58 | /// deprecated: use `Step.WriteFile`. | |
| 45 | 59 | pub const WriteFileStep = @import("Build/Step/WriteFile.zig"); |
| 46 | 60 | |
| 47 | 61 | install_tls: TopLevelStep, |
| ... | ... | @@ -442,8 +456,8 @@ pub fn resolveInstallPrefix(self: *Build, install_prefix: ?[]const u8, dir_list: |
| 442 | 456 | self.h_dir = self.pathJoin(&h_list); |
| 443 | 457 | } |
| 444 | 458 | |
| 445 | pub fn addOptions(self: *Build) *OptionsStep { | |
| 446 | return OptionsStep.create(self); | |
| 459 | pub fn addOptions(self: *Build) *Step.Options { | |
| 460 | return Step.Options.create(self); | |
| 447 | 461 | } |
| 448 | 462 | |
| 449 | 463 | pub const ExecutableOptions = struct { |
| ... | ... | @@ -452,7 +466,7 @@ pub const ExecutableOptions = struct { |
| 452 | 466 | version: ?std.builtin.Version = null, |
| 453 | 467 | target: CrossTarget = .{}, |
| 454 | 468 | optimize: std.builtin.Mode = .Debug, |
| 455 | linkage: ?CompileStep.Linkage = null, | |
| 469 | linkage: ?Step.Compile.Linkage = null, | |
| 456 | 470 | max_rss: usize = 0, |
| 457 | 471 | link_libc: ?bool = null, |
| 458 | 472 | single_threaded: ?bool = null, |
| ... | ... | @@ -460,8 +474,8 @@ pub const ExecutableOptions = struct { |
| 460 | 474 | use_lld: ?bool = null, |
| 461 | 475 | }; |
| 462 | 476 | |
| 463 | pub fn addExecutable(b: *Build, options: ExecutableOptions) *CompileStep { | |
| 464 | return CompileStep.create(b, .{ | |
| 477 | pub fn addExecutable(b: *Build, options: ExecutableOptions) *Step.Compile { | |
| 478 | return Step.Compile.create(b, .{ | |
| 465 | 479 | .name = options.name, |
| 466 | 480 | .root_source_file = options.root_source_file, |
| 467 | 481 | .version = options.version, |
| ... | ... | @@ -489,8 +503,8 @@ pub const ObjectOptions = struct { |
| 489 | 503 | use_lld: ?bool = null, |
| 490 | 504 | }; |
| 491 | 505 | |
| 492 | pub fn addObject(b: *Build, options: ObjectOptions) *CompileStep { | |
| 493 | return CompileStep.create(b, .{ | |
| 506 | pub fn addObject(b: *Build, options: ObjectOptions) *Step.Compile { | |
| 507 | return Step.Compile.create(b, .{ | |
| 494 | 508 | .name = options.name, |
| 495 | 509 | .root_source_file = options.root_source_file, |
| 496 | 510 | .target = options.target, |
| ... | ... | @@ -517,8 +531,8 @@ pub const SharedLibraryOptions = struct { |
| 517 | 531 | use_lld: ?bool = null, |
| 518 | 532 | }; |
| 519 | 533 | |
| 520 | pub fn addSharedLibrary(b: *Build, options: SharedLibraryOptions) *CompileStep { | |
| 521 | return CompileStep.create(b, .{ | |
| 534 | pub fn addSharedLibrary(b: *Build, options: SharedLibraryOptions) *Step.Compile { | |
| 535 | return Step.Compile.create(b, .{ | |
| 522 | 536 | .name = options.name, |
| 523 | 537 | .root_source_file = options.root_source_file, |
| 524 | 538 | .kind = .lib, |
| ... | ... | @@ -547,8 +561,8 @@ pub const StaticLibraryOptions = struct { |
| 547 | 561 | use_lld: ?bool = null, |
| 548 | 562 | }; |
| 549 | 563 | |
| 550 | pub fn addStaticLibrary(b: *Build, options: StaticLibraryOptions) *CompileStep { | |
| 551 | return CompileStep.create(b, .{ | |
| 564 | pub fn addStaticLibrary(b: *Build, options: StaticLibraryOptions) *Step.Compile { | |
| 565 | return Step.Compile.create(b, .{ | |
| 552 | 566 | .name = options.name, |
| 553 | 567 | .root_source_file = options.root_source_file, |
| 554 | 568 | .kind = .lib, |
| ... | ... | @@ -579,8 +593,8 @@ pub const TestOptions = struct { |
| 579 | 593 | use_lld: ?bool = null, |
| 580 | 594 | }; |
| 581 | 595 | |
| 582 | pub fn addTest(b: *Build, options: TestOptions) *CompileStep { | |
| 583 | return CompileStep.create(b, .{ | |
| 596 | pub fn addTest(b: *Build, options: TestOptions) *Step.Compile { | |
| 597 | return Step.Compile.create(b, .{ | |
| 584 | 598 | .name = options.name, |
| 585 | 599 | .kind = .@"test", |
| 586 | 600 | .root_source_file = options.root_source_file, |
| ... | ... | @@ -604,8 +618,8 @@ pub const AssemblyOptions = struct { |
| 604 | 618 | max_rss: usize = 0, |
| 605 | 619 | }; |
| 606 | 620 | |
| 607 | pub fn addAssembly(b: *Build, options: AssemblyOptions) *CompileStep { | |
| 608 | const obj_step = CompileStep.create(b, .{ | |
| 621 | pub fn addAssembly(b: *Build, options: AssemblyOptions) *Step.Compile { | |
| 622 | const obj_step = Step.Compile.create(b, .{ | |
| 609 | 623 | .name = options.name, |
| 610 | 624 | .kind = .obj, |
| 611 | 625 | .root_source_file = null, |
| ... | ... | @@ -657,25 +671,25 @@ fn moduleDependenciesToArrayHashMap(arena: Allocator, deps: []const ModuleDepend |
| 657 | 671 | return result; |
| 658 | 672 | } |
| 659 | 673 | |
| 660 | /// Initializes a RunStep with argv, which must at least have the path to the | |
| 674 | /// Initializes a `Step.Run` with argv, which must at least have the path to the | |
| 661 | 675 | /// executable. More command line arguments can be added with `addArg`, |
| 662 | 676 | /// `addArgs`, and `addArtifactArg`. |
| 663 | 677 | /// Be careful using this function, as it introduces a system dependency. |
| 664 | /// To run an executable built with zig build, see `CompileStep.run`. | |
| 665 | pub fn addSystemCommand(self: *Build, argv: []const []const u8) *RunStep { | |
| 678 | /// To run an executable built with zig build, see `Step.Compile.run`. | |
| 679 | pub fn addSystemCommand(self: *Build, argv: []const []const u8) *Step.Run { | |
| 666 | 680 | assert(argv.len >= 1); |
| 667 | const run_step = RunStep.create(self, self.fmt("run {s}", .{argv[0]})); | |
| 681 | const run_step = Step.Run.create(self, self.fmt("run {s}", .{argv[0]})); | |
| 668 | 682 | run_step.addArgs(argv); |
| 669 | 683 | return run_step; |
| 670 | 684 | } |
| 671 | 685 | |
| 672 | /// Creates a `RunStep` with an executable built with `addExecutable`. | |
| 673 | /// Add command line arguments with methods of `RunStep`. | |
| 674 | pub fn addRunArtifact(b: *Build, exe: *CompileStep) *RunStep { | |
| 686 | /// Creates a `Step.Run` with an executable built with `addExecutable`. | |
| 687 | /// Add command line arguments with methods of `Step.Run`. | |
| 688 | pub fn addRunArtifact(b: *Build, exe: *Step.Compile) *Step.Run { | |
| 675 | 689 | // It doesn't have to be native. We catch that if you actually try to run it. |
| 676 | 690 | // Consider that this is declarative; the run step may not be run unless a user |
| 677 | 691 | // option is supplied. |
| 678 | const run_step = RunStep.create(b, b.fmt("run {s}", .{exe.name})); | |
| 692 | const run_step = Step.Run.create(b, b.fmt("run {s}", .{exe.name})); | |
| 679 | 693 | run_step.addArtifactArg(exe); |
| 680 | 694 | |
| 681 | 695 | if (exe.kind == .@"test") { |
| ... | ... | @@ -696,14 +710,14 @@ pub fn addRunArtifact(b: *Build, exe: *CompileStep) *RunStep { |
| 696 | 710 | /// when an option found in the input file is missing from `values`. |
| 697 | 711 | pub fn addConfigHeader( |
| 698 | 712 | b: *Build, |
| 699 | options: ConfigHeaderStep.Options, | |
| 713 | options: Step.ConfigHeader.Options, | |
| 700 | 714 | values: anytype, |
| 701 | ) *ConfigHeaderStep { | |
| 715 | ) *Step.ConfigHeader { | |
| 702 | 716 | var options_copy = options; |
| 703 | 717 | if (options_copy.first_ret_addr == null) |
| 704 | 718 | options_copy.first_ret_addr = @returnAddress(); |
| 705 | 719 | |
| 706 | const config_header_step = ConfigHeaderStep.create(b, options_copy); | |
| 720 | const config_header_step = Step.ConfigHeader.create(b, options_copy); | |
| 707 | 721 | config_header_step.addValues(values); |
| 708 | 722 | return config_header_step; |
| 709 | 723 | } |
| ... | ... | @@ -734,28 +748,28 @@ pub fn dupePath(self: *Build, bytes: []const u8) []u8 { |
| 734 | 748 | return the_copy; |
| 735 | 749 | } |
| 736 | 750 | |
| 737 | pub fn addWriteFile(self: *Build, file_path: []const u8, data: []const u8) *WriteFileStep { | |
| 751 | pub fn addWriteFile(self: *Build, file_path: []const u8, data: []const u8) *Step.WriteFile { | |
| 738 | 752 | const write_file_step = self.addWriteFiles(); |
| 739 | 753 | write_file_step.add(file_path, data); |
| 740 | 754 | return write_file_step; |
| 741 | 755 | } |
| 742 | 756 | |
| 743 | pub fn addWriteFiles(b: *Build) *WriteFileStep { | |
| 744 | return WriteFileStep.create(b); | |
| 757 | pub fn addWriteFiles(b: *Build) *Step.WriteFile { | |
| 758 | return Step.WriteFile.create(b); | |
| 745 | 759 | } |
| 746 | 760 | |
| 747 | pub fn addRemoveDirTree(self: *Build, dir_path: []const u8) *RemoveDirStep { | |
| 748 | const remove_dir_step = self.allocator.create(RemoveDirStep) catch @panic("OOM"); | |
| 749 | remove_dir_step.* = RemoveDirStep.init(self, dir_path); | |
| 761 | pub fn addRemoveDirTree(self: *Build, dir_path: []const u8) *Step.RemoveDir { | |
| 762 | const remove_dir_step = self.allocator.create(Step.RemoveDir) catch @panic("OOM"); | |
| 763 | remove_dir_step.* = Step.RemoveDir.init(self, dir_path); | |
| 750 | 764 | return remove_dir_step; |
| 751 | 765 | } |
| 752 | 766 | |
| 753 | pub fn addFmt(b: *Build, options: FmtStep.Options) *FmtStep { | |
| 754 | return FmtStep.create(b, options); | |
| 767 | pub fn addFmt(b: *Build, options: Step.Fmt.Options) *Step.Fmt { | |
| 768 | return Step.Fmt.create(b, options); | |
| 755 | 769 | } |
| 756 | 770 | |
| 757 | pub fn addTranslateC(self: *Build, options: TranslateCStep.Options) *TranslateCStep { | |
| 758 | return TranslateCStep.create(self, options); | |
| 771 | pub fn addTranslateC(self: *Build, options: Step.TranslateC.Options) *Step.TranslateC { | |
| 772 | return Step.TranslateC.create(self, options); | |
| 759 | 773 | } |
| 760 | 774 | |
| 761 | 775 | pub fn getInstallStep(self: *Build) *Step { |
| ... | ... | @@ -1213,12 +1227,12 @@ fn printCmd(ally: Allocator, cwd: ?[]const u8, argv: []const []const u8) void { |
| 1213 | 1227 | std.debug.print("{s}\n", .{text}); |
| 1214 | 1228 | } |
| 1215 | 1229 | |
| 1216 | pub fn installArtifact(self: *Build, artifact: *CompileStep) void { | |
| 1230 | pub fn installArtifact(self: *Build, artifact: *Step.Compile) void { | |
| 1217 | 1231 | self.getInstallStep().dependOn(&self.addInstallArtifact(artifact).step); |
| 1218 | 1232 | } |
| 1219 | 1233 | |
| 1220 | pub fn addInstallArtifact(self: *Build, artifact: *CompileStep) *InstallArtifactStep { | |
| 1221 | return InstallArtifactStep.create(self, artifact); | |
| 1234 | pub fn addInstallArtifact(self: *Build, artifact: *Step.Compile) *Step.InstallArtifact { | |
| 1235 | return Step.InstallArtifact.create(self, artifact); | |
| 1222 | 1236 | } |
| 1223 | 1237 | |
| 1224 | 1238 | ///`dest_rel_path` is relative to prefix path |
| ... | ... | @@ -1240,26 +1254,26 @@ pub fn installLibFile(self: *Build, src_path: []const u8, dest_rel_path: []const |
| 1240 | 1254 | self.getInstallStep().dependOn(&self.addInstallFileWithDir(.{ .path = src_path }, .lib, dest_rel_path).step); |
| 1241 | 1255 | } |
| 1242 | 1256 | |
| 1243 | pub fn addObjCopy(b: *Build, source: FileSource, options: ObjCopyStep.Options) *ObjCopyStep { | |
| 1244 | return ObjCopyStep.create(b, source, options); | |
| 1257 | pub fn addObjCopy(b: *Build, source: FileSource, options: Step.ObjCopy.Options) *Step.ObjCopy { | |
| 1258 | return Step.ObjCopy.create(b, source, options); | |
| 1245 | 1259 | } |
| 1246 | 1260 | |
| 1247 | 1261 | ///`dest_rel_path` is relative to install prefix path |
| 1248 | pub fn addInstallFile(self: *Build, source: FileSource, dest_rel_path: []const u8) *InstallFileStep { | |
| 1262 | pub fn addInstallFile(self: *Build, source: FileSource, dest_rel_path: []const u8) *Step.InstallFile { | |
| 1249 | 1263 | return self.addInstallFileWithDir(source.dupe(self), .prefix, dest_rel_path); |
| 1250 | 1264 | } |
| 1251 | 1265 | |
| 1252 | 1266 | ///`dest_rel_path` is relative to bin path |
| 1253 | pub fn addInstallBinFile(self: *Build, source: FileSource, dest_rel_path: []const u8) *InstallFileStep { | |
| 1267 | pub fn addInstallBinFile(self: *Build, source: FileSource, dest_rel_path: []const u8) *Step.InstallFile { | |
| 1254 | 1268 | return self.addInstallFileWithDir(source.dupe(self), .bin, dest_rel_path); |
| 1255 | 1269 | } |
| 1256 | 1270 | |
| 1257 | 1271 | ///`dest_rel_path` is relative to lib path |
| 1258 | pub fn addInstallLibFile(self: *Build, source: FileSource, dest_rel_path: []const u8) *InstallFileStep { | |
| 1272 | pub fn addInstallLibFile(self: *Build, source: FileSource, dest_rel_path: []const u8) *Step.InstallFile { | |
| 1259 | 1273 | return self.addInstallFileWithDir(source.dupe(self), .lib, dest_rel_path); |
| 1260 | 1274 | } |
| 1261 | 1275 | |
| 1262 | pub fn addInstallHeaderFile(b: *Build, src_path: []const u8, dest_rel_path: []const u8) *InstallFileStep { | |
| 1276 | pub fn addInstallHeaderFile(b: *Build, src_path: []const u8, dest_rel_path: []const u8) *Step.InstallFile { | |
| 1263 | 1277 | return b.addInstallFileWithDir(.{ .path = src_path }, .header, dest_rel_path); |
| 1264 | 1278 | } |
| 1265 | 1279 | |
| ... | ... | @@ -1268,22 +1282,22 @@ pub fn addInstallFileWithDir( |
| 1268 | 1282 | source: FileSource, |
| 1269 | 1283 | install_dir: InstallDir, |
| 1270 | 1284 | dest_rel_path: []const u8, |
| 1271 | ) *InstallFileStep { | |
| 1272 | return InstallFileStep.create(self, source.dupe(self), install_dir, dest_rel_path); | |
| 1285 | ) *Step.InstallFile { | |
| 1286 | return Step.InstallFile.create(self, source.dupe(self), install_dir, dest_rel_path); | |
| 1273 | 1287 | } |
| 1274 | 1288 | |
| 1275 | pub fn addInstallDirectory(self: *Build, options: InstallDirectoryOptions) *InstallDirStep { | |
| 1276 | const install_step = self.allocator.create(InstallDirStep) catch @panic("OOM"); | |
| 1277 | install_step.* = InstallDirStep.init(self, options); | |
| 1289 | pub fn addInstallDirectory(self: *Build, options: InstallDirectoryOptions) *Step.InstallDir { | |
| 1290 | const install_step = self.allocator.create(Step.InstallDir) catch @panic("OOM"); | |
| 1291 | install_step.* = Step.InstallDir.init(self, options); | |
| 1278 | 1292 | return install_step; |
| 1279 | 1293 | } |
| 1280 | 1294 | |
| 1281 | 1295 | pub fn addCheckFile( |
| 1282 | 1296 | b: *Build, |
| 1283 | 1297 | file_source: FileSource, |
| 1284 | options: CheckFileStep.Options, | |
| 1285 | ) *CheckFileStep { | |
| 1286 | return CheckFileStep.create(b, file_source, options); | |
| 1298 | options: Step.CheckFile.Options, | |
| 1299 | ) *Step.CheckFile { | |
| 1300 | return Step.CheckFile.create(b, file_source, options); | |
| 1287 | 1301 | } |
| 1288 | 1302 | |
| 1289 | 1303 | pub fn pushInstalledFile(self: *Build, dir: InstallDir, dest_rel_path: []const u8) void { |
| ... | ... | @@ -1453,10 +1467,10 @@ pub fn getInstallPath(self: *Build, dir: InstallDir, dest_rel_path: []const u8) |
| 1453 | 1467 | pub const Dependency = struct { |
| 1454 | 1468 | builder: *Build, |
| 1455 | 1469 | |
| 1456 | pub fn artifact(d: *Dependency, name: []const u8) *CompileStep { | |
| 1457 | var found: ?*CompileStep = null; | |
| 1470 | pub fn artifact(d: *Dependency, name: []const u8) *Step.Compile { | |
| 1471 | var found: ?*Step.Compile = null; | |
| 1458 | 1472 | for (d.builder.install_tls.step.dependencies.items) |dep_step| { |
| 1459 | const inst = dep_step.cast(InstallArtifactStep) orelse continue; | |
| 1473 | const inst = dep_step.cast(Step.InstallArtifact) orelse continue; | |
| 1460 | 1474 | if (mem.eql(u8, inst.artifact.name, name)) { |
| 1461 | 1475 | if (found != null) panic("artifact name '{s}' is ambiguous", .{name}); |
| 1462 | 1476 | found = inst.artifact; |
| ... | ... | @@ -1464,7 +1478,7 @@ pub const Dependency = struct { |
| 1464 | 1478 | } |
| 1465 | 1479 | return found orelse { |
| 1466 | 1480 | for (d.builder.install_tls.step.dependencies.items) |dep_step| { |
| 1467 | const inst = dep_step.cast(InstallArtifactStep) orelse continue; | |
| 1481 | const inst = dep_step.cast(Step.InstallArtifact) orelse continue; | |
| 1468 | 1482 | log.info("available artifact: '{s}'", .{inst.artifact.name}); |
| 1469 | 1483 | } |
| 1470 | 1484 | panic("unable to find artifact '{s}'", .{name}); |
| ... | ... | @@ -1808,17 +1822,5 @@ pub fn hex64(x: u64) [16]u8 { |
| 1808 | 1822 | } |
| 1809 | 1823 | |
| 1810 | 1824 | test { |
| 1811 | _ = CheckFileStep; | |
| 1812 | _ = CheckObjectStep; | |
| 1813 | _ = FmtStep; | |
| 1814 | _ = InstallArtifactStep; | |
| 1815 | _ = InstallDirStep; | |
| 1816 | _ = InstallFileStep; | |
| 1817 | _ = ObjCopyStep; | |
| 1818 | _ = CompileStep; | |
| 1819 | _ = OptionsStep; | |
| 1820 | _ = RemoveDirStep; | |
| 1821 | _ = RunStep; | |
| 1822 | _ = TranslateCStep; | |
| 1823 | _ = WriteFileStep; | |
| 1825 | _ = Step; | |
| 1824 | 1826 | } |
lib/std/Build/Step.zig+49-18| ... | ... | @@ -94,26 +94,41 @@ pub const Id = enum { |
| 94 | 94 | pub fn Type(comptime id: Id) type { |
| 95 | 95 | return switch (id) { |
| 96 | 96 | .top_level => Build.TopLevelStep, |
| 97 | .compile => Build.CompileStep, | |
| 98 | .install_artifact => Build.InstallArtifactStep, | |
| 99 | .install_file => Build.InstallFileStep, | |
| 100 | .install_dir => Build.InstallDirStep, | |
| 101 | .remove_dir => Build.RemoveDirStep, | |
| 102 | .fmt => Build.FmtStep, | |
| 103 | .translate_c => Build.TranslateCStep, | |
| 104 | .write_file => Build.WriteFileStep, | |
| 105 | .run => Build.RunStep, | |
| 106 | .check_file => Build.CheckFileStep, | |
| 107 | .check_object => Build.CheckObjectStep, | |
| 108 | .config_header => Build.ConfigHeaderStep, | |
| 109 | .objcopy => Build.ObjCopyStep, | |
| 110 | .options => Build.OptionsStep, | |
| 97 | .compile => Compile, | |
| 98 | .install_artifact => InstallArtifact, | |
| 99 | .install_file => InstallFile, | |
| 100 | .install_dir => InstallDir, | |
| 101 | .remove_dir => RemoveDir, | |
| 102 | .fmt => Fmt, | |
| 103 | .translate_c => TranslateC, | |
| 104 | .write_file => WriteFile, | |
| 105 | .run => Run, | |
| 106 | .check_file => CheckFile, | |
| 107 | .check_object => CheckObject, | |
| 108 | .config_header => ConfigHeader, | |
| 109 | .objcopy => ObjCopy, | |
| 110 | .options => Options, | |
| 111 | 111 | .custom => @compileError("no type available for custom step"), |
| 112 | 112 | }; |
| 113 | 113 | } |
| 114 | 114 | }; |
| 115 | 115 | |
| 116 | pub const Options = struct { | |
| 116 | pub const CheckFile = @import("Step/CheckFile.zig"); | |
| 117 | pub const CheckObject = @import("Step/CheckObject.zig"); | |
| 118 | pub const ConfigHeader = @import("Step/ConfigHeader.zig"); | |
| 119 | pub const Fmt = @import("Step/Fmt.zig"); | |
| 120 | pub const InstallArtifact = @import("Step/InstallArtifact.zig"); | |
| 121 | pub const InstallDir = @import("Step/InstallDir.zig"); | |
| 122 | pub const InstallFile = @import("Step/InstallFile.zig"); | |
| 123 | pub const ObjCopy = @import("Step/ObjCopy.zig"); | |
| 124 | pub const Compile = @import("Step/Compile.zig"); | |
| 125 | pub const Options = @import("Step/Options.zig"); | |
| 126 | pub const RemoveDir = @import("Step/RemoveDir.zig"); | |
| 127 | pub const Run = @import("Step/Run.zig"); | |
| 128 | pub const TranslateC = @import("Step/TranslateC.zig"); | |
| 129 | pub const WriteFile = @import("Step/WriteFile.zig"); | |
| 130 | ||
| 131 | pub const StepOptions = struct { | |
| 117 | 132 | id: Id, |
| 118 | 133 | name: []const u8, |
| 119 | 134 | owner: *Build, |
| ... | ... | @@ -122,7 +137,7 @@ pub const Options = struct { |
| 122 | 137 | max_rss: usize = 0, |
| 123 | 138 | }; |
| 124 | 139 | |
| 125 | pub fn init(options: Options) Step { | |
| 140 | pub fn init(options: StepOptions) Step { | |
| 126 | 141 | const arena = options.owner.allocator; |
| 127 | 142 | |
| 128 | 143 | var addresses = [1]usize{0} ** n_debug_stack_frames; |
| ... | ... | @@ -387,8 +402,8 @@ pub fn evalZigProcess( |
| 387 | 402 | s.result_duration_ns = timer.read(); |
| 388 | 403 | s.result_peak_rss = child.resource_usage_statistics.getMaxRss() orelse 0; |
| 389 | 404 | |
| 390 | // Special handling for CompileStep that is expecting compile errors. | |
| 391 | if (s.cast(Build.CompileStep)) |compile| switch (term) { | |
| 405 | // Special handling for Compile step that is expecting compile errors. | |
| 406 | if (s.cast(Compile)) |compile| switch (term) { | |
| 392 | 407 | .Exited => { |
| 393 | 408 | // Note that the exit code may be 0 in this case due to the |
| 394 | 409 | // compiler server protocol. |
| ... | ... | @@ -535,3 +550,19 @@ pub fn writeManifest(s: *Step, man: *std.Build.Cache.Manifest) !void { |
| 535 | 550 | }; |
| 536 | 551 | } |
| 537 | 552 | } |
| 553 | ||
| 554 | test { | |
| 555 | _ = CheckFile; | |
| 556 | _ = CheckObject; | |
| 557 | _ = Fmt; | |
| 558 | _ = InstallArtifact; | |
| 559 | _ = InstallDir; | |
| 560 | _ = InstallFile; | |
| 561 | _ = ObjCopy; | |
| 562 | _ = Compile; | |
| 563 | _ = Options; | |
| 564 | _ = RemoveDir; | |
| 565 | _ = Run; | |
| 566 | _ = TranslateC; | |
| 567 | _ = WriteFile; | |
| 568 | } |
lib/std/Build/Step/CheckFile.zig+6-6| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | //! Fail the build step if a file does not match certain checks. |
| 2 | 2 | //! TODO: make this more flexible, supporting more kinds of checks. |
| 3 | 3 | //! TODO: generalize the code in std.testing.expectEqualStrings and make this |
| 4 | //! CheckFileStep produce those helpful diagnostics when there is not a match. | |
| 5 | const CheckFileStep = @This(); | |
| 4 | //! CheckFile step produce those helpful diagnostics when there is not a match. | |
| 5 | const CheckFile = @This(); | |
| 6 | 6 | const std = @import("std"); |
| 7 | 7 | const Step = std.Build.Step; |
| 8 | 8 | const fs = std.fs; |
| ... | ... | @@ -25,8 +25,8 @@ pub fn create( |
| 25 | 25 | owner: *std.Build, |
| 26 | 26 | source: std.Build.FileSource, |
| 27 | 27 | options: Options, |
| 28 | ) *CheckFileStep { | |
| 29 | const self = owner.allocator.create(CheckFileStep) catch @panic("OOM"); | |
| 28 | ) *CheckFile { | |
| 29 | const self = owner.allocator.create(CheckFile) catch @panic("OOM"); | |
| 30 | 30 | self.* = .{ |
| 31 | 31 | .step = Step.init(.{ |
| 32 | 32 | .id = .check_file, |
| ... | ... | @@ -42,14 +42,14 @@ pub fn create( |
| 42 | 42 | return self; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | pub fn setName(self: *CheckFileStep, name: []const u8) void { | |
| 45 | pub fn setName(self: *CheckFile, name: []const u8) void { | |
| 46 | 46 | self.step.name = name; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 50 | 50 | _ = prog_node; |
| 51 | 51 | const b = step.owner; |
| 52 | const self = @fieldParentPtr(CheckFileStep, "step", step); | |
| 52 | const self = @fieldParentPtr(CheckFile, "step", step); | |
| 53 | 53 | |
| 54 | 54 | const src_path = self.source.getPath(b); |
| 55 | 55 | const contents = fs.cwd().readFileAlloc(b.allocator, src_path, self.max_bytes) catch |err| { |
lib/std/Build/Step/CheckObject.zig+14-14| ... | ... | @@ -6,7 +6,7 @@ const math = std.math; |
| 6 | 6 | const mem = std.mem; |
| 7 | 7 | const testing = std.testing; |
| 8 | 8 | |
| 9 | const CheckObjectStep = @This(); | |
| 9 | const CheckObject = @This(); | |
| 10 | 10 | |
| 11 | 11 | const Allocator = mem.Allocator; |
| 12 | 12 | const Step = std.Build.Step; |
| ... | ... | @@ -24,9 +24,9 @@ pub fn create( |
| 24 | 24 | owner: *std.Build, |
| 25 | 25 | source: std.Build.FileSource, |
| 26 | 26 | obj_format: std.Target.ObjectFormat, |
| 27 | ) *CheckObjectStep { | |
| 27 | ) *CheckObject { | |
| 28 | 28 | const gpa = owner.allocator; |
| 29 | const self = gpa.create(CheckObjectStep) catch @panic("OOM"); | |
| 29 | const self = gpa.create(CheckObject) catch @panic("OOM"); | |
| 30 | 30 | self.* = .{ |
| 31 | 31 | .step = Step.init(.{ |
| 32 | 32 | .id = .check_file, |
| ... | ... | @@ -47,11 +47,11 @@ pub fn create( |
| 47 | 47 | /// TODO this doesn't actually compare, and there's no apparent reason for it |
| 48 | 48 | /// to depend on the check object step. I don't see why this function should exist, |
| 49 | 49 | /// the caller could just add the run step directly. |
| 50 | pub fn runAndCompare(self: *CheckObjectStep) *std.Build.RunStep { | |
| 50 | pub fn runAndCompare(self: *CheckObject) *std.Build.Step.Run { | |
| 51 | 51 | const dependencies_len = self.step.dependencies.items.len; |
| 52 | 52 | assert(dependencies_len > 0); |
| 53 | 53 | const exe_step = self.step.dependencies.items[dependencies_len - 1]; |
| 54 | const exe = exe_step.cast(std.Build.CompileStep).?; | |
| 54 | const exe = exe_step.cast(std.Build.Step.Compile).?; | |
| 55 | 55 | const run = self.step.owner.addRunArtifact(exe); |
| 56 | 56 | run.skip_foreign_checks = true; |
| 57 | 57 | run.step.dependOn(&self.step); |
| ... | ... | @@ -274,15 +274,15 @@ const Check = struct { |
| 274 | 274 | }; |
| 275 | 275 | |
| 276 | 276 | /// Creates a new sequence of actions with `phrase` as the first anchor searched phrase. |
| 277 | pub fn checkStart(self: *CheckObjectStep, phrase: []const u8) void { | |
| 277 | pub fn checkStart(self: *CheckObject, phrase: []const u8) void { | |
| 278 | 278 | var new_check = Check.create(self.step.owner.allocator); |
| 279 | 279 | new_check.match(.{ .string = self.step.owner.dupe(phrase) }); |
| 280 | 280 | self.checks.append(new_check) catch @panic("OOM"); |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | /// Adds another searched phrase to the latest created Check with `CheckObjectStep.checkStart(...)`. | |
| 283 | /// Adds another searched phrase to the latest created Check with `CheckObject.checkStart(...)`. | |
| 284 | 284 | /// Asserts at least one check already exists. |
| 285 | pub fn checkNext(self: *CheckObjectStep, phrase: []const u8) void { | |
| 285 | pub fn checkNext(self: *CheckObject, phrase: []const u8) void { | |
| 286 | 286 | assert(self.checks.items.len > 0); |
| 287 | 287 | const last = &self.checks.items[self.checks.items.len - 1]; |
| 288 | 288 | last.match(.{ .string = self.step.owner.dupe(phrase) }); |
| ... | ... | @@ -291,7 +291,7 @@ pub fn checkNext(self: *CheckObjectStep, phrase: []const u8) void { |
| 291 | 291 | /// Like `checkNext()` but takes an additional argument `FileSource` which will be |
| 292 | 292 | /// resolved to a full search query in `make()`. |
| 293 | 293 | pub fn checkNextFileSource( |
| 294 | self: *CheckObjectStep, | |
| 294 | self: *CheckObject, | |
| 295 | 295 | phrase: []const u8, |
| 296 | 296 | file_source: std.Build.FileSource, |
| 297 | 297 | ) void { |
| ... | ... | @@ -300,10 +300,10 @@ pub fn checkNextFileSource( |
| 300 | 300 | last.match(.{ .string = self.step.owner.dupe(phrase), .file_source = file_source }); |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | /// Adds another searched phrase to the latest created Check with `CheckObjectStep.checkStart(...)` | |
| 303 | /// Adds another searched phrase to the latest created Check with `CheckObject.checkStart(...)` | |
| 304 | 304 | /// however ensures there is no matching phrase in the output. |
| 305 | 305 | /// Asserts at least one check already exists. |
| 306 | pub fn checkNotPresent(self: *CheckObjectStep, phrase: []const u8) void { | |
| 306 | pub fn checkNotPresent(self: *CheckObject, phrase: []const u8) void { | |
| 307 | 307 | assert(self.checks.items.len > 0); |
| 308 | 308 | const last = &self.checks.items[self.checks.items.len - 1]; |
| 309 | 309 | last.notPresent(.{ .string = self.step.owner.dupe(phrase) }); |
| ... | ... | @@ -312,7 +312,7 @@ pub fn checkNotPresent(self: *CheckObjectStep, phrase: []const u8) void { |
| 312 | 312 | /// Creates a new check checking specifically symbol table parsed and dumped from the object |
| 313 | 313 | /// file. |
| 314 | 314 | /// Issuing this check will force parsing and dumping of the symbol table. |
| 315 | pub fn checkInSymtab(self: *CheckObjectStep) void { | |
| 315 | pub fn checkInSymtab(self: *CheckObject) void { | |
| 316 | 316 | self.dump_symtab = true; |
| 317 | 317 | const symtab_label = switch (self.obj_format) { |
| 318 | 318 | .macho => MachODumper.symtab_label, |
| ... | ... | @@ -325,7 +325,7 @@ pub fn checkInSymtab(self: *CheckObjectStep) void { |
| 325 | 325 | /// on the extracted variables. It will then compare the reduced program with the value of |
| 326 | 326 | /// the expected variable. |
| 327 | 327 | pub fn checkComputeCompare( |
| 328 | self: *CheckObjectStep, | |
| 328 | self: *CheckObject, | |
| 329 | 329 | program: []const u8, |
| 330 | 330 | expected: ComputeCompareExpected, |
| 331 | 331 | ) void { |
| ... | ... | @@ -338,7 +338,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 338 | 338 | _ = prog_node; |
| 339 | 339 | const b = step.owner; |
| 340 | 340 | const gpa = b.allocator; |
| 341 | const self = @fieldParentPtr(CheckObjectStep, "step", step); | |
| 341 | const self = @fieldParentPtr(CheckObject, "step", step); | |
| 342 | 342 | |
| 343 | 343 | const src_path = self.source.getPath(b); |
| 344 | 344 | const contents = fs.cwd().readFileAllocOptions( |
lib/std/Build/Step/Compile.zig+81-87| ... | ... | @@ -18,14 +18,8 @@ const ExecError = std.Build.ExecError; |
| 18 | 18 | const Module = std.Build.Module; |
| 19 | 19 | const VcpkgRoot = std.Build.VcpkgRoot; |
| 20 | 20 | const InstallDir = std.Build.InstallDir; |
| 21 | const InstallArtifactStep = std.Build.InstallArtifactStep; | |
| 22 | 21 | const GeneratedFile = std.Build.GeneratedFile; |
| 23 | const ObjCopyStep = std.Build.ObjCopyStep; | |
| 24 | const CheckObjectStep = std.Build.CheckObjectStep; | |
| 25 | const RunStep = std.Build.RunStep; | |
| 26 | const OptionsStep = std.Build.OptionsStep; | |
| 27 | const ConfigHeaderStep = std.Build.ConfigHeaderStep; | |
| 28 | const CompileStep = @This(); | |
| 22 | const Compile = @This(); | |
| 29 | 23 | |
| 30 | 24 | pub const base_id: Step.Id = .compile; |
| 31 | 25 | |
| ... | ... | @@ -211,8 +205,8 @@ want_lto: ?bool = null, |
| 211 | 205 | use_llvm: ?bool, |
| 212 | 206 | use_lld: ?bool, |
| 213 | 207 | |
| 214 | /// This is an advanced setting that can change the intent of this CompileStep. | |
| 215 | /// If this slice has nonzero length, it means that this CompileStep exists to | |
| 208 | /// This is an advanced setting that can change the intent of this Compile step. | |
| 209 | /// If this slice has nonzero length, it means that this Compile step exists to | |
| 216 | 210 | /// check for compile errors and return *success* if they match, and failure |
| 217 | 211 | /// otherwise. |
| 218 | 212 | expect_errors: []const []const u8 = &.{}, |
| ... | ... | @@ -242,7 +236,7 @@ pub const CSourceFile = struct { |
| 242 | 236 | |
| 243 | 237 | pub const LinkObject = union(enum) { |
| 244 | 238 | static_path: FileSource, |
| 245 | other_step: *CompileStep, | |
| 239 | other_step: *Compile, | |
| 246 | 240 | system_lib: SystemLib, |
| 247 | 241 | assembly_file: FileSource, |
| 248 | 242 | c_source_file: *CSourceFile, |
| ... | ... | @@ -273,8 +267,8 @@ const FrameworkLinkInfo = struct { |
| 273 | 267 | pub const IncludeDir = union(enum) { |
| 274 | 268 | raw_path: []const u8, |
| 275 | 269 | raw_path_system: []const u8, |
| 276 | other_step: *CompileStep, | |
| 277 | config_header_step: *ConfigHeaderStep, | |
| 270 | other_step: *Compile, | |
| 271 | config_header_step: *Step.ConfigHeader, | |
| 278 | 272 | }; |
| 279 | 273 | |
| 280 | 274 | pub const Options = struct { |
| ... | ... | @@ -319,7 +313,7 @@ pub const EmitOption = union(enum) { |
| 319 | 313 | } |
| 320 | 314 | }; |
| 321 | 315 | |
| 322 | pub fn create(owner: *std.Build, options: Options) *CompileStep { | |
| 316 | pub fn create(owner: *std.Build, options: Options) *Compile { | |
| 323 | 317 | const name = owner.dupe(options.name); |
| 324 | 318 | const root_src: ?FileSource = if (options.root_source_file) |rsrc| rsrc.dupe(owner) else null; |
| 325 | 319 | if (mem.indexOf(u8, name, "/") != null or mem.indexOf(u8, name, "\\") != null) { |
| ... | ... | @@ -361,8 +355,8 @@ pub fn create(owner: *std.Build, options: Options) *CompileStep { |
| 361 | 355 | .version = options.version, |
| 362 | 356 | }) catch @panic("OOM"); |
| 363 | 357 | |
| 364 | const self = owner.allocator.create(CompileStep) catch @panic("OOM"); | |
| 365 | self.* = CompileStep{ | |
| 358 | const self = owner.allocator.create(Compile) catch @panic("OOM"); | |
| 359 | self.* = Compile{ | |
| 366 | 360 | .strip = null, |
| 367 | 361 | .unwind_tables = null, |
| 368 | 362 | .verbose_link = false, |
| ... | ... | @@ -459,7 +453,7 @@ pub fn create(owner: *std.Build, options: Options) *CompileStep { |
| 459 | 453 | return self; |
| 460 | 454 | } |
| 461 | 455 | |
| 462 | pub fn installHeader(cs: *CompileStep, src_path: []const u8, dest_rel_path: []const u8) void { | |
| 456 | pub fn installHeader(cs: *Compile, src_path: []const u8, dest_rel_path: []const u8) void { | |
| 463 | 457 | const b = cs.step.owner; |
| 464 | 458 | const install_file = b.addInstallHeaderFile(src_path, dest_rel_path); |
| 465 | 459 | b.getInstallStep().dependOn(&install_file.step); |
| ... | ... | @@ -472,8 +466,8 @@ pub const InstallConfigHeaderOptions = struct { |
| 472 | 466 | }; |
| 473 | 467 | |
| 474 | 468 | pub fn installConfigHeader( |
| 475 | cs: *CompileStep, | |
| 476 | config_header: *ConfigHeaderStep, | |
| 469 | cs: *Compile, | |
| 470 | config_header: *Step.ConfigHeader, | |
| 477 | 471 | options: InstallConfigHeaderOptions, |
| 478 | 472 | ) void { |
| 479 | 473 | const dest_rel_path = options.dest_rel_path orelse config_header.include_path; |
| ... | ... | @@ -489,7 +483,7 @@ pub fn installConfigHeader( |
| 489 | 483 | } |
| 490 | 484 | |
| 491 | 485 | pub fn installHeadersDirectory( |
| 492 | a: *CompileStep, | |
| 486 | a: *Compile, | |
| 493 | 487 | src_dir_path: []const u8, |
| 494 | 488 | dest_rel_path: []const u8, |
| 495 | 489 | ) void { |
| ... | ... | @@ -501,8 +495,8 @@ pub fn installHeadersDirectory( |
| 501 | 495 | } |
| 502 | 496 | |
| 503 | 497 | pub fn installHeadersDirectoryOptions( |
| 504 | cs: *CompileStep, | |
| 505 | options: std.Build.InstallDirStep.Options, | |
| 498 | cs: *Compile, | |
| 499 | options: std.Build.Step.InstallDir.Options, | |
| 506 | 500 | ) void { |
| 507 | 501 | const b = cs.step.owner; |
| 508 | 502 | const install_dir = b.addInstallDirectory(options); |
| ... | ... | @@ -510,7 +504,7 @@ pub fn installHeadersDirectoryOptions( |
| 510 | 504 | cs.installed_headers.append(&install_dir.step) catch @panic("OOM"); |
| 511 | 505 | } |
| 512 | 506 | |
| 513 | pub fn installLibraryHeaders(cs: *CompileStep, l: *CompileStep) void { | |
| 507 | pub fn installLibraryHeaders(cs: *Compile, l: *Compile) void { | |
| 514 | 508 | assert(l.kind == .lib); |
| 515 | 509 | const b = cs.step.owner; |
| 516 | 510 | const install_step = b.getInstallStep(); |
| ... | ... | @@ -533,7 +527,7 @@ pub fn installLibraryHeaders(cs: *CompileStep, l: *CompileStep) void { |
| 533 | 527 | cs.installed_headers.appendSlice(l.installed_headers.items) catch @panic("OOM"); |
| 534 | 528 | } |
| 535 | 529 | |
| 536 | pub fn addObjCopy(cs: *CompileStep, options: ObjCopyStep.Options) *ObjCopyStep { | |
| 530 | pub fn addObjCopy(cs: *Compile, options: Step.ObjCopy.Options) *Step.ObjCopy { | |
| 537 | 531 | const b = cs.step.owner; |
| 538 | 532 | var copy = options; |
| 539 | 533 | if (copy.basename == null) { |
| ... | ... | @@ -554,34 +548,34 @@ pub const run = @compileError("deprecated; use std.Build.addRunArtifact"); |
| 554 | 548 | /// which is undesirable when installing an artifact provided by a dependency package. |
| 555 | 549 | pub const install = @compileError("deprecated; use std.Build.installArtifact"); |
| 556 | 550 | |
| 557 | pub fn checkObject(self: *CompileStep) *CheckObjectStep { | |
| 558 | return CheckObjectStep.create(self.step.owner, self.getOutputSource(), self.target_info.target.ofmt); | |
| 551 | pub fn checkObject(self: *Compile) *Step.CheckObject { | |
| 552 | return Step.CheckObject.create(self.step.owner, self.getOutputSource(), self.target_info.target.ofmt); | |
| 559 | 553 | } |
| 560 | 554 | |
| 561 | pub fn setLinkerScriptPath(self: *CompileStep, source: FileSource) void { | |
| 555 | pub fn setLinkerScriptPath(self: *Compile, source: FileSource) void { | |
| 562 | 556 | const b = self.step.owner; |
| 563 | 557 | self.linker_script = source.dupe(b); |
| 564 | 558 | source.addStepDependencies(&self.step); |
| 565 | 559 | } |
| 566 | 560 | |
| 567 | pub fn forceUndefinedSymbol(self: *CompileStep, symbol_name: []const u8) void { | |
| 561 | pub fn forceUndefinedSymbol(self: *Compile, symbol_name: []const u8) void { | |
| 568 | 562 | const b = self.step.owner; |
| 569 | 563 | self.force_undefined_symbols.put(b.dupe(symbol_name), {}) catch @panic("OOM"); |
| 570 | 564 | } |
| 571 | 565 | |
| 572 | pub fn linkFramework(self: *CompileStep, framework_name: []const u8) void { | |
| 566 | pub fn linkFramework(self: *Compile, framework_name: []const u8) void { | |
| 573 | 567 | const b = self.step.owner; |
| 574 | 568 | self.frameworks.put(b.dupe(framework_name), .{}) catch @panic("OOM"); |
| 575 | 569 | } |
| 576 | 570 | |
| 577 | pub fn linkFrameworkNeeded(self: *CompileStep, framework_name: []const u8) void { | |
| 571 | pub fn linkFrameworkNeeded(self: *Compile, framework_name: []const u8) void { | |
| 578 | 572 | const b = self.step.owner; |
| 579 | 573 | self.frameworks.put(b.dupe(framework_name), .{ |
| 580 | 574 | .needed = true, |
| 581 | 575 | }) catch @panic("OOM"); |
| 582 | 576 | } |
| 583 | 577 | |
| 584 | pub fn linkFrameworkWeak(self: *CompileStep, framework_name: []const u8) void { | |
| 578 | pub fn linkFrameworkWeak(self: *Compile, framework_name: []const u8) void { | |
| 585 | 579 | const b = self.step.owner; |
| 586 | 580 | self.frameworks.put(b.dupe(framework_name), .{ |
| 587 | 581 | .weak = true, |
| ... | ... | @@ -589,7 +583,7 @@ pub fn linkFrameworkWeak(self: *CompileStep, framework_name: []const u8) void { |
| 589 | 583 | } |
| 590 | 584 | |
| 591 | 585 | /// Returns whether the library, executable, or object depends on a particular system library. |
| 592 | pub fn dependsOnSystemLibrary(self: CompileStep, name: []const u8) bool { | |
| 586 | pub fn dependsOnSystemLibrary(self: Compile, name: []const u8) bool { | |
| 593 | 587 | if (isLibCLibrary(name)) { |
| 594 | 588 | return self.is_linking_libc; |
| 595 | 589 | } |
| ... | ... | @@ -605,51 +599,51 @@ pub fn dependsOnSystemLibrary(self: CompileStep, name: []const u8) bool { |
| 605 | 599 | return false; |
| 606 | 600 | } |
| 607 | 601 | |
| 608 | pub fn linkLibrary(self: *CompileStep, lib: *CompileStep) void { | |
| 602 | pub fn linkLibrary(self: *Compile, lib: *Compile) void { | |
| 609 | 603 | assert(lib.kind == .lib); |
| 610 | 604 | self.linkLibraryOrObject(lib); |
| 611 | 605 | } |
| 612 | 606 | |
| 613 | pub fn isDynamicLibrary(self: *CompileStep) bool { | |
| 607 | pub fn isDynamicLibrary(self: *Compile) bool { | |
| 614 | 608 | return self.kind == .lib and self.linkage == Linkage.dynamic; |
| 615 | 609 | } |
| 616 | 610 | |
| 617 | pub fn isStaticLibrary(self: *CompileStep) bool { | |
| 611 | pub fn isStaticLibrary(self: *Compile) bool { | |
| 618 | 612 | return self.kind == .lib and self.linkage != Linkage.dynamic; |
| 619 | 613 | } |
| 620 | 614 | |
| 621 | pub fn producesPdbFile(self: *CompileStep) bool { | |
| 615 | pub fn producesPdbFile(self: *Compile) bool { | |
| 622 | 616 | if (!self.target.isWindows() and !self.target.isUefi()) return false; |
| 623 | 617 | if (self.target.getObjectFormat() == .c) return false; |
| 624 | 618 | if (self.strip == true) return false; |
| 625 | 619 | return self.isDynamicLibrary() or self.kind == .exe or self.kind == .@"test"; |
| 626 | 620 | } |
| 627 | 621 | |
| 628 | pub fn linkLibC(self: *CompileStep) void { | |
| 622 | pub fn linkLibC(self: *Compile) void { | |
| 629 | 623 | self.is_linking_libc = true; |
| 630 | 624 | } |
| 631 | 625 | |
| 632 | pub fn linkLibCpp(self: *CompileStep) void { | |
| 626 | pub fn linkLibCpp(self: *Compile) void { | |
| 633 | 627 | self.is_linking_libcpp = true; |
| 634 | 628 | } |
| 635 | 629 | |
| 636 | 630 | /// If the value is omitted, it is set to 1. |
| 637 | 631 | /// `name` and `value` need not live longer than the function call. |
| 638 | pub fn defineCMacro(self: *CompileStep, name: []const u8, value: ?[]const u8) void { | |
| 632 | pub fn defineCMacro(self: *Compile, name: []const u8, value: ?[]const u8) void { | |
| 639 | 633 | const b = self.step.owner; |
| 640 | 634 | const macro = std.Build.constructCMacro(b.allocator, name, value); |
| 641 | 635 | self.c_macros.append(macro) catch @panic("OOM"); |
| 642 | 636 | } |
| 643 | 637 | |
| 644 | 638 | /// name_and_value looks like [name]=[value]. If the value is omitted, it is set to 1. |
| 645 | pub fn defineCMacroRaw(self: *CompileStep, name_and_value: []const u8) void { | |
| 639 | pub fn defineCMacroRaw(self: *Compile, name_and_value: []const u8) void { | |
| 646 | 640 | const b = self.step.owner; |
| 647 | 641 | self.c_macros.append(b.dupe(name_and_value)) catch @panic("OOM"); |
| 648 | 642 | } |
| 649 | 643 | |
| 650 | 644 | /// This one has no integration with anything, it just puts -lname on the command line. |
| 651 | 645 | /// Prefer to use `linkSystemLibrary` instead. |
| 652 | pub fn linkSystemLibraryName(self: *CompileStep, name: []const u8) void { | |
| 646 | pub fn linkSystemLibraryName(self: *Compile, name: []const u8) void { | |
| 653 | 647 | const b = self.step.owner; |
| 654 | 648 | self.link_objects.append(.{ |
| 655 | 649 | .system_lib = .{ |
| ... | ... | @@ -663,7 +657,7 @@ pub fn linkSystemLibraryName(self: *CompileStep, name: []const u8) void { |
| 663 | 657 | |
| 664 | 658 | /// This one has no integration with anything, it just puts -needed-lname on the command line. |
| 665 | 659 | /// Prefer to use `linkSystemLibraryNeeded` instead. |
| 666 | pub fn linkSystemLibraryNeededName(self: *CompileStep, name: []const u8) void { | |
| 660 | pub fn linkSystemLibraryNeededName(self: *Compile, name: []const u8) void { | |
| 667 | 661 | const b = self.step.owner; |
| 668 | 662 | self.link_objects.append(.{ |
| 669 | 663 | .system_lib = .{ |
| ... | ... | @@ -677,7 +671,7 @@ pub fn linkSystemLibraryNeededName(self: *CompileStep, name: []const u8) void { |
| 677 | 671 | |
| 678 | 672 | /// Darwin-only. This one has no integration with anything, it just puts -weak-lname on the |
| 679 | 673 | /// command line. Prefer to use `linkSystemLibraryWeak` instead. |
| 680 | pub fn linkSystemLibraryWeakName(self: *CompileStep, name: []const u8) void { | |
| 674 | pub fn linkSystemLibraryWeakName(self: *Compile, name: []const u8) void { | |
| 681 | 675 | const b = self.step.owner; |
| 682 | 676 | self.link_objects.append(.{ |
| 683 | 677 | .system_lib = .{ |
| ... | ... | @@ -691,7 +685,7 @@ pub fn linkSystemLibraryWeakName(self: *CompileStep, name: []const u8) void { |
| 691 | 685 | |
| 692 | 686 | /// This links against a system library, exclusively using pkg-config to find the library. |
| 693 | 687 | /// Prefer to use `linkSystemLibrary` instead. |
| 694 | pub fn linkSystemLibraryPkgConfigOnly(self: *CompileStep, lib_name: []const u8) void { | |
| 688 | pub fn linkSystemLibraryPkgConfigOnly(self: *Compile, lib_name: []const u8) void { | |
| 695 | 689 | const b = self.step.owner; |
| 696 | 690 | self.link_objects.append(.{ |
| 697 | 691 | .system_lib = .{ |
| ... | ... | @@ -705,7 +699,7 @@ pub fn linkSystemLibraryPkgConfigOnly(self: *CompileStep, lib_name: []const u8) |
| 705 | 699 | |
| 706 | 700 | /// This links against a system library, exclusively using pkg-config to find the library. |
| 707 | 701 | /// Prefer to use `linkSystemLibraryNeeded` instead. |
| 708 | pub fn linkSystemLibraryNeededPkgConfigOnly(self: *CompileStep, lib_name: []const u8) void { | |
| 702 | pub fn linkSystemLibraryNeededPkgConfigOnly(self: *Compile, lib_name: []const u8) void { | |
| 709 | 703 | const b = self.step.owner; |
| 710 | 704 | self.link_objects.append(.{ |
| 711 | 705 | .system_lib = .{ |
| ... | ... | @@ -719,7 +713,7 @@ pub fn linkSystemLibraryNeededPkgConfigOnly(self: *CompileStep, lib_name: []cons |
| 719 | 713 | |
| 720 | 714 | /// Run pkg-config for the given library name and parse the output, returning the arguments |
| 721 | 715 | /// that should be passed to zig to link the given library. |
| 722 | fn runPkgConfig(self: *CompileStep, lib_name: []const u8) ![]const []const u8 { | |
| 716 | fn runPkgConfig(self: *Compile, lib_name: []const u8) ![]const []const u8 { | |
| 723 | 717 | const b = self.step.owner; |
| 724 | 718 | const pkg_name = match: { |
| 725 | 719 | // First we have to map the library name to pkg config name. Unfortunately, |
| ... | ... | @@ -813,19 +807,19 @@ fn runPkgConfig(self: *CompileStep, lib_name: []const u8) ![]const []const u8 { |
| 813 | 807 | return zig_args.toOwnedSlice(); |
| 814 | 808 | } |
| 815 | 809 | |
| 816 | pub fn linkSystemLibrary(self: *CompileStep, name: []const u8) void { | |
| 810 | pub fn linkSystemLibrary(self: *Compile, name: []const u8) void { | |
| 817 | 811 | self.linkSystemLibraryInner(name, .{}); |
| 818 | 812 | } |
| 819 | 813 | |
| 820 | pub fn linkSystemLibraryNeeded(self: *CompileStep, name: []const u8) void { | |
| 814 | pub fn linkSystemLibraryNeeded(self: *Compile, name: []const u8) void { | |
| 821 | 815 | self.linkSystemLibraryInner(name, .{ .needed = true }); |
| 822 | 816 | } |
| 823 | 817 | |
| 824 | pub fn linkSystemLibraryWeak(self: *CompileStep, name: []const u8) void { | |
| 818 | pub fn linkSystemLibraryWeak(self: *Compile, name: []const u8) void { | |
| 825 | 819 | self.linkSystemLibraryInner(name, .{ .weak = true }); |
| 826 | 820 | } |
| 827 | 821 | |
| 828 | fn linkSystemLibraryInner(self: *CompileStep, name: []const u8, opts: struct { | |
| 822 | fn linkSystemLibraryInner(self: *Compile, name: []const u8, opts: struct { | |
| 829 | 823 | needed: bool = false, |
| 830 | 824 | weak: bool = false, |
| 831 | 825 | }) void { |
| ... | ... | @@ -850,7 +844,7 @@ fn linkSystemLibraryInner(self: *CompileStep, name: []const u8, opts: struct { |
| 850 | 844 | } |
| 851 | 845 | |
| 852 | 846 | /// Handy when you have many C/C++ source files and want them all to have the same flags. |
| 853 | pub fn addCSourceFiles(self: *CompileStep, files: []const []const u8, flags: []const []const u8) void { | |
| 847 | pub fn addCSourceFiles(self: *Compile, files: []const []const u8, flags: []const []const u8) void { | |
| 854 | 848 | const b = self.step.owner; |
| 855 | 849 | const c_source_files = b.allocator.create(CSourceFiles) catch @panic("OOM"); |
| 856 | 850 | |
| ... | ... | @@ -864,14 +858,14 @@ pub fn addCSourceFiles(self: *CompileStep, files: []const []const u8, flags: []c |
| 864 | 858 | self.link_objects.append(.{ .c_source_files = c_source_files }) catch @panic("OOM"); |
| 865 | 859 | } |
| 866 | 860 | |
| 867 | pub fn addCSourceFile(self: *CompileStep, file: []const u8, flags: []const []const u8) void { | |
| 861 | pub fn addCSourceFile(self: *Compile, file: []const u8, flags: []const []const u8) void { | |
| 868 | 862 | self.addCSourceFileSource(.{ |
| 869 | 863 | .args = flags, |
| 870 | 864 | .source = .{ .path = file }, |
| 871 | 865 | }); |
| 872 | 866 | } |
| 873 | 867 | |
| 874 | pub fn addCSourceFileSource(self: *CompileStep, source: CSourceFile) void { | |
| 868 | pub fn addCSourceFileSource(self: *Compile, source: CSourceFile) void { | |
| 875 | 869 | const b = self.step.owner; |
| 876 | 870 | const c_source_file = b.allocator.create(CSourceFile) catch @panic("OOM"); |
| 877 | 871 | c_source_file.* = source.dupe(b); |
| ... | ... | @@ -879,85 +873,85 @@ pub fn addCSourceFileSource(self: *CompileStep, source: CSourceFile) void { |
| 879 | 873 | source.source.addStepDependencies(&self.step); |
| 880 | 874 | } |
| 881 | 875 | |
| 882 | pub fn setVerboseLink(self: *CompileStep, value: bool) void { | |
| 876 | pub fn setVerboseLink(self: *Compile, value: bool) void { | |
| 883 | 877 | self.verbose_link = value; |
| 884 | 878 | } |
| 885 | 879 | |
| 886 | pub fn setVerboseCC(self: *CompileStep, value: bool) void { | |
| 880 | pub fn setVerboseCC(self: *Compile, value: bool) void { | |
| 887 | 881 | self.verbose_cc = value; |
| 888 | 882 | } |
| 889 | 883 | |
| 890 | pub fn overrideZigLibDir(self: *CompileStep, dir_path: []const u8) void { | |
| 884 | pub fn overrideZigLibDir(self: *Compile, dir_path: []const u8) void { | |
| 891 | 885 | const b = self.step.owner; |
| 892 | 886 | self.zig_lib_dir = b.dupePath(dir_path); |
| 893 | 887 | } |
| 894 | 888 | |
| 895 | pub fn setMainPkgPath(self: *CompileStep, dir_path: []const u8) void { | |
| 889 | pub fn setMainPkgPath(self: *Compile, dir_path: []const u8) void { | |
| 896 | 890 | const b = self.step.owner; |
| 897 | 891 | self.main_pkg_path = b.dupePath(dir_path); |
| 898 | 892 | } |
| 899 | 893 | |
| 900 | pub fn setLibCFile(self: *CompileStep, libc_file: ?FileSource) void { | |
| 894 | pub fn setLibCFile(self: *Compile, libc_file: ?FileSource) void { | |
| 901 | 895 | const b = self.step.owner; |
| 902 | 896 | self.libc_file = if (libc_file) |f| f.dupe(b) else null; |
| 903 | 897 | } |
| 904 | 898 | |
| 905 | 899 | /// Returns the generated executable, library or object file. |
| 906 | 900 | /// To run an executable built with zig build, use `run`, or create an install step and invoke it. |
| 907 | pub fn getOutputSource(self: *CompileStep) FileSource { | |
| 901 | pub fn getOutputSource(self: *Compile) FileSource { | |
| 908 | 902 | return .{ .generated = &self.output_path_source }; |
| 909 | 903 | } |
| 910 | 904 | |
| 911 | pub fn getOutputDirectorySource(self: *CompileStep) FileSource { | |
| 905 | pub fn getOutputDirectorySource(self: *Compile) FileSource { | |
| 912 | 906 | return .{ .generated = &self.output_dirname_source }; |
| 913 | 907 | } |
| 914 | 908 | |
| 915 | 909 | /// Returns the generated import library. This function can only be called for libraries. |
| 916 | pub fn getOutputLibSource(self: *CompileStep) FileSource { | |
| 910 | pub fn getOutputLibSource(self: *Compile) FileSource { | |
| 917 | 911 | assert(self.kind == .lib); |
| 918 | 912 | return .{ .generated = &self.output_lib_path_source }; |
| 919 | 913 | } |
| 920 | 914 | |
| 921 | 915 | /// Returns the generated header file. |
| 922 | 916 | /// This function can only be called for libraries or object files which have `emit_h` set. |
| 923 | pub fn getOutputHSource(self: *CompileStep) FileSource { | |
| 917 | pub fn getOutputHSource(self: *Compile) FileSource { | |
| 924 | 918 | assert(self.kind != .exe and self.kind != .@"test"); |
| 925 | 919 | assert(self.emit_h); |
| 926 | 920 | return .{ .generated = &self.output_h_path_source }; |
| 927 | 921 | } |
| 928 | 922 | |
| 929 | 923 | /// Returns the generated PDB file. This function can only be called for Windows and UEFI. |
| 930 | pub fn getOutputPdbSource(self: *CompileStep) FileSource { | |
| 924 | pub fn getOutputPdbSource(self: *Compile) FileSource { | |
| 931 | 925 | // TODO: Is this right? Isn't PDB for *any* PE/COFF file? |
| 932 | 926 | assert(self.target.isWindows() or self.target.isUefi()); |
| 933 | 927 | return .{ .generated = &self.output_pdb_path_source }; |
| 934 | 928 | } |
| 935 | 929 | |
| 936 | pub fn addAssemblyFile(self: *CompileStep, path: []const u8) void { | |
| 930 | pub fn addAssemblyFile(self: *Compile, path: []const u8) void { | |
| 937 | 931 | const b = self.step.owner; |
| 938 | 932 | self.link_objects.append(.{ |
| 939 | 933 | .assembly_file = .{ .path = b.dupe(path) }, |
| 940 | 934 | }) catch @panic("OOM"); |
| 941 | 935 | } |
| 942 | 936 | |
| 943 | pub fn addAssemblyFileSource(self: *CompileStep, source: FileSource) void { | |
| 937 | pub fn addAssemblyFileSource(self: *Compile, source: FileSource) void { | |
| 944 | 938 | const b = self.step.owner; |
| 945 | 939 | const source_duped = source.dupe(b); |
| 946 | 940 | self.link_objects.append(.{ .assembly_file = source_duped }) catch @panic("OOM"); |
| 947 | 941 | source_duped.addStepDependencies(&self.step); |
| 948 | 942 | } |
| 949 | 943 | |
| 950 | pub fn addObjectFile(self: *CompileStep, source_file: []const u8) void { | |
| 944 | pub fn addObjectFile(self: *Compile, source_file: []const u8) void { | |
| 951 | 945 | self.addObjectFileSource(.{ .path = source_file }); |
| 952 | 946 | } |
| 953 | 947 | |
| 954 | pub fn addObjectFileSource(self: *CompileStep, source: FileSource) void { | |
| 948 | pub fn addObjectFileSource(self: *Compile, source: FileSource) void { | |
| 955 | 949 | const b = self.step.owner; |
| 956 | 950 | self.link_objects.append(.{ .static_path = source.dupe(b) }) catch @panic("OOM"); |
| 957 | 951 | source.addStepDependencies(&self.step); |
| 958 | 952 | } |
| 959 | 953 | |
| 960 | pub fn addObject(self: *CompileStep, obj: *CompileStep) void { | |
| 954 | pub fn addObject(self: *Compile, obj: *Compile) void { | |
| 961 | 955 | assert(obj.kind == .obj); |
| 962 | 956 | self.linkLibraryOrObject(obj); |
| 963 | 957 | } |
| ... | ... | @@ -967,54 +961,54 @@ pub const addIncludeDir = @compileError("deprecated; use addIncludePath"); |
| 967 | 961 | pub const addLibPath = @compileError("deprecated, use addLibraryPath"); |
| 968 | 962 | pub const addFrameworkDir = @compileError("deprecated, use addFrameworkPath"); |
| 969 | 963 | |
| 970 | pub fn addSystemIncludePath(self: *CompileStep, path: []const u8) void { | |
| 964 | pub fn addSystemIncludePath(self: *Compile, path: []const u8) void { | |
| 971 | 965 | const b = self.step.owner; |
| 972 | 966 | self.include_dirs.append(IncludeDir{ .raw_path_system = b.dupe(path) }) catch @panic("OOM"); |
| 973 | 967 | } |
| 974 | 968 | |
| 975 | pub fn addIncludePath(self: *CompileStep, path: []const u8) void { | |
| 969 | pub fn addIncludePath(self: *Compile, path: []const u8) void { | |
| 976 | 970 | const b = self.step.owner; |
| 977 | 971 | self.include_dirs.append(IncludeDir{ .raw_path = b.dupe(path) }) catch @panic("OOM"); |
| 978 | 972 | } |
| 979 | 973 | |
| 980 | pub fn addConfigHeader(self: *CompileStep, config_header: *ConfigHeaderStep) void { | |
| 974 | pub fn addConfigHeader(self: *Compile, config_header: *Step.ConfigHeader) void { | |
| 981 | 975 | self.step.dependOn(&config_header.step); |
| 982 | 976 | self.include_dirs.append(.{ .config_header_step = config_header }) catch @panic("OOM"); |
| 983 | 977 | } |
| 984 | 978 | |
| 985 | pub fn addLibraryPath(self: *CompileStep, path: []const u8) void { | |
| 979 | pub fn addLibraryPath(self: *Compile, path: []const u8) void { | |
| 986 | 980 | const b = self.step.owner; |
| 987 | 981 | self.lib_paths.append(.{ .path = b.dupe(path) }) catch @panic("OOM"); |
| 988 | 982 | } |
| 989 | 983 | |
| 990 | pub fn addLibraryPathDirectorySource(self: *CompileStep, directory_source: FileSource) void { | |
| 984 | pub fn addLibraryPathDirectorySource(self: *Compile, directory_source: FileSource) void { | |
| 991 | 985 | self.lib_paths.append(directory_source) catch @panic("OOM"); |
| 992 | 986 | directory_source.addStepDependencies(&self.step); |
| 993 | 987 | } |
| 994 | 988 | |
| 995 | pub fn addRPath(self: *CompileStep, path: []const u8) void { | |
| 989 | pub fn addRPath(self: *Compile, path: []const u8) void { | |
| 996 | 990 | const b = self.step.owner; |
| 997 | 991 | self.rpaths.append(.{ .path = b.dupe(path) }) catch @panic("OOM"); |
| 998 | 992 | } |
| 999 | 993 | |
| 1000 | pub fn addRPathDirectorySource(self: *CompileStep, directory_source: FileSource) void { | |
| 994 | pub fn addRPathDirectorySource(self: *Compile, directory_source: FileSource) void { | |
| 1001 | 995 | self.rpaths.append(directory_source) catch @panic("OOM"); |
| 1002 | 996 | directory_source.addStepDependencies(&self.step); |
| 1003 | 997 | } |
| 1004 | 998 | |
| 1005 | pub fn addFrameworkPath(self: *CompileStep, dir_path: []const u8) void { | |
| 999 | pub fn addFrameworkPath(self: *Compile, dir_path: []const u8) void { | |
| 1006 | 1000 | const b = self.step.owner; |
| 1007 | 1001 | self.framework_dirs.append(.{ .path = b.dupe(dir_path) }) catch @panic("OOM"); |
| 1008 | 1002 | } |
| 1009 | 1003 | |
| 1010 | pub fn addFrameworkPathDirectorySource(self: *CompileStep, directory_source: FileSource) void { | |
| 1004 | pub fn addFrameworkPathDirectorySource(self: *Compile, directory_source: FileSource) void { | |
| 1011 | 1005 | self.framework_dirs.append(directory_source) catch @panic("OOM"); |
| 1012 | 1006 | directory_source.addStepDependencies(&self.step); |
| 1013 | 1007 | } |
| 1014 | 1008 | |
| 1015 | 1009 | /// Adds a module to be used with `@import` and exposing it in the current |
| 1016 | 1010 | /// package's module table using `name`. |
| 1017 | pub fn addModule(cs: *CompileStep, name: []const u8, module: *Module) void { | |
| 1011 | pub fn addModule(cs: *Compile, name: []const u8, module: *Module) void { | |
| 1018 | 1012 | const b = cs.step.owner; |
| 1019 | 1013 | cs.modules.put(b.dupe(name), module) catch @panic("OOM"); |
| 1020 | 1014 | |
| ... | ... | @@ -1025,17 +1019,17 @@ pub fn addModule(cs: *CompileStep, name: []const u8, module: *Module) void { |
| 1025 | 1019 | |
| 1026 | 1020 | /// Adds a module to be used with `@import` without exposing it in the current |
| 1027 | 1021 | /// package's module table. |
| 1028 | pub fn addAnonymousModule(cs: *CompileStep, name: []const u8, options: std.Build.CreateModuleOptions) void { | |
| 1022 | pub fn addAnonymousModule(cs: *Compile, name: []const u8, options: std.Build.CreateModuleOptions) void { | |
| 1029 | 1023 | const b = cs.step.owner; |
| 1030 | 1024 | const module = b.createModule(options); |
| 1031 | 1025 | return addModule(cs, name, module); |
| 1032 | 1026 | } |
| 1033 | 1027 | |
| 1034 | pub fn addOptions(cs: *CompileStep, module_name: []const u8, options: *OptionsStep) void { | |
| 1028 | pub fn addOptions(cs: *Compile, module_name: []const u8, options: *Step.Options) void { | |
| 1035 | 1029 | addModule(cs, module_name, options.createModule()); |
| 1036 | 1030 | } |
| 1037 | 1031 | |
| 1038 | fn addRecursiveBuildDeps(cs: *CompileStep, module: *Module, done: *std.AutoHashMap(*Module, void)) !void { | |
| 1032 | fn addRecursiveBuildDeps(cs: *Compile, module: *Module, done: *std.AutoHashMap(*Module, void)) !void { | |
| 1039 | 1033 | if (done.contains(module)) return; |
| 1040 | 1034 | try done.put(module, {}); |
| 1041 | 1035 | module.source_file.addStepDependencies(&cs.step); |
| ... | ... | @@ -1046,7 +1040,7 @@ fn addRecursiveBuildDeps(cs: *CompileStep, module: *Module, done: *std.AutoHashM |
| 1046 | 1040 | |
| 1047 | 1041 | /// If Vcpkg was found on the system, it will be added to include and lib |
| 1048 | 1042 | /// paths for the specified target. |
| 1049 | pub fn addVcpkgPaths(self: *CompileStep, linkage: CompileStep.Linkage) !void { | |
| 1043 | pub fn addVcpkgPaths(self: *Compile, linkage: Compile.Linkage) !void { | |
| 1050 | 1044 | const b = self.step.owner; |
| 1051 | 1045 | // Ideally in the Unattempted case we would call the function recursively |
| 1052 | 1046 | // after findVcpkgRoot and have only one switch statement, but the compiler |
| ... | ... | @@ -1082,7 +1076,7 @@ pub fn addVcpkgPaths(self: *CompileStep, linkage: CompileStep.Linkage) !void { |
| 1082 | 1076 | } |
| 1083 | 1077 | } |
| 1084 | 1078 | |
| 1085 | pub fn setExecCmd(self: *CompileStep, args: []const ?[]const u8) void { | |
| 1079 | pub fn setExecCmd(self: *Compile, args: []const ?[]const u8) void { | |
| 1086 | 1080 | const b = self.step.owner; |
| 1087 | 1081 | assert(self.kind == .@"test"); |
| 1088 | 1082 | const duped_args = b.allocator.alloc(?[]u8, args.len) catch @panic("OOM"); |
| ... | ... | @@ -1092,7 +1086,7 @@ pub fn setExecCmd(self: *CompileStep, args: []const ?[]const u8) void { |
| 1092 | 1086 | self.exec_cmd_args = duped_args; |
| 1093 | 1087 | } |
| 1094 | 1088 | |
| 1095 | fn linkLibraryOrObject(self: *CompileStep, other: *CompileStep) void { | |
| 1089 | fn linkLibraryOrObject(self: *Compile, other: *Compile) void { | |
| 1096 | 1090 | self.step.dependOn(&other.step); |
| 1097 | 1091 | self.link_objects.append(.{ .other_step = other }) catch @panic("OOM"); |
| 1098 | 1092 | self.include_dirs.append(.{ .other_step = other }) catch @panic("OOM"); |
| ... | ... | @@ -1103,7 +1097,7 @@ fn linkLibraryOrObject(self: *CompileStep, other: *CompileStep) void { |
| 1103 | 1097 | } |
| 1104 | 1098 | |
| 1105 | 1099 | fn appendModuleArgs( |
| 1106 | cs: *CompileStep, | |
| 1100 | cs: *Compile, | |
| 1107 | 1101 | zig_args: *ArrayList([]const u8), |
| 1108 | 1102 | ) error{OutOfMemory}!void { |
| 1109 | 1103 | const b = cs.step.owner; |
| ... | ... | @@ -1214,7 +1208,7 @@ fn constructDepString( |
| 1214 | 1208 | |
| 1215 | 1209 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 1216 | 1210 | const b = step.owner; |
| 1217 | const self = @fieldParentPtr(CompileStep, "step", step); | |
| 1211 | const self = @fieldParentPtr(Compile, "step", step); | |
| 1218 | 1212 | |
| 1219 | 1213 | if (self.root_src == null and self.link_objects.items.len == 0) { |
| 1220 | 1214 | return step.fail("the linker needs one or more objects to link", .{}); |
| ... | ... | @@ -2088,7 +2082,7 @@ const TransitiveDeps = struct { |
| 2088 | 2082 | } |
| 2089 | 2083 | } |
| 2090 | 2084 | |
| 2091 | fn addInner(td: *TransitiveDeps, other: *CompileStep, dyn: bool) !void { | |
| 2085 | fn addInner(td: *TransitiveDeps, other: *Compile, dyn: bool) !void { | |
| 2092 | 2086 | // Inherit dependency on libc and libc++ |
| 2093 | 2087 | td.is_linking_libcpp = td.is_linking_libcpp or other.is_linking_libcpp; |
| 2094 | 2088 | td.is_linking_libc = td.is_linking_libc or other.is_linking_libc; |
| ... | ... | @@ -2128,7 +2122,7 @@ const TransitiveDeps = struct { |
| 2128 | 2122 | } |
| 2129 | 2123 | }; |
| 2130 | 2124 | |
| 2131 | fn checkCompileErrors(self: *CompileStep) !void { | |
| 2125 | fn checkCompileErrors(self: *Compile) !void { | |
| 2132 | 2126 | // Clear this field so that it does not get printed by the build runner. |
| 2133 | 2127 | const actual_eb = self.step.result_error_bundle; |
| 2134 | 2128 | self.step.result_error_bundle = std.zig.ErrorBundle.empty; |
lib/std/Build/Step/ConfigHeader.zig+13-13| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const ConfigHeaderStep = @This(); | |
| 2 | const ConfigHeader = @This(); | |
| 3 | 3 | const Step = std.Build.Step; |
| 4 | 4 | |
| 5 | 5 | pub const Style = union(enum) { |
| ... | ... | @@ -48,8 +48,8 @@ pub const Options = struct { |
| 48 | 48 | first_ret_addr: ?usize = null, |
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | pub fn create(owner: *std.Build, options: Options) *ConfigHeaderStep { | |
| 52 | const self = owner.allocator.create(ConfigHeaderStep) catch @panic("OOM"); | |
| 51 | pub fn create(owner: *std.Build, options: Options) *ConfigHeader { | |
| 52 | const self = owner.allocator.create(ConfigHeader) catch @panic("OOM"); | |
| 53 | 53 | |
| 54 | 54 | var include_path: []const u8 = "config.h"; |
| 55 | 55 | |
| ... | ... | @@ -93,21 +93,21 @@ pub fn create(owner: *std.Build, options: Options) *ConfigHeaderStep { |
| 93 | 93 | return self; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | pub fn addValues(self: *ConfigHeaderStep, values: anytype) void { | |
| 96 | pub fn addValues(self: *ConfigHeader, values: anytype) void { | |
| 97 | 97 | return addValuesInner(self, values) catch @panic("OOM"); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | pub fn getFileSource(self: *ConfigHeaderStep) std.Build.FileSource { | |
| 100 | pub fn getFileSource(self: *ConfigHeader) std.Build.FileSource { | |
| 101 | 101 | return .{ .generated = &self.output_file }; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | fn addValuesInner(self: *ConfigHeaderStep, values: anytype) !void { | |
| 104 | fn addValuesInner(self: *ConfigHeader, values: anytype) !void { | |
| 105 | 105 | inline for (@typeInfo(@TypeOf(values)).Struct.fields) |field| { |
| 106 | 106 | try putValue(self, field.name, field.type, @field(values, field.name)); |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | fn putValue(self: *ConfigHeaderStep, field_name: []const u8, comptime T: type, v: T) !void { | |
| 110 | fn putValue(self: *ConfigHeader, field_name: []const u8, comptime T: type, v: T) !void { | |
| 111 | 111 | switch (@typeInfo(T)) { |
| 112 | 112 | .Null => { |
| 113 | 113 | try self.values.put(field_name, .undef); |
| ... | ... | @@ -151,31 +151,31 @@ fn putValue(self: *ConfigHeaderStep, field_name: []const u8, comptime T: type, v |
| 151 | 151 | else => {}, |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | @compileError("unsupported ConfigHeaderStep value type: " ++ @typeName(T)); | |
| 154 | @compileError("unsupported ConfigHeader value type: " ++ @typeName(T)); | |
| 155 | 155 | }, |
| 156 | else => @compileError("unsupported ConfigHeaderStep value type: " ++ @typeName(T)), | |
| 156 | else => @compileError("unsupported ConfigHeader value type: " ++ @typeName(T)), | |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 161 | 161 | _ = prog_node; |
| 162 | 162 | const b = step.owner; |
| 163 | const self = @fieldParentPtr(ConfigHeaderStep, "step", step); | |
| 163 | const self = @fieldParentPtr(ConfigHeader, "step", step); | |
| 164 | 164 | const gpa = b.allocator; |
| 165 | 165 | const arena = b.allocator; |
| 166 | 166 | |
| 167 | 167 | var man = b.cache.obtain(); |
| 168 | 168 | defer man.deinit(); |
| 169 | 169 | |
| 170 | // Random bytes to make ConfigHeaderStep unique. Refresh this with new | |
| 171 | // random bytes when ConfigHeaderStep implementation is modified in a | |
| 170 | // Random bytes to make ConfigHeader unique. Refresh this with new | |
| 171 | // random bytes when ConfigHeader implementation is modified in a | |
| 172 | 172 | // non-backwards-compatible way. |
| 173 | 173 | man.hash.add(@as(u32, 0xdef08d23)); |
| 174 | 174 | |
| 175 | 175 | var output = std.ArrayList(u8).init(gpa); |
| 176 | 176 | defer output.deinit(); |
| 177 | 177 | |
| 178 | const header_text = "This file was generated by ConfigHeaderStep using the Zig Build System."; | |
| 178 | const header_text = "This file was generated by ConfigHeader using the Zig Build System."; | |
| 179 | 179 | const c_generated_line = "/* " ++ header_text ++ " */\n"; |
| 180 | 180 | const asm_generated_line = "; " ++ header_text ++ "\n"; |
| 181 | 181 |
lib/std/Build/Step/Fmt.zig+4-4| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //! * Check mode: fail the step if a non-conforming file is found. |
| 4 | 4 | const std = @import("std"); |
| 5 | 5 | const Step = std.Build.Step; |
| 6 | const FmtStep = @This(); | |
| 6 | const Fmt = @This(); | |
| 7 | 7 | |
| 8 | 8 | step: Step, |
| 9 | 9 | paths: []const []const u8, |
| ... | ... | @@ -19,8 +19,8 @@ pub const Options = struct { |
| 19 | 19 | check: bool = false, |
| 20 | 20 | }; |
| 21 | 21 | |
| 22 | pub fn create(owner: *std.Build, options: Options) *FmtStep { | |
| 23 | const self = owner.allocator.create(FmtStep) catch @panic("OOM"); | |
| 22 | pub fn create(owner: *std.Build, options: Options) *Fmt { | |
| 23 | const self = owner.allocator.create(Fmt) catch @panic("OOM"); | |
| 24 | 24 | const name = if (options.check) "zig fmt --check" else "zig fmt"; |
| 25 | 25 | self.* = .{ |
| 26 | 26 | .step = Step.init(.{ |
| ... | ... | @@ -47,7 +47,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 47 | 47 | |
| 48 | 48 | const b = step.owner; |
| 49 | 49 | const arena = b.allocator; |
| 50 | const self = @fieldParentPtr(FmtStep, "step", step); | |
| 50 | const self = @fieldParentPtr(Fmt, "step", step); | |
| 51 | 51 | |
| 52 | 52 | var argv: std.ArrayListUnmanaged([]const u8) = .{}; |
| 53 | 53 | try argv.ensureUnusedCapacity(arena, 2 + 1 + self.paths.len + 2 * self.exclude_paths.len); |
lib/std/Build/Step/InstallArtifact.zig+8-9| ... | ... | @@ -1,24 +1,23 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const Step = std.Build.Step; |
| 3 | const CompileStep = std.Build.CompileStep; | |
| 4 | 3 | const InstallDir = std.Build.InstallDir; |
| 5 | const InstallArtifactStep = @This(); | |
| 4 | const InstallArtifact = @This(); | |
| 6 | 5 | const fs = std.fs; |
| 7 | 6 | |
| 8 | 7 | pub const base_id = .install_artifact; |
| 9 | 8 | |
| 10 | 9 | step: Step, |
| 11 | artifact: *CompileStep, | |
| 10 | artifact: *Step.Compile, | |
| 12 | 11 | dest_dir: InstallDir, |
| 13 | 12 | pdb_dir: ?InstallDir, |
| 14 | 13 | h_dir: ?InstallDir, |
| 15 | 14 | /// If non-null, adds additional path components relative to dest_dir, and |
| 16 | /// overrides the basename of the CompileStep. | |
| 15 | /// overrides the basename of the Compile step. | |
| 17 | 16 | dest_sub_path: ?[]const u8, |
| 18 | 17 | |
| 19 | pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep { | |
| 20 | const self = owner.allocator.create(InstallArtifactStep) catch @panic("OOM"); | |
| 21 | self.* = InstallArtifactStep{ | |
| 18 | pub fn create(owner: *std.Build, artifact: *Step.Compile) *InstallArtifact { | |
| 19 | const self = owner.allocator.create(InstallArtifact) catch @panic("OOM"); | |
| 20 | self.* = InstallArtifact{ | |
| 22 | 21 | .step = Step.init(.{ |
| 23 | 22 | .id = base_id, |
| 24 | 23 | .name = owner.fmt("install {s}", .{artifact.name}), |
| ... | ... | @@ -66,7 +65,7 @@ pub fn create(owner: *std.Build, artifact: *CompileStep) *InstallArtifactStep { |
| 66 | 65 | |
| 67 | 66 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 68 | 67 | _ = prog_node; |
| 69 | const self = @fieldParentPtr(InstallArtifactStep, "step", step); | |
| 68 | const self = @fieldParentPtr(InstallArtifact, "step", step); | |
| 70 | 69 | const src_builder = self.artifact.step.owner; |
| 71 | 70 | const dest_builder = step.owner; |
| 72 | 71 | |
| ... | ... | @@ -90,7 +89,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 90 | 89 | self.artifact.version != null and |
| 91 | 90 | self.artifact.target.wantSharedLibSymLinks()) |
| 92 | 91 | { |
| 93 | try CompileStep.doAtomicSymLinks(step, full_dest_path, self.artifact.major_only_filename.?, self.artifact.name_only_filename.?); | |
| 92 | try Step.Compile.doAtomicSymLinks(step, full_dest_path, self.artifact.major_only_filename.?, self.artifact.name_only_filename.?); | |
| 94 | 93 | } |
| 95 | 94 | if (self.artifact.isDynamicLibrary() and |
| 96 | 95 | self.artifact.target.isWindows() and |
lib/std/Build/Step/InstallFile.zig+4-4| ... | ... | @@ -2,7 +2,7 @@ const std = @import("std"); |
| 2 | 2 | const Step = std.Build.Step; |
| 3 | 3 | const FileSource = std.Build.FileSource; |
| 4 | 4 | const InstallDir = std.Build.InstallDir; |
| 5 | const InstallFileStep = @This(); | |
| 5 | const InstallFile = @This(); | |
| 6 | 6 | const assert = std.debug.assert; |
| 7 | 7 | |
| 8 | 8 | pub const base_id = .install_file; |
| ... | ... | @@ -20,10 +20,10 @@ pub fn create( |
| 20 | 20 | source: FileSource, |
| 21 | 21 | dir: InstallDir, |
| 22 | 22 | dest_rel_path: []const u8, |
| 23 | ) *InstallFileStep { | |
| 23 | ) *InstallFile { | |
| 24 | 24 | assert(dest_rel_path.len != 0); |
| 25 | 25 | owner.pushInstalledFile(dir, dest_rel_path); |
| 26 | const self = owner.allocator.create(InstallFileStep) catch @panic("OOM"); | |
| 26 | const self = owner.allocator.create(InstallFile) catch @panic("OOM"); | |
| 27 | 27 | self.* = .{ |
| 28 | 28 | .step = Step.init(.{ |
| 29 | 29 | .id = base_id, |
| ... | ... | @@ -43,7 +43,7 @@ pub fn create( |
| 43 | 43 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 44 | 44 | _ = prog_node; |
| 45 | 45 | const src_builder = step.owner; |
| 46 | const self = @fieldParentPtr(InstallFileStep, "step", step); | |
| 46 | const self = @fieldParentPtr(InstallFile, "step", step); | |
| 47 | 47 | const dest_builder = self.dest_builder; |
| 48 | 48 | const full_src_path = self.source.getPath2(src_builder, step); |
| 49 | 49 | const full_dest_path = dest_builder.getInstallPath(self.dir, self.dest_rel_path); |
lib/std/Build/Step/ObjCopy.zig+8-9| ... | ... | @@ -1,12 +1,11 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const ObjCopyStep = @This(); | |
| 2 | const ObjCopy = @This(); | |
| 3 | 3 | |
| 4 | 4 | const Allocator = std.mem.Allocator; |
| 5 | 5 | const ArenaAllocator = std.heap.ArenaAllocator; |
| 6 | 6 | const ArrayListUnmanaged = std.ArrayListUnmanaged; |
| 7 | 7 | const File = std.fs.File; |
| 8 | 8 | const InstallDir = std.Build.InstallDir; |
| 9 | const CompileStep = std.Build.CompileStep; | |
| 10 | 9 | const Step = std.Build.Step; |
| 11 | 10 | const elf = std.elf; |
| 12 | 11 | const fs = std.fs; |
| ... | ... | @@ -40,9 +39,9 @@ pub fn create( |
| 40 | 39 | owner: *std.Build, |
| 41 | 40 | file_source: std.Build.FileSource, |
| 42 | 41 | options: Options, |
| 43 | ) *ObjCopyStep { | |
| 44 | const self = owner.allocator.create(ObjCopyStep) catch @panic("OOM"); | |
| 45 | self.* = ObjCopyStep{ | |
| 42 | ) *ObjCopy { | |
| 43 | const self = owner.allocator.create(ObjCopy) catch @panic("OOM"); | |
| 44 | self.* = ObjCopy{ | |
| 46 | 45 | .step = Step.init(.{ |
| 47 | 46 | .id = base_id, |
| 48 | 47 | .name = owner.fmt("objcopy {s}", .{file_source.getDisplayName()}), |
| ... | ... | @@ -61,19 +60,19 @@ pub fn create( |
| 61 | 60 | return self; |
| 62 | 61 | } |
| 63 | 62 | |
| 64 | pub fn getOutputSource(self: *const ObjCopyStep) std.Build.FileSource { | |
| 63 | pub fn getOutputSource(self: *const ObjCopy) std.Build.FileSource { | |
| 65 | 64 | return .{ .generated = &self.output_file }; |
| 66 | 65 | } |
| 67 | 66 | |
| 68 | 67 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 69 | 68 | const b = step.owner; |
| 70 | const self = @fieldParentPtr(ObjCopyStep, "step", step); | |
| 69 | const self = @fieldParentPtr(ObjCopy, "step", step); | |
| 71 | 70 | |
| 72 | 71 | var man = b.cache.obtain(); |
| 73 | 72 | defer man.deinit(); |
| 74 | 73 | |
| 75 | // Random bytes to make ObjCopyStep unique. Refresh this with new random | |
| 76 | // bytes when ObjCopyStep implementation is modified incompatibly. | |
| 74 | // Random bytes to make ObjCopy unique. Refresh this with new random | |
| 75 | // bytes when ObjCopy implementation is modified incompatibly. | |
| 77 | 76 | man.hash.add(@as(u32, 0xe18b7baf)); |
| 78 | 77 | |
| 79 | 78 | const full_src_path = self.file_source.getPath(b); |
lib/std/Build/Step/Options.zig+12-13| ... | ... | @@ -3,10 +3,9 @@ const builtin = @import("builtin"); |
| 3 | 3 | const fs = std.fs; |
| 4 | 4 | const Step = std.Build.Step; |
| 5 | 5 | const GeneratedFile = std.Build.GeneratedFile; |
| 6 | const CompileStep = std.Build.CompileStep; | |
| 7 | 6 | const FileSource = std.Build.FileSource; |
| 8 | 7 | |
| 9 | const OptionsStep = @This(); | |
| 8 | const Options = @This(); | |
| 10 | 9 | |
| 11 | 10 | pub const base_id = .options; |
| 12 | 11 | |
| ... | ... | @@ -17,8 +16,8 @@ contents: std.ArrayList(u8), |
| 17 | 16 | artifact_args: std.ArrayList(OptionArtifactArg), |
| 18 | 17 | file_source_args: std.ArrayList(OptionFileSourceArg), |
| 19 | 18 | |
| 20 | pub fn create(owner: *std.Build) *OptionsStep { | |
| 21 | const self = owner.allocator.create(OptionsStep) catch @panic("OOM"); | |
| 19 | pub fn create(owner: *std.Build) *Options { | |
| 20 | const self = owner.allocator.create(Options) catch @panic("OOM"); | |
| 22 | 21 | self.* = .{ |
| 23 | 22 | .step = Step.init(.{ |
| 24 | 23 | .id = base_id, |
| ... | ... | @@ -36,11 +35,11 @@ pub fn create(owner: *std.Build) *OptionsStep { |
| 36 | 35 | return self; |
| 37 | 36 | } |
| 38 | 37 | |
| 39 | pub fn addOption(self: *OptionsStep, comptime T: type, name: []const u8, value: T) void { | |
| 38 | pub fn addOption(self: *Options, comptime T: type, name: []const u8, value: T) void { | |
| 40 | 39 | return addOptionFallible(self, T, name, value) catch @panic("unhandled error"); |
| 41 | 40 | } |
| 42 | 41 | |
| 43 | fn addOptionFallible(self: *OptionsStep, comptime T: type, name: []const u8, value: T) !void { | |
| 42 | fn addOptionFallible(self: *Options, comptime T: type, name: []const u8, value: T) !void { | |
| 44 | 43 | const out = self.contents.writer(); |
| 45 | 44 | switch (T) { |
| 46 | 45 | []const []const u8 => { |
| ... | ... | @@ -189,7 +188,7 @@ fn printLiteral(out: anytype, val: anytype, indent: u8) !void { |
| 189 | 188 | /// The value is the path in the cache dir. |
| 190 | 189 | /// Adds a dependency automatically. |
| 191 | 190 | pub fn addOptionFileSource( |
| 192 | self: *OptionsStep, | |
| 191 | self: *Options, | |
| 193 | 192 | name: []const u8, |
| 194 | 193 | source: FileSource, |
| 195 | 194 | ) void { |
| ... | ... | @@ -202,19 +201,19 @@ pub fn addOptionFileSource( |
| 202 | 201 | |
| 203 | 202 | /// The value is the path in the cache dir. |
| 204 | 203 | /// Adds a dependency automatically. |
| 205 | pub fn addOptionArtifact(self: *OptionsStep, name: []const u8, artifact: *CompileStep) void { | |
| 204 | pub fn addOptionArtifact(self: *Options, name: []const u8, artifact: *Step.Compile) void { | |
| 206 | 205 | self.artifact_args.append(.{ .name = self.step.owner.dupe(name), .artifact = artifact }) catch @panic("OOM"); |
| 207 | 206 | self.step.dependOn(&artifact.step); |
| 208 | 207 | } |
| 209 | 208 | |
| 210 | pub fn createModule(self: *OptionsStep) *std.Build.Module { | |
| 209 | pub fn createModule(self: *Options) *std.Build.Module { | |
| 211 | 210 | return self.step.owner.createModule(.{ |
| 212 | 211 | .source_file = self.getSource(), |
| 213 | 212 | .dependencies = &.{}, |
| 214 | 213 | }); |
| 215 | 214 | } |
| 216 | 215 | |
| 217 | pub fn getSource(self: *OptionsStep) FileSource { | |
| 216 | pub fn getSource(self: *Options) FileSource { | |
| 218 | 217 | return .{ .generated = &self.generated_file }; |
| 219 | 218 | } |
| 220 | 219 | |
| ... | ... | @@ -223,7 +222,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 223 | 222 | _ = prog_node; |
| 224 | 223 | |
| 225 | 224 | const b = step.owner; |
| 226 | const self = @fieldParentPtr(OptionsStep, "step", step); | |
| 225 | const self = @fieldParentPtr(Options, "step", step); | |
| 227 | 226 | |
| 228 | 227 | for (self.artifact_args.items) |item| { |
| 229 | 228 | self.addOption( |
| ... | ... | @@ -314,7 +313,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 314 | 313 | |
| 315 | 314 | const OptionArtifactArg = struct { |
| 316 | 315 | name: []const u8, |
| 317 | artifact: *CompileStep, | |
| 316 | artifact: *Step.Compile, | |
| 318 | 317 | }; |
| 319 | 318 | |
| 320 | 319 | const OptionFileSourceArg = struct { |
| ... | ... | @@ -322,7 +321,7 @@ const OptionFileSourceArg = struct { |
| 322 | 321 | source: FileSource, |
| 323 | 322 | }; |
| 324 | 323 | |
| 325 | test "OptionsStep" { | |
| 324 | test Options { | |
| 326 | 325 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 327 | 326 | |
| 328 | 327 | var arena = std.heap.ArenaAllocator.init(std.testing.allocator); |
lib/std/Build/Step/RemoveDir.zig+4-4| ... | ... | @@ -1,15 +1,15 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const fs = std.fs; |
| 3 | 3 | const Step = std.Build.Step; |
| 4 | const RemoveDirStep = @This(); | |
| 4 | const RemoveDir = @This(); | |
| 5 | 5 | |
| 6 | 6 | pub const base_id = .remove_dir; |
| 7 | 7 | |
| 8 | 8 | step: Step, |
| 9 | 9 | dir_path: []const u8, |
| 10 | 10 | |
| 11 | pub fn init(owner: *std.Build, dir_path: []const u8) RemoveDirStep { | |
| 12 | return RemoveDirStep{ | |
| 11 | pub fn init(owner: *std.Build, dir_path: []const u8) RemoveDir { | |
| 12 | return RemoveDir{ | |
| 13 | 13 | .step = Step.init(.{ |
| 14 | 14 | .id = .remove_dir, |
| 15 | 15 | .name = owner.fmt("RemoveDir {s}", .{dir_path}), |
| ... | ... | @@ -26,7 +26,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 26 | 26 | _ = prog_node; |
| 27 | 27 | |
| 28 | 28 | const b = step.owner; |
| 29 | const self = @fieldParentPtr(RemoveDirStep, "step", step); | |
| 29 | const self = @fieldParentPtr(RemoveDir, "step", step); | |
| 30 | 30 | |
| 31 | 31 | b.build_root.handle.deleteTree(self.dir_path) catch |err| { |
| 32 | 32 | if (b.build_root.path) |base| { |
lib/std/Build/Step/Run.zig+53-55| ... | ... | @@ -1,8 +1,6 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | const Step = std.Build.Step; |
| 4 | const CompileStep = std.Build.CompileStep; | |
| 5 | const WriteFileStep = std.Build.WriteFileStep; | |
| 6 | 4 | const fs = std.fs; |
| 7 | 5 | const mem = std.mem; |
| 8 | 6 | const process = std.process; |
| ... | ... | @@ -12,7 +10,7 @@ const Allocator = mem.Allocator; |
| 12 | 10 | const ExecError = std.Build.ExecError; |
| 13 | 11 | const assert = std.debug.assert; |
| 14 | 12 | |
| 15 | const RunStep = @This(); | |
| 13 | const Run = @This(); | |
| 16 | 14 | |
| 17 | 15 | pub const base_id: Step.Id = .run; |
| 18 | 16 | |
| ... | ... | @@ -29,12 +27,12 @@ cwd: ?[]const u8, |
| 29 | 27 | /// Override this field to modify the environment, or use setEnvironmentVariable |
| 30 | 28 | env_map: ?*EnvMap, |
| 31 | 29 | |
| 32 | /// Configures whether the RunStep is considered to have side-effects, and also | |
| 33 | /// whether the RunStep will inherit stdio streams, forwarding them to the | |
| 30 | /// Configures whether the Run step is considered to have side-effects, and also | |
| 31 | /// whether the Run step will inherit stdio streams, forwarding them to the | |
| 34 | 32 | /// parent process, in which case will require a global lock to prevent other |
| 35 | 33 | /// steps from interfering with stdio while the subprocess associated with this |
| 36 | /// RunStep is running. | |
| 37 | /// If the RunStep is determined to not have side-effects, then execution will | |
| 34 | /// Run step is running. | |
| 35 | /// If the Run step is determined to not have side-effects, then execution will | |
| 38 | 36 | /// be skipped if all output files are up-to-date and input files are |
| 39 | 37 | /// unchanged. |
| 40 | 38 | stdio: StdIo = .infer_from_args, |
| ... | ... | @@ -42,9 +40,9 @@ stdio: StdIo = .infer_from_args, |
| 42 | 40 | stdin: ?[]const u8 = null, |
| 43 | 41 | |
| 44 | 42 | /// Additional file paths relative to build.zig that, when modified, indicate |
| 45 | /// that the RunStep should be re-executed. | |
| 46 | /// If the RunStep is determined to have side-effects, this field is ignored | |
| 47 | /// and the RunStep is always executed when it appears in the build graph. | |
| 43 | /// that the Run step should be re-executed. | |
| 44 | /// If the Run step is determined to have side-effects, this field is ignored | |
| 45 | /// and the Run step is always executed when it appears in the build graph. | |
| 48 | 46 | extra_file_dependencies: []const []const u8 = &.{}, |
| 49 | 47 | |
| 50 | 48 | /// After adding an output argument, this step will by default rename itself |
| ... | ... | @@ -52,14 +50,14 @@ extra_file_dependencies: []const []const u8 = &.{}, |
| 52 | 50 | /// This can be disabled by setting this to false. |
| 53 | 51 | rename_step_with_output_arg: bool = true, |
| 54 | 52 | |
| 55 | /// If this is true, a RunStep which is configured to check the output of the | |
| 53 | /// If this is true, a Run step which is configured to check the output of the | |
| 56 | 54 | /// executed binary will not fail the build if the binary cannot be executed |
| 57 | 55 | /// due to being for a foreign binary to the host system which is running the |
| 58 | 56 | /// build graph. |
| 59 | 57 | /// Command-line arguments such as -fqemu and -fwasmtime may affect whether a |
| 60 | 58 | /// binary is detected as foreign, as well as system configuration such as |
| 61 | 59 | /// Rosetta (macOS) and binfmt_misc (Linux). |
| 62 | /// If this RunStep is considered to have side-effects, then this flag does | |
| 60 | /// If this Run step is considered to have side-effects, then this flag does | |
| 63 | 61 | /// nothing. |
| 64 | 62 | skip_foreign_checks: bool = false, |
| 65 | 63 | |
| ... | ... | @@ -73,18 +71,18 @@ captured_stderr: ?*Output = null, |
| 73 | 71 | has_side_effects: bool = false, |
| 74 | 72 | |
| 75 | 73 | pub const StdIo = union(enum) { |
| 76 | /// Whether the RunStep has side-effects will be determined by whether or not one | |
| 74 | /// Whether the Run step has side-effects will be determined by whether or not one | |
| 77 | 75 | /// of the args is an output file (added with `addOutputFileArg`). |
| 78 | /// If the RunStep is determined to have side-effects, this is the same as `inherit`. | |
| 76 | /// If the Run step is determined to have side-effects, this is the same as `inherit`. | |
| 79 | 77 | /// The step will fail if the subprocess crashes or returns a non-zero exit code. |
| 80 | 78 | infer_from_args, |
| 81 | /// Causes the RunStep to be considered to have side-effects, and therefore | |
| 79 | /// Causes the Run step to be considered to have side-effects, and therefore | |
| 82 | 80 | /// always execute when it appears in the build graph. |
| 83 | 81 | /// It also means that this step will obtain a global lock to prevent other |
| 84 | 82 | /// steps from running in the meantime. |
| 85 | 83 | /// The step will fail if the subprocess crashes or returns a non-zero exit code. |
| 86 | 84 | inherit, |
| 87 | /// Causes the RunStep to be considered to *not* have side-effects. The | |
| 85 | /// Causes the Run step to be considered to *not* have side-effects. The | |
| 88 | 86 | /// process will be re-executed if any of the input dependencies are |
| 89 | 87 | /// modified. The exit code and standard I/O streams will be checked for |
| 90 | 88 | /// certain conditions, and the step will succeed or fail based on these |
| ... | ... | @@ -92,7 +90,7 @@ pub const StdIo = union(enum) { |
| 92 | 90 | /// Note that an explicit check for exit code 0 needs to be added to this |
| 93 | 91 | /// list if such a check is desirable. |
| 94 | 92 | check: std.ArrayList(Check), |
| 95 | /// This RunStep is running a zig unit test binary and will communicate | |
| 93 | /// This Run step is running a zig unit test binary and will communicate | |
| 96 | 94 | /// extra metadata over the IPC protocol. |
| 97 | 95 | zig_test, |
| 98 | 96 | |
| ... | ... | @@ -106,7 +104,7 @@ pub const StdIo = union(enum) { |
| 106 | 104 | }; |
| 107 | 105 | |
| 108 | 106 | pub const Arg = union(enum) { |
| 109 | artifact: *CompileStep, | |
| 107 | artifact: *Step.Compile, | |
| 110 | 108 | file_source: std.Build.FileSource, |
| 111 | 109 | directory_source: std.Build.FileSource, |
| 112 | 110 | bytes: []u8, |
| ... | ... | @@ -119,8 +117,8 @@ pub const Output = struct { |
| 119 | 117 | basename: []const u8, |
| 120 | 118 | }; |
| 121 | 119 | |
| 122 | pub fn create(owner: *std.Build, name: []const u8) *RunStep { | |
| 123 | const self = owner.allocator.create(RunStep) catch @panic("OOM"); | |
| 120 | pub fn create(owner: *std.Build, name: []const u8) *Run { | |
| 121 | const self = owner.allocator.create(Run) catch @panic("OOM"); | |
| 124 | 122 | self.* = .{ |
| 125 | 123 | .step = Step.init(.{ |
| 126 | 124 | .id = base_id, |
| ... | ... | @@ -135,17 +133,17 @@ pub fn create(owner: *std.Build, name: []const u8) *RunStep { |
| 135 | 133 | return self; |
| 136 | 134 | } |
| 137 | 135 | |
| 138 | pub fn setName(self: *RunStep, name: []const u8) void { | |
| 136 | pub fn setName(self: *Run, name: []const u8) void { | |
| 139 | 137 | self.step.name = name; |
| 140 | 138 | self.rename_step_with_output_arg = false; |
| 141 | 139 | } |
| 142 | 140 | |
| 143 | pub fn enableTestRunnerMode(rs: *RunStep) void { | |
| 141 | pub fn enableTestRunnerMode(rs: *Run) void { | |
| 144 | 142 | rs.stdio = .zig_test; |
| 145 | 143 | rs.addArgs(&.{"--listen=-"}); |
| 146 | 144 | } |
| 147 | 145 | |
| 148 | pub fn addArtifactArg(self: *RunStep, artifact: *CompileStep) void { | |
| 146 | pub fn addArtifactArg(self: *Run, artifact: *Step.Compile) void { | |
| 149 | 147 | self.argv.append(Arg{ .artifact = artifact }) catch @panic("OOM"); |
| 150 | 148 | self.step.dependOn(&artifact.step); |
| 151 | 149 | } |
| ... | ... | @@ -153,12 +151,12 @@ pub fn addArtifactArg(self: *RunStep, artifact: *CompileStep) void { |
| 153 | 151 | /// This provides file path as a command line argument to the command being |
| 154 | 152 | /// run, and returns a FileSource which can be used as inputs to other APIs |
| 155 | 153 | /// throughout the build system. |
| 156 | pub fn addOutputFileArg(rs: *RunStep, basename: []const u8) std.Build.FileSource { | |
| 154 | pub fn addOutputFileArg(rs: *Run, basename: []const u8) std.Build.FileSource { | |
| 157 | 155 | return addPrefixedOutputFileArg(rs, "", basename); |
| 158 | 156 | } |
| 159 | 157 | |
| 160 | 158 | pub fn addPrefixedOutputFileArg( |
| 161 | rs: *RunStep, | |
| 159 | rs: *Run, | |
| 162 | 160 | prefix: []const u8, |
| 163 | 161 | basename: []const u8, |
| 164 | 162 | ) std.Build.FileSource { |
| ... | ... | @@ -179,38 +177,38 @@ pub fn addPrefixedOutputFileArg( |
| 179 | 177 | return .{ .generated = &output.generated_file }; |
| 180 | 178 | } |
| 181 | 179 | |
| 182 | pub fn addFileSourceArg(self: *RunStep, file_source: std.Build.FileSource) void { | |
| 180 | pub fn addFileSourceArg(self: *Run, file_source: std.Build.FileSource) void { | |
| 183 | 181 | self.argv.append(.{ |
| 184 | 182 | .file_source = file_source.dupe(self.step.owner), |
| 185 | 183 | }) catch @panic("OOM"); |
| 186 | 184 | file_source.addStepDependencies(&self.step); |
| 187 | 185 | } |
| 188 | 186 | |
| 189 | pub fn addDirectorySourceArg(self: *RunStep, directory_source: std.Build.FileSource) void { | |
| 187 | pub fn addDirectorySourceArg(self: *Run, directory_source: std.Build.FileSource) void { | |
| 190 | 188 | self.argv.append(.{ |
| 191 | 189 | .directory_source = directory_source.dupe(self.step.owner), |
| 192 | 190 | }) catch @panic("OOM"); |
| 193 | 191 | directory_source.addStepDependencies(&self.step); |
| 194 | 192 | } |
| 195 | 193 | |
| 196 | pub fn addArg(self: *RunStep, arg: []const u8) void { | |
| 194 | pub fn addArg(self: *Run, arg: []const u8) void { | |
| 197 | 195 | self.argv.append(.{ .bytes = self.step.owner.dupe(arg) }) catch @panic("OOM"); |
| 198 | 196 | } |
| 199 | 197 | |
| 200 | pub fn addArgs(self: *RunStep, args: []const []const u8) void { | |
| 198 | pub fn addArgs(self: *Run, args: []const []const u8) void { | |
| 201 | 199 | for (args) |arg| { |
| 202 | 200 | self.addArg(arg); |
| 203 | 201 | } |
| 204 | 202 | } |
| 205 | 203 | |
| 206 | pub fn clearEnvironment(self: *RunStep) void { | |
| 204 | pub fn clearEnvironment(self: *Run) void { | |
| 207 | 205 | const b = self.step.owner; |
| 208 | 206 | const new_env_map = b.allocator.create(EnvMap) catch @panic("OOM"); |
| 209 | 207 | new_env_map.* = EnvMap.init(b.allocator); |
| 210 | 208 | self.env_map = new_env_map; |
| 211 | 209 | } |
| 212 | 210 | |
| 213 | pub fn addPathDir(self: *RunStep, search_path: []const u8) void { | |
| 211 | pub fn addPathDir(self: *Run, search_path: []const u8) void { | |
| 214 | 212 | const b = self.step.owner; |
| 215 | 213 | const env_map = getEnvMapInternal(self); |
| 216 | 214 | |
| ... | ... | @@ -225,11 +223,11 @@ pub fn addPathDir(self: *RunStep, search_path: []const u8) void { |
| 225 | 223 | } |
| 226 | 224 | } |
| 227 | 225 | |
| 228 | pub fn getEnvMap(self: *RunStep) *EnvMap { | |
| 226 | pub fn getEnvMap(self: *Run) *EnvMap { | |
| 229 | 227 | return getEnvMapInternal(self); |
| 230 | 228 | } |
| 231 | 229 | |
| 232 | fn getEnvMapInternal(self: *RunStep) *EnvMap { | |
| 230 | fn getEnvMapInternal(self: *Run) *EnvMap { | |
| 233 | 231 | const arena = self.step.owner.allocator; |
| 234 | 232 | return self.env_map orelse { |
| 235 | 233 | const env_map = arena.create(EnvMap) catch @panic("OOM"); |
| ... | ... | @@ -239,25 +237,25 @@ fn getEnvMapInternal(self: *RunStep) *EnvMap { |
| 239 | 237 | }; |
| 240 | 238 | } |
| 241 | 239 | |
| 242 | pub fn setEnvironmentVariable(self: *RunStep, key: []const u8, value: []const u8) void { | |
| 240 | pub fn setEnvironmentVariable(self: *Run, key: []const u8, value: []const u8) void { | |
| 243 | 241 | const b = self.step.owner; |
| 244 | 242 | const env_map = self.getEnvMap(); |
| 245 | 243 | env_map.put(b.dupe(key), b.dupe(value)) catch @panic("unhandled error"); |
| 246 | 244 | } |
| 247 | 245 | |
| 248 | pub fn removeEnvironmentVariable(self: *RunStep, key: []const u8) void { | |
| 246 | pub fn removeEnvironmentVariable(self: *Run, key: []const u8) void { | |
| 249 | 247 | self.getEnvMap().remove(key); |
| 250 | 248 | } |
| 251 | 249 | |
| 252 | 250 | /// Adds a check for exact stderr match. Does not add any other checks. |
| 253 | pub fn expectStdErrEqual(self: *RunStep, bytes: []const u8) void { | |
| 251 | pub fn expectStdErrEqual(self: *Run, bytes: []const u8) void { | |
| 254 | 252 | const new_check: StdIo.Check = .{ .expect_stderr_exact = self.step.owner.dupe(bytes) }; |
| 255 | 253 | self.addCheck(new_check); |
| 256 | 254 | } |
| 257 | 255 | |
| 258 | 256 | /// Adds a check for exact stdout match as well as a check for exit code 0, if |
| 259 | 257 | /// there is not already an expected termination check. |
| 260 | pub fn expectStdOutEqual(self: *RunStep, bytes: []const u8) void { | |
| 258 | pub fn expectStdOutEqual(self: *Run, bytes: []const u8) void { | |
| 261 | 259 | const new_check: StdIo.Check = .{ .expect_stdout_exact = self.step.owner.dupe(bytes) }; |
| 262 | 260 | self.addCheck(new_check); |
| 263 | 261 | if (!self.hasTermCheck()) { |
| ... | ... | @@ -265,12 +263,12 @@ pub fn expectStdOutEqual(self: *RunStep, bytes: []const u8) void { |
| 265 | 263 | } |
| 266 | 264 | } |
| 267 | 265 | |
| 268 | pub fn expectExitCode(self: *RunStep, code: u8) void { | |
| 266 | pub fn expectExitCode(self: *Run, code: u8) void { | |
| 269 | 267 | const new_check: StdIo.Check = .{ .expect_term = .{ .Exited = code } }; |
| 270 | 268 | self.addCheck(new_check); |
| 271 | 269 | } |
| 272 | 270 | |
| 273 | pub fn hasTermCheck(self: RunStep) bool { | |
| 271 | pub fn hasTermCheck(self: Run) bool { | |
| 274 | 272 | for (self.stdio.check.items) |check| switch (check) { |
| 275 | 273 | .expect_term => return true, |
| 276 | 274 | else => continue, |
| ... | ... | @@ -278,18 +276,18 @@ pub fn hasTermCheck(self: RunStep) bool { |
| 278 | 276 | return false; |
| 279 | 277 | } |
| 280 | 278 | |
| 281 | pub fn addCheck(self: *RunStep, new_check: StdIo.Check) void { | |
| 279 | pub fn addCheck(self: *Run, new_check: StdIo.Check) void { | |
| 282 | 280 | switch (self.stdio) { |
| 283 | 281 | .infer_from_args => { |
| 284 | 282 | self.stdio = .{ .check = std.ArrayList(StdIo.Check).init(self.step.owner.allocator) }; |
| 285 | 283 | self.stdio.check.append(new_check) catch @panic("OOM"); |
| 286 | 284 | }, |
| 287 | 285 | .check => |*checks| checks.append(new_check) catch @panic("OOM"), |
| 288 | else => @panic("illegal call to addCheck: conflicting helper method calls. Suggest to directly set stdio field of RunStep instead"), | |
| 286 | else => @panic("illegal call to addCheck: conflicting helper method calls. Suggest to directly set stdio field of Run instead"), | |
| 289 | 287 | } |
| 290 | 288 | } |
| 291 | 289 | |
| 292 | pub fn captureStdErr(self: *RunStep) std.Build.FileSource { | |
| 290 | pub fn captureStdErr(self: *Run) std.Build.FileSource { | |
| 293 | 291 | assert(self.stdio != .inherit); |
| 294 | 292 | |
| 295 | 293 | if (self.captured_stderr) |output| return .{ .generated = &output.generated_file }; |
| ... | ... | @@ -304,7 +302,7 @@ pub fn captureStdErr(self: *RunStep) std.Build.FileSource { |
| 304 | 302 | return .{ .generated = &output.generated_file }; |
| 305 | 303 | } |
| 306 | 304 | |
| 307 | pub fn captureStdOut(self: *RunStep) std.Build.FileSource { | |
| 305 | pub fn captureStdOut(self: *Run) std.Build.FileSource { | |
| 308 | 306 | assert(self.stdio != .inherit); |
| 309 | 307 | |
| 310 | 308 | if (self.captured_stdout) |output| return .{ .generated = &output.generated_file }; |
| ... | ... | @@ -319,8 +317,8 @@ pub fn captureStdOut(self: *RunStep) std.Build.FileSource { |
| 319 | 317 | return .{ .generated = &output.generated_file }; |
| 320 | 318 | } |
| 321 | 319 | |
| 322 | /// Returns whether the RunStep has side effects *other than* updating the output arguments. | |
| 323 | fn hasSideEffects(self: RunStep) bool { | |
| 320 | /// Returns whether the Run step has side effects *other than* updating the output arguments. | |
| 321 | fn hasSideEffects(self: Run) bool { | |
| 324 | 322 | if (self.has_side_effects) return true; |
| 325 | 323 | return switch (self.stdio) { |
| 326 | 324 | .infer_from_args => !self.hasAnyOutputArgs(), |
| ... | ... | @@ -330,7 +328,7 @@ fn hasSideEffects(self: RunStep) bool { |
| 330 | 328 | }; |
| 331 | 329 | } |
| 332 | 330 | |
| 333 | fn hasAnyOutputArgs(self: RunStep) bool { | |
| 331 | fn hasAnyOutputArgs(self: Run) bool { | |
| 334 | 332 | if (self.captured_stdout != null) return true; |
| 335 | 333 | if (self.captured_stderr != null) return true; |
| 336 | 334 | for (self.argv.items) |arg| switch (arg) { |
| ... | ... | @@ -371,7 +369,7 @@ fn checksContainStderr(checks: []const StdIo.Check) bool { |
| 371 | 369 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 372 | 370 | const b = step.owner; |
| 373 | 371 | const arena = b.allocator; |
| 374 | const self = @fieldParentPtr(RunStep, "step", step); | |
| 372 | const self = @fieldParentPtr(Run, "step", step); | |
| 375 | 373 | const has_side_effects = self.hasSideEffects(); |
| 376 | 374 | |
| 377 | 375 | var argv_list = ArrayList([]const u8).init(arena); |
| ... | ... | @@ -541,7 +539,7 @@ fn termMatches(expected: ?std.process.Child.Term, actual: std.process.Child.Term |
| 541 | 539 | } |
| 542 | 540 | |
| 543 | 541 | fn runCommand( |
| 544 | self: *RunStep, | |
| 542 | self: *Run, | |
| 545 | 543 | argv: []const []const u8, |
| 546 | 544 | has_side_effects: bool, |
| 547 | 545 | digest: ?*const [std.Build.Cache.hex_digest_len]u8, |
| ... | ... | @@ -567,7 +565,7 @@ fn runCommand( |
| 567 | 565 | // FileNotFound: can happen with a wrong dynamic linker path |
| 568 | 566 | if (err == error.InvalidExe or err == error.FileNotFound) interpret: { |
| 569 | 567 | // TODO: learn the target from the binary directly rather than from |
| 570 | // relying on it being a CompileStep. This will make this logic | |
| 568 | // relying on it being a Compile step. This will make this logic | |
| 571 | 569 | // work even for the edge case that the binary was produced by a |
| 572 | 570 | // third party. |
| 573 | 571 | const exe = switch (self.argv.items[0]) { |
| ... | ... | @@ -862,7 +860,7 @@ const ChildProcResult = struct { |
| 862 | 860 | }; |
| 863 | 861 | |
| 864 | 862 | fn spawnChildAndCollect( |
| 865 | self: *RunStep, | |
| 863 | self: *Run, | |
| 866 | 864 | argv: []const []const u8, |
| 867 | 865 | has_side_effects: bool, |
| 868 | 866 | prog_node: *std.Progress.Node, |
| ... | ... | @@ -936,7 +934,7 @@ const StdIoResult = struct { |
| 936 | 934 | }; |
| 937 | 935 | |
| 938 | 936 | fn evalZigTest( |
| 939 | self: *RunStep, | |
| 937 | self: *Run, | |
| 940 | 938 | child: *std.process.Child, |
| 941 | 939 | prog_node: *std.Progress.Node, |
| 942 | 940 | ) !StdIoResult { |
| ... | ... | @@ -1121,7 +1119,7 @@ fn sendRunTestMessage(file: std.fs.File, index: u32) !void { |
| 1121 | 1119 | try file.writeAll(full_msg); |
| 1122 | 1120 | } |
| 1123 | 1121 | |
| 1124 | fn evalGeneric(self: *RunStep, child: *std.process.Child) !StdIoResult { | |
| 1122 | fn evalGeneric(self: *Run, child: *std.process.Child) !StdIoResult { | |
| 1125 | 1123 | const arena = self.step.owner.allocator; |
| 1126 | 1124 | |
| 1127 | 1125 | if (self.stdin) |stdin| { |
| ... | ... | @@ -1188,7 +1186,7 @@ fn evalGeneric(self: *RunStep, child: *std.process.Child) !StdIoResult { |
| 1188 | 1186 | }; |
| 1189 | 1187 | } |
| 1190 | 1188 | |
| 1191 | fn addPathForDynLibs(self: *RunStep, artifact: *CompileStep) void { | |
| 1189 | fn addPathForDynLibs(self: *Run, artifact: *Step.Compile) void { | |
| 1192 | 1190 | const b = self.step.owner; |
| 1193 | 1191 | for (artifact.link_objects.items) |link_object| { |
| 1194 | 1192 | switch (link_object) { |
| ... | ... | @@ -1204,10 +1202,10 @@ fn addPathForDynLibs(self: *RunStep, artifact: *CompileStep) void { |
| 1204 | 1202 | } |
| 1205 | 1203 | |
| 1206 | 1204 | fn failForeign( |
| 1207 | self: *RunStep, | |
| 1205 | self: *Run, | |
| 1208 | 1206 | suggested_flag: []const u8, |
| 1209 | 1207 | argv0: []const u8, |
| 1210 | exe: *CompileStep, | |
| 1208 | exe: *Step.Compile, | |
| 1211 | 1209 | ) error{ MakeFailed, MakeSkipped, OutOfMemory } { |
| 1212 | 1210 | switch (self.stdio) { |
| 1213 | 1211 | .check, .zig_test => { |
lib/std/Build/Step/TranslateC.zig+12-14| ... | ... | @@ -1,12 +1,10 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const Step = std.Build.Step; |
| 3 | const CompileStep = std.Build.CompileStep; | |
| 4 | const CheckFileStep = std.Build.CheckFileStep; | |
| 5 | 3 | const fs = std.fs; |
| 6 | 4 | const mem = std.mem; |
| 7 | 5 | const CrossTarget = std.zig.CrossTarget; |
| 8 | 6 | |
| 9 | const TranslateCStep = @This(); | |
| 7 | const TranslateC = @This(); | |
| 10 | 8 | |
| 11 | 9 | pub const base_id = .translate_c; |
| 12 | 10 | |
| ... | ... | @@ -25,10 +23,10 @@ pub const Options = struct { |
| 25 | 23 | optimize: std.builtin.OptimizeMode, |
| 26 | 24 | }; |
| 27 | 25 | |
| 28 | pub fn create(owner: *std.Build, options: Options) *TranslateCStep { | |
| 29 | const self = owner.allocator.create(TranslateCStep) catch @panic("OOM"); | |
| 26 | pub fn create(owner: *std.Build, options: Options) *TranslateC { | |
| 27 | const self = owner.allocator.create(TranslateC) catch @panic("OOM"); | |
| 30 | 28 | const source = options.source_file.dupe(owner); |
| 31 | self.* = TranslateCStep{ | |
| 29 | self.* = TranslateC{ | |
| 32 | 30 | .step = Step.init(.{ |
| 33 | 31 | .id = .translate_c, |
| 34 | 32 | .name = "translate-c", |
| ... | ... | @@ -52,11 +50,11 @@ pub const AddExecutableOptions = struct { |
| 52 | 50 | version: ?std.builtin.Version = null, |
| 53 | 51 | target: ?CrossTarget = null, |
| 54 | 52 | optimize: ?std.builtin.Mode = null, |
| 55 | linkage: ?CompileStep.Linkage = null, | |
| 53 | linkage: ?Step.Compile.Linkage = null, | |
| 56 | 54 | }; |
| 57 | 55 | |
| 58 | 56 | /// Creates a step to build an executable from the translated source. |
| 59 | pub fn addExecutable(self: *TranslateCStep, options: AddExecutableOptions) *CompileStep { | |
| 57 | pub fn addExecutable(self: *TranslateC, options: AddExecutableOptions) *Step.Compile { | |
| 60 | 58 | return self.step.owner.addExecutable(.{ |
| 61 | 59 | .root_source_file = .{ .generated = &self.output_file }, |
| 62 | 60 | .name = options.name orelse "translated_c", |
| ... | ... | @@ -67,12 +65,12 @@ pub fn addExecutable(self: *TranslateCStep, options: AddExecutableOptions) *Comp |
| 67 | 65 | }); |
| 68 | 66 | } |
| 69 | 67 | |
| 70 | pub fn addIncludeDir(self: *TranslateCStep, include_dir: []const u8) void { | |
| 68 | pub fn addIncludeDir(self: *TranslateC, include_dir: []const u8) void { | |
| 71 | 69 | self.include_dirs.append(self.step.owner.dupePath(include_dir)) catch @panic("OOM"); |
| 72 | 70 | } |
| 73 | 71 | |
| 74 | pub fn addCheckFile(self: *TranslateCStep, expected_matches: []const []const u8) *CheckFileStep { | |
| 75 | return CheckFileStep.create( | |
| 72 | pub fn addCheckFile(self: *TranslateC, expected_matches: []const []const u8) *Step.CheckFile { | |
| 73 | return Step.CheckFile.create( | |
| 76 | 74 | self.step.owner, |
| 77 | 75 | .{ .generated = &self.output_file }, |
| 78 | 76 | .{ .expected_matches = expected_matches }, |
| ... | ... | @@ -81,19 +79,19 @@ pub fn addCheckFile(self: *TranslateCStep, expected_matches: []const []const u8) |
| 81 | 79 | |
| 82 | 80 | /// If the value is omitted, it is set to 1. |
| 83 | 81 | /// `name` and `value` need not live longer than the function call. |
| 84 | pub fn defineCMacro(self: *TranslateCStep, name: []const u8, value: ?[]const u8) void { | |
| 82 | pub fn defineCMacro(self: *TranslateC, name: []const u8, value: ?[]const u8) void { | |
| 85 | 83 | const macro = std.Build.constructCMacro(self.step.owner.allocator, name, value); |
| 86 | 84 | self.c_macros.append(macro) catch @panic("OOM"); |
| 87 | 85 | } |
| 88 | 86 | |
| 89 | 87 | /// name_and_value looks like [name]=[value]. If the value is omitted, it is set to 1. |
| 90 | pub fn defineCMacroRaw(self: *TranslateCStep, name_and_value: []const u8) void { | |
| 88 | pub fn defineCMacroRaw(self: *TranslateC, name_and_value: []const u8) void { | |
| 91 | 89 | self.c_macros.append(self.step.owner.dupe(name_and_value)) catch @panic("OOM"); |
| 92 | 90 | } |
| 93 | 91 | |
| 94 | 92 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 95 | 93 | const b = step.owner; |
| 96 | const self = @fieldParentPtr(TranslateCStep, "step", step); | |
| 94 | const self = @fieldParentPtr(TranslateC, "step", step); | |
| 97 | 95 | |
| 98 | 96 | var argv_list = std.ArrayList([]const u8).init(b.allocator); |
| 99 | 97 | try argv_list.append(b.zig_exe); |
lib/std/Build/Step/WriteFile.zig+19-19| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | //! WriteFileStep is primarily used to create a directory in an appropriate | |
| 1 | //! WriteFile is primarily used to create a directory in an appropriate | |
| 2 | 2 | //! location inside the local cache which has a set of files that have either |
| 3 | 3 | //! been generated during the build, or are copied from the source package. |
| 4 | 4 | //! |
| ... | ... | @@ -12,7 +12,7 @@ const std = @import("std"); |
| 12 | 12 | const Step = std.Build.Step; |
| 13 | 13 | const fs = std.fs; |
| 14 | 14 | const ArrayList = std.ArrayList; |
| 15 | const WriteFileStep = @This(); | |
| 15 | const WriteFile = @This(); | |
| 16 | 16 | |
| 17 | 17 | step: Step, |
| 18 | 18 | /// The elements here are pointers because we need stable pointers for the |
| ... | ... | @@ -39,8 +39,8 @@ pub const Contents = union(enum) { |
| 39 | 39 | copy: std.Build.FileSource, |
| 40 | 40 | }; |
| 41 | 41 | |
| 42 | pub fn create(owner: *std.Build) *WriteFileStep { | |
| 43 | const wf = owner.allocator.create(WriteFileStep) catch @panic("OOM"); | |
| 42 | pub fn create(owner: *std.Build) *WriteFile { | |
| 43 | const wf = owner.allocator.create(WriteFile) catch @panic("OOM"); | |
| 44 | 44 | wf.* = .{ |
| 45 | 45 | .step = Step.init(.{ |
| 46 | 46 | .id = .write_file, |
| ... | ... | @@ -55,7 +55,7 @@ pub fn create(owner: *std.Build) *WriteFileStep { |
| 55 | 55 | return wf; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | pub fn add(wf: *WriteFileStep, sub_path: []const u8, bytes: []const u8) void { | |
| 58 | pub fn add(wf: *WriteFile, sub_path: []const u8, bytes: []const u8) void { | |
| 59 | 59 | const b = wf.step.owner; |
| 60 | 60 | const gpa = b.allocator; |
| 61 | 61 | const file = gpa.create(File) catch @panic("OOM"); |
| ... | ... | @@ -72,11 +72,11 @@ pub fn add(wf: *WriteFileStep, sub_path: []const u8, bytes: []const u8) void { |
| 72 | 72 | /// Place the file into the generated directory within the local cache, |
| 73 | 73 | /// along with all the rest of the files added to this step. The parameter |
| 74 | 74 | /// here is the destination path relative to the local cache directory |
| 75 | /// associated with this WriteFileStep. It may be a basename, or it may | |
| 75 | /// associated with this WriteFile. It may be a basename, or it may | |
| 76 | 76 | /// include sub-directories, in which case this step will ensure the |
| 77 | 77 | /// required sub-path exists. |
| 78 | 78 | /// This is the option expected to be used most commonly with `addCopyFile`. |
| 79 | pub fn addCopyFile(wf: *WriteFileStep, source: std.Build.FileSource, sub_path: []const u8) void { | |
| 79 | pub fn addCopyFile(wf: *WriteFile, source: std.Build.FileSource, sub_path: []const u8) void { | |
| 80 | 80 | const b = wf.step.owner; |
| 81 | 81 | const gpa = b.allocator; |
| 82 | 82 | const file = gpa.create(File) catch @panic("OOM"); |
| ... | ... | @@ -97,7 +97,7 @@ pub fn addCopyFile(wf: *WriteFileStep, source: std.Build.FileSource, sub_path: [ |
| 97 | 97 | /// run by a developer with intent to modify source files and then commit |
| 98 | 98 | /// those changes to version control. |
| 99 | 99 | /// A file added this way is not available with `getFileSource`. |
| 100 | pub fn addCopyFileToSource(wf: *WriteFileStep, source: std.Build.FileSource, sub_path: []const u8) void { | |
| 100 | pub fn addCopyFileToSource(wf: *WriteFile, source: std.Build.FileSource, sub_path: []const u8) void { | |
| 101 | 101 | const b = wf.step.owner; |
| 102 | 102 | wf.output_source_files.append(b.allocator, .{ |
| 103 | 103 | .contents = .{ .copy = source }, |
| ... | ... | @@ -112,7 +112,7 @@ pub fn addCopyFileToSource(wf: *WriteFileStep, source: std.Build.FileSource, sub |
| 112 | 112 | /// run by a developer with intent to modify source files and then commit |
| 113 | 113 | /// those changes to version control. |
| 114 | 114 | /// A file added this way is not available with `getFileSource`. |
| 115 | pub fn addBytesToSource(wf: *WriteFileStep, bytes: []const u8, sub_path: []const u8) void { | |
| 115 | pub fn addBytesToSource(wf: *WriteFile, bytes: []const u8, sub_path: []const u8) void { | |
| 116 | 116 | const b = wf.step.owner; |
| 117 | 117 | wf.output_source_files.append(b.allocator, .{ |
| 118 | 118 | .contents = .{ .bytes = bytes }, |
| ... | ... | @@ -121,7 +121,7 @@ pub fn addBytesToSource(wf: *WriteFileStep, bytes: []const u8, sub_path: []const |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /// Gets a file source for the given sub_path. If the file does not exist, returns `null`. |
| 124 | pub fn getFileSource(wf: *WriteFileStep, sub_path: []const u8) ?std.Build.FileSource { | |
| 124 | pub fn getFileSource(wf: *WriteFile, sub_path: []const u8) ?std.Build.FileSource { | |
| 125 | 125 | for (wf.files.items) |file| { |
| 126 | 126 | if (std.mem.eql(u8, file.sub_path, sub_path)) { |
| 127 | 127 | return .{ .generated = &file.generated_file }; |
| ... | ... | @@ -131,12 +131,12 @@ pub fn getFileSource(wf: *WriteFileStep, sub_path: []const u8) ?std.Build.FileSo |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /// Returns a `FileSource` representing the base directory that contains all the |
| 134 | /// files from this `WriteFileStep`. | |
| 135 | pub fn getDirectorySource(wf: *WriteFileStep) std.Build.FileSource { | |
| 134 | /// files from this `WriteFile`. | |
| 135 | pub fn getDirectorySource(wf: *WriteFile) std.Build.FileSource { | |
| 136 | 136 | return .{ .generated = &wf.generated_directory }; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | fn maybeUpdateName(wf: *WriteFileStep) void { | |
| 139 | fn maybeUpdateName(wf: *WriteFile) void { | |
| 140 | 140 | if (wf.files.items.len == 1) { |
| 141 | 141 | // First time adding a file; update name. |
| 142 | 142 | if (std.mem.eql(u8, wf.step.name, "WriteFile")) { |
| ... | ... | @@ -148,10 +148,10 @@ fn maybeUpdateName(wf: *WriteFileStep) void { |
| 148 | 148 | fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 149 | 149 | _ = prog_node; |
| 150 | 150 | const b = step.owner; |
| 151 | const wf = @fieldParentPtr(WriteFileStep, "step", step); | |
| 151 | const wf = @fieldParentPtr(WriteFile, "step", step); | |
| 152 | 152 | |
| 153 | 153 | // Writing to source files is kind of an extra capability of this |
| 154 | // WriteFileStep - arguably it should be a different step. But anyway here | |
| 154 | // WriteFile - arguably it should be a different step. But anyway here | |
| 155 | 155 | // it is, it happens unconditionally and does not interact with the other |
| 156 | 156 | // files here. |
| 157 | 157 | var any_miss = false; |
| ... | ... | @@ -194,14 +194,14 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void { |
| 194 | 194 | // the data to a file would probably be very fast - but as a way to find a canonical |
| 195 | 195 | // location to put build artifacts. |
| 196 | 196 | |
| 197 | // If, for example, a hard-coded path was used as the location to put WriteFileStep | |
| 198 | // files, then two WriteFileSteps executing in parallel might clobber each other. | |
| 197 | // If, for example, a hard-coded path was used as the location to put WriteFile | |
| 198 | // files, then two WriteFiles executing in parallel might clobber each other. | |
| 199 | 199 | |
| 200 | 200 | var man = b.cache.obtain(); |
| 201 | 201 | defer man.deinit(); |
| 202 | 202 | |
| 203 | // Random bytes to make WriteFileStep unique. Refresh this with | |
| 204 | // new random bytes when WriteFileStep implementation is modified | |
| 203 | // Random bytes to make WriteFile unique. Refresh this with | |
| 204 | // new random bytes when WriteFile implementation is modified | |
| 205 | 205 | // in a non-backwards-compatible way. |
| 206 | 206 | man.hash.add(@as(u32, 0xd767ee59)); |
| 207 | 207 |
test/link/macho/dead_strip/build.zig+1-1| ... | ... | @@ -42,7 +42,7 @@ fn createScenario( |
| 42 | 42 | optimize: std.builtin.OptimizeMode, |
| 43 | 43 | target: std.zig.CrossTarget, |
| 44 | 44 | name: []const u8, |
| 45 | ) *std.Build.CompileStep { | |
| 45 | ) *std.Build.Step.Compile { | |
| 46 | 46 | const exe = b.addExecutable(.{ |
| 47 | 47 | .name = name, |
| 48 | 48 | .optimize = optimize, |
test/link/macho/dead_strip_dylibs/build.zig+1-1| ... | ... | @@ -46,7 +46,7 @@ fn createScenario( |
| 46 | 46 | b: *std.Build, |
| 47 | 47 | optimize: std.builtin.OptimizeMode, |
| 48 | 48 | name: []const u8, |
| 49 | ) *std.Build.CompileStep { | |
| 49 | ) *std.Build.Step.Compile { | |
| 50 | 50 | const exe = b.addExecutable(.{ |
| 51 | 51 | .name = name, |
| 52 | 52 | .optimize = optimize, |
test/link/macho/headerpad/build.zig+1-1| ... | ... | @@ -104,7 +104,7 @@ fn simpleExe( |
| 104 | 104 | b: *std.Build, |
| 105 | 105 | optimize: std.builtin.OptimizeMode, |
| 106 | 106 | name: []const u8, |
| 107 | ) *std.Build.CompileStep { | |
| 107 | ) *std.Build.Step.Compile { | |
| 108 | 108 | const exe = b.addExecutable(.{ |
| 109 | 109 | .name = name, |
| 110 | 110 | .optimize = optimize, |
test/link/macho/search_strategy/build.zig+1-1| ... | ... | @@ -46,7 +46,7 @@ fn createScenario( |
| 46 | 46 | optimize: std.builtin.OptimizeMode, |
| 47 | 47 | target: std.zig.CrossTarget, |
| 48 | 48 | name: []const u8, |
| 49 | ) *std.Build.CompileStep { | |
| 49 | ) *std.Build.Step.Compile { | |
| 50 | 50 | const static = b.addStaticLibrary(.{ |
| 51 | 51 | .name = name, |
| 52 | 52 | .optimize = optimize, |
test/link/macho/unwind_info/build.zig+1-1| ... | ... | @@ -65,7 +65,7 @@ fn createScenario( |
| 65 | 65 | optimize: std.builtin.OptimizeMode, |
| 66 | 66 | target: std.zig.CrossTarget, |
| 67 | 67 | name: []const u8, |
| 68 | ) *std.Build.CompileStep { | |
| 68 | ) *std.Build.Step.Compile { | |
| 69 | 69 | const exe = b.addExecutable(.{ |
| 70 | 70 | .name = name, |
| 71 | 71 | .optimize = optimize, |
test/link/macho/uuid/build.zig+1-2| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const CompileStep = std.Build.CompileStep; | |
| 3 | 2 | const FileSource = std.Build.FileSource; |
| 4 | 3 | const Step = std.Build.Step; |
| 5 | 4 | |
| ... | ... | @@ -60,7 +59,7 @@ fn simpleDylib( |
| 60 | 59 | b: *std.Build, |
| 61 | 60 | optimize: std.builtin.OptimizeMode, |
| 62 | 61 | target: std.zig.CrossTarget, |
| 63 | ) *std.Build.CompileStep { | |
| 62 | ) *std.Build.Step.Compile { | |
| 64 | 63 | const dylib = b.addSharedLibrary(.{ |
| 65 | 64 | .name = "test", |
| 66 | 65 | .version = .{ .major = 1, .minor = 0 }, |
test/src/Cases.zig+1-1| ... | ... | @@ -465,7 +465,7 @@ pub fn lowerToBuildSteps( |
| 465 | 465 | parent_step: *std.Build.Step, |
| 466 | 466 | opt_test_filter: ?[]const u8, |
| 467 | 467 | cases_dir_path: []const u8, |
| 468 | incremental_exe: *std.Build.CompileStep, | |
| 468 | incremental_exe: *std.Build.Step.Compile, | |
| 469 | 469 | ) void { |
| 470 | 470 | for (self.incremental_cases.items) |incr_case| { |
| 471 | 471 | if (opt_test_filter) |test_filter| { |
test/src/StackTrace.zig+1-1| ... | ... | @@ -3,7 +3,7 @@ step: *Step, |
| 3 | 3 | test_index: usize, |
| 4 | 4 | test_filter: ?[]const u8, |
| 5 | 5 | optimize_modes: []const OptimizeMode, |
| 6 | check_exe: *std.Build.CompileStep, | |
| 6 | check_exe: *std.Build.Step.Compile, | |
| 7 | 7 | |
| 8 | 8 | const Expect = [@typeInfo(OptimizeMode).Enum.fields.len][]const u8; |
| 9 | 9 |
test/standalone/install_raw_hex/build.zig-1| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | 2 | const std = @import("std"); |
| 3 | const CheckFileStep = std.Build.CheckFileStep; | |
| 4 | 3 | |
| 5 | 4 | pub fn build(b: *std.Build) void { |
| 6 | 5 | const test_step = b.step("test", "Test it"); |
test/tests.zig+1-1| ... | ... | @@ -1132,7 +1132,7 @@ pub fn addCases( |
| 1132 | 1132 | b: *std.Build, |
| 1133 | 1133 | parent_step: *Step, |
| 1134 | 1134 | opt_test_filter: ?[]const u8, |
| 1135 | check_case_exe: *std.Build.CompileStep, | |
| 1135 | check_case_exe: *std.Build.Step.Compile, | |
| 1136 | 1136 | ) !void { |
| 1137 | 1137 | const arena = b.allocator; |
| 1138 | 1138 | const gpa = b.allocator; |