diff --git a/build.zig b/build.zig index 21059abd3c80fe88beb268a39307d2d3f9dba73f..0e43b82f9a5583dea3cfb9eb21c57af466413222 100644 --- a/build.zig +++ b/build.zig @@ -34,7 +34,7 @@ pub fn build(b: *std.Build) !void { const docgen_exe = b.addExecutable(.{ .name = "docgen", - .root_source_file = .{ .path = "tools/docgen.zig" }, + .root_source_file = b.path("tools/docgen.zig"), .target = b.host, .optimize = .Debug, .single_threaded = single_threaded, @@ -46,7 +46,7 @@ pub fn build(b: *std.Build) !void { docgen_cmd.addArg("--zig-lib-dir"); docgen_cmd.addDirectoryArg(p); } - docgen_cmd.addFileArg(.{ .path = "doc/langref.html.in" }); + docgen_cmd.addFileArg(b.path("doc/langref.html.in")); const langref_file = docgen_cmd.addOutputFileArg("langref.html"); const install_langref = b.addInstallFileWithDir(langref_file, .prefix, "doc/langref.html"); if (!skip_install_langref) { @@ -55,9 +55,9 @@ pub fn build(b: *std.Build) !void { const autodoc_test = b.addObject(.{ .name = "std", - .root_source_file = .{ .path = "lib/std/std.zig" }, + .root_source_file = b.path("lib/std/std.zig"), .target = target, - .zig_lib_dir = .{ .path = "lib" }, + .zig_lib_dir = b.path("lib"), .optimize = .Debug, }); const install_std_docs = b.addInstallDirectory(.{ @@ -86,7 +86,7 @@ pub fn build(b: *std.Build) !void { const check_case_exe = b.addExecutable(.{ .name = "check-case", - .root_source_file = .{ .path = "test/src/Cases.zig" }, + .root_source_file = b.path("test/src/Cases.zig"), .target = b.host, .optimize = optimize, .single_threaded = single_threaded, @@ -135,7 +135,7 @@ pub fn build(b: *std.Build) !void { if (!skip_install_lib_files) { b.installDirectory(.{ - .source_dir = .{ .path = "lib" }, + .source_dir = b.path("lib"), .install_dir = if (flat) .prefix else .lib, .install_subdir = if (flat) "lib" else "zig", .exclude_extensions = &[_][]const u8{ @@ -552,10 +552,10 @@ pub fn build(b: *std.Build) !void { const update_mingw_exe = b.addExecutable(.{ .name = "update_mingw", .target = b.host, - .root_source_file = .{ .path = "tools/update_mingw.zig" }, + .root_source_file = b.path("tools/update_mingw.zig"), }); const update_mingw_run = b.addRunArtifact(update_mingw_exe); - update_mingw_run.addDirectoryArg(.{ .path = "lib" }); + update_mingw_run.addDirectoryArg(b.path("lib")); if (opt_mingw_src_path) |mingw_src_path| { update_mingw_run.addDirectoryArg(.{ .cwd_relative = mingw_src_path }); } else { @@ -606,10 +606,10 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void { }); run_opt.addArtifactArg(exe); run_opt.addArg("-o"); - run_opt.addFileArg(.{ .path = "stage1/zig1.wasm" }); + run_opt.addFileArg(b.path("stage1/zig1.wasm")); const copy_zig_h = b.addWriteFiles(); - copy_zig_h.addCopyFileToSource(.{ .path = "lib/zig.h" }, "stage1/zig.h"); + copy_zig_h.addCopyFileToSource(b.path("lib/zig.h"), "stage1/zig.h"); const update_zig1_step = b.step("update-zig1", "Update stage1/zig1.wasm"); update_zig1_step.dependOn(&run_opt.step); @@ -627,7 +627,7 @@ const AddCompilerStepOptions = struct { fn addCompilerStep(b: *std.Build, options: AddCompilerStepOptions) *std.Build.Step.Compile { const exe = b.addExecutable(.{ .name = "zig", - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .target = options.target, .optimize = options.optimize, .max_rss = 7_000_000_000, @@ -638,11 +638,11 @@ fn addCompilerStep(b: *std.Build, options: AddCompilerStepOptions) *std.Build.St exe.stack_size = stack_size; const aro_module = b.createModule(.{ - .root_source_file = .{ .path = "lib/compiler/aro/aro.zig" }, + .root_source_file = b.path("lib/compiler/aro/aro.zig"), }); const aro_translate_c_module = b.createModule(.{ - .root_source_file = .{ .path = "lib/compiler/aro_translate_c.zig" }, + .root_source_file = b.path("lib/compiler/aro_translate_c.zig"), .imports = &.{ .{ .name = "aro", diff --git a/lib/std/Build.zig b/lib/std/Build.zig index 40196ab961bc09d5b8068cb5aab6c34e00f07a1f..a3d091858a84f544af14c64935a68fc98caa12c7 100644 --- a/lib/std/Build.zig +++ b/lib/std/Build.zig @@ -1546,22 +1546,22 @@ pub fn addInstallArtifact( } ///`dest_rel_path` is relative to prefix path -pub fn installFile(self: *Build, src_path: []const u8, dest_rel_path: []const u8) void { - self.getInstallStep().dependOn(&self.addInstallFileWithDir(.{ .path = src_path }, .prefix, dest_rel_path).step); +pub fn installFile(b: *Build, src_path: []const u8, dest_rel_path: []const u8) void { + b.getInstallStep().dependOn(&b.addInstallFileWithDir(b.path(src_path), .prefix, dest_rel_path).step); } -pub fn installDirectory(self: *Build, options: Step.InstallDir.Options) void { - self.getInstallStep().dependOn(&self.addInstallDirectory(options).step); +pub fn installDirectory(b: *Build, options: Step.InstallDir.Options) void { + b.getInstallStep().dependOn(&b.addInstallDirectory(options).step); } ///`dest_rel_path` is relative to bin path -pub fn installBinFile(self: *Build, src_path: []const u8, dest_rel_path: []const u8) void { - self.getInstallStep().dependOn(&self.addInstallFileWithDir(.{ .path = src_path }, .bin, dest_rel_path).step); +pub fn installBinFile(b: *Build, src_path: []const u8, dest_rel_path: []const u8) void { + b.getInstallStep().dependOn(&b.addInstallFileWithDir(b.path(src_path), .bin, dest_rel_path).step); } ///`dest_rel_path` is relative to lib path -pub fn installLibFile(self: *Build, src_path: []const u8, dest_rel_path: []const u8) void { - self.getInstallStep().dependOn(&self.addInstallFileWithDir(.{ .path = src_path }, .lib, dest_rel_path).step); +pub fn installLibFile(b: *Build, src_path: []const u8, dest_rel_path: []const u8) void { + b.getInstallStep().dependOn(&b.addInstallFileWithDir(b.path(src_path), .lib, dest_rel_path).step); } pub fn addObjCopy(b: *Build, source: LazyPath, options: Step.ObjCopy.Options) *Step.ObjCopy { @@ -1637,7 +1637,11 @@ pub fn truncateFile(self: *Build, dest_path: []const u8) !void { /// References a file or directory relative to the source root. pub fn path(b: *Build, sub_path: []const u8) LazyPath { - assert(!fs.path.isAbsolute(sub_path)); + if (fs.path.isAbsolute(sub_path)) { + std.debug.panic("sub_path is expected to be relative to the build root, but was this absolute path: '{s}'. It is best avoid absolute paths, but if you must, it is supported by LazyPath.cwd_relative", .{ + sub_path, + }); + } return .{ .src_path = .{ .owner = b, .sub_path = sub_path, @@ -2315,12 +2319,15 @@ pub const LazyPath = union(enum) { } } - /// Duplicates the file source for a given builder. + /// Copies the internal strings. + /// + /// The `b` parameter is only used for its allocator. All *Build instances + /// share the same allocator. pub fn dupe(self: LazyPath, b: *Build) LazyPath { return switch (self) { .src_path => |sp| .{ .src_path = .{ .owner = sp.owner, - .sub_path = b.dupePath(sp.sub_path), + .sub_path = sp.owner.dupePath(sp.sub_path), } }, .path => |p| .{ .path = b.dupePath(p) }, .cwd_relative => |p| .{ .cwd_relative = b.dupePath(p) }, diff --git a/lib/std/Build/Module.zig b/lib/std/Build/Module.zig index 02386de4308f3fb4e09ad25f113837fa65e54385..d19f0a781e30df4b9d884b938e16fb83bc490e18 100644 --- a/lib/std/Build/Module.zig +++ b/lib/std/Build/Module.zig @@ -451,7 +451,7 @@ pub fn linkFramework(m: *Module, name: []const u8, options: LinkFrameworkOptions pub const AddCSourceFilesOptions = struct { /// When provided, `files` are relative to `root` rather than the /// package that owns the `Compile` step. - root: LazyPath = .{ .path = "" }, + root: ?LazyPath = null, files: []const []const u8, flags: []const []const u8 = &.{}, }; @@ -472,7 +472,7 @@ pub fn addCSourceFiles(m: *Module, options: AddCSourceFilesOptions) void { const c_source_files = allocator.create(CSourceFiles) catch @panic("OOM"); c_source_files.* = .{ - .root = options.root, + .root = options.root orelse b.path(""), .files = b.dupeStrings(options.files), .flags = b.dupeStrings(options.flags), }; @@ -573,17 +573,6 @@ pub fn addLibraryPath(m: *Module, directory_path: LazyPath) void { pub fn addRPath(m: *Module, directory_path: LazyPath) void { const b = m.owner; - switch (directory_path) { - .path, .cwd_relative => |path| { - // TODO: remove this check after people upgrade and stop expecting it to work - if (std.mem.startsWith(u8, path, "@executable_path") or - std.mem.startsWith(u8, path, "@loader_path")) - { - @panic("this function is for adding directory paths. It does not support special rpaths. use addRPathSpecial for that."); - } - }, - else => {}, - } m.rpaths.append(b.allocator, .{ .lazy_path = directory_path.dupe(b) }) catch @panic("OOM"); addLazyPathDependenciesOnly(m, directory_path); } diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig index a63d9f6838533916e5b5eb944f74bfc64d148a60..c36fd8c4ca6ba9b1c8c7e389449602013c6417bb 100644 --- a/lib/std/Build/Step/Compile.zig +++ b/lib/std/Build/Step/Compile.zig @@ -264,20 +264,8 @@ pub const HeaderInstallation = union(enum) { dest_rel_path: []const u8, pub fn dupe(self: File, b: *std.Build) File { - // 'path' lazy paths are relative to the build root of some step, inferred from the step - // in which they are used. This means that we can't dupe such paths, because they may - // come from dependencies with their own build roots and duping the paths as is might - // cause the build script to search for the file relative to the wrong root. - // As a temporary workaround, we convert build root-relative paths to absolute paths. - // If/when the build-root relative paths are updated to encode which build root they are - // relative to, this workaround should be removed. - const duped_source: LazyPath = switch (self.source) { - .path => |root_rel| .{ .cwd_relative = b.pathFromRoot(root_rel) }, - else => self.source.dupe(b), - }; - return .{ - .source = duped_source, + .source = self.source.dupe(b), .dest_rel_path = b.dupePath(self.dest_rel_path), }; } @@ -305,20 +293,8 @@ pub const HeaderInstallation = union(enum) { }; pub fn dupe(self: Directory, b: *std.Build) Directory { - // 'path' lazy paths are relative to the build root of some step, inferred from the step - // in which they are used. This means that we can't dupe such paths, because they may - // come from dependencies with their own build roots and duping the paths as is might - // cause the build script to search for the file relative to the wrong root. - // As a temporary workaround, we convert build root-relative paths to absolute paths. - // If/when the build-root relative paths are updated to encode which build root they are - // relative to, this workaround should be removed. - const duped_source: LazyPath = switch (self.source) { - .path => |root_rel| .{ .cwd_relative = b.pathFromRoot(root_rel) }, - else => self.source.dupe(b), - }; - return .{ - .source = duped_source, + .source = self.source.dupe(b), .dest_rel_path = b.dupePath(self.dest_rel_path), .options = self.options.dupe(b), }; diff --git a/test/link/bss/build.zig b/test/link/bss/build.zig index 865af0a4889f87e51675bc89c00e14e1b9120e7b..cbe913781cafe98c8199b443d32aba65d6f7715d 100644 --- a/test/link/bss/build.zig +++ b/test/link/bss/build.zig @@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void { const exe = b.addExecutable(.{ .name = "bss", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = b.host, .optimize = .Debug, }); diff --git a/test/link/common_symbols/build.zig b/test/link/common_symbols/build.zig index 9b5c9da662925f6ce86c3284b6bdd674da8c26bf..dd093a891a14b47fcf616fe63755037ef56e4cd1 100644 --- a/test/link/common_symbols/build.zig +++ b/test/link/common_symbols/build.zig @@ -22,7 +22,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize }); const test_exe = b.addTest(.{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, }); test_exe.linkLibrary(lib_a); diff --git a/test/link/common_symbols_alignment/build.zig b/test/link/common_symbols_alignment/build.zig index 63aff339a9760071fe7cd5f8d964021cd157464f..7e732762ef8a8d50a4fb402e503977383b7dd2f3 100644 --- a/test/link/common_symbols_alignment/build.zig +++ b/test/link/common_symbols_alignment/build.zig @@ -22,7 +22,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize }); const test_exe = b.addTest(.{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, }); test_exe.linkLibrary(lib_a); diff --git a/test/link/glibc_compat/build.zig b/test/link/glibc_compat/build.zig index e0cc1a70d81f5eeba791588f152dcd15424c69ef..67a58200c3ccfc778f086a21135b8aff5f1f3f84 100644 --- a/test/link/glibc_compat/build.zig +++ b/test/link/glibc_compat/build.zig @@ -21,7 +21,7 @@ pub fn build(b: *std.Build) void { .{ .arch_os_abi = t }, ) catch unreachable), }); - exe.addCSourceFile(.{ .file = .{ .path = "main.c" } }); + exe.addCSourceFile(.{ .file = b.path("main.c") }); exe.linkLibC(); // TODO: actually test the output _ = exe.getEmittedBin(); @@ -45,7 +45,7 @@ pub fn build(b: *std.Build) void { const exe = b.addExecutable(.{ .name = t, - .root_source_file = .{ .path = "glibc_runtime_check.zig" }, + .root_source_file = b.path("glibc_runtime_check.zig"), .target = target, }); exe.linkLibC(); diff --git a/test/link/interdependent_static_c_libs/build.zig b/test/link/interdependent_static_c_libs/build.zig index 01ed218cce3f73d12e19b71b891739f9311d243f..7b84235b0c1ee3e1e649abbe89959c98ccd77baa 100644 --- a/test/link/interdependent_static_c_libs/build.zig +++ b/test/link/interdependent_static_c_libs/build.zig @@ -16,24 +16,24 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize .optimize = optimize, .target = b.host, }); - lib_a.addCSourceFile(.{ .file = .{ .path = "a.c" }, .flags = &[_][]const u8{} }); - lib_a.addIncludePath(.{ .path = "." }); + lib_a.addCSourceFile(.{ .file = b.path("a.c"), .flags = &[_][]const u8{} }); + lib_a.addIncludePath(b.path(".")); const lib_b = b.addStaticLibrary(.{ .name = "b", .optimize = optimize, .target = b.host, }); - lib_b.addCSourceFile(.{ .file = .{ .path = "b.c" }, .flags = &[_][]const u8{} }); - lib_b.addIncludePath(.{ .path = "." }); + lib_b.addCSourceFile(.{ .file = b.path("b.c"), .flags = &[_][]const u8{} }); + lib_b.addIncludePath(b.path(".")); const test_exe = b.addTest(.{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, }); test_exe.linkLibrary(lib_a); test_exe.linkLibrary(lib_b); - test_exe.addIncludePath(.{ .path = "." }); + test_exe.addIncludePath(b.path(".")); test_step.dependOn(&b.addRunArtifact(test_exe).step); } diff --git a/test/link/macho.zig b/test/link/macho.zig index 9e91e14da379cffa2869fc31f067709d9e4f0a56..4fc6f1b5f1b6f3f27417f30b7a8fe8285865a947 100644 --- a/test/link/macho.zig +++ b/test/link/macho.zig @@ -836,9 +836,9 @@ fn testLinkDirectlyCppTbd(b: *Build, opts: Options) *Step { , .cpp_source_flags = &.{ "-nostdlib++", "-nostdinc++" }, }); - exe.root_module.addSystemIncludePath(.{ .path = b.pathJoin(&.{ sdk, "/usr/include" }) }); - exe.root_module.addIncludePath(.{ .path = b.pathJoin(&.{ sdk, "/usr/include/c++/v1" }) }); - exe.root_module.addObjectFile(.{ .path = b.pathJoin(&.{ sdk, "/usr/lib/libc++.tbd" }) }); + exe.root_module.addSystemIncludePath(b.path(b.pathJoin(&.{ sdk, "/usr/include" }))); + exe.root_module.addIncludePath(b.path(b.pathJoin(&.{ sdk, "/usr/include/c++/v1" }))); + exe.root_module.addObjectFile(b.path(b.pathJoin(&.{ sdk, "/usr/lib/libc++.tbd" }))); const check = exe.checkObject(); check.checkInSymtab(); diff --git a/test/link/static_libs_from_object_files/build.zig b/test/link/static_libs_from_object_files/build.zig index d0ea78bbd66c4f8f82eb6eb7b4aa9131b5426ab3..dd679e7ef809540bc4bb0b00eb20e2105f21f864 100644 --- a/test/link/static_libs_from_object_files/build.zig +++ b/test/link/static_libs_from_object_files/build.zig @@ -57,7 +57,7 @@ fn add(b: *Build, test_step: *Step, files: []const LazyPath, optimize: std.built { const exe = b.addExecutable(.{ .name = "test1", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, .target = b.host, }); @@ -93,7 +93,7 @@ fn add(b: *Build, test_step: *Step, files: []const LazyPath, optimize: std.built const exe = b.addExecutable(.{ .name = "test2", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = b.host, .optimize = optimize, }); @@ -134,7 +134,7 @@ fn add(b: *Build, test_step: *Step, files: []const LazyPath, optimize: std.built const exe = b.addExecutable(.{ .name = "test3", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = b.host, .optimize = optimize, }); diff --git a/test/link/wasm/archive/build.zig b/test/link/wasm/archive/build.zig index cd91feae65dd1015c6282c186ae3736bea27e145..34c5818ad88b244d4ca9d851bbab2c958a112f9b 100644 --- a/test/link/wasm/archive/build.zig +++ b/test/link/wasm/archive/build.zig @@ -17,7 +17,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize // and therefore link with its archive file. const lib = b.addExecutable(.{ .name = "main", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), .strip = false, diff --git a/test/link/wasm/basic-features/build.zig b/test/link/wasm/basic-features/build.zig index 6f9e82d09df3683cd29894a472a3bc67c28b15c9..87355a5c12880fd7c9f92aa0f6a9d81c215bf877 100644 --- a/test/link/wasm/basic-features/build.zig +++ b/test/link/wasm/basic-features/build.zig @@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void { // Library with explicitly set cpu features const lib = b.addExecutable(.{ .name = "lib", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = .Debug, .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, diff --git a/test/link/wasm/bss/build.zig b/test/link/wasm/bss/build.zig index 3a1592f394d5e2337350688edfe44c5765d12969..dc7d1bae4b9a78a975b4402e249f49a5f6d0d5c9 100644 --- a/test/link/wasm/bss/build.zig +++ b/test/link/wasm/bss/build.zig @@ -16,7 +16,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt { const lib = b.addExecutable(.{ .name = "lib", - .root_source_file = .{ .path = "lib.zig" }, + .root_source_file = b.path("lib.zig"), .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), .optimize = optimize_mode, .strip = false, @@ -64,7 +64,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt { const lib = b.addExecutable(.{ .name = "lib", - .root_source_file = .{ .path = "lib2.zig" }, + .root_source_file = b.path("lib2.zig"), .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), .optimize = optimize_mode, .strip = false, diff --git a/test/link/wasm/export-data/build.zig b/test/link/wasm/export-data/build.zig index 05b2ca161bbfb24d2907d3af5fcde9ea2c658747..7e3c5e5841396f20d51440fa25fa50733bae169c 100644 --- a/test/link/wasm/export-data/build.zig +++ b/test/link/wasm/export-data/build.zig @@ -11,7 +11,7 @@ pub fn build(b: *std.Build) void { const lib = b.addExecutable(.{ .name = "lib", - .root_source_file = .{ .path = "lib.zig" }, + .root_source_file = b.path("lib.zig"), .optimize = .ReleaseSafe, // to make the output deterministic in address positions .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), }); diff --git a/test/link/wasm/export/build.zig b/test/link/wasm/export/build.zig index ab2893ce3c6a6f3ff6fbb98a89f4704af0530718..368826843a6c3caf6a3d5fcd86f07e3c3ff6a9f4 100644 --- a/test/link/wasm/export/build.zig +++ b/test/link/wasm/export/build.zig @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { const no_export = b.addExecutable(.{ .name = "no-export", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), }); @@ -25,7 +25,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize const dynamic_export = b.addExecutable(.{ .name = "dynamic", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), }); @@ -36,7 +36,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize const force_export = b.addExecutable(.{ .name = "force", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), }); diff --git a/test/link/wasm/extern-mangle/build.zig b/test/link/wasm/extern-mangle/build.zig index 41a00eefc97da3c7bf3f3da33991aa2124ac9ff2..5a4cbc1cdae3eaa03c225b65145458fdefba477e 100644 --- a/test/link/wasm/extern-mangle/build.zig +++ b/test/link/wasm/extern-mangle/build.zig @@ -13,7 +13,7 @@ pub fn build(b: *std.Build) void { fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { const lib = b.addExecutable(.{ .name = "lib", - .root_source_file = .{ .path = "lib.zig" }, + .root_source_file = b.path("lib.zig"), .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), .optimize = optimize, }); diff --git a/test/link/wasm/extern/build.zig b/test/link/wasm/extern/build.zig index baa2b6d61e81e96a24226481321d4b8f972cabea..77dcbc47c51cc2a73fdf8b8593ddbc8e36ee1b87 100644 --- a/test/link/wasm/extern/build.zig +++ b/test/link/wasm/extern/build.zig @@ -15,11 +15,11 @@ pub fn build(b: *std.Build) void { fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { const exe = b.addExecutable(.{ .name = "extern", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .wasi }), }); - exe.addCSourceFile(.{ .file = .{ .path = "foo.c" }, .flags = &.{} }); + exe.addCSourceFile(.{ .file = b.path("foo.c"), .flags = &.{} }); exe.use_llvm = false; exe.use_lld = false; diff --git a/test/link/wasm/function-table/build.zig b/test/link/wasm/function-table/build.zig index aca66e4f7157f88b4ca7a80f17d5b0119e2f100d..3042ddf5d55e32d12af59a46675e6c1dfae70c3d 100644 --- a/test/link/wasm/function-table/build.zig +++ b/test/link/wasm/function-table/build.zig @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { const import_table = b.addExecutable(.{ .name = "import_table", - .root_source_file = .{ .path = "lib.zig" }, + .root_source_file = b.path("lib.zig"), .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), .optimize = optimize, }); @@ -27,7 +27,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize const export_table = b.addExecutable(.{ .name = "export_table", - .root_source_file = .{ .path = "lib.zig" }, + .root_source_file = b.path("lib.zig"), .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), .optimize = optimize, }); @@ -39,7 +39,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize const regular_table = b.addExecutable(.{ .name = "regular_table", - .root_source_file = .{ .path = "lib.zig" }, + .root_source_file = b.path("lib.zig"), .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), .optimize = optimize, }); diff --git a/test/link/wasm/infer-features/build.zig b/test/link/wasm/infer-features/build.zig index e3fe860f54062a9c140cede530202272233064f6..e72e3934f75b150c8cb50ebe6931666cb77b6ec1 100644 --- a/test/link/wasm/infer-features/build.zig +++ b/test/link/wasm/infer-features/build.zig @@ -13,13 +13,13 @@ pub fn build(b: *std.Build) void { .os_tag = .freestanding, }), }); - c_obj.addCSourceFile(.{ .file = .{ .path = "foo.c" }, .flags = &.{} }); + c_obj.addCSourceFile(.{ .file = b.path("foo.c"), .flags = &.{} }); // Wasm library that doesn't have any features specified. This will // infer its featureset from other linked object files. const lib = b.addExecutable(.{ .name = "lib", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = .Debug, .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, diff --git a/test/link/wasm/producers/build.zig b/test/link/wasm/producers/build.zig index 4fb777e1232d19c4932be302083bf5776613c970..2dae6e3f9bd17772c4f5aebed0060511f96eb76b 100644 --- a/test/link/wasm/producers/build.zig +++ b/test/link/wasm/producers/build.zig @@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void { fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { const lib = b.addExecutable(.{ .name = "lib", - .root_source_file = .{ .path = "lib.zig" }, + .root_source_file = b.path("lib.zig"), .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), .optimize = optimize, .strip = false, diff --git a/test/link/wasm/segments/build.zig b/test/link/wasm/segments/build.zig index 86073ff9770d6c48ddfd4abe8fb104d39809319b..3c8bac3f07309a7f86a9697377b3de8fb79c9a01 100644 --- a/test/link/wasm/segments/build.zig +++ b/test/link/wasm/segments/build.zig @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { const lib = b.addExecutable(.{ .name = "lib", - .root_source_file = .{ .path = "lib.zig" }, + .root_source_file = b.path("lib.zig"), .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), .optimize = optimize, .strip = false, diff --git a/test/link/wasm/shared-memory/build.zig b/test/link/wasm/shared-memory/build.zig index 0cad2560cbe6fc7fb814b6c99b5c2a21871c2d32..7807a95a4fc4b87a1a6ffdd9a586981a43e7cc8e 100644 --- a/test/link/wasm/shared-memory/build.zig +++ b/test/link/wasm/shared-memory/build.zig @@ -13,7 +13,7 @@ pub fn build(b: *std.Build) void { fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.OptimizeMode) void { const exe = b.addExecutable(.{ .name = "lib", - .root_source_file = .{ .path = "lib.zig" }, + .root_source_file = b.path("lib.zig"), .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .cpu_model = .{ .explicit = &std.Target.wasm.cpu.mvp }, diff --git a/test/link/wasm/stack_pointer/build.zig b/test/link/wasm/stack_pointer/build.zig index e95c27827ed0b5dc95dbdf7820e692bf04a66cfc..e42e3628800181b81ec0ba26cdf8cc1476008684 100644 --- a/test/link/wasm/stack_pointer/build.zig +++ b/test/link/wasm/stack_pointer/build.zig @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { const lib = b.addExecutable(.{ .name = "lib", - .root_source_file = .{ .path = "lib.zig" }, + .root_source_file = b.path("lib.zig"), .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), .optimize = optimize, .strip = false, diff --git a/test/link/wasm/type/build.zig b/test/link/wasm/type/build.zig index b62886c74eb3000494a5d71c189e5050f7abba4a..46b80dbfe5dca58e8e2bd64f0f36fceaaf3ec79f 100644 --- a/test/link/wasm/type/build.zig +++ b/test/link/wasm/type/build.zig @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { const exe = b.addExecutable(.{ .name = "lib", - .root_source_file = .{ .path = "lib.zig" }, + .root_source_file = b.path("lib.zig"), .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), .optimize = optimize, .strip = false, diff --git a/test/standalone/build.zig b/test/standalone/build.zig index 673a52cedd5e07f53df1e8286ea8338e3589c7c1..b2575bc83e3ec7e55ff66275e46b50b972e24bdb 100644 --- a/test/standalone/build.zig +++ b/test/standalone/build.zig @@ -44,7 +44,7 @@ pub fn build(b: *std.Build) void { }) |tool_src_path| { const tool = b.addTest(.{ .name = std.fs.path.stem(tool_src_path), - .root_source_file = .{ .path = tool_src_path }, + .root_source_file = b.path(tool_src_path), .optimize = .Debug, .target = tools_target, }); diff --git a/test/standalone/c_compiler/build.zig b/test/standalone/c_compiler/build.zig index 0550ad8cee75d899469c206ff0ae6d93f48102e0..a3c842d8d51e167d254bb8fca289e55db1af04d0 100644 --- a/test/standalone/c_compiler/build.zig +++ b/test/standalone/c_compiler/build.zig @@ -30,7 +30,7 @@ fn add( .optimize = optimize, .target = target, }); - exe_c.addCSourceFile(.{ .file = .{ .path = "test.c" }, .flags = &[0][]const u8{} }); + exe_c.addCSourceFile(.{ .file = b.path("test.c"), .flags = &[0][]const u8{} }); exe_c.linkLibC(); const exe_cpp = b.addExecutable(.{ @@ -39,7 +39,7 @@ fn add( .target = target, }); b.default_step.dependOn(&exe_cpp.step); - exe_cpp.addCSourceFile(.{ .file = .{ .path = "test.cpp" }, .flags = &[0][]const u8{} }); + exe_cpp.addCSourceFile(.{ .file = b.path("test.cpp"), .flags = &[0][]const u8{} }); exe_cpp.linkLibCpp(); switch (target.result.os.tag) { diff --git a/test/standalone/child_process/build.zig b/test/standalone/child_process/build.zig index 89558c00e6096842c03a24172537b9ff39b0718d..35317602b5e949793d6c196a7c227e49c05587fe 100644 --- a/test/standalone/child_process/build.zig +++ b/test/standalone/child_process/build.zig @@ -12,14 +12,14 @@ pub fn build(b: *std.Build) void { const child = b.addExecutable(.{ .name = "child", - .root_source_file = .{ .path = "child.zig" }, + .root_source_file = b.path("child.zig"), .optimize = optimize, .target = target, }); const main = b.addExecutable(.{ .name = "main", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, .target = target, }); diff --git a/test/standalone/cmakedefine/build.zig b/test/standalone/cmakedefine/build.zig index 967aa7ecbd96fee46b0456cf85b83221bfe41e0e..d90441360fce41b587f66549e0aa6b939878a8b9 100644 --- a/test/standalone/cmakedefine/build.zig +++ b/test/standalone/cmakedefine/build.zig @@ -4,7 +4,7 @@ const ConfigHeader = std.Build.Step.ConfigHeader; pub fn build(b: *std.Build) void { const config_header = b.addConfigHeader( .{ - .style = .{ .cmake = .{ .path = "config.h.in" } }, + .style = .{ .cmake = b.path("config.h.in") }, .include_path = "config.h", }, .{ @@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void { const pwd_sh = b.addConfigHeader( .{ - .style = .{ .cmake = .{ .path = "pwd.sh.in" } }, + .style = .{ .cmake = b.path("pwd.sh.in") }, .include_path = "pwd.sh", }, .{ .DIR = "${PWD}" }, @@ -36,7 +36,7 @@ pub fn build(b: *std.Build) void { const sigil_header = b.addConfigHeader( .{ - .style = .{ .cmake = .{ .path = "sigil.h.in" } }, + .style = .{ .cmake = b.path("sigil.h.in") }, .include_path = "sigil.h", }, .{}, @@ -44,7 +44,7 @@ pub fn build(b: *std.Build) void { const stack_header = b.addConfigHeader( .{ - .style = .{ .cmake = .{ .path = "stack.h.in" } }, + .style = .{ .cmake = b.path("stack.h.in") }, .include_path = "stack.h", }, .{ @@ -57,7 +57,7 @@ pub fn build(b: *std.Build) void { const wrapper_header = b.addConfigHeader( .{ - .style = .{ .cmake = .{ .path = "wrapper.h.in" } }, + .style = .{ .cmake = b.path("wrapper.h.in") }, .include_path = "wrapper.h", }, .{ diff --git a/test/standalone/compiler_rt_panic/build.zig b/test/standalone/compiler_rt_panic/build.zig index 8ad7732a931b5fe2f3b15f0a3c3a20ce31d48f99..93331a028245d686d729141eeeff3d44a58715ef 100644 --- a/test/standalone/compiler_rt_panic/build.zig +++ b/test/standalone/compiler_rt_panic/build.zig @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void { }); exe.linkLibC(); exe.addCSourceFile(.{ - .file = .{ .path = "main.c" }, + .file = b.path("main.c"), .flags = &.{}, }); exe.link_gc_sections = false; diff --git a/test/standalone/dep_diamond/build.zig b/test/standalone/dep_diamond/build.zig index 9190b29594cf3cd82c4cbbe7814295629d05bf03..b14503e349197115d24b861705c3af3156445135 100644 --- a/test/standalone/dep_diamond/build.zig +++ b/test/standalone/dep_diamond/build.zig @@ -7,21 +7,21 @@ pub fn build(b: *std.Build) void { const optimize: std.builtin.OptimizeMode = .Debug; const shared = b.createModule(.{ - .root_source_file = .{ .path = "shared.zig" }, + .root_source_file = b.path("shared.zig"), }); const exe = b.addExecutable(.{ .name = "test", - .root_source_file = .{ .path = "test.zig" }, + .root_source_file = b.path("test.zig"), .target = b.host, .optimize = optimize, }); exe.root_module.addAnonymousImport("foo", .{ - .root_source_file = .{ .path = "foo.zig" }, + .root_source_file = b.path("foo.zig"), .imports = &.{.{ .name = "shared", .module = shared }}, }); exe.root_module.addAnonymousImport("bar", .{ - .root_source_file = .{ .path = "bar.zig" }, + .root_source_file = b.path("bar.zig"), .imports = &.{.{ .name = "shared", .module = shared }}, }); diff --git a/test/standalone/dep_mutually_recursive/build.zig b/test/standalone/dep_mutually_recursive/build.zig index 04589d9b5ba4da05bc81dedd2a1a80b595421c3c..804abbce18d6fec648297f4ad053ef84da52817e 100644 --- a/test/standalone/dep_mutually_recursive/build.zig +++ b/test/standalone/dep_mutually_recursive/build.zig @@ -7,17 +7,17 @@ pub fn build(b: *std.Build) void { const optimize: std.builtin.OptimizeMode = .Debug; const foo = b.createModule(.{ - .root_source_file = .{ .path = "foo.zig" }, + .root_source_file = b.path("foo.zig"), }); const bar = b.createModule(.{ - .root_source_file = .{ .path = "bar.zig" }, + .root_source_file = b.path("bar.zig"), }); foo.addImport("bar", bar); bar.addImport("foo", foo); const exe = b.addExecutable(.{ .name = "test", - .root_source_file = .{ .path = "test.zig" }, + .root_source_file = b.path("test.zig"), .target = b.host, .optimize = optimize, }); diff --git a/test/standalone/dep_recursive/build.zig b/test/standalone/dep_recursive/build.zig index a6334e6a9763f265532571d09473cc000028fbb5..0ab732db4b0692f9ffe4ab02295e7157f301a33d 100644 --- a/test/standalone/dep_recursive/build.zig +++ b/test/standalone/dep_recursive/build.zig @@ -7,13 +7,13 @@ pub fn build(b: *std.Build) void { const optimize: std.builtin.OptimizeMode = .Debug; const foo = b.createModule(.{ - .root_source_file = .{ .path = "foo.zig" }, + .root_source_file = b.path("foo.zig"), }); foo.addImport("foo", foo); const exe = b.addExecutable(.{ .name = "test", - .root_source_file = .{ .path = "test.zig" }, + .root_source_file = b.path("test.zig"), .target = b.host, .optimize = optimize, }); diff --git a/test/standalone/dep_shared_builtin/build.zig b/test/standalone/dep_shared_builtin/build.zig index 33d53ad166ba11f8dbc85c8ca355429459a776c2..de84e2848d59e10e0c1569101dcbf7f176d3d6a9 100644 --- a/test/standalone/dep_shared_builtin/build.zig +++ b/test/standalone/dep_shared_builtin/build.zig @@ -8,12 +8,12 @@ pub fn build(b: *std.Build) void { const exe = b.addExecutable(.{ .name = "test", - .root_source_file = .{ .path = "test.zig" }, + .root_source_file = b.path("test.zig"), .target = b.host, .optimize = optimize, }); exe.root_module.addAnonymousImport("foo", .{ - .root_source_file = .{ .path = "foo.zig" }, + .root_source_file = b.path("foo.zig"), }); const run = b.addRunArtifact(exe); diff --git a/test/standalone/dep_triangle/build.zig b/test/standalone/dep_triangle/build.zig index b155554997531ef9b8111d381b02da498ccc0e7c..f9f29099d5e77a800822f2cc102f4d2233798544 100644 --- a/test/standalone/dep_triangle/build.zig +++ b/test/standalone/dep_triangle/build.zig @@ -7,17 +7,17 @@ pub fn build(b: *std.Build) void { const optimize: std.builtin.OptimizeMode = .Debug; const shared = b.createModule(.{ - .root_source_file = .{ .path = "shared.zig" }, + .root_source_file = b.path("shared.zig"), }); const exe = b.addExecutable(.{ .name = "test", - .root_source_file = .{ .path = "test.zig" }, + .root_source_file = b.path("test.zig"), .target = b.host, .optimize = optimize, }); exe.root_module.addAnonymousImport("foo", .{ - .root_source_file = .{ .path = "foo.zig" }, + .root_source_file = b.path("foo.zig"), .imports = &.{.{ .name = "shared", .module = shared }}, }); exe.root_module.addImport("shared", shared); diff --git a/test/standalone/depend_on_main_mod/build.zig b/test/standalone/depend_on_main_mod/build.zig index bbef64693e59f8864d49e0a68509931011a2969e..42e96e0aa0676e718f09e75c7f0125fefdb8797a 100644 --- a/test/standalone/depend_on_main_mod/build.zig +++ b/test/standalone/depend_on_main_mod/build.zig @@ -9,13 +9,13 @@ pub fn build(b: *std.Build) void { const exe = b.addExecutable(.{ .name = "depend_on_main_mod", - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); const foo_module = b.addModule("foo", .{ - .root_source_file = .{ .path = "src/foo.zig" }, + .root_source_file = b.path("src/foo.zig"), }); foo_module.addImport("root2", &exe.root_module); diff --git a/test/standalone/dirname/build.zig b/test/standalone/dirname/build.zig index 272ed54b3835d38c205f5bfa966fdc931d6c08cf..279f66093a8dbe7a0435987a3e5e5d091b65701b 100644 --- a/test/standalone/dirname/build.zig +++ b/test/standalone/dirname/build.zig @@ -6,9 +6,7 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "Test it"); b.default_step = test_step; - const touch_src = std.Build.LazyPath{ - .path = "touch.zig", - }; + const touch_src = b.path("touch.zig"); const touch = b.addExecutable(.{ .name = "touch", @@ -20,14 +18,14 @@ pub fn build(b: *std.Build) void { const exists_in = b.addExecutable(.{ .name = "exists_in", - .root_source_file = .{ .path = "exists_in.zig" }, + .root_source_file = b.path("exists_in.zig"), .optimize = .Debug, .target = target, }); const has_basename = b.addExecutable(.{ .name = "has_basename", - .root_source_file = .{ .path = "has_basename.zig" }, + .root_source_file = b.path("has_basename.zig"), .optimize = .Debug, .target = target, }); diff --git a/test/standalone/embed_generated_file/build.zig b/test/standalone/embed_generated_file/build.zig index 3f67cdea5421acf0630f49222e61d3b0ba1fb4c0..f7430b7716ba4a57a632fcb1c82efe6bb0cf0b7f 100644 --- a/test/standalone/embed_generated_file/build.zig +++ b/test/standalone/embed_generated_file/build.zig @@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void { const bootloader = b.addExecutable(.{ .name = "bootloader", - .root_source_file = .{ .path = "bootloader.zig" }, + .root_source_file = b.path("bootloader.zig"), .target = b.resolveTargetQuery(.{ .cpu_arch = .x86, .os_tag = .freestanding, @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { }); const exe = b.addTest(.{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = .Debug, }); exe.root_module.addAnonymousImport("bootloader.elf", .{ diff --git a/test/standalone/empty_env/build.zig b/test/standalone/empty_env/build.zig index a2fe48312827853e9c34ff6ddcef65a293c418dd..b8e488f830e5f8ed606add296b1fcc9b271d1a6f 100644 --- a/test/standalone/empty_env/build.zig +++ b/test/standalone/empty_env/build.zig @@ -14,7 +14,7 @@ pub fn build(b: *std.Build) void { const main = b.addExecutable(.{ .name = "main", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = b.host, .optimize = optimize, }); diff --git a/test/standalone/extern/build.zig b/test/standalone/extern/build.zig index 401deb3dc4d117242c7cbfa6d349fb83748bd447..878b92ab5838ea05bfdc92cd158c8c8e50dbf2f4 100644 --- a/test/standalone/extern/build.zig +++ b/test/standalone/extern/build.zig @@ -5,12 +5,12 @@ pub fn build(b: *std.Build) void { const obj = b.addObject(.{ .name = "exports", - .root_source_file = .{ .path = "exports.zig" }, + .root_source_file = b.path("exports.zig"), .target = b.host, .optimize = optimize, }); const main = b.addTest(.{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, }); main.addObject(obj); diff --git a/test/standalone/global_linkage/build.zig b/test/standalone/global_linkage/build.zig index 13b7fcfa0e5ffc9b1bee178a37414b586d5253d6..9edbc9612967dc8cdd55f76d8dcbfd2c2bf78f69 100644 --- a/test/standalone/global_linkage/build.zig +++ b/test/standalone/global_linkage/build.zig @@ -9,20 +9,20 @@ pub fn build(b: *std.Build) void { const obj1 = b.addStaticLibrary(.{ .name = "obj1", - .root_source_file = .{ .path = "obj1.zig" }, + .root_source_file = b.path("obj1.zig"), .optimize = optimize, .target = target, }); const obj2 = b.addStaticLibrary(.{ .name = "obj2", - .root_source_file = .{ .path = "obj2.zig" }, + .root_source_file = b.path("obj2.zig"), .optimize = optimize, .target = target, }); const main = b.addTest(.{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, }); main.linkLibrary(obj1); diff --git a/test/standalone/install_headers/build.zig b/test/standalone/install_headers/build.zig index 4c9bbb501ae7fb82302d6f1b55e1b9d24bdeb53e..889ee717d685b0c13fefbd4021cb2457f3ee0b17 100644 --- a/test/standalone/install_headers/build.zig +++ b/test/standalone/install_headers/build.zig @@ -32,7 +32,7 @@ pub fn build(b: *std.Build) void { \\} ) }); - libfoo.installHeadersDirectory(.{ .path = "include" }, "foo", .{ .exclude_extensions = &.{".ignore_me.h"} }); + libfoo.installHeadersDirectory(b.path("include"), "foo", .{ .exclude_extensions = &.{".ignore_me.h"} }); libfoo.installHeader(b.addWriteFiles().add("d.h", \\#define FOO_D "D" \\ @@ -78,7 +78,7 @@ pub fn build(b: *std.Build) void { }); const check_exists = b.addExecutable(.{ .name = "check_exists", - .root_source_file = .{ .path = "check_exists.zig" }, + .root_source_file = b.path("check_exists.zig"), .target = b.resolveTargetQuery(.{}), .optimize = .Debug, }); diff --git a/test/standalone/install_raw_hex/build.zig b/test/standalone/install_raw_hex/build.zig index d1ec55ab53494ce9a9fb4f9e4484b785e29fae47..515528534ee7238a0bed9aacd41a3f093353ab90 100644 --- a/test/standalone/install_raw_hex/build.zig +++ b/test/standalone/install_raw_hex/build.zig @@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void { const elf = b.addExecutable(.{ .name = "zig-nrf52-blink.elf", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); diff --git a/test/standalone/ios/build.zig b/test/standalone/ios/build.zig index 356f12a3d90297eba96d03b645538340bda2438d..daabe8990dbf532538739323aacb03003c474fd5 100644 --- a/test/standalone/ios/build.zig +++ b/test/standalone/ios/build.zig @@ -21,10 +21,10 @@ pub fn build(b: *std.Build) void { .optimize = optimize, .target = target, }); - exe.addCSourceFile(.{ .file = .{ .path = "main.m" }, .flags = &.{} }); - exe.addSystemIncludePath(.{ .path = b.pathJoin(&.{ sdk, "/usr/include" }) }); - exe.addSystemFrameworkPath(.{ .path = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) }); - exe.addLibraryPath(.{ .path = b.pathJoin(&.{ sdk, "/usr/lib" }) }); + exe.addCSourceFile(.{ .file = b.path("main.m"), .flags = &.{} }); + exe.addSystemIncludePath(b.path(b.pathJoin(&.{ sdk, "/usr/include" }))); + exe.addSystemFrameworkPath(b.path(b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }))); + exe.addLibraryPath(b.path(b.pathJoin(&.{ sdk, "/usr/lib" }))); exe.linkFramework("Foundation"); exe.linkFramework("UIKit"); exe.linkLibC(); diff --git a/test/standalone/issue_11595/build.zig b/test/standalone/issue_11595/build.zig index c591b3058b5de164bbee70e6d21361a4df657bcd..b6e17f1eef6df7359be041767ca429a5d4e578df 100644 --- a/test/standalone/issue_11595/build.zig +++ b/test/standalone/issue_11595/build.zig @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { const exe = b.addExecutable(.{ .name = "zigtest", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); diff --git a/test/standalone/issue_12706/build.zig b/test/standalone/issue_12706/build.zig index 9a80dae256fec810274b3ffad465bcb34f4d082e..528eba89d3a7e6761c704e73dd5963c3d42dbd59 100644 --- a/test/standalone/issue_12706/build.zig +++ b/test/standalone/issue_12706/build.zig @@ -10,7 +10,7 @@ pub fn build(b: *std.Build) void { const exe = b.addExecutable(.{ .name = "main", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, .target = target, }); diff --git a/test/standalone/issue_339/build.zig b/test/standalone/issue_339/build.zig index 5dc686a77924c4af8432a60541dca3ae49ab6553..6327c5ed97fecad9b9c2b479c4225c5823c060b1 100644 --- a/test/standalone/issue_339/build.zig +++ b/test/standalone/issue_339/build.zig @@ -9,7 +9,7 @@ pub fn build(b: *std.Build) void { const obj = b.addObject(.{ .name = "test", - .root_source_file = .{ .path = "test.zig" }, + .root_source_file = b.path("test.zig"), .target = target, .optimize = optimize, }); diff --git a/test/standalone/issue_794/build.zig b/test/standalone/issue_794/build.zig index eb05aa9b4fd5829ad6a84aefbb7f7bf85a6b03d5..d42ff1f3049f6ebb68facc22115806841b89ebda 100644 --- a/test/standalone/issue_794/build.zig +++ b/test/standalone/issue_794/build.zig @@ -5,9 +5,9 @@ pub fn build(b: *std.Build) void { b.default_step = test_step; const test_artifact = b.addTest(.{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), }); - test_artifact.addIncludePath(.{ .path = "a_directory" }); + test_artifact.addIncludePath(b.path("a_directory")); // TODO: actually check the output _ = test_artifact.getEmittedBin(); diff --git a/test/standalone/issue_8550/build.zig b/test/standalone/issue_8550/build.zig index 557019cfdc044379d3ccc8fd68f73d0987389449..a0dea518d683aeecc9126c0d4e29b326908494a8 100644 --- a/test/standalone/issue_8550/build.zig +++ b/test/standalone/issue_8550/build.zig @@ -15,12 +15,12 @@ pub fn build(b: *std.Build) !void { const kernel = b.addExecutable(.{ .name = "kernel", - .root_source_file = .{ .path = "./main.zig" }, + .root_source_file = b.path("./main.zig"), .optimize = optimize, .target = target, }); - kernel.addObjectFile(.{ .path = "./boot.S" }); - kernel.setLinkerScript(.{ .path = "./linker.ld" }); + kernel.addObjectFile(b.path("./boot.S")); + kernel.setLinkerScript(b.path("./linker.ld")); b.installArtifact(kernel); test_step.dependOn(&kernel.step); diff --git a/test/standalone/load_dynamic_library/build.zig b/test/standalone/load_dynamic_library/build.zig index 140f276ebe0479b129508ade6b6c4e59b6b78db5..27f8f6de7cce9397df749a9e2486cc6edebb347f 100644 --- a/test/standalone/load_dynamic_library/build.zig +++ b/test/standalone/load_dynamic_library/build.zig @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void { const lib = b.addSharedLibrary(.{ .name = "add", - .root_source_file = .{ .path = "add.zig" }, + .root_source_file = b.path("add.zig"), .version = .{ .major = 1, .minor = 0, .patch = 0 }, .optimize = optimize, .target = target, @@ -25,7 +25,7 @@ pub fn build(b: *std.Build) void { const main = b.addExecutable(.{ .name = "main", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, .target = target, }); diff --git a/test/standalone/mix_c_files/build.zig b/test/standalone/mix_c_files/build.zig index e91f87e13284d128d65c0a9a184d8c07d35a4c5a..779d4d030e08448c75acef195a2f283927f60ad2 100644 --- a/test/standalone/mix_c_files/build.zig +++ b/test/standalone/mix_c_files/build.zig @@ -18,11 +18,11 @@ pub fn build(b: *std.Build) void { fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { const exe = b.addExecutable(.{ .name = "test", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = b.host, .optimize = optimize, }); - exe.addCSourceFile(.{ .file = .{ .path = "test.c" }, .flags = &[_][]const u8{"-std=c11"} }); + exe.addCSourceFile(.{ .file = b.path("test.c"), .flags = &[_][]const u8{"-std=c11"} }); exe.linkLibC(); const run_cmd = b.addRunArtifact(exe); diff --git a/test/standalone/mix_o_files/build.zig b/test/standalone/mix_o_files/build.zig index aa648145a831785b5a19b56a7934f1cbd6efac0d..dd8ef9a4c4bbaa1008c1a217011d3b9497da322c 100644 --- a/test/standalone/mix_o_files/build.zig +++ b/test/standalone/mix_o_files/build.zig @@ -9,7 +9,7 @@ pub fn build(b: *std.Build) void { const obj = b.addObject(.{ .name = "base64", - .root_source_file = .{ .path = "base64.zig" }, + .root_source_file = b.path("base64.zig"), .optimize = optimize, .target = target, }); @@ -20,7 +20,7 @@ pub fn build(b: *std.Build) void { .target = target, }); exe.addCSourceFile(.{ - .file = .{ .path = "test.c" }, + .file = b.path("test.c"), .flags = &[_][]const u8{"-std=c99"}, }); exe.addObject(obj); diff --git a/test/standalone/pie/build.zig b/test/standalone/pie/build.zig index 2e9f99ff4b67a50df466ee7dd6750a3210fc8938..25ed330abce22e388dbe1159b778fc97d79fe348 100644 --- a/test/standalone/pie/build.zig +++ b/test/standalone/pie/build.zig @@ -11,7 +11,7 @@ pub fn build(b: *std.Build) void { }); const main = b.addTest(.{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, .target = target, }); diff --git a/test/standalone/pkg_import/build.zig b/test/standalone/pkg_import/build.zig index 207f924f9be97a393082b55959a39de8c5f6ce1d..4bef1d756f489280105c369af6197eb91881fd42 100644 --- a/test/standalone/pkg_import/build.zig +++ b/test/standalone/pkg_import/build.zig @@ -8,11 +8,11 @@ pub fn build(b: *std.Build) void { const exe = b.addExecutable(.{ .name = "test", - .root_source_file = .{ .path = "test.zig" }, + .root_source_file = b.path("test.zig"), .optimize = optimize, .target = b.host, }); - exe.root_module.addAnonymousImport("my_pkg", .{ .root_source_file = .{ .path = "pkg.zig" } }); + exe.root_module.addAnonymousImport("my_pkg", .{ .root_source_file = b.path("pkg.zig") }); const run = b.addRunArtifact(exe); test_step.dependOn(&run.step); diff --git a/test/standalone/self_exe_symlink/build.zig b/test/standalone/self_exe_symlink/build.zig index d61d5025743366a9bd56addc9423d3ef13a37fc3..77799cfa00cc5610b6719f076319a27b44d1dfaf 100644 --- a/test/standalone/self_exe_symlink/build.zig +++ b/test/standalone/self_exe_symlink/build.zig @@ -15,14 +15,14 @@ pub fn build(b: *std.Build) void { const main = b.addExecutable(.{ .name = "main", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, .target = target, }); const create_symlink_exe = b.addExecutable(.{ .name = "create-symlink", - .root_source_file = .{ .path = "create-symlink.zig" }, + .root_source_file = b.path("create-symlink.zig"), .optimize = optimize, .target = target, }); diff --git a/test/standalone/shared_library/build.zig b/test/standalone/shared_library/build.zig index 4d409295e866f31c8e8a787c05b7853a560c8e33..2765a2ec07bba4bca9b2c17a8a94290ece36e151 100644 --- a/test/standalone/shared_library/build.zig +++ b/test/standalone/shared_library/build.zig @@ -13,7 +13,7 @@ pub fn build(b: *std.Build) void { const target = b.host; const lib = b.addSharedLibrary(.{ .name = "mathtest", - .root_source_file = .{ .path = "mathtest.zig" }, + .root_source_file = b.path("mathtest.zig"), .version = .{ .major = 1, .minor = 0, .patch = 0 }, .target = target, .optimize = optimize, @@ -25,7 +25,7 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); exe.addCSourceFile(.{ - .file = .{ .path = "test.c" }, + .file = b.path("test.c"), .flags = &[_][]const u8{"-std=c99"}, }); exe.linkLibrary(lib); diff --git a/test/standalone/simple/build.zig b/test/standalone/simple/build.zig index 8bcfbe0fcac24d5329070b0fb68198d3b58ee481..c623780fa5df43627de0d71f026f19b2120759f5 100644 --- a/test/standalone/simple/build.zig +++ b/test/standalone/simple/build.zig @@ -42,7 +42,7 @@ pub fn build(b: *std.Build) void { if (case.is_exe) { const exe = b.addExecutable(.{ .name = std.fs.path.stem(case.src_path), - .root_source_file = .{ .path = case.src_path }, + .root_source_file = b.path(case.src_path), .optimize = optimize, .target = resolved_target, }); @@ -56,7 +56,7 @@ pub fn build(b: *std.Build) void { if (case.is_test) { const exe = b.addTest(.{ .name = std.fs.path.stem(case.src_path), - .root_source_file = .{ .path = case.src_path }, + .root_source_file = b.path(case.src_path), .optimize = optimize, .target = resolved_target, }); diff --git a/test/standalone/stack_iterator/build.zig b/test/standalone/stack_iterator/build.zig index 463a533ac4009996e377b802e415f0621b612618..7041aaa0b89d70de95eca9d14615069d303d2f19 100644 --- a/test/standalone/stack_iterator/build.zig +++ b/test/standalone/stack_iterator/build.zig @@ -19,7 +19,7 @@ pub fn build(b: *std.Build) void { { const exe = b.addExecutable(.{ .name = "unwind_fp", - .root_source_file = .{ .path = "unwind.zig" }, + .root_source_file = b.path("unwind.zig"), .target = target, .optimize = optimize, .unwind_tables = if (target.result.isDarwin()) true else null, @@ -42,7 +42,7 @@ pub fn build(b: *std.Build) void { { const exe = b.addExecutable(.{ .name = "unwind_nofp", - .root_source_file = .{ .path = "unwind.zig" }, + .root_source_file = b.path("unwind.zig"), .target = target, .optimize = optimize, .unwind_tables = true, @@ -74,14 +74,14 @@ pub fn build(b: *std.Build) void { c_shared_lib.defineCMacro("LIB_API", "__declspec(dllexport)"); c_shared_lib.addCSourceFile(.{ - .file = .{ .path = "shared_lib.c" }, + .file = b.path("shared_lib.c"), .flags = &.{"-fomit-frame-pointer"}, }); c_shared_lib.linkLibC(); const exe = b.addExecutable(.{ .name = "shared_lib_unwind", - .root_source_file = .{ .path = "shared_lib_unwind.zig" }, + .root_source_file = b.path("shared_lib_unwind.zig"), .target = target, .optimize = optimize, .unwind_tables = if (target.result.isDarwin()) true else null, diff --git a/test/standalone/static_c_lib/build.zig b/test/standalone/static_c_lib/build.zig index 244107b0f1e180b83f91b922e5220442e28b849a..c025aa9b393876b305a7be8631f93e9f25c8c23f 100644 --- a/test/standalone/static_c_lib/build.zig +++ b/test/standalone/static_c_lib/build.zig @@ -11,15 +11,15 @@ pub fn build(b: *std.Build) void { .optimize = optimize, .target = b.host, }); - foo.addCSourceFile(.{ .file = .{ .path = "foo.c" }, .flags = &[_][]const u8{} }); - foo.addIncludePath(.{ .path = "." }); + foo.addCSourceFile(.{ .file = b.path("foo.c"), .flags = &[_][]const u8{} }); + foo.addIncludePath(b.path(".")); const test_exe = b.addTest(.{ - .root_source_file = .{ .path = "foo.zig" }, + .root_source_file = b.path("foo.zig"), .optimize = optimize, }); test_exe.linkLibrary(foo); - test_exe.addIncludePath(.{ .path = "." }); + test_exe.addIncludePath(b.path(".")); test_step.dependOn(&b.addRunArtifact(test_exe).step); } diff --git a/test/standalone/strip_empty_loop/build.zig b/test/standalone/strip_empty_loop/build.zig index 4875bd9128c73bbff18c2f630879ef9591262966..aadfbd2fc0b0e55fc63d6789e43d4173dd3ae305 100644 --- a/test/standalone/strip_empty_loop/build.zig +++ b/test/standalone/strip_empty_loop/build.zig @@ -9,7 +9,7 @@ pub fn build(b: *std.Build) void { const main = b.addExecutable(.{ .name = "main", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, .target = target, .strip = true, diff --git a/test/standalone/strip_struct_init/build.zig b/test/standalone/strip_struct_init/build.zig index 2d903f973a1fd83482f201f70c8ea059471793ff..ef7960d13051ccf348b65f4df4676b6d994eb9cc 100644 --- a/test/standalone/strip_struct_init/build.zig +++ b/test/standalone/strip_struct_init/build.zig @@ -7,7 +7,7 @@ pub fn build(b: *std.Build) void { const optimize: std.builtin.OptimizeMode = .Debug; const main = b.addTest(.{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, .strip = true, }); diff --git a/test/standalone/test_runner_module_imports/build.zig b/test/standalone/test_runner_module_imports/build.zig index 57e4516077f2c4012ae1e657b9c0434327345d78..cad3b05e08eaf9a9149118c0717b66c655232f72 100644 --- a/test/standalone/test_runner_module_imports/build.zig +++ b/test/standalone/test_runner_module_imports/build.zig @@ -2,13 +2,13 @@ const std = @import("std"); pub fn build(b: *std.Build) void { const t = b.addTest(.{ - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .test_runner = b.path("test_runner/main.zig"), }); - const module1 = b.createModule(.{ .root_source_file = .{ .path = "module1/main.zig" } }); + const module1 = b.createModule(.{ .root_source_file = b.path("module1/main.zig") }); const module2 = b.createModule(.{ - .root_source_file = .{ .path = "module2/main.zig" }, + .root_source_file = b.path("module2/main.zig"), .imports = &.{.{ .name = "module1", .module = module1 }}, }); diff --git a/test/standalone/test_runner_path/build.zig b/test/standalone/test_runner_path/build.zig index ea8982a0f1101ae631b4aef20d7013b60c7cfaf7..48ca3c19db8849d935c24bf1301b71c46224533f 100644 --- a/test/standalone/test_runner_path/build.zig +++ b/test/standalone/test_runner_path/build.zig @@ -7,7 +7,7 @@ pub fn build(b: *std.Build) void { b.default_step = test_step; const test_exe = b.addTest(.{ - .root_source_file = .{ .path = "test.zig" }, + .root_source_file = b.path("test.zig"), }); test_exe.test_runner = b.path("test_runner.zig"); diff --git a/test/standalone/use_alias/build.zig b/test/standalone/use_alias/build.zig index 0511cd3935fcaaaa4c5fe603b7d7faad4ec7522c..7ee501713c32e29f0dc0410e4bdcf9632ca4f8a1 100644 --- a/test/standalone/use_alias/build.zig +++ b/test/standalone/use_alias/build.zig @@ -7,10 +7,10 @@ pub fn build(b: *std.Build) void { const optimize: std.builtin.OptimizeMode = .Debug; const main = b.addTest(.{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .optimize = optimize, }); - main.addIncludePath(.{ .path = "." }); + main.addIncludePath(b.path(".")); test_step.dependOn(&b.addRunArtifact(main).step); } diff --git a/test/standalone/windows_entry_points/build.zig b/test/standalone/windows_entry_points/build.zig index 25c48391475a5e6cbffad1bb0fe1830aacf4b40c..c3d9c49940830291bc53d25f1d2a8f66eb81df2b 100644 --- a/test/standalone/windows_entry_points/build.zig +++ b/test/standalone/windows_entry_points/build.zig @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, .link_libc = true, }); - exe.addCSourceFile(.{ .file = .{ .path = "main.c" } }); + exe.addCSourceFile(.{ .file = b.path("main.c") }); _ = exe.getEmittedBin(); test_step.dependOn(&exe.step); @@ -31,7 +31,7 @@ pub fn build(b: *std.Build) void { .link_libc = true, }); exe.mingw_unicode_entry_point = true; - exe.addCSourceFile(.{ .file = .{ .path = "wmain.c" } }); + exe.addCSourceFile(.{ .file = b.path("wmain.c") }); _ = exe.getEmittedBin(); test_step.dependOn(&exe.step); @@ -45,7 +45,7 @@ pub fn build(b: *std.Build) void { .link_libc = true, }); // Note: `exe.subsystem = .Windows;` is not necessary - exe.addCSourceFile(.{ .file = .{ .path = "winmain.c" } }); + exe.addCSourceFile(.{ .file = b.path("winmain.c") }); _ = exe.getEmittedBin(); test_step.dependOn(&exe.step); @@ -60,7 +60,7 @@ pub fn build(b: *std.Build) void { }); exe.mingw_unicode_entry_point = true; // Note: `exe.subsystem = .Windows;` is not necessary - exe.addCSourceFile(.{ .file = .{ .path = "wwinmain.c" } }); + exe.addCSourceFile(.{ .file = b.path("wwinmain.c") }); _ = exe.getEmittedBin(); test_step.dependOn(&exe.step); diff --git a/test/standalone/windows_resources/build.zig b/test/standalone/windows_resources/build.zig index 51117515715a8e58ea5bd3a9982273db9a9ece2c..6a72dee2a61e7f18f463df4eb4deeb3265284997 100644 --- a/test/standalone/windows_resources/build.zig +++ b/test/standalone/windows_resources/build.zig @@ -25,12 +25,12 @@ fn add( ) void { const exe = b.addExecutable(.{ .name = "zig_resource_test", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = .Debug, }); exe.addWin32ResourceFile(.{ - .file = .{ .path = "res/zig.rc" }, + .file = b.path("res/zig.rc"), .flags = &.{"/c65001"}, // UTF-8 code page }); exe.rc_includes = switch (rc_includes) { diff --git a/test/standalone/zerolength_check/build.zig b/test/standalone/zerolength_check/build.zig index dacfc841c1a7059eab0c79a4ca5f48b33e6b58ba..8118c6e17231ed40e0516c3ea07aac76715c06d6 100644 --- a/test/standalone/zerolength_check/build.zig +++ b/test/standalone/zerolength_check/build.zig @@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void { fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { const unit_tests = b.addTest(.{ - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .target = b.resolveTargetQuery(.{ .os_tag = .wasi, .cpu_arch = .wasm32, diff --git a/test/tests.zig b/test/tests.zig index 286ac7e91ce69c2f674d81bfcaa8996583f89bd5..5ab5268e31a9a8cb21114e311c928fe71a682a5e 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -641,7 +641,7 @@ pub fn addStackTraceTests( ) *Step { const check_exe = b.addExecutable(.{ .name = "check-stack-trace", - .root_source_file = .{ .path = "test/src/check-stack-trace.zig" }, + .root_source_file = b.path("test/src/check-stack-trace.zig"), .target = b.host, .optimize = .Debug, }); @@ -879,7 +879,7 @@ pub fn addCliTests(b: *std.Build) *Step { run6.step.dependOn(&write6.step); // TODO change this to an exact match - const check6 = b.addCheckFile(.{ .path = fmt6_path }, .{ + const check6 = b.addCheckFile(.{ .cwd_relative = fmt6_path }, .{ .expected_matches = &.{ "// no reason", }, @@ -1037,7 +1037,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { options.max_rss; const these_tests = b.addTest(.{ - .root_source_file = .{ .path = options.root_src }, + .root_source_file = b.path(options.root_src), .optimize = test_target.optimize_mode, .target = resolved_target, .max_rss = max_rss, @@ -1046,7 +1046,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { .single_threaded = test_target.single_threaded, .use_llvm = test_target.use_llvm, .use_lld = test_target.use_lld, - .zig_lib_dir = .{ .path = "lib" }, + .zig_lib_dir = b.path("lib"), .pic = test_target.pic, .strip = test_target.strip, }); @@ -1062,7 +1062,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { const use_lld = if (test_target.use_lld == false) "-no-lld" else ""; const use_pic = if (test_target.pic == true) "-pic" else ""; - for (options.include_paths) |include_path| these_tests.addIncludePath(.{ .path = include_path }); + for (options.include_paths) |include_path| these_tests.addIncludePath(b.path(include_path)); const qualified_name = b.fmt("{s}-{s}-{s}-{s}{s}{s}{s}{s}{s}", .{ options.name, @@ -1084,7 +1084,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { .name = qualified_name, .link_libc = test_target.link_libc, .target = b.resolveTargetQuery(altered_query), - .zig_lib_dir = .{ .path = "lib" }, + .zig_lib_dir = b.path("lib"), }); compile_c.addCSourceFile(.{ .file = these_tests.getEmittedBin(), @@ -1113,7 +1113,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { "-Wno-absolute-value", }, }); - compile_c.addIncludePath(.{ .path = "lib" }); // for zig.h + compile_c.addIncludePath(b.path("lib")); // for zig.h if (target.os.tag == .windows) { if (true) { // Unfortunately this requires about 8G of RAM for clang to compile @@ -1189,7 +1189,7 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S if (c_abi_target.use_lld == false) "-no-lld" else "", if (c_abi_target.pic == true) "-pic" else "", }), - .root_source_file = .{ .path = "test/c_abi/main.zig" }, + .root_source_file = b.path("test/c_abi/main.zig"), .target = resolved_target, .optimize = optimize_mode, .link_libc = true, @@ -1199,7 +1199,7 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S .strip = c_abi_target.strip, }); test_step.addCSourceFile(.{ - .file = .{ .path = "test/c_abi/cfuncs.c" }, + .file = b.path("test/c_abi/cfuncs.c"), .flags = &.{"-std=c99"}, }); for (c_abi_target.c_defines) |define| test_step.defineCMacro(define, null);