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