From 16cdd1297ebfac534615eaeb8439a4e1de71837c Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 31 Jan 2023 13:44:06 -0700 Subject: [PATCH] rename std.Build.LibExeObjStep to std.Build.CompileStep This matches the nomenclature internally: a Compilation is the main type that represents a single invokation of the compiler. --- build.zig | 12 +- lib/std/Build.zig | 49 +++--- lib/std/Build/CheckObjectStep.zig | 2 +- .../{LibExeObjStep.zig => CompileStep.zig} | 154 +++++++++--------- lib/std/Build/EmulatableRunStep.zig | 6 +- lib/std/Build/InstallArtifactStep.zig | 8 +- lib/std/Build/InstallRawStep.zig | 6 +- lib/std/Build/OptionsStep.zig | 6 +- lib/std/Build/RunStep.zig | 10 +- lib/std/Build/Step.zig | 4 +- lib/std/Build/TranslateCStep.zig | 6 +- lib/std/std.zig | 2 + test/link/macho/bugs/13457/build.zig | 1 - test/link/macho/dead_strip/build.zig | 7 +- test/link/macho/dead_strip_dylibs/build.zig | 3 +- test/link/macho/headerpad/build.zig | 3 +- test/link/macho/needed_framework/build.zig | 1 - test/link/macho/needed_library/build.zig | 1 - test/link/macho/search_strategy/build.zig | 7 +- test/link/macho/strict_validation/build.zig | 1 - test/link/macho/unwind_info/build.zig | 7 +- test/link/macho/uuid/build.zig | 7 +- test/link/macho/weak_framework/build.zig | 1 - test/link/macho/weak_library/build.zig | 1 - test/tests.zig | 10 +- 25 files changed, 162 insertions(+), 153 deletions(-) rename lib/std/Build/{LibExeObjStep.zig => CompileStep.zig} (93%) diff --git a/build.zig b/build.zig index 713eac6517..ecf51fe316 100644 --- a/build.zig +++ b/build.zig @@ -516,7 +516,7 @@ fn addCompilerStep( b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget, -) *std.Build.LibExeObjStep { +) *std.Build.CompileStep { const exe = b.addExecutable(.{ .name = "zig", .root_source_file = .{ .path = "src/main.zig" }, @@ -544,7 +544,7 @@ const exe_cflags = [_][]const u8{ fn addCmakeCfgOptionsToExe( b: *std.Build, cfg: CMakeConfig, - exe: *std.Build.LibExeObjStep, + exe: *std.Build.CompileStep, use_zig_libcxx: bool, ) !void { if (exe.target.isDarwin()) { @@ -623,7 +623,7 @@ fn addCmakeCfgOptionsToExe( } } -fn addStaticLlvmOptionsToExe(exe: *std.Build.LibExeObjStep) !void { +fn addStaticLlvmOptionsToExe(exe: *std.Build.CompileStep) !void { // Adds the Zig C++ sources which both stage1 and stage2 need. // // We need this because otherwise zig_clang_cc1_main.cpp ends up pulling @@ -662,7 +662,7 @@ fn addStaticLlvmOptionsToExe(exe: *std.Build.LibExeObjStep) !void { fn addCxxKnownPath( b: *std.Build, ctx: CMakeConfig, - exe: *std.Build.LibExeObjStep, + exe: *std.Build.CompileStep, objname: []const u8, errtxt: ?[]const u8, need_cpp_includes: bool, @@ -695,7 +695,7 @@ fn addCxxKnownPath( } } -fn addCMakeLibraryList(exe: *std.Build.LibExeObjStep, list: []const u8) void { +fn addCMakeLibraryList(exe: *std.Build.CompileStep, list: []const u8) void { var it = mem.tokenize(u8, list, ";"); while (it.next()) |lib| { if (mem.startsWith(u8, lib, "-l")) { @@ -709,7 +709,7 @@ fn addCMakeLibraryList(exe: *std.Build.LibExeObjStep, list: []const u8) void { } const CMakeConfig = struct { - llvm_linkage: std.Build.LibExeObjStep.Linkage, + llvm_linkage: std.Build.CompileStep.Linkage, cmake_binary_dir: []const u8, cmake_prefix_path: []const u8, cmake_static_library_prefix: []const u8, diff --git a/lib/std/Build.zig b/lib/std/Build.zig index c0152ef6f1..4647baa398 100644 --- a/lib/std/Build.zig +++ b/lib/std/Build.zig @@ -19,6 +19,9 @@ const NativeTargetInfo = std.zig.system.NativeTargetInfo; const Sha256 = std.crypto.hash.sha2.Sha256; const Build = @This(); +///// deprecated: use `CompileStep` instead. +//pub const LibExeObjStep = CompileStep; + pub const Step = @import("Build/Step.zig"); pub const CheckFileStep = @import("Build/CheckFileStep.zig"); pub const CheckObjectStep = @import("Build/CheckObjectStep.zig"); @@ -29,7 +32,7 @@ pub const InstallArtifactStep = @import("Build/InstallArtifactStep.zig"); pub const InstallDirStep = @import("Build/InstallDirStep.zig"); pub const InstallFileStep = @import("Build/InstallFileStep.zig"); pub const InstallRawStep = @import("Build/InstallRawStep.zig"); -pub const LibExeObjStep = @import("Build/LibExeObjStep.zig"); +pub const CompileStep = @import("Build/CompileStep.zig"); pub const LogStep = @import("Build/LogStep.zig"); pub const OptionsStep = @import("Build/OptionsStep.zig"); pub const RemoveDirStep = @import("Build/RemoveDirStep.zig"); @@ -423,11 +426,11 @@ pub const ExecutableOptions = struct { version: ?std.builtin.Version = null, target: CrossTarget = .{}, optimize: std.builtin.Mode = .Debug, - linkage: ?LibExeObjStep.Linkage = null, + linkage: ?CompileStep.Linkage = null, }; -pub fn addExecutable(b: *Build, options: ExecutableOptions) *LibExeObjStep { - return LibExeObjStep.create(b, .{ +pub fn addExecutable(b: *Build, options: ExecutableOptions) *CompileStep { + return CompileStep.create(b, .{ .name = options.name, .root_source_file = options.root_source_file, .version = options.version, @@ -445,8 +448,8 @@ pub const ObjectOptions = struct { optimize: std.builtin.Mode, }; -pub fn addObject(b: *Build, options: ObjectOptions) *LibExeObjStep { - return LibExeObjStep.create(b, .{ +pub fn addObject(b: *Build, options: ObjectOptions) *CompileStep { + return CompileStep.create(b, .{ .name = options.name, .root_source_file = options.root_source_file, .target = options.target, @@ -463,8 +466,8 @@ pub const SharedLibraryOptions = struct { optimize: std.builtin.Mode, }; -pub fn addSharedLibrary(b: *Build, options: SharedLibraryOptions) *LibExeObjStep { - return LibExeObjStep.create(b, .{ +pub fn addSharedLibrary(b: *Build, options: SharedLibraryOptions) *CompileStep { + return CompileStep.create(b, .{ .name = options.name, .root_source_file = options.root_source_file, .kind = .lib, @@ -483,8 +486,8 @@ pub const StaticLibraryOptions = struct { version: ?std.builtin.Version = null, }; -pub fn addStaticLibrary(b: *Build, options: StaticLibraryOptions) *LibExeObjStep { - return LibExeObjStep.create(b, .{ +pub fn addStaticLibrary(b: *Build, options: StaticLibraryOptions) *CompileStep { + return CompileStep.create(b, .{ .name = options.name, .root_source_file = options.root_source_file, .kind = .lib, @@ -497,15 +500,15 @@ pub fn addStaticLibrary(b: *Build, options: StaticLibraryOptions) *LibExeObjStep pub const TestOptions = struct { name: []const u8 = "test", - kind: LibExeObjStep.Kind = .@"test", + kind: CompileStep.Kind = .@"test", root_source_file: FileSource, target: CrossTarget = .{}, optimize: std.builtin.Mode = .Debug, version: ?std.builtin.Version = null, }; -pub fn addTest(b: *Build, options: TestOptions) *LibExeObjStep { - return LibExeObjStep.create(b, .{ +pub fn addTest(b: *Build, options: TestOptions) *CompileStep { + return CompileStep.create(b, .{ .name = options.name, .kind = options.kind, .root_source_file = options.root_source_file, @@ -521,8 +524,8 @@ pub const AssemblyOptions = struct { optimize: std.builtin.Mode, }; -pub fn addAssembly(b: *Build, options: AssemblyOptions) *LibExeObjStep { - const obj_step = LibExeObjStep.create(b, .{ +pub fn addAssembly(b: *Build, options: AssemblyOptions) *CompileStep { + const obj_step = CompileStep.create(b, .{ .name = options.name, .root_source_file = null, .target = options.target, @@ -536,7 +539,7 @@ pub fn addAssembly(b: *Build, options: AssemblyOptions) *LibExeObjStep { /// executable. More command line arguments can be added with `addArg`, /// `addArgs`, and `addArtifactArg`. /// Be careful using this function, as it introduces a system dependency. -/// To run an executable built with zig build, see `LibExeObjStep.run`. +/// To run an executable built with zig build, see `CompileStep.run`. pub fn addSystemCommand(self: *Build, argv: []const []const u8) *RunStep { assert(argv.len >= 1); const run_step = RunStep.create(self, self.fmt("run {s}", .{argv[0]})); @@ -1167,11 +1170,11 @@ pub fn makePath(self: *Build, path: []const u8) !void { }; } -pub fn installArtifact(self: *Build, artifact: *LibExeObjStep) void { +pub fn installArtifact(self: *Build, artifact: *CompileStep) void { self.getInstallStep().dependOn(&self.addInstallArtifact(artifact).step); } -pub fn addInstallArtifact(self: *Build, artifact: *LibExeObjStep) *InstallArtifactStep { +pub fn addInstallArtifact(self: *Build, artifact: *CompileStep) *InstallArtifactStep { return InstallArtifactStep.create(self, artifact); } @@ -1195,7 +1198,7 @@ pub fn installLibFile(self: *Build, src_path: []const u8, dest_rel_path: []const } /// Output format (BIN vs Intel HEX) determined by filename -pub fn installRaw(self: *Build, artifact: *LibExeObjStep, dest_filename: []const u8, options: InstallRawStep.CreateOptions) *InstallRawStep { +pub fn installRaw(self: *Build, artifact: *CompileStep, dest_filename: []const u8, options: InstallRawStep.CreateOptions) *InstallRawStep { const raw = self.addInstallRaw(artifact, dest_filename, options); self.getInstallStep().dependOn(&raw.step); return raw; @@ -1220,7 +1223,7 @@ pub fn addInstallHeaderFile(b: *Build, src_path: []const u8, dest_rel_path: []co return b.addInstallFileWithDir(.{ .path = src_path }, .header, dest_rel_path); } -pub fn addInstallRaw(self: *Build, artifact: *LibExeObjStep, dest_filename: []const u8, options: InstallRawStep.CreateOptions) *InstallRawStep { +pub fn addInstallRaw(self: *Build, artifact: *CompileStep, dest_filename: []const u8, options: InstallRawStep.CreateOptions) *InstallRawStep { return InstallRawStep.create(self, artifact, dest_filename, options); } @@ -1456,8 +1459,8 @@ pub fn getInstallPath(self: *Build, dir: InstallDir, dest_rel_path: []const u8) pub const Dependency = struct { builder: *Build, - pub fn artifact(d: *Dependency, name: []const u8) *LibExeObjStep { - var found: ?*LibExeObjStep = null; + pub fn artifact(d: *Dependency, name: []const u8) *CompileStep { + var found: ?*CompileStep = null; for (d.builder.install_tls.step.dependencies.items) |dep_step| { const inst = dep_step.cast(InstallArtifactStep) orelse continue; if (mem.eql(u8, inst.artifact.name, name)) { @@ -1767,7 +1770,7 @@ test { _ = InstallDirStep; _ = InstallFileStep; _ = InstallRawStep; - _ = LibExeObjStep; + _ = CompileStep; _ = LogStep; _ = OptionsStep; _ = RemoveDirStep; diff --git a/lib/std/Build/CheckObjectStep.zig b/lib/std/Build/CheckObjectStep.zig index 7907be1787..bfa5338927 100644 --- a/lib/std/Build/CheckObjectStep.zig +++ b/lib/std/Build/CheckObjectStep.zig @@ -42,7 +42,7 @@ pub fn runAndCompare(self: *CheckObjectStep) *EmulatableRunStep { const dependencies_len = self.step.dependencies.items.len; assert(dependencies_len > 0); const exe_step = self.step.dependencies.items[dependencies_len - 1]; - const exe = exe_step.cast(std.Build.LibExeObjStep).?; + const exe = exe_step.cast(std.Build.CompileStep).?; const emulatable_step = EmulatableRunStep.create(self.builder, "EmulatableRun", exe); emulatable_step.step.dependOn(&self.step); return emulatable_step; diff --git a/lib/std/Build/LibExeObjStep.zig b/lib/std/Build/CompileStep.zig similarity index 93% rename from lib/std/Build/LibExeObjStep.zig rename to lib/std/Build/CompileStep.zig index 67f42c1783..5257c85a5c 100644 --- a/lib/std/Build/LibExeObjStep.zig +++ b/lib/std/Build/CompileStep.zig @@ -27,9 +27,9 @@ const CheckObjectStep = std.Build.CheckObjectStep; const RunStep = std.Build.RunStep; const OptionsStep = std.Build.OptionsStep; const ConfigHeaderStep = std.Build.ConfigHeaderStep; -const LibExeObjStep = @This(); +const CompileStep = @This(); -pub const base_id = .lib_exe_obj; +pub const base_id: Step.Id = .compile; step: Step, builder: *std.Build, @@ -234,7 +234,7 @@ pub const CSourceFile = struct { pub const LinkObject = union(enum) { static_path: FileSource, - other_step: *LibExeObjStep, + other_step: *CompileStep, system_lib: SystemLib, assembly_file: FileSource, c_source_file: *CSourceFile, @@ -265,7 +265,7 @@ const FrameworkLinkInfo = struct { pub const IncludeDir = union(enum) { raw_path: []const u8, raw_path_system: []const u8, - other_step: *LibExeObjStep, + other_step: *CompileStep, config_header_step: *ConfigHeaderStep, }; @@ -305,15 +305,15 @@ pub const EmitOption = union(enum) { } }; -pub fn create(builder: *std.Build, options: Options) *LibExeObjStep { +pub fn create(builder: *std.Build, options: Options) *CompileStep { const name = builder.dupe(options.name); const root_src: ?FileSource = if (options.root_source_file) |rsrc| rsrc.dupe(builder) else null; if (mem.indexOf(u8, name, "/") != null or mem.indexOf(u8, name, "\\") != null) { panic("invalid name: '{s}'. It looks like a file path, but it is supposed to be the library or application name.", .{name}); } - const self = builder.allocator.create(LibExeObjStep) catch unreachable; - self.* = LibExeObjStep{ + const self = builder.allocator.create(CompileStep) catch unreachable; + self.* = CompileStep{ .strip = null, .unwind_tables = null, .builder = builder, @@ -371,7 +371,7 @@ pub fn create(builder: *std.Build, options: Options) *LibExeObjStep { return self; } -fn computeOutFileNames(self: *LibExeObjStep) void { +fn computeOutFileNames(self: *CompileStep) void { const target = self.target_info.target; self.out_filename = std.zig.binNameAlloc(self.builder.allocator, .{ @@ -424,26 +424,26 @@ fn computeOutFileNames(self: *LibExeObjStep) void { } } -pub fn setOutputDir(self: *LibExeObjStep, dir: []const u8) void { +pub fn setOutputDir(self: *CompileStep, dir: []const u8) void { self.output_dir = self.builder.dupePath(dir); } -pub fn install(self: *LibExeObjStep) void { +pub fn install(self: *CompileStep) void { self.builder.installArtifact(self); } -pub fn installRaw(self: *LibExeObjStep, dest_filename: []const u8, options: InstallRawStep.CreateOptions) *InstallRawStep { +pub fn installRaw(self: *CompileStep, dest_filename: []const u8, options: InstallRawStep.CreateOptions) *InstallRawStep { return self.builder.installRaw(self, dest_filename, options); } -pub fn installHeader(a: *LibExeObjStep, src_path: []const u8, dest_rel_path: []const u8) void { +pub fn installHeader(a: *CompileStep, src_path: []const u8, dest_rel_path: []const u8) void { const install_file = a.builder.addInstallHeaderFile(src_path, dest_rel_path); a.builder.getInstallStep().dependOn(&install_file.step); a.installed_headers.append(&install_file.step) catch unreachable; } pub fn installHeadersDirectory( - a: *LibExeObjStep, + a: *CompileStep, src_dir_path: []const u8, dest_rel_path: []const u8, ) void { @@ -455,7 +455,7 @@ pub fn installHeadersDirectory( } pub fn installHeadersDirectoryOptions( - a: *LibExeObjStep, + a: *CompileStep, options: std.Build.InstallDirStep.Options, ) void { const install_dir = a.builder.addInstallDirectory(options); @@ -463,7 +463,7 @@ pub fn installHeadersDirectoryOptions( a.installed_headers.append(&install_dir.step) catch unreachable; } -pub fn installLibraryHeaders(a: *LibExeObjStep, l: *LibExeObjStep) void { +pub fn installLibraryHeaders(a: *CompileStep, l: *CompileStep) void { assert(l.kind == .lib); const install_step = a.builder.getInstallStep(); // Copy each element from installed_headers, modifying the builder @@ -488,7 +488,7 @@ pub fn installLibraryHeaders(a: *LibExeObjStep, l: *LibExeObjStep) void { /// Creates a `RunStep` with an executable built with `addExecutable`. /// Add command line arguments with `addArg`. -pub fn run(exe: *LibExeObjStep) *RunStep { +pub fn run(exe: *CompileStep) *RunStep { assert(exe.kind == .exe or exe.kind == .test_exe); // It doesn't have to be native. We catch that if you actually try to run it. @@ -512,7 +512,7 @@ pub fn run(exe: *LibExeObjStep) *RunStep { /// Allows running foreign binaries through emulation platforms such as Qemu or Rosetta. /// When a binary cannot be ran through emulation or the option is disabled, a warning /// will be printed and the binary will *NOT* be ran. -pub fn runEmulatable(exe: *LibExeObjStep) *EmulatableRunStep { +pub fn runEmulatable(exe: *CompileStep) *EmulatableRunStep { assert(exe.kind == .exe or exe.kind == .test_exe); const run_step = EmulatableRunStep.create(exe.builder, exe.builder.fmt("run {s}", .{exe.step.name}), exe); @@ -522,33 +522,33 @@ pub fn runEmulatable(exe: *LibExeObjStep) *EmulatableRunStep { return run_step; } -pub fn checkObject(self: *LibExeObjStep, obj_format: std.Target.ObjectFormat) *CheckObjectStep { +pub fn checkObject(self: *CompileStep, obj_format: std.Target.ObjectFormat) *CheckObjectStep { return CheckObjectStep.create(self.builder, self.getOutputSource(), obj_format); } -pub fn setLinkerScriptPath(self: *LibExeObjStep, source: FileSource) void { +pub fn setLinkerScriptPath(self: *CompileStep, source: FileSource) void { self.linker_script = source.dupe(self.builder); source.addStepDependencies(&self.step); } -pub fn linkFramework(self: *LibExeObjStep, framework_name: []const u8) void { +pub fn linkFramework(self: *CompileStep, framework_name: []const u8) void { self.frameworks.put(self.builder.dupe(framework_name), .{}) catch unreachable; } -pub fn linkFrameworkNeeded(self: *LibExeObjStep, framework_name: []const u8) void { +pub fn linkFrameworkNeeded(self: *CompileStep, framework_name: []const u8) void { self.frameworks.put(self.builder.dupe(framework_name), .{ .needed = true, }) catch unreachable; } -pub fn linkFrameworkWeak(self: *LibExeObjStep, framework_name: []const u8) void { +pub fn linkFrameworkWeak(self: *CompileStep, framework_name: []const u8) void { self.frameworks.put(self.builder.dupe(framework_name), .{ .weak = true, }) catch unreachable; } /// Returns whether the library, executable, or object depends on a particular system library. -pub fn dependsOnSystemLibrary(self: LibExeObjStep, name: []const u8) bool { +pub fn dependsOnSystemLibrary(self: CompileStep, name: []const u8) bool { if (isLibCLibrary(name)) { return self.is_linking_libc; } @@ -564,49 +564,49 @@ pub fn dependsOnSystemLibrary(self: LibExeObjStep, name: []const u8) bool { return false; } -pub fn linkLibrary(self: *LibExeObjStep, lib: *LibExeObjStep) void { +pub fn linkLibrary(self: *CompileStep, lib: *CompileStep) void { assert(lib.kind == .lib); self.linkLibraryOrObject(lib); } -pub fn isDynamicLibrary(self: *LibExeObjStep) bool { +pub fn isDynamicLibrary(self: *CompileStep) bool { return self.kind == .lib and self.linkage == Linkage.dynamic; } -pub fn isStaticLibrary(self: *LibExeObjStep) bool { +pub fn isStaticLibrary(self: *CompileStep) bool { return self.kind == .lib and self.linkage != Linkage.dynamic; } -pub fn producesPdbFile(self: *LibExeObjStep) bool { +pub fn producesPdbFile(self: *CompileStep) bool { if (!self.target.isWindows() and !self.target.isUefi()) return false; if (self.target.getObjectFormat() == .c) return false; if (self.strip == true) return false; return self.isDynamicLibrary() or self.kind == .exe or self.kind == .test_exe; } -pub fn linkLibC(self: *LibExeObjStep) void { +pub fn linkLibC(self: *CompileStep) void { self.is_linking_libc = true; } -pub fn linkLibCpp(self: *LibExeObjStep) void { +pub fn linkLibCpp(self: *CompileStep) void { self.is_linking_libcpp = true; } /// If the value is omitted, it is set to 1. /// `name` and `value` need not live longer than the function call. -pub fn defineCMacro(self: *LibExeObjStep, name: []const u8, value: ?[]const u8) void { +pub fn defineCMacro(self: *CompileStep, name: []const u8, value: ?[]const u8) void { const macro = std.Build.constructCMacro(self.builder.allocator, name, value); self.c_macros.append(macro) catch unreachable; } /// name_and_value looks like [name]=[value]. If the value is omitted, it is set to 1. -pub fn defineCMacroRaw(self: *LibExeObjStep, name_and_value: []const u8) void { +pub fn defineCMacroRaw(self: *CompileStep, name_and_value: []const u8) void { self.c_macros.append(self.builder.dupe(name_and_value)) catch unreachable; } /// This one has no integration with anything, it just puts -lname on the command line. /// Prefer to use `linkSystemLibrary` instead. -pub fn linkSystemLibraryName(self: *LibExeObjStep, name: []const u8) void { +pub fn linkSystemLibraryName(self: *CompileStep, name: []const u8) void { self.link_objects.append(.{ .system_lib = .{ .name = self.builder.dupe(name), @@ -619,7 +619,7 @@ pub fn linkSystemLibraryName(self: *LibExeObjStep, name: []const u8) void { /// This one has no integration with anything, it just puts -needed-lname on the command line. /// Prefer to use `linkSystemLibraryNeeded` instead. -pub fn linkSystemLibraryNeededName(self: *LibExeObjStep, name: []const u8) void { +pub fn linkSystemLibraryNeededName(self: *CompileStep, name: []const u8) void { self.link_objects.append(.{ .system_lib = .{ .name = self.builder.dupe(name), @@ -632,7 +632,7 @@ pub fn linkSystemLibraryNeededName(self: *LibExeObjStep, name: []const u8) void /// Darwin-only. This one has no integration with anything, it just puts -weak-lname on the /// command line. Prefer to use `linkSystemLibraryWeak` instead. -pub fn linkSystemLibraryWeakName(self: *LibExeObjStep, name: []const u8) void { +pub fn linkSystemLibraryWeakName(self: *CompileStep, name: []const u8) void { self.link_objects.append(.{ .system_lib = .{ .name = self.builder.dupe(name), @@ -645,7 +645,7 @@ pub fn linkSystemLibraryWeakName(self: *LibExeObjStep, name: []const u8) void { /// This links against a system library, exclusively using pkg-config to find the library. /// Prefer to use `linkSystemLibrary` instead. -pub fn linkSystemLibraryPkgConfigOnly(self: *LibExeObjStep, lib_name: []const u8) void { +pub fn linkSystemLibraryPkgConfigOnly(self: *CompileStep, lib_name: []const u8) void { self.link_objects.append(.{ .system_lib = .{ .name = self.builder.dupe(lib_name), @@ -658,7 +658,7 @@ pub fn linkSystemLibraryPkgConfigOnly(self: *LibExeObjStep, lib_name: []const u8 /// This links against a system library, exclusively using pkg-config to find the library. /// Prefer to use `linkSystemLibraryNeeded` instead. -pub fn linkSystemLibraryNeededPkgConfigOnly(self: *LibExeObjStep, lib_name: []const u8) void { +pub fn linkSystemLibraryNeededPkgConfigOnly(self: *CompileStep, lib_name: []const u8) void { self.link_objects.append(.{ .system_lib = .{ .name = self.builder.dupe(lib_name), @@ -671,7 +671,7 @@ pub fn linkSystemLibraryNeededPkgConfigOnly(self: *LibExeObjStep, lib_name: []co /// Run pkg-config for the given library name and parse the output, returning the arguments /// that should be passed to zig to link the given library. -pub fn runPkgConfig(self: *LibExeObjStep, lib_name: []const u8) ![]const []const u8 { +pub fn runPkgConfig(self: *CompileStep, lib_name: []const u8) ![]const []const u8 { const pkg_name = match: { // First we have to map the library name to pkg config name. Unfortunately, // there are several examples where this is not straightforward: @@ -765,19 +765,19 @@ pub fn runPkgConfig(self: *LibExeObjStep, lib_name: []const u8) ![]const []const return zig_args.toOwnedSlice(); } -pub fn linkSystemLibrary(self: *LibExeObjStep, name: []const u8) void { +pub fn linkSystemLibrary(self: *CompileStep, name: []const u8) void { self.linkSystemLibraryInner(name, .{}); } -pub fn linkSystemLibraryNeeded(self: *LibExeObjStep, name: []const u8) void { +pub fn linkSystemLibraryNeeded(self: *CompileStep, name: []const u8) void { self.linkSystemLibraryInner(name, .{ .needed = true }); } -pub fn linkSystemLibraryWeak(self: *LibExeObjStep, name: []const u8) void { +pub fn linkSystemLibraryWeak(self: *CompileStep, name: []const u8) void { self.linkSystemLibraryInner(name, .{ .weak = true }); } -fn linkSystemLibraryInner(self: *LibExeObjStep, name: []const u8, opts: struct { +fn linkSystemLibraryInner(self: *CompileStep, name: []const u8, opts: struct { needed: bool = false, weak: bool = false, }) void { @@ -800,23 +800,23 @@ fn linkSystemLibraryInner(self: *LibExeObjStep, name: []const u8, opts: struct { }) catch unreachable; } -pub fn setNamePrefix(self: *LibExeObjStep, text: []const u8) void { +pub fn setNamePrefix(self: *CompileStep, text: []const u8) void { assert(self.kind == .@"test" or self.kind == .test_exe); self.name_prefix = self.builder.dupe(text); } -pub fn setFilter(self: *LibExeObjStep, text: ?[]const u8) void { +pub fn setFilter(self: *CompileStep, text: ?[]const u8) void { assert(self.kind == .@"test" or self.kind == .test_exe); self.filter = if (text) |t| self.builder.dupe(t) else null; } -pub fn setTestRunner(self: *LibExeObjStep, path: ?[]const u8) void { +pub fn setTestRunner(self: *CompileStep, path: ?[]const u8) void { assert(self.kind == .@"test" or self.kind == .test_exe); self.test_runner = if (path) |p| self.builder.dupePath(p) else null; } /// Handy when you have many C/C++ source files and want them all to have the same flags. -pub fn addCSourceFiles(self: *LibExeObjStep, files: []const []const u8, flags: []const []const u8) void { +pub fn addCSourceFiles(self: *CompileStep, files: []const []const u8, flags: []const []const u8) void { const c_source_files = self.builder.allocator.create(CSourceFiles) catch unreachable; const files_copy = self.builder.dupeStrings(files); @@ -829,89 +829,89 @@ pub fn addCSourceFiles(self: *LibExeObjStep, files: []const []const u8, flags: [ self.link_objects.append(.{ .c_source_files = c_source_files }) catch unreachable; } -pub fn addCSourceFile(self: *LibExeObjStep, file: []const u8, flags: []const []const u8) void { +pub fn addCSourceFile(self: *CompileStep, file: []const u8, flags: []const []const u8) void { self.addCSourceFileSource(.{ .args = flags, .source = .{ .path = file }, }); } -pub fn addCSourceFileSource(self: *LibExeObjStep, source: CSourceFile) void { +pub fn addCSourceFileSource(self: *CompileStep, source: CSourceFile) void { const c_source_file = self.builder.allocator.create(CSourceFile) catch unreachable; c_source_file.* = source.dupe(self.builder); self.link_objects.append(.{ .c_source_file = c_source_file }) catch unreachable; source.source.addStepDependencies(&self.step); } -pub fn setVerboseLink(self: *LibExeObjStep, value: bool) void { +pub fn setVerboseLink(self: *CompileStep, value: bool) void { self.verbose_link = value; } -pub fn setVerboseCC(self: *LibExeObjStep, value: bool) void { +pub fn setVerboseCC(self: *CompileStep, value: bool) void { self.verbose_cc = value; } -pub fn overrideZigLibDir(self: *LibExeObjStep, dir_path: []const u8) void { +pub fn overrideZigLibDir(self: *CompileStep, dir_path: []const u8) void { self.override_lib_dir = self.builder.dupePath(dir_path); } -pub fn setMainPkgPath(self: *LibExeObjStep, dir_path: []const u8) void { +pub fn setMainPkgPath(self: *CompileStep, dir_path: []const u8) void { self.main_pkg_path = self.builder.dupePath(dir_path); } -pub fn setLibCFile(self: *LibExeObjStep, libc_file: ?FileSource) void { +pub fn setLibCFile(self: *CompileStep, libc_file: ?FileSource) void { self.libc_file = if (libc_file) |f| f.dupe(self.builder) else null; } /// Returns the generated executable, library or object file. /// To run an executable built with zig build, use `run`, or create an install step and invoke it. -pub fn getOutputSource(self: *LibExeObjStep) FileSource { +pub fn getOutputSource(self: *CompileStep) FileSource { return FileSource{ .generated = &self.output_path_source }; } /// Returns the generated import library. This function can only be called for libraries. -pub fn getOutputLibSource(self: *LibExeObjStep) FileSource { +pub fn getOutputLibSource(self: *CompileStep) FileSource { assert(self.kind == .lib); return FileSource{ .generated = &self.output_lib_path_source }; } /// Returns the generated header file. /// This function can only be called for libraries or object files which have `emit_h` set. -pub fn getOutputHSource(self: *LibExeObjStep) FileSource { +pub fn getOutputHSource(self: *CompileStep) FileSource { assert(self.kind != .exe and self.kind != .test_exe and self.kind != .@"test"); assert(self.emit_h); return FileSource{ .generated = &self.output_h_path_source }; } /// Returns the generated PDB file. This function can only be called for Windows and UEFI. -pub fn getOutputPdbSource(self: *LibExeObjStep) FileSource { +pub fn getOutputPdbSource(self: *CompileStep) FileSource { // TODO: Is this right? Isn't PDB for *any* PE/COFF file? assert(self.target.isWindows() or self.target.isUefi()); return FileSource{ .generated = &self.output_pdb_path_source }; } -pub fn addAssemblyFile(self: *LibExeObjStep, path: []const u8) void { +pub fn addAssemblyFile(self: *CompileStep, path: []const u8) void { self.link_objects.append(.{ .assembly_file = .{ .path = self.builder.dupe(path) }, }) catch unreachable; } -pub fn addAssemblyFileSource(self: *LibExeObjStep, source: FileSource) void { +pub fn addAssemblyFileSource(self: *CompileStep, source: FileSource) void { const source_duped = source.dupe(self.builder); self.link_objects.append(.{ .assembly_file = source_duped }) catch unreachable; source_duped.addStepDependencies(&self.step); } -pub fn addObjectFile(self: *LibExeObjStep, source_file: []const u8) void { +pub fn addObjectFile(self: *CompileStep, source_file: []const u8) void { self.addObjectFileSource(.{ .path = source_file }); } -pub fn addObjectFileSource(self: *LibExeObjStep, source: FileSource) void { +pub fn addObjectFileSource(self: *CompileStep, source: FileSource) void { self.link_objects.append(.{ .static_path = source.dupe(self.builder) }) catch unreachable; source.addStepDependencies(&self.step); } -pub fn addObject(self: *LibExeObjStep, obj: *LibExeObjStep) void { +pub fn addObject(self: *CompileStep, obj: *CompileStep) void { assert(obj.kind == .obj); self.linkLibraryOrObject(obj); } @@ -921,41 +921,41 @@ pub const addIncludeDir = @compileError("deprecated; use addIncludePath"); pub const addLibPath = @compileError("deprecated, use addLibraryPath"); pub const addFrameworkDir = @compileError("deprecated, use addFrameworkPath"); -pub fn addSystemIncludePath(self: *LibExeObjStep, path: []const u8) void { +pub fn addSystemIncludePath(self: *CompileStep, path: []const u8) void { self.include_dirs.append(IncludeDir{ .raw_path_system = self.builder.dupe(path) }) catch unreachable; } -pub fn addIncludePath(self: *LibExeObjStep, path: []const u8) void { +pub fn addIncludePath(self: *CompileStep, path: []const u8) void { self.include_dirs.append(IncludeDir{ .raw_path = self.builder.dupe(path) }) catch unreachable; } -pub fn addConfigHeader(self: *LibExeObjStep, config_header: *ConfigHeaderStep) void { +pub fn addConfigHeader(self: *CompileStep, config_header: *ConfigHeaderStep) void { self.step.dependOn(&config_header.step); self.include_dirs.append(.{ .config_header_step = config_header }) catch @panic("OOM"); } -pub fn addLibraryPath(self: *LibExeObjStep, path: []const u8) void { +pub fn addLibraryPath(self: *CompileStep, path: []const u8) void { self.lib_paths.append(self.builder.dupe(path)) catch unreachable; } -pub fn addRPath(self: *LibExeObjStep, path: []const u8) void { +pub fn addRPath(self: *CompileStep, path: []const u8) void { self.rpaths.append(self.builder.dupe(path)) catch unreachable; } -pub fn addFrameworkPath(self: *LibExeObjStep, dir_path: []const u8) void { +pub fn addFrameworkPath(self: *CompileStep, dir_path: []const u8) void { self.framework_dirs.append(self.builder.dupe(dir_path)) catch unreachable; } -pub fn addPackage(self: *LibExeObjStep, package: Pkg) void { +pub fn addPackage(self: *CompileStep, package: Pkg) void { self.packages.append(self.builder.dupePkg(package)) catch unreachable; self.addRecursiveBuildDeps(package); } -pub fn addOptions(self: *LibExeObjStep, package_name: []const u8, options: *OptionsStep) void { +pub fn addOptions(self: *CompileStep, package_name: []const u8, options: *OptionsStep) void { self.addPackage(options.getPackage(package_name)); } -fn addRecursiveBuildDeps(self: *LibExeObjStep, package: Pkg) void { +fn addRecursiveBuildDeps(self: *CompileStep, package: Pkg) void { package.source.addStepDependencies(&self.step); if (package.dependencies) |deps| { for (deps) |dep| { @@ -964,7 +964,7 @@ fn addRecursiveBuildDeps(self: *LibExeObjStep, package: Pkg) void { } } -pub fn addPackagePath(self: *LibExeObjStep, name: []const u8, pkg_index_path: []const u8) void { +pub fn addPackagePath(self: *CompileStep, name: []const u8, pkg_index_path: []const u8) void { self.addPackage(Pkg{ .name = self.builder.dupe(name), .source = .{ .path = self.builder.dupe(pkg_index_path) }, @@ -973,7 +973,7 @@ pub fn addPackagePath(self: *LibExeObjStep, name: []const u8, pkg_index_path: [] /// If Vcpkg was found on the system, it will be added to include and lib /// paths for the specified target. -pub fn addVcpkgPaths(self: *LibExeObjStep, linkage: LibExeObjStep.Linkage) !void { +pub fn addVcpkgPaths(self: *CompileStep, linkage: CompileStep.Linkage) !void { // Ideally in the Unattempted case we would call the function recursively // after findVcpkgRoot and have only one switch statement, but the compiler // cannot resolve the error set. @@ -1008,7 +1008,7 @@ pub fn addVcpkgPaths(self: *LibExeObjStep, linkage: LibExeObjStep.Linkage) !void } } -pub fn setExecCmd(self: *LibExeObjStep, args: []const ?[]const u8) void { +pub fn setExecCmd(self: *CompileStep, args: []const ?[]const u8) void { assert(self.kind == .@"test"); const duped_args = self.builder.allocator.alloc(?[]u8, args.len) catch unreachable; for (args) |arg, i| { @@ -1017,13 +1017,13 @@ pub fn setExecCmd(self: *LibExeObjStep, args: []const ?[]const u8) void { self.exec_cmd_args = duped_args; } -fn linkLibraryOrObject(self: *LibExeObjStep, other: *LibExeObjStep) void { +fn linkLibraryOrObject(self: *CompileStep, other: *CompileStep) void { self.step.dependOn(&other.step); self.link_objects.append(.{ .other_step = other }) catch unreachable; self.include_dirs.append(.{ .other_step = other }) catch unreachable; } -fn makePackageCmd(self: *LibExeObjStep, pkg: Pkg, zig_args: *ArrayList([]const u8)) error{OutOfMemory}!void { +fn makePackageCmd(self: *CompileStep, pkg: Pkg, zig_args: *ArrayList([]const u8)) error{OutOfMemory}!void { const builder = self.builder; try zig_args.append("--pkg-begin"); @@ -1040,7 +1040,7 @@ fn makePackageCmd(self: *LibExeObjStep, pkg: Pkg, zig_args: *ArrayList([]const u } fn make(step: *Step) !void { - const self = @fieldParentPtr(LibExeObjStep, "step", step); + const self = @fieldParentPtr(CompileStep, "step", step); const builder = self.builder; if (self.root_src == null and self.link_objects.items.len == 0) { @@ -2004,7 +2004,7 @@ const TransitiveDeps = struct { } } - fn addInner(td: *TransitiveDeps, other: *LibExeObjStep, dyn: bool) !void { + fn addInner(td: *TransitiveDeps, other: *CompileStep, dyn: bool) !void { // Inherit dependency on libc and libc++ td.is_linking_libcpp = td.is_linking_libcpp or other.is_linking_libcpp; td.is_linking_libc = td.is_linking_libc or other.is_linking_libc; diff --git a/lib/std/Build/EmulatableRunStep.zig b/lib/std/Build/EmulatableRunStep.zig index b7b12d791f..26804b2fc8 100644 --- a/lib/std/Build/EmulatableRunStep.zig +++ b/lib/std/Build/EmulatableRunStep.zig @@ -6,7 +6,7 @@ const std = @import("../std.zig"); const Step = std.Build.Step; -const LibExeObjStep = std.Build.LibExeObjStep; +const CompileStep = std.Build.CompileStep; const RunStep = std.Build.RunStep; const fs = std.fs; @@ -23,7 +23,7 @@ step: Step, builder: *std.Build, /// The artifact (executable) to be run by this step -exe: *LibExeObjStep, +exe: *CompileStep, /// Set this to `null` to ignore the exit code for the purpose of determining a successful execution expected_exit_code: ?u8 = 0, @@ -45,7 +45,7 @@ hide_foreign_binaries_warning: bool, /// binary through emulation when any of the emulation options such as `enable_rosetta` are set to true. /// When set to false, and the binary is foreign, running the executable is skipped. /// Asserts given artifact is an executable. -pub fn create(builder: *std.Build, name: []const u8, artifact: *LibExeObjStep) *EmulatableRunStep { +pub fn create(builder: *std.Build, name: []const u8, artifact: *CompileStep) *EmulatableRunStep { std.debug.assert(artifact.kind == .exe or artifact.kind == .test_exe); const self = builder.allocator.create(EmulatableRunStep) catch unreachable; diff --git a/lib/std/Build/InstallArtifactStep.zig b/lib/std/Build/InstallArtifactStep.zig index 929b30e935..898b9e85e7 100644 --- a/lib/std/Build/InstallArtifactStep.zig +++ b/lib/std/Build/InstallArtifactStep.zig @@ -1,6 +1,6 @@ const std = @import("../std.zig"); const Step = std.Build.Step; -const LibExeObjStep = std.Build.LibExeObjStep; +const CompileStep = std.Build.CompileStep; const InstallDir = std.Build.InstallDir; const InstallArtifactStep = @This(); @@ -8,12 +8,12 @@ pub const base_id = .install_artifact; step: Step, builder: *std.Build, -artifact: *LibExeObjStep, +artifact: *CompileStep, dest_dir: InstallDir, pdb_dir: ?InstallDir, h_dir: ?InstallDir, -pub fn create(builder: *std.Build, artifact: *LibExeObjStep) *InstallArtifactStep { +pub fn create(builder: *std.Build, artifact: *CompileStep) *InstallArtifactStep { if (artifact.install_step) |s| return s; const self = builder.allocator.create(InstallArtifactStep) catch unreachable; @@ -67,7 +67,7 @@ fn make(step: *Step) !void { const full_dest_path = builder.getInstallPath(self.dest_dir, self.artifact.out_filename); try builder.updateFile(self.artifact.getOutputSource().getPath(builder), full_dest_path); if (self.artifact.isDynamicLibrary() and self.artifact.version != null and self.artifact.target.wantSharedLibSymLinks()) { - try LibExeObjStep.doAtomicSymLinks(builder.allocator, full_dest_path, self.artifact.major_only_filename.?, self.artifact.name_only_filename.?); + try CompileStep.doAtomicSymLinks(builder.allocator, full_dest_path, self.artifact.major_only_filename.?, self.artifact.name_only_filename.?); } if (self.artifact.isDynamicLibrary() and self.artifact.target.isWindows() and self.artifact.emit_implib != .no_emit) { const full_implib_path = builder.getInstallPath(self.dest_dir, self.artifact.out_lib_filename); diff --git a/lib/std/Build/InstallRawStep.zig b/lib/std/Build/InstallRawStep.zig index 08d646ff88..e7ffe78878 100644 --- a/lib/std/Build/InstallRawStep.zig +++ b/lib/std/Build/InstallRawStep.zig @@ -9,7 +9,7 @@ const ArenaAllocator = std.heap.ArenaAllocator; const ArrayListUnmanaged = std.ArrayListUnmanaged; const File = std.fs.File; const InstallDir = std.Build.InstallDir; -const LibExeObjStep = std.Build.LibExeObjStep; +const CompileStep = std.Build.CompileStep; const Step = std.Build.Step; const elf = std.elf; const fs = std.fs; @@ -25,7 +25,7 @@ pub const RawFormat = enum { step: Step, builder: *std.Build, -artifact: *LibExeObjStep, +artifact: *CompileStep, dest_dir: InstallDir, dest_filename: []const u8, options: CreateOptions, @@ -40,7 +40,7 @@ pub const CreateOptions = struct { pub fn create( builder: *std.Build, - artifact: *LibExeObjStep, + artifact: *CompileStep, dest_filename: []const u8, options: CreateOptions, ) *InstallRawStep { diff --git a/lib/std/Build/OptionsStep.zig b/lib/std/Build/OptionsStep.zig index 8e1a7ef2fc..94c41ce9e6 100644 --- a/lib/std/Build/OptionsStep.zig +++ b/lib/std/Build/OptionsStep.zig @@ -3,7 +3,7 @@ const builtin = @import("builtin"); const fs = std.fs; const Step = std.Build.Step; const GeneratedFile = std.Build.GeneratedFile; -const LibExeObjStep = std.Build.LibExeObjStep; +const CompileStep = std.Build.CompileStep; const FileSource = std.Build.FileSource; const OptionsStep = @This(); @@ -195,7 +195,7 @@ pub fn addOptionFileSource( /// The value is the path in the cache dir. /// Adds a dependency automatically. -pub fn addOptionArtifact(self: *OptionsStep, name: []const u8, artifact: *LibExeObjStep) void { +pub fn addOptionArtifact(self: *OptionsStep, name: []const u8, artifact: *CompileStep) void { self.artifact_args.append(.{ .name = self.builder.dupe(name), .artifact = artifact }) catch unreachable; self.step.dependOn(&artifact.step); } @@ -266,7 +266,7 @@ fn hashContentsToFileName(self: *OptionsStep) [64]u8 { const OptionArtifactArg = struct { name: []const u8, - artifact: *LibExeObjStep, + artifact: *CompileStep, }; const OptionFileSourceArg = struct { diff --git a/lib/std/Build/RunStep.zig b/lib/std/Build/RunStep.zig index 83e4f7f66c..9ab9ea6335 100644 --- a/lib/std/Build/RunStep.zig +++ b/lib/std/Build/RunStep.zig @@ -1,7 +1,7 @@ const std = @import("../std.zig"); const builtin = @import("builtin"); const Step = std.Build.Step; -const LibExeObjStep = std.Build.LibExeObjStep; +const CompileStep = std.Build.CompileStep; const WriteFileStep = std.Build.WriteFileStep; const fs = std.fs; const mem = std.mem; @@ -48,7 +48,7 @@ pub const StdIoAction = union(enum) { }; pub const Arg = union(enum) { - artifact: *LibExeObjStep, + artifact: *CompileStep, file_source: std.Build.FileSource, bytes: []u8, }; @@ -66,7 +66,7 @@ pub fn create(builder: *std.Build, name: []const u8) *RunStep { return self; } -pub fn addArtifactArg(self: *RunStep, artifact: *LibExeObjStep) void { +pub fn addArtifactArg(self: *RunStep, artifact: *CompileStep) void { self.argv.append(Arg{ .artifact = artifact }) catch unreachable; self.step.dependOn(&artifact.step); } @@ -355,13 +355,13 @@ fn printCmd(cwd: ?[]const u8, argv: []const []const u8) void { std.debug.print("\n", .{}); } -fn addPathForDynLibs(self: *RunStep, artifact: *LibExeObjStep) void { +fn addPathForDynLibs(self: *RunStep, artifact: *CompileStep) void { addPathForDynLibsInternal(&self.step, self.builder, artifact); } /// This should only be used for internal usage, this is called automatically /// for the user. -pub fn addPathForDynLibsInternal(step: *Step, builder: *std.Build, artifact: *LibExeObjStep) void { +pub fn addPathForDynLibsInternal(step: *Step, builder: *std.Build, artifact: *CompileStep) void { for (artifact.link_objects.items) |link_object| { switch (link_object) { .other_step => |other| { diff --git a/lib/std/Build/Step.zig b/lib/std/Build/Step.zig index 86d6645c29..aff8a49161 100644 --- a/lib/std/Build/Step.zig +++ b/lib/std/Build/Step.zig @@ -7,7 +7,7 @@ done_flag: bool, pub const Id = enum { top_level, - lib_exe_obj, + compile, install_artifact, install_file, install_dir, @@ -28,7 +28,7 @@ pub const Id = enum { pub fn Type(comptime id: Id) type { return switch (id) { .top_level => Build.TopLevelStep, - .lib_exe_obj => Build.LibExeObjStep, + .compile => Build.CompileStep, .install_artifact => Build.InstallArtifactStep, .install_file => Build.InstallFileStep, .install_dir => Build.InstallDirStep, diff --git a/lib/std/Build/TranslateCStep.zig b/lib/std/Build/TranslateCStep.zig index 5404747846..c59362aeee 100644 --- a/lib/std/Build/TranslateCStep.zig +++ b/lib/std/Build/TranslateCStep.zig @@ -1,6 +1,6 @@ const std = @import("../std.zig"); const Step = std.Build.Step; -const LibExeObjStep = std.Build.LibExeObjStep; +const CompileStep = std.Build.CompileStep; const CheckFileStep = std.Build.CheckFileStep; const fs = std.fs; const mem = std.mem; @@ -51,11 +51,11 @@ pub const AddExecutableOptions = struct { version: ?std.builtin.Version = null, target: ?CrossTarget = null, optimize: ?std.builtin.Mode = null, - linkage: ?LibExeObjStep.Linkage = null, + linkage: ?CompileStep.Linkage = null, }; /// Creates a step to build an executable from the translated source. -pub fn addExecutable(self: *TranslateCStep, options: AddExecutableOptions) *LibExeObjStep { +pub fn addExecutable(self: *TranslateCStep, options: AddExecutableOptions) *CompileStep { return self.builder.addExecutable(.{ .root_source_file = .{ .generated = &self.output_file }, .name = options.name orelse "translated_c", diff --git a/lib/std/std.zig b/lib/std/std.zig index e0318ceb43..7440b49662 100644 --- a/lib/std/std.zig +++ b/lib/std/std.zig @@ -97,8 +97,10 @@ pub const zig = @import("zig.zig"); pub const start = @import("start.zig"); ///// Deprecated. Use `std.Build` instead. +///// TODO: remove this after releasing 0.11.0 //pub const build = struct { // /// Deprecated. Use `std.Build` instead. +// /// TODO: remove this after releasing 0.11.0 // pub const Builder = Build; //}; diff --git a/test/link/macho/bugs/13457/build.zig b/test/link/macho/bugs/13457/build.zig index 6ca1f31b86..3560b4a168 100644 --- a/test/link/macho/bugs/13457/build.zig +++ b/test/link/macho/bugs/13457/build.zig @@ -1,5 +1,4 @@ const std = @import("std"); -const LibExeObjectStep = std.Build.LibExeObjStep; pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); diff --git a/test/link/macho/dead_strip/build.zig b/test/link/macho/dead_strip/build.zig index b6c3002492..d82c81edca 100644 --- a/test/link/macho/dead_strip/build.zig +++ b/test/link/macho/dead_strip/build.zig @@ -1,5 +1,4 @@ const std = @import("std"); -const LibExeObjectStep = std.Build.LibExeObjStep; pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); @@ -36,7 +35,11 @@ pub fn build(b: *std.Build) void { } } -fn createScenario(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *LibExeObjectStep { +fn createScenario( + b: *std.Build, + optimize: std.builtin.OptimizeMode, + target: std.zig.CrossTarget, +) *std.Build.CompileStep { const exe = b.addExecutable(.{ .name = "test", .optimize = optimize, diff --git a/test/link/macho/dead_strip_dylibs/build.zig b/test/link/macho/dead_strip_dylibs/build.zig index f61b30ca4a..8b62cec6e6 100644 --- a/test/link/macho/dead_strip_dylibs/build.zig +++ b/test/link/macho/dead_strip_dylibs/build.zig @@ -1,5 +1,4 @@ const std = @import("std"); -const LibExeObjectStep = std.Build.LibExeObjStep; pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); @@ -35,7 +34,7 @@ pub fn build(b: *std.Build) void { } } -fn createScenario(b: *std.Build, optimize: std.builtin.OptimizeMode) *LibExeObjectStep { +fn createScenario(b: *std.Build, optimize: std.builtin.OptimizeMode) *std.Build.CompileStep { const exe = b.addExecutable(.{ .name = "test", .optimize = optimize, diff --git a/test/link/macho/headerpad/build.zig b/test/link/macho/headerpad/build.zig index 2b3c6abb8a..3ef17573f8 100644 --- a/test/link/macho/headerpad/build.zig +++ b/test/link/macho/headerpad/build.zig @@ -1,6 +1,5 @@ const std = @import("std"); const builtin = @import("builtin"); -const LibExeObjectStep = std.Build.LibExeObjStep; pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); @@ -93,7 +92,7 @@ pub fn build(b: *std.Build) void { } } -fn simpleExe(b: *std.Build, optimize: std.builtin.OptimizeMode) *LibExeObjectStep { +fn simpleExe(b: *std.Build, optimize: std.builtin.OptimizeMode) *std.Build.CompileStep { const exe = b.addExecutable(.{ .name = "main", .optimize = optimize, diff --git a/test/link/macho/needed_framework/build.zig b/test/link/macho/needed_framework/build.zig index 62b70b21f1..8b6e3dd87f 100644 --- a/test/link/macho/needed_framework/build.zig +++ b/test/link/macho/needed_framework/build.zig @@ -1,5 +1,4 @@ const std = @import("std"); -const LibExeObjectStep = std.Build.LibExeObjStep; pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); diff --git a/test/link/macho/needed_library/build.zig b/test/link/macho/needed_library/build.zig index cdad94357b..92a73d22b7 100644 --- a/test/link/macho/needed_library/build.zig +++ b/test/link/macho/needed_library/build.zig @@ -1,5 +1,4 @@ const std = @import("std"); -const LibExeObjectStep = std.Build.LibExeObjStep; pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); diff --git a/test/link/macho/search_strategy/build.zig b/test/link/macho/search_strategy/build.zig index eeda89446b..62757f885b 100644 --- a/test/link/macho/search_strategy/build.zig +++ b/test/link/macho/search_strategy/build.zig @@ -1,5 +1,4 @@ const std = @import("std"); -const LibExeObjectStep = std.Build.LibExeObjStep; pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); @@ -35,7 +34,11 @@ pub fn build(b: *std.Build) void { } } -fn createScenario(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *LibExeObjectStep { +fn createScenario( + b: *std.Build, + optimize: std.builtin.OptimizeMode, + target: std.zig.CrossTarget, +) *std.Build.CompileStep { const static = b.addStaticLibrary(.{ .name = "a", .optimize = optimize, diff --git a/test/link/macho/strict_validation/build.zig b/test/link/macho/strict_validation/build.zig index 6eabc02b5f..408076657b 100644 --- a/test/link/macho/strict_validation/build.zig +++ b/test/link/macho/strict_validation/build.zig @@ -1,6 +1,5 @@ const std = @import("std"); const builtin = @import("builtin"); -const LibExeObjectStep = std.Build.LibExeObjStep; pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); diff --git a/test/link/macho/unwind_info/build.zig b/test/link/macho/unwind_info/build.zig index e43c002e2e..408f762f5d 100644 --- a/test/link/macho/unwind_info/build.zig +++ b/test/link/macho/unwind_info/build.zig @@ -1,6 +1,5 @@ const std = @import("std"); const builtin = @import("builtin"); -const LibExeObjectStep = std.Build.LibExeObjStep; pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); @@ -51,7 +50,11 @@ fn testUnwindInfo( test_step.dependOn(&run_cmd.step); } -fn createScenario(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *LibExeObjectStep { +fn createScenario( + b: *std.Build, + optimize: std.builtin.OptimizeMode, + target: std.zig.CrossTarget, +) *std.Build.CompileStep { const exe = b.addExecutable(.{ .name = "test", .optimize = optimize, diff --git a/test/link/macho/uuid/build.zig b/test/link/macho/uuid/build.zig index 62c288f1a0..6a68263fbf 100644 --- a/test/link/macho/uuid/build.zig +++ b/test/link/macho/uuid/build.zig @@ -1,5 +1,4 @@ const std = @import("std"); -const LibExeObjectStep = std.Build.LibExeObjStep; pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test"); @@ -51,7 +50,11 @@ fn testUuid( } } -fn simpleDylib(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *LibExeObjectStep { +fn simpleDylib( + b: *std.Build, + optimize: std.builtin.OptimizeMode, + target: std.zig.CrossTarget, +) *std.Build.CompileStep { const dylib = b.addSharedLibrary(.{ .name = "test", .version = .{ .major = 1, .minor = 0 }, diff --git a/test/link/macho/weak_framework/build.zig b/test/link/macho/weak_framework/build.zig index 5be66991dd..ca28458d77 100644 --- a/test/link/macho/weak_framework/build.zig +++ b/test/link/macho/weak_framework/build.zig @@ -1,5 +1,4 @@ const std = @import("std"); -const LibExeObjectStep = std.Build.LibExeObjStep; pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); diff --git a/test/link/macho/weak_library/build.zig b/test/link/macho/weak_library/build.zig index 505ab5ae96..de5aa45e30 100644 --- a/test/link/macho/weak_library/build.zig +++ b/test/link/macho/weak_library/build.zig @@ -1,5 +1,4 @@ const std = @import("std"); -const LibExeObjectStep = std.Build.LibExeObjStep; pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); diff --git a/test/tests.zig b/test/tests.zig index de25528dde..0f36c8eb94 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -8,7 +8,7 @@ const mem = std.mem; const fmt = std.fmt; const ArrayList = std.ArrayList; const OptimizeMode = std.builtin.OptimizeMode; -const LibExeObjStep = std.Build.LibExeObjStep; +const CompileStep = std.Build.CompileStep; const Allocator = mem.Allocator; const ExecError = std.Build.ExecError; const Step = std.Build.Step; @@ -842,7 +842,7 @@ pub const StackTracesContext = struct { step: Step, context: *StackTracesContext, - exe: *LibExeObjStep, + exe: *CompileStep, name: []const u8, optimize_mode: OptimizeMode, expect_output: []const u8, @@ -850,7 +850,7 @@ pub const StackTracesContext = struct { pub fn create( context: *StackTracesContext, - exe: *LibExeObjStep, + exe: *CompileStep, name: []const u8, optimize_mode: OptimizeMode, expect_output: []const u8, @@ -1180,14 +1180,14 @@ pub const GenHContext = struct { const GenHCmpOutputStep = struct { step: Step, context: *GenHContext, - obj: *LibExeObjStep, + obj: *CompileStep, name: []const u8, test_index: usize, case: *const TestCase, pub fn create( context: *GenHContext, - obj: *LibExeObjStep, + obj: *CompileStep, name: []const u8, case: *const TestCase, ) *GenHCmpOutputStep {