| author | |
| committer | |
| log | 10ff81c26457ff02b7a7ed580aaf773297ad8025 |
| tree | 1b303c864ace3e76ac716ab7ed23ddbddc3521f9 |
| parent | 3bafc4400a40b497b3b3f8113f72c4b80969f13f |
| parent | 499a202a13c2a61f3cb2535c1bd63a9b6b30bfb7 |
| signature |
std.Build.LazyPath: upgrade API usages of source-relative path68 files changed, 173 insertions(+), 203 deletions(-)
build.zig+13-13| ... | ... | @@ -34,7 +34,7 @@ pub fn build(b: *std.Build) !void { |
| 34 | 34 | |
| 35 | 35 | const docgen_exe = b.addExecutable(.{ |
| 36 | 36 | .name = "docgen", |
| 37 | .root_source_file = .{ .path = "tools/docgen.zig" }, | |
| 37 | .root_source_file = b.path("tools/docgen.zig"), | |
| 38 | 38 | .target = b.host, |
| 39 | 39 | .optimize = .Debug, |
| 40 | 40 | .single_threaded = single_threaded, |
| ... | ... | @@ -46,7 +46,7 @@ pub fn build(b: *std.Build) !void { |
| 46 | 46 | docgen_cmd.addArg("--zig-lib-dir"); |
| 47 | 47 | docgen_cmd.addDirectoryArg(p); |
| 48 | 48 | } |
| 49 | docgen_cmd.addFileArg(.{ .path = "doc/langref.html.in" }); | |
| 49 | docgen_cmd.addFileArg(b.path("doc/langref.html.in")); | |
| 50 | 50 | const langref_file = docgen_cmd.addOutputFileArg("langref.html"); |
| 51 | 51 | const install_langref = b.addInstallFileWithDir(langref_file, .prefix, "doc/langref.html"); |
| 52 | 52 | if (!skip_install_langref) { |
| ... | ... | @@ -55,9 +55,9 @@ pub fn build(b: *std.Build) !void { |
| 55 | 55 | |
| 56 | 56 | const autodoc_test = b.addObject(.{ |
| 57 | 57 | .name = "std", |
| 58 | .root_source_file = .{ .path = "lib/std/std.zig" }, | |
| 58 | .root_source_file = b.path("lib/std/std.zig"), | |
| 59 | 59 | .target = target, |
| 60 | .zig_lib_dir = .{ .path = "lib" }, | |
| 60 | .zig_lib_dir = b.path("lib"), | |
| 61 | 61 | .optimize = .Debug, |
| 62 | 62 | }); |
| 63 | 63 | const install_std_docs = b.addInstallDirectory(.{ |
| ... | ... | @@ -86,7 +86,7 @@ pub fn build(b: *std.Build) !void { |
| 86 | 86 | |
| 87 | 87 | const check_case_exe = b.addExecutable(.{ |
| 88 | 88 | .name = "check-case", |
| 89 | .root_source_file = .{ .path = "test/src/Cases.zig" }, | |
| 89 | .root_source_file = b.path("test/src/Cases.zig"), | |
| 90 | 90 | .target = b.host, |
| 91 | 91 | .optimize = optimize, |
| 92 | 92 | .single_threaded = single_threaded, |
| ... | ... | @@ -135,7 +135,7 @@ pub fn build(b: *std.Build) !void { |
| 135 | 135 | |
| 136 | 136 | if (!skip_install_lib_files) { |
| 137 | 137 | b.installDirectory(.{ |
| 138 | .source_dir = .{ .path = "lib" }, | |
| 138 | .source_dir = b.path("lib"), | |
| 139 | 139 | .install_dir = if (flat) .prefix else .lib, |
| 140 | 140 | .install_subdir = if (flat) "lib" else "zig", |
| 141 | 141 | .exclude_extensions = &[_][]const u8{ |
| ... | ... | @@ -552,10 +552,10 @@ pub fn build(b: *std.Build) !void { |
| 552 | 552 | const update_mingw_exe = b.addExecutable(.{ |
| 553 | 553 | .name = "update_mingw", |
| 554 | 554 | .target = b.host, |
| 555 | .root_source_file = .{ .path = "tools/update_mingw.zig" }, | |
| 555 | .root_source_file = b.path("tools/update_mingw.zig"), | |
| 556 | 556 | }); |
| 557 | 557 | const update_mingw_run = b.addRunArtifact(update_mingw_exe); |
| 558 | update_mingw_run.addDirectoryArg(.{ .path = "lib" }); | |
| 558 | update_mingw_run.addDirectoryArg(b.path("lib")); | |
| 559 | 559 | if (opt_mingw_src_path) |mingw_src_path| { |
| 560 | 560 | update_mingw_run.addDirectoryArg(.{ .cwd_relative = mingw_src_path }); |
| 561 | 561 | } else { |
| ... | ... | @@ -606,10 +606,10 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void { |
| 606 | 606 | }); |
| 607 | 607 | run_opt.addArtifactArg(exe); |
| 608 | 608 | run_opt.addArg("-o"); |
| 609 | run_opt.addFileArg(.{ .path = "stage1/zig1.wasm" }); | |
| 609 | run_opt.addFileArg(b.path("stage1/zig1.wasm")); | |
| 610 | 610 | |
| 611 | 611 | const copy_zig_h = b.addWriteFiles(); |
| 612 | copy_zig_h.addCopyFileToSource(.{ .path = "lib/zig.h" }, "stage1/zig.h"); | |
| 612 | copy_zig_h.addCopyFileToSource(b.path("lib/zig.h"), "stage1/zig.h"); | |
| 613 | 613 | |
| 614 | 614 | const update_zig1_step = b.step("update-zig1", "Update stage1/zig1.wasm"); |
| 615 | 615 | update_zig1_step.dependOn(&run_opt.step); |
| ... | ... | @@ -627,7 +627,7 @@ const AddCompilerStepOptions = struct { |
| 627 | 627 | fn addCompilerStep(b: *std.Build, options: AddCompilerStepOptions) *std.Build.Step.Compile { |
| 628 | 628 | const exe = b.addExecutable(.{ |
| 629 | 629 | .name = "zig", |
| 630 | .root_source_file = .{ .path = "src/main.zig" }, | |
| 630 | .root_source_file = b.path("src/main.zig"), | |
| 631 | 631 | .target = options.target, |
| 632 | 632 | .optimize = options.optimize, |
| 633 | 633 | .max_rss = 7_000_000_000, |
| ... | ... | @@ -638,11 +638,11 @@ fn addCompilerStep(b: *std.Build, options: AddCompilerStepOptions) *std.Build.St |
| 638 | 638 | exe.stack_size = stack_size; |
| 639 | 639 | |
| 640 | 640 | const aro_module = b.createModule(.{ |
| 641 | .root_source_file = .{ .path = "lib/compiler/aro/aro.zig" }, | |
| 641 | .root_source_file = b.path("lib/compiler/aro/aro.zig"), | |
| 642 | 642 | }); |
| 643 | 643 | |
| 644 | 644 | const aro_translate_c_module = b.createModule(.{ |
| 645 | .root_source_file = .{ .path = "lib/compiler/aro_translate_c.zig" }, | |
| 645 | .root_source_file = b.path("lib/compiler/aro_translate_c.zig"), | |
| 646 | 646 | .imports = &.{ |
| 647 | 647 | .{ |
| 648 | 648 | .name = "aro", |
lib/std/Build.zig+18-11| ... | ... | @@ -1546,22 +1546,22 @@ pub fn addInstallArtifact( |
| 1546 | 1546 | } |
| 1547 | 1547 | |
| 1548 | 1548 | ///`dest_rel_path` is relative to prefix path |
| 1549 | pub fn installFile(self: *Build, src_path: []const u8, dest_rel_path: []const u8) void { | |
| 1550 | self.getInstallStep().dependOn(&self.addInstallFileWithDir(.{ .path = src_path }, .prefix, dest_rel_path).step); | |
| 1549 | pub fn installFile(b: *Build, src_path: []const u8, dest_rel_path: []const u8) void { | |
| 1550 | b.getInstallStep().dependOn(&b.addInstallFileWithDir(b.path(src_path), .prefix, dest_rel_path).step); | |
| 1551 | 1551 | } |
| 1552 | 1552 | |
| 1553 | pub fn installDirectory(self: *Build, options: Step.InstallDir.Options) void { | |
| 1554 | self.getInstallStep().dependOn(&self.addInstallDirectory(options).step); | |
| 1553 | pub fn installDirectory(b: *Build, options: Step.InstallDir.Options) void { | |
| 1554 | b.getInstallStep().dependOn(&b.addInstallDirectory(options).step); | |
| 1555 | 1555 | } |
| 1556 | 1556 | |
| 1557 | 1557 | ///`dest_rel_path` is relative to bin path |
| 1558 | pub fn installBinFile(self: *Build, src_path: []const u8, dest_rel_path: []const u8) void { | |
| 1559 | self.getInstallStep().dependOn(&self.addInstallFileWithDir(.{ .path = src_path }, .bin, dest_rel_path).step); | |
| 1558 | pub fn installBinFile(b: *Build, src_path: []const u8, dest_rel_path: []const u8) void { | |
| 1559 | b.getInstallStep().dependOn(&b.addInstallFileWithDir(b.path(src_path), .bin, dest_rel_path).step); | |
| 1560 | 1560 | } |
| 1561 | 1561 | |
| 1562 | 1562 | ///`dest_rel_path` is relative to lib path |
| 1563 | pub fn installLibFile(self: *Build, src_path: []const u8, dest_rel_path: []const u8) void { | |
| 1564 | self.getInstallStep().dependOn(&self.addInstallFileWithDir(.{ .path = src_path }, .lib, dest_rel_path).step); | |
| 1563 | pub fn installLibFile(b: *Build, src_path: []const u8, dest_rel_path: []const u8) void { | |
| 1564 | b.getInstallStep().dependOn(&b.addInstallFileWithDir(b.path(src_path), .lib, dest_rel_path).step); | |
| 1565 | 1565 | } |
| 1566 | 1566 | |
| 1567 | 1567 | 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 { |
| 1637 | 1637 | |
| 1638 | 1638 | /// References a file or directory relative to the source root. |
| 1639 | 1639 | pub fn path(b: *Build, sub_path: []const u8) LazyPath { |
| 1640 | assert(!fs.path.isAbsolute(sub_path)); | |
| 1640 | if (fs.path.isAbsolute(sub_path)) { | |
| 1641 | 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", .{ | |
| 1642 | sub_path, | |
| 1643 | }); | |
| 1644 | } | |
| 1641 | 1645 | return .{ .src_path = .{ |
| 1642 | 1646 | .owner = b, |
| 1643 | 1647 | .sub_path = sub_path, |
| ... | ... | @@ -2315,12 +2319,15 @@ pub const LazyPath = union(enum) { |
| 2315 | 2319 | } |
| 2316 | 2320 | } |
| 2317 | 2321 | |
| 2318 | /// Duplicates the file source for a given builder. | |
| 2322 | /// Copies the internal strings. | |
| 2323 | /// | |
| 2324 | /// The `b` parameter is only used for its allocator. All *Build instances | |
| 2325 | /// share the same allocator. | |
| 2319 | 2326 | pub fn dupe(self: LazyPath, b: *Build) LazyPath { |
| 2320 | 2327 | return switch (self) { |
| 2321 | 2328 | .src_path => |sp| .{ .src_path = .{ |
| 2322 | 2329 | .owner = sp.owner, |
| 2323 | .sub_path = b.dupePath(sp.sub_path), | |
| 2330 | .sub_path = sp.owner.dupePath(sp.sub_path), | |
| 2324 | 2331 | } }, |
| 2325 | 2332 | .path => |p| .{ .path = b.dupePath(p) }, |
| 2326 | 2333 | .cwd_relative => |p| .{ .cwd_relative = b.dupePath(p) }, |
lib/std/Build/Module.zig+2-13| ... | ... | @@ -451,7 +451,7 @@ pub fn linkFramework(m: *Module, name: []const u8, options: LinkFrameworkOptions |
| 451 | 451 | pub const AddCSourceFilesOptions = struct { |
| 452 | 452 | /// When provided, `files` are relative to `root` rather than the |
| 453 | 453 | /// package that owns the `Compile` step. |
| 454 | root: LazyPath = .{ .path = "" }, | |
| 454 | root: ?LazyPath = null, | |
| 455 | 455 | files: []const []const u8, |
| 456 | 456 | flags: []const []const u8 = &.{}, |
| 457 | 457 | }; |
| ... | ... | @@ -472,7 +472,7 @@ pub fn addCSourceFiles(m: *Module, options: AddCSourceFilesOptions) void { |
| 472 | 472 | |
| 473 | 473 | const c_source_files = allocator.create(CSourceFiles) catch @panic("OOM"); |
| 474 | 474 | c_source_files.* = .{ |
| 475 | .root = options.root, | |
| 475 | .root = options.root orelse b.path(""), | |
| 476 | 476 | .files = b.dupeStrings(options.files), |
| 477 | 477 | .flags = b.dupeStrings(options.flags), |
| 478 | 478 | }; |
| ... | ... | @@ -573,17 +573,6 @@ pub fn addLibraryPath(m: *Module, directory_path: LazyPath) void { |
| 573 | 573 | |
| 574 | 574 | pub fn addRPath(m: *Module, directory_path: LazyPath) void { |
| 575 | 575 | const b = m.owner; |
| 576 | switch (directory_path) { | |
| 577 | .path, .cwd_relative => |path| { | |
| 578 | // TODO: remove this check after people upgrade and stop expecting it to work | |
| 579 | if (std.mem.startsWith(u8, path, "@executable_path") or | |
| 580 | std.mem.startsWith(u8, path, "@loader_path")) | |
| 581 | { | |
| 582 | @panic("this function is for adding directory paths. It does not support special rpaths. use addRPathSpecial for that."); | |
| 583 | } | |
| 584 | }, | |
| 585 | else => {}, | |
| 586 | } | |
| 587 | 576 | m.rpaths.append(b.allocator, .{ .lazy_path = directory_path.dupe(b) }) catch @panic("OOM"); |
| 588 | 577 | addLazyPathDependenciesOnly(m, directory_path); |
| 589 | 578 | } |
lib/std/Build/Step/Compile.zig+2-26| ... | ... | @@ -264,20 +264,8 @@ pub const HeaderInstallation = union(enum) { |
| 264 | 264 | dest_rel_path: []const u8, |
| 265 | 265 | |
| 266 | 266 | pub fn dupe(self: File, b: *std.Build) File { |
| 267 | // 'path' lazy paths are relative to the build root of some step, inferred from the step | |
| 268 | // in which they are used. This means that we can't dupe such paths, because they may | |
| 269 | // come from dependencies with their own build roots and duping the paths as is might | |
| 270 | // cause the build script to search for the file relative to the wrong root. | |
| 271 | // As a temporary workaround, we convert build root-relative paths to absolute paths. | |
| 272 | // If/when the build-root relative paths are updated to encode which build root they are | |
| 273 | // relative to, this workaround should be removed. | |
| 274 | const duped_source: LazyPath = switch (self.source) { | |
| 275 | .path => |root_rel| .{ .cwd_relative = b.pathFromRoot(root_rel) }, | |
| 276 | else => self.source.dupe(b), | |
| 277 | }; | |
| 278 | ||
| 279 | 267 | return .{ |
| 280 | .source = duped_source, | |
| 268 | .source = self.source.dupe(b), | |
| 281 | 269 | .dest_rel_path = b.dupePath(self.dest_rel_path), |
| 282 | 270 | }; |
| 283 | 271 | } |
| ... | ... | @@ -305,20 +293,8 @@ pub const HeaderInstallation = union(enum) { |
| 305 | 293 | }; |
| 306 | 294 | |
| 307 | 295 | pub fn dupe(self: Directory, b: *std.Build) Directory { |
| 308 | // 'path' lazy paths are relative to the build root of some step, inferred from the step | |
| 309 | // in which they are used. This means that we can't dupe such paths, because they may | |
| 310 | // come from dependencies with their own build roots and duping the paths as is might | |
| 311 | // cause the build script to search for the file relative to the wrong root. | |
| 312 | // As a temporary workaround, we convert build root-relative paths to absolute paths. | |
| 313 | // If/when the build-root relative paths are updated to encode which build root they are | |
| 314 | // relative to, this workaround should be removed. | |
| 315 | const duped_source: LazyPath = switch (self.source) { | |
| 316 | .path => |root_rel| .{ .cwd_relative = b.pathFromRoot(root_rel) }, | |
| 317 | else => self.source.dupe(b), | |
| 318 | }; | |
| 319 | ||
| 320 | 296 | return .{ |
| 321 | .source = duped_source, | |
| 297 | .source = self.source.dupe(b), | |
| 322 | 298 | .dest_rel_path = b.dupePath(self.dest_rel_path), |
| 323 | 299 | .options = self.options.dupe(b), |
| 324 | 300 | }; |
test/link/bss/build.zig+1-1| ... | ... | @@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void { |
| 6 | 6 | |
| 7 | 7 | const exe = b.addExecutable(.{ |
| 8 | 8 | .name = "bss", |
| 9 | .root_source_file = .{ .path = "main.zig" }, | |
| 9 | .root_source_file = b.path("main.zig"), | |
| 10 | 10 | .target = b.host, |
| 11 | 11 | .optimize = .Debug, |
| 12 | 12 | }); |
test/link/common_symbols/build.zig+1-1| ... | ... | @@ -22,7 +22,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 22 | 22 | }); |
| 23 | 23 | |
| 24 | 24 | const test_exe = b.addTest(.{ |
| 25 | .root_source_file = .{ .path = "main.zig" }, | |
| 25 | .root_source_file = b.path("main.zig"), | |
| 26 | 26 | .optimize = optimize, |
| 27 | 27 | }); |
| 28 | 28 | test_exe.linkLibrary(lib_a); |
test/link/common_symbols_alignment/build.zig+1-1| ... | ... | @@ -22,7 +22,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 22 | 22 | }); |
| 23 | 23 | |
| 24 | 24 | const test_exe = b.addTest(.{ |
| 25 | .root_source_file = .{ .path = "main.zig" }, | |
| 25 | .root_source_file = b.path("main.zig"), | |
| 26 | 26 | .optimize = optimize, |
| 27 | 27 | }); |
| 28 | 28 | test_exe.linkLibrary(lib_a); |
test/link/glibc_compat/build.zig+2-2| ... | ... | @@ -21,7 +21,7 @@ pub fn build(b: *std.Build) void { |
| 21 | 21 | .{ .arch_os_abi = t }, |
| 22 | 22 | ) catch unreachable), |
| 23 | 23 | }); |
| 24 | exe.addCSourceFile(.{ .file = .{ .path = "main.c" } }); | |
| 24 | exe.addCSourceFile(.{ .file = b.path("main.c") }); | |
| 25 | 25 | exe.linkLibC(); |
| 26 | 26 | // TODO: actually test the output |
| 27 | 27 | _ = exe.getEmittedBin(); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn build(b: *std.Build) void { |
| 45 | 45 | |
| 46 | 46 | const exe = b.addExecutable(.{ |
| 47 | 47 | .name = t, |
| 48 | .root_source_file = .{ .path = "glibc_runtime_check.zig" }, | |
| 48 | .root_source_file = b.path("glibc_runtime_check.zig"), | |
| 49 | 49 | .target = target, |
| 50 | 50 | }); |
| 51 | 51 | exe.linkLibC(); |
test/link/interdependent_static_c_libs/build.zig+6-6| ... | ... | @@ -16,24 +16,24 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 16 | 16 | .optimize = optimize, |
| 17 | 17 | .target = b.host, |
| 18 | 18 | }); |
| 19 | lib_a.addCSourceFile(.{ .file = .{ .path = "a.c" }, .flags = &[_][]const u8{} }); | |
| 20 | lib_a.addIncludePath(.{ .path = "." }); | |
| 19 | lib_a.addCSourceFile(.{ .file = b.path("a.c"), .flags = &[_][]const u8{} }); | |
| 20 | lib_a.addIncludePath(b.path(".")); | |
| 21 | 21 | |
| 22 | 22 | const lib_b = b.addStaticLibrary(.{ |
| 23 | 23 | .name = "b", |
| 24 | 24 | .optimize = optimize, |
| 25 | 25 | .target = b.host, |
| 26 | 26 | }); |
| 27 | lib_b.addCSourceFile(.{ .file = .{ .path = "b.c" }, .flags = &[_][]const u8{} }); | |
| 28 | lib_b.addIncludePath(.{ .path = "." }); | |
| 27 | lib_b.addCSourceFile(.{ .file = b.path("b.c"), .flags = &[_][]const u8{} }); | |
| 28 | lib_b.addIncludePath(b.path(".")); | |
| 29 | 29 | |
| 30 | 30 | const test_exe = b.addTest(.{ |
| 31 | .root_source_file = .{ .path = "main.zig" }, | |
| 31 | .root_source_file = b.path("main.zig"), | |
| 32 | 32 | .optimize = optimize, |
| 33 | 33 | }); |
| 34 | 34 | test_exe.linkLibrary(lib_a); |
| 35 | 35 | test_exe.linkLibrary(lib_b); |
| 36 | test_exe.addIncludePath(.{ .path = "." }); | |
| 36 | test_exe.addIncludePath(b.path(".")); | |
| 37 | 37 | |
| 38 | 38 | test_step.dependOn(&b.addRunArtifact(test_exe).step); |
| 39 | 39 | } |
test/link/macho.zig+3-3| ... | ... | @@ -836,9 +836,9 @@ fn testLinkDirectlyCppTbd(b: *Build, opts: Options) *Step { |
| 836 | 836 | , |
| 837 | 837 | .cpp_source_flags = &.{ "-nostdlib++", "-nostdinc++" }, |
| 838 | 838 | }); |
| 839 | exe.root_module.addSystemIncludePath(.{ .path = b.pathJoin(&.{ sdk, "/usr/include" }) }); | |
| 840 | exe.root_module.addIncludePath(.{ .path = b.pathJoin(&.{ sdk, "/usr/include/c++/v1" }) }); | |
| 841 | exe.root_module.addObjectFile(.{ .path = b.pathJoin(&.{ sdk, "/usr/lib/libc++.tbd" }) }); | |
| 839 | exe.root_module.addSystemIncludePath(b.path(b.pathJoin(&.{ sdk, "/usr/include" }))); | |
| 840 | exe.root_module.addIncludePath(b.path(b.pathJoin(&.{ sdk, "/usr/include/c++/v1" }))); | |
| 841 | exe.root_module.addObjectFile(b.path(b.pathJoin(&.{ sdk, "/usr/lib/libc++.tbd" }))); | |
| 842 | 842 | |
| 843 | 843 | const check = exe.checkObject(); |
| 844 | 844 | check.checkInSymtab(); |
test/link/static_libs_from_object_files/build.zig+3-3| ... | ... | @@ -57,7 +57,7 @@ fn add(b: *Build, test_step: *Step, files: []const LazyPath, optimize: std.built |
| 57 | 57 | { |
| 58 | 58 | const exe = b.addExecutable(.{ |
| 59 | 59 | .name = "test1", |
| 60 | .root_source_file = .{ .path = "main.zig" }, | |
| 60 | .root_source_file = b.path("main.zig"), | |
| 61 | 61 | .optimize = optimize, |
| 62 | 62 | .target = b.host, |
| 63 | 63 | }); |
| ... | ... | @@ -93,7 +93,7 @@ fn add(b: *Build, test_step: *Step, files: []const LazyPath, optimize: std.built |
| 93 | 93 | |
| 94 | 94 | const exe = b.addExecutable(.{ |
| 95 | 95 | .name = "test2", |
| 96 | .root_source_file = .{ .path = "main.zig" }, | |
| 96 | .root_source_file = b.path("main.zig"), | |
| 97 | 97 | .target = b.host, |
| 98 | 98 | .optimize = optimize, |
| 99 | 99 | }); |
| ... | ... | @@ -134,7 +134,7 @@ fn add(b: *Build, test_step: *Step, files: []const LazyPath, optimize: std.built |
| 134 | 134 | |
| 135 | 135 | const exe = b.addExecutable(.{ |
| 136 | 136 | .name = "test3", |
| 137 | .root_source_file = .{ .path = "main.zig" }, | |
| 137 | .root_source_file = b.path("main.zig"), | |
| 138 | 138 | .target = b.host, |
| 139 | 139 | .optimize = optimize, |
| 140 | 140 | }); |
test/link/wasm/archive/build.zig+1-1| ... | ... | @@ -17,7 +17,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 17 | 17 | // and therefore link with its archive file. |
| 18 | 18 | const lib = b.addExecutable(.{ |
| 19 | 19 | .name = "main", |
| 20 | .root_source_file = .{ .path = "main.zig" }, | |
| 20 | .root_source_file = b.path("main.zig"), | |
| 21 | 21 | .optimize = optimize, |
| 22 | 22 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 23 | 23 | .strip = false, |
test/link/wasm/basic-features/build.zig+1-1| ... | ... | @@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void { |
| 6 | 6 | // Library with explicitly set cpu features |
| 7 | 7 | const lib = b.addExecutable(.{ |
| 8 | 8 | .name = "lib", |
| 9 | .root_source_file = .{ .path = "main.zig" }, | |
| 9 | .root_source_file = b.path("main.zig"), | |
| 10 | 10 | .optimize = .Debug, |
| 11 | 11 | .target = b.resolveTargetQuery(.{ |
| 12 | 12 | .cpu_arch = .wasm32, |
test/link/wasm/bss/build.zig+2-2| ... | ... | @@ -16,7 +16,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt |
| 16 | 16 | { |
| 17 | 17 | const lib = b.addExecutable(.{ |
| 18 | 18 | .name = "lib", |
| 19 | .root_source_file = .{ .path = "lib.zig" }, | |
| 19 | .root_source_file = b.path("lib.zig"), | |
| 20 | 20 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 21 | 21 | .optimize = optimize_mode, |
| 22 | 22 | .strip = false, |
| ... | ... | @@ -64,7 +64,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.Opt |
| 64 | 64 | { |
| 65 | 65 | const lib = b.addExecutable(.{ |
| 66 | 66 | .name = "lib", |
| 67 | .root_source_file = .{ .path = "lib2.zig" }, | |
| 67 | .root_source_file = b.path("lib2.zig"), | |
| 68 | 68 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 69 | 69 | .optimize = optimize_mode, |
| 70 | 70 | .strip = false, |
test/link/wasm/export-data/build.zig+1-1| ... | ... | @@ -11,7 +11,7 @@ pub fn build(b: *std.Build) void { |
| 11 | 11 | |
| 12 | 12 | const lib = b.addExecutable(.{ |
| 13 | 13 | .name = "lib", |
| 14 | .root_source_file = .{ .path = "lib.zig" }, | |
| 14 | .root_source_file = b.path("lib.zig"), | |
| 15 | 15 | .optimize = .ReleaseSafe, // to make the output deterministic in address positions |
| 16 | 16 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 17 | 17 | }); |
test/link/wasm/export/build.zig+3-3| ... | ... | @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { |
| 15 | 15 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { |
| 16 | 16 | const no_export = b.addExecutable(.{ |
| 17 | 17 | .name = "no-export", |
| 18 | .root_source_file = .{ .path = "main.zig" }, | |
| 18 | .root_source_file = b.path("main.zig"), | |
| 19 | 19 | .optimize = optimize, |
| 20 | 20 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 21 | 21 | }); |
| ... | ... | @@ -25,7 +25,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 25 | 25 | |
| 26 | 26 | const dynamic_export = b.addExecutable(.{ |
| 27 | 27 | .name = "dynamic", |
| 28 | .root_source_file = .{ .path = "main.zig" }, | |
| 28 | .root_source_file = b.path("main.zig"), | |
| 29 | 29 | .optimize = optimize, |
| 30 | 30 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 31 | 31 | }); |
| ... | ... | @@ -36,7 +36,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 36 | 36 | |
| 37 | 37 | const force_export = b.addExecutable(.{ |
| 38 | 38 | .name = "force", |
| 39 | .root_source_file = .{ .path = "main.zig" }, | |
| 39 | .root_source_file = b.path("main.zig"), | |
| 40 | 40 | .optimize = optimize, |
| 41 | 41 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 42 | 42 | }); |
test/link/wasm/extern-mangle/build.zig+1-1| ... | ... | @@ -13,7 +13,7 @@ pub fn build(b: *std.Build) void { |
| 13 | 13 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { |
| 14 | 14 | const lib = b.addExecutable(.{ |
| 15 | 15 | .name = "lib", |
| 16 | .root_source_file = .{ .path = "lib.zig" }, | |
| 16 | .root_source_file = b.path("lib.zig"), | |
| 17 | 17 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 18 | 18 | .optimize = optimize, |
| 19 | 19 | }); |
test/link/wasm/extern/build.zig+2-2| ... | ... | @@ -15,11 +15,11 @@ pub fn build(b: *std.Build) void { |
| 15 | 15 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { |
| 16 | 16 | const exe = b.addExecutable(.{ |
| 17 | 17 | .name = "extern", |
| 18 | .root_source_file = .{ .path = "main.zig" }, | |
| 18 | .root_source_file = b.path("main.zig"), | |
| 19 | 19 | .optimize = optimize, |
| 20 | 20 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .wasi }), |
| 21 | 21 | }); |
| 22 | exe.addCSourceFile(.{ .file = .{ .path = "foo.c" }, .flags = &.{} }); | |
| 22 | exe.addCSourceFile(.{ .file = b.path("foo.c"), .flags = &.{} }); | |
| 23 | 23 | exe.use_llvm = false; |
| 24 | 24 | exe.use_lld = false; |
| 25 | 25 |
test/link/wasm/function-table/build.zig+3-3| ... | ... | @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { |
| 15 | 15 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { |
| 16 | 16 | const import_table = b.addExecutable(.{ |
| 17 | 17 | .name = "import_table", |
| 18 | .root_source_file = .{ .path = "lib.zig" }, | |
| 18 | .root_source_file = b.path("lib.zig"), | |
| 19 | 19 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 20 | 20 | .optimize = optimize, |
| 21 | 21 | }); |
| ... | ... | @@ -27,7 +27,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 27 | 27 | |
| 28 | 28 | const export_table = b.addExecutable(.{ |
| 29 | 29 | .name = "export_table", |
| 30 | .root_source_file = .{ .path = "lib.zig" }, | |
| 30 | .root_source_file = b.path("lib.zig"), | |
| 31 | 31 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 32 | 32 | .optimize = optimize, |
| 33 | 33 | }); |
| ... | ... | @@ -39,7 +39,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize |
| 39 | 39 | |
| 40 | 40 | const regular_table = b.addExecutable(.{ |
| 41 | 41 | .name = "regular_table", |
| 42 | .root_source_file = .{ .path = "lib.zig" }, | |
| 42 | .root_source_file = b.path("lib.zig"), | |
| 43 | 43 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 44 | 44 | .optimize = optimize, |
| 45 | 45 | }); |
test/link/wasm/infer-features/build.zig+2-2| ... | ... | @@ -13,13 +13,13 @@ pub fn build(b: *std.Build) void { |
| 13 | 13 | .os_tag = .freestanding, |
| 14 | 14 | }), |
| 15 | 15 | }); |
| 16 | c_obj.addCSourceFile(.{ .file = .{ .path = "foo.c" }, .flags = &.{} }); | |
| 16 | c_obj.addCSourceFile(.{ .file = b.path("foo.c"), .flags = &.{} }); | |
| 17 | 17 | |
| 18 | 18 | // Wasm library that doesn't have any features specified. This will |
| 19 | 19 | // infer its featureset from other linked object files. |
| 20 | 20 | const lib = b.addExecutable(.{ |
| 21 | 21 | .name = "lib", |
| 22 | .root_source_file = .{ .path = "main.zig" }, | |
| 22 | .root_source_file = b.path("main.zig"), | |
| 23 | 23 | .optimize = .Debug, |
| 24 | 24 | .target = b.resolveTargetQuery(.{ |
| 25 | 25 | .cpu_arch = .wasm32, |
test/link/wasm/producers/build.zig+1-1| ... | ... | @@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void { |
| 16 | 16 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { |
| 17 | 17 | const lib = b.addExecutable(.{ |
| 18 | 18 | .name = "lib", |
| 19 | .root_source_file = .{ .path = "lib.zig" }, | |
| 19 | .root_source_file = b.path("lib.zig"), | |
| 20 | 20 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 21 | 21 | .optimize = optimize, |
| 22 | 22 | .strip = false, |
test/link/wasm/segments/build.zig+1-1| ... | ... | @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { |
| 15 | 15 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { |
| 16 | 16 | const lib = b.addExecutable(.{ |
| 17 | 17 | .name = "lib", |
| 18 | .root_source_file = .{ .path = "lib.zig" }, | |
| 18 | .root_source_file = b.path("lib.zig"), | |
| 19 | 19 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 20 | 20 | .optimize = optimize, |
| 21 | 21 | .strip = false, |
test/link/wasm/shared-memory/build.zig+1-1| ... | ... | @@ -13,7 +13,7 @@ pub fn build(b: *std.Build) void { |
| 13 | 13 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize_mode: std.builtin.OptimizeMode) void { |
| 14 | 14 | const exe = b.addExecutable(.{ |
| 15 | 15 | .name = "lib", |
| 16 | .root_source_file = .{ .path = "lib.zig" }, | |
| 16 | .root_source_file = b.path("lib.zig"), | |
| 17 | 17 | .target = b.resolveTargetQuery(.{ |
| 18 | 18 | .cpu_arch = .wasm32, |
| 19 | 19 | .cpu_model = .{ .explicit = &std.Target.wasm.cpu.mvp }, |
test/link/wasm/stack_pointer/build.zig+1-1| ... | ... | @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { |
| 15 | 15 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { |
| 16 | 16 | const lib = b.addExecutable(.{ |
| 17 | 17 | .name = "lib", |
| 18 | .root_source_file = .{ .path = "lib.zig" }, | |
| 18 | .root_source_file = b.path("lib.zig"), | |
| 19 | 19 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 20 | 20 | .optimize = optimize, |
| 21 | 21 | .strip = false, |
test/link/wasm/type/build.zig+1-1| ... | ... | @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { |
| 15 | 15 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { |
| 16 | 16 | const exe = b.addExecutable(.{ |
| 17 | 17 | .name = "lib", |
| 18 | .root_source_file = .{ .path = "lib.zig" }, | |
| 18 | .root_source_file = b.path("lib.zig"), | |
| 19 | 19 | .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }), |
| 20 | 20 | .optimize = optimize, |
| 21 | 21 | .strip = false, |
test/standalone/build.zig+1-1| ... | ... | @@ -44,7 +44,7 @@ pub fn build(b: *std.Build) void { |
| 44 | 44 | }) |tool_src_path| { |
| 45 | 45 | const tool = b.addTest(.{ |
| 46 | 46 | .name = std.fs.path.stem(tool_src_path), |
| 47 | .root_source_file = .{ .path = tool_src_path }, | |
| 47 | .root_source_file = b.path(tool_src_path), | |
| 48 | 48 | .optimize = .Debug, |
| 49 | 49 | .target = tools_target, |
| 50 | 50 | }); |
test/standalone/c_compiler/build.zig+2-2| ... | ... | @@ -30,7 +30,7 @@ fn add( |
| 30 | 30 | .optimize = optimize, |
| 31 | 31 | .target = target, |
| 32 | 32 | }); |
| 33 | exe_c.addCSourceFile(.{ .file = .{ .path = "test.c" }, .flags = &[0][]const u8{} }); | |
| 33 | exe_c.addCSourceFile(.{ .file = b.path("test.c"), .flags = &[0][]const u8{} }); | |
| 34 | 34 | exe_c.linkLibC(); |
| 35 | 35 | |
| 36 | 36 | const exe_cpp = b.addExecutable(.{ |
| ... | ... | @@ -39,7 +39,7 @@ fn add( |
| 39 | 39 | .target = target, |
| 40 | 40 | }); |
| 41 | 41 | b.default_step.dependOn(&exe_cpp.step); |
| 42 | exe_cpp.addCSourceFile(.{ .file = .{ .path = "test.cpp" }, .flags = &[0][]const u8{} }); | |
| 42 | exe_cpp.addCSourceFile(.{ .file = b.path("test.cpp"), .flags = &[0][]const u8{} }); | |
| 43 | 43 | exe_cpp.linkLibCpp(); |
| 44 | 44 | |
| 45 | 45 | switch (target.result.os.tag) { |
test/standalone/child_process/build.zig+2-2| ... | ... | @@ -12,14 +12,14 @@ pub fn build(b: *std.Build) void { |
| 12 | 12 | |
| 13 | 13 | const child = b.addExecutable(.{ |
| 14 | 14 | .name = "child", |
| 15 | .root_source_file = .{ .path = "child.zig" }, | |
| 15 | .root_source_file = b.path("child.zig"), | |
| 16 | 16 | .optimize = optimize, |
| 17 | 17 | .target = target, |
| 18 | 18 | }); |
| 19 | 19 | |
| 20 | 20 | const main = b.addExecutable(.{ |
| 21 | 21 | .name = "main", |
| 22 | .root_source_file = .{ .path = "main.zig" }, | |
| 22 | .root_source_file = b.path("main.zig"), | |
| 23 | 23 | .optimize = optimize, |
| 24 | 24 | .target = target, |
| 25 | 25 | }); |
test/standalone/cmakedefine/build.zig+5-5| ... | ... | @@ -4,7 +4,7 @@ const ConfigHeader = std.Build.Step.ConfigHeader; |
| 4 | 4 | pub fn build(b: *std.Build) void { |
| 5 | 5 | const config_header = b.addConfigHeader( |
| 6 | 6 | .{ |
| 7 | .style = .{ .cmake = .{ .path = "config.h.in" } }, | |
| 7 | .style = .{ .cmake = b.path("config.h.in") }, | |
| 8 | 8 | .include_path = "config.h", |
| 9 | 9 | }, |
| 10 | 10 | .{ |
| ... | ... | @@ -28,7 +28,7 @@ pub fn build(b: *std.Build) void { |
| 28 | 28 | |
| 29 | 29 | const pwd_sh = b.addConfigHeader( |
| 30 | 30 | .{ |
| 31 | .style = .{ .cmake = .{ .path = "pwd.sh.in" } }, | |
| 31 | .style = .{ .cmake = b.path("pwd.sh.in") }, | |
| 32 | 32 | .include_path = "pwd.sh", |
| 33 | 33 | }, |
| 34 | 34 | .{ .DIR = "${PWD}" }, |
| ... | ... | @@ -36,7 +36,7 @@ pub fn build(b: *std.Build) void { |
| 36 | 36 | |
| 37 | 37 | const sigil_header = b.addConfigHeader( |
| 38 | 38 | .{ |
| 39 | .style = .{ .cmake = .{ .path = "sigil.h.in" } }, | |
| 39 | .style = .{ .cmake = b.path("sigil.h.in") }, | |
| 40 | 40 | .include_path = "sigil.h", |
| 41 | 41 | }, |
| 42 | 42 | .{}, |
| ... | ... | @@ -44,7 +44,7 @@ pub fn build(b: *std.Build) void { |
| 44 | 44 | |
| 45 | 45 | const stack_header = b.addConfigHeader( |
| 46 | 46 | .{ |
| 47 | .style = .{ .cmake = .{ .path = "stack.h.in" } }, | |
| 47 | .style = .{ .cmake = b.path("stack.h.in") }, | |
| 48 | 48 | .include_path = "stack.h", |
| 49 | 49 | }, |
| 50 | 50 | .{ |
| ... | ... | @@ -57,7 +57,7 @@ pub fn build(b: *std.Build) void { |
| 57 | 57 | |
| 58 | 58 | const wrapper_header = b.addConfigHeader( |
| 59 | 59 | .{ |
| 60 | .style = .{ .cmake = .{ .path = "wrapper.h.in" } }, | |
| 60 | .style = .{ .cmake = b.path("wrapper.h.in") }, | |
| 61 | 61 | .include_path = "wrapper.h", |
| 62 | 62 | }, |
| 63 | 63 | .{ |
test/standalone/compiler_rt_panic/build.zig+1-1| ... | ... | @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void { |
| 17 | 17 | }); |
| 18 | 18 | exe.linkLibC(); |
| 19 | 19 | exe.addCSourceFile(.{ |
| 20 | .file = .{ .path = "main.c" }, | |
| 20 | .file = b.path("main.c"), | |
| 21 | 21 | .flags = &.{}, |
| 22 | 22 | }); |
| 23 | 23 | exe.link_gc_sections = false; |
test/standalone/dep_diamond/build.zig+4-4| ... | ... | @@ -7,21 +7,21 @@ pub fn build(b: *std.Build) void { |
| 7 | 7 | const optimize: std.builtin.OptimizeMode = .Debug; |
| 8 | 8 | |
| 9 | 9 | const shared = b.createModule(.{ |
| 10 | .root_source_file = .{ .path = "shared.zig" }, | |
| 10 | .root_source_file = b.path("shared.zig"), | |
| 11 | 11 | }); |
| 12 | 12 | |
| 13 | 13 | const exe = b.addExecutable(.{ |
| 14 | 14 | .name = "test", |
| 15 | .root_source_file = .{ .path = "test.zig" }, | |
| 15 | .root_source_file = b.path("test.zig"), | |
| 16 | 16 | .target = b.host, |
| 17 | 17 | .optimize = optimize, |
| 18 | 18 | }); |
| 19 | 19 | exe.root_module.addAnonymousImport("foo", .{ |
| 20 | .root_source_file = .{ .path = "foo.zig" }, | |
| 20 | .root_source_file = b.path("foo.zig"), | |
| 21 | 21 | .imports = &.{.{ .name = "shared", .module = shared }}, |
| 22 | 22 | }); |
| 23 | 23 | exe.root_module.addAnonymousImport("bar", .{ |
| 24 | .root_source_file = .{ .path = "bar.zig" }, | |
| 24 | .root_source_file = b.path("bar.zig"), | |
| 25 | 25 | .imports = &.{.{ .name = "shared", .module = shared }}, |
| 26 | 26 | }); |
| 27 | 27 |
test/standalone/dep_mutually_recursive/build.zig+3-3| ... | ... | @@ -7,17 +7,17 @@ pub fn build(b: *std.Build) void { |
| 7 | 7 | const optimize: std.builtin.OptimizeMode = .Debug; |
| 8 | 8 | |
| 9 | 9 | const foo = b.createModule(.{ |
| 10 | .root_source_file = .{ .path = "foo.zig" }, | |
| 10 | .root_source_file = b.path("foo.zig"), | |
| 11 | 11 | }); |
| 12 | 12 | const bar = b.createModule(.{ |
| 13 | .root_source_file = .{ .path = "bar.zig" }, | |
| 13 | .root_source_file = b.path("bar.zig"), | |
| 14 | 14 | }); |
| 15 | 15 | foo.addImport("bar", bar); |
| 16 | 16 | bar.addImport("foo", foo); |
| 17 | 17 | |
| 18 | 18 | const exe = b.addExecutable(.{ |
| 19 | 19 | .name = "test", |
| 20 | .root_source_file = .{ .path = "test.zig" }, | |
| 20 | .root_source_file = b.path("test.zig"), | |
| 21 | 21 | .target = b.host, |
| 22 | 22 | .optimize = optimize, |
| 23 | 23 | }); |
test/standalone/dep_recursive/build.zig+2-2| ... | ... | @@ -7,13 +7,13 @@ pub fn build(b: *std.Build) void { |
| 7 | 7 | const optimize: std.builtin.OptimizeMode = .Debug; |
| 8 | 8 | |
| 9 | 9 | const foo = b.createModule(.{ |
| 10 | .root_source_file = .{ .path = "foo.zig" }, | |
| 10 | .root_source_file = b.path("foo.zig"), | |
| 11 | 11 | }); |
| 12 | 12 | foo.addImport("foo", foo); |
| 13 | 13 | |
| 14 | 14 | const exe = b.addExecutable(.{ |
| 15 | 15 | .name = "test", |
| 16 | .root_source_file = .{ .path = "test.zig" }, | |
| 16 | .root_source_file = b.path("test.zig"), | |
| 17 | 17 | .target = b.host, |
| 18 | 18 | .optimize = optimize, |
| 19 | 19 | }); |
test/standalone/dep_shared_builtin/build.zig+2-2| ... | ... | @@ -8,12 +8,12 @@ pub fn build(b: *std.Build) void { |
| 8 | 8 | |
| 9 | 9 | const exe = b.addExecutable(.{ |
| 10 | 10 | .name = "test", |
| 11 | .root_source_file = .{ .path = "test.zig" }, | |
| 11 | .root_source_file = b.path("test.zig"), | |
| 12 | 12 | .target = b.host, |
| 13 | 13 | .optimize = optimize, |
| 14 | 14 | }); |
| 15 | 15 | exe.root_module.addAnonymousImport("foo", .{ |
| 16 | .root_source_file = .{ .path = "foo.zig" }, | |
| 16 | .root_source_file = b.path("foo.zig"), | |
| 17 | 17 | }); |
| 18 | 18 | |
| 19 | 19 | const run = b.addRunArtifact(exe); |
test/standalone/dep_triangle/build.zig+3-3| ... | ... | @@ -7,17 +7,17 @@ pub fn build(b: *std.Build) void { |
| 7 | 7 | const optimize: std.builtin.OptimizeMode = .Debug; |
| 8 | 8 | |
| 9 | 9 | const shared = b.createModule(.{ |
| 10 | .root_source_file = .{ .path = "shared.zig" }, | |
| 10 | .root_source_file = b.path("shared.zig"), | |
| 11 | 11 | }); |
| 12 | 12 | |
| 13 | 13 | const exe = b.addExecutable(.{ |
| 14 | 14 | .name = "test", |
| 15 | .root_source_file = .{ .path = "test.zig" }, | |
| 15 | .root_source_file = b.path("test.zig"), | |
| 16 | 16 | .target = b.host, |
| 17 | 17 | .optimize = optimize, |
| 18 | 18 | }); |
| 19 | 19 | exe.root_module.addAnonymousImport("foo", .{ |
| 20 | .root_source_file = .{ .path = "foo.zig" }, | |
| 20 | .root_source_file = b.path("foo.zig"), | |
| 21 | 21 | .imports = &.{.{ .name = "shared", .module = shared }}, |
| 22 | 22 | }); |
| 23 | 23 | exe.root_module.addImport("shared", shared); |
test/standalone/depend_on_main_mod/build.zig+2-2| ... | ... | @@ -9,13 +9,13 @@ pub fn build(b: *std.Build) void { |
| 9 | 9 | |
| 10 | 10 | const exe = b.addExecutable(.{ |
| 11 | 11 | .name = "depend_on_main_mod", |
| 12 | .root_source_file = .{ .path = "src/main.zig" }, | |
| 12 | .root_source_file = b.path("src/main.zig"), | |
| 13 | 13 | .target = target, |
| 14 | 14 | .optimize = optimize, |
| 15 | 15 | }); |
| 16 | 16 | |
| 17 | 17 | const foo_module = b.addModule("foo", .{ |
| 18 | .root_source_file = .{ .path = "src/foo.zig" }, | |
| 18 | .root_source_file = b.path("src/foo.zig"), | |
| 19 | 19 | }); |
| 20 | 20 | |
| 21 | 21 | foo_module.addImport("root2", &exe.root_module); |
test/standalone/dirname/build.zig+3-5| ... | ... | @@ -6,9 +6,7 @@ pub fn build(b: *std.Build) void { |
| 6 | 6 | const test_step = b.step("test", "Test it"); |
| 7 | 7 | b.default_step = test_step; |
| 8 | 8 | |
| 9 | const touch_src = std.Build.LazyPath{ | |
| 10 | .path = "touch.zig", | |
| 11 | }; | |
| 9 | const touch_src = b.path("touch.zig"); | |
| 12 | 10 | |
| 13 | 11 | const touch = b.addExecutable(.{ |
| 14 | 12 | .name = "touch", |
| ... | ... | @@ -20,14 +18,14 @@ pub fn build(b: *std.Build) void { |
| 20 | 18 | |
| 21 | 19 | const exists_in = b.addExecutable(.{ |
| 22 | 20 | .name = "exists_in", |
| 23 | .root_source_file = .{ .path = "exists_in.zig" }, | |
| 21 | .root_source_file = b.path("exists_in.zig"), | |
| 24 | 22 | .optimize = .Debug, |
| 25 | 23 | .target = target, |
| 26 | 24 | }); |
| 27 | 25 | |
| 28 | 26 | const has_basename = b.addExecutable(.{ |
| 29 | 27 | .name = "has_basename", |
| 30 | .root_source_file = .{ .path = "has_basename.zig" }, | |
| 28 | .root_source_file = b.path("has_basename.zig"), | |
| 31 | 29 | .optimize = .Debug, |
| 32 | 30 | .target = target, |
| 33 | 31 | }); |
test/standalone/embed_generated_file/build.zig+2-2| ... | ... | @@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void { |
| 6 | 6 | |
| 7 | 7 | const bootloader = b.addExecutable(.{ |
| 8 | 8 | .name = "bootloader", |
| 9 | .root_source_file = .{ .path = "bootloader.zig" }, | |
| 9 | .root_source_file = b.path("bootloader.zig"), | |
| 10 | 10 | .target = b.resolveTargetQuery(.{ |
| 11 | 11 | .cpu_arch = .x86, |
| 12 | 12 | .os_tag = .freestanding, |
| ... | ... | @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { |
| 15 | 15 | }); |
| 16 | 16 | |
| 17 | 17 | const exe = b.addTest(.{ |
| 18 | .root_source_file = .{ .path = "main.zig" }, | |
| 18 | .root_source_file = b.path("main.zig"), | |
| 19 | 19 | .optimize = .Debug, |
| 20 | 20 | }); |
| 21 | 21 | exe.root_module.addAnonymousImport("bootloader.elf", .{ |
test/standalone/empty_env/build.zig+1-1| ... | ... | @@ -14,7 +14,7 @@ pub fn build(b: *std.Build) void { |
| 14 | 14 | |
| 15 | 15 | const main = b.addExecutable(.{ |
| 16 | 16 | .name = "main", |
| 17 | .root_source_file = .{ .path = "main.zig" }, | |
| 17 | .root_source_file = b.path("main.zig"), | |
| 18 | 18 | .target = b.host, |
| 19 | 19 | .optimize = optimize, |
| 20 | 20 | }); |
test/standalone/extern/build.zig+2-2| ... | ... | @@ -5,12 +5,12 @@ pub fn build(b: *std.Build) void { |
| 5 | 5 | |
| 6 | 6 | const obj = b.addObject(.{ |
| 7 | 7 | .name = "exports", |
| 8 | .root_source_file = .{ .path = "exports.zig" }, | |
| 8 | .root_source_file = b.path("exports.zig"), | |
| 9 | 9 | .target = b.host, |
| 10 | 10 | .optimize = optimize, |
| 11 | 11 | }); |
| 12 | 12 | const main = b.addTest(.{ |
| 13 | .root_source_file = .{ .path = "main.zig" }, | |
| 13 | .root_source_file = b.path("main.zig"), | |
| 14 | 14 | .optimize = optimize, |
| 15 | 15 | }); |
| 16 | 16 | main.addObject(obj); |
test/standalone/global_linkage/build.zig+3-3| ... | ... | @@ -9,20 +9,20 @@ pub fn build(b: *std.Build) void { |
| 9 | 9 | |
| 10 | 10 | const obj1 = b.addStaticLibrary(.{ |
| 11 | 11 | .name = "obj1", |
| 12 | .root_source_file = .{ .path = "obj1.zig" }, | |
| 12 | .root_source_file = b.path("obj1.zig"), | |
| 13 | 13 | .optimize = optimize, |
| 14 | 14 | .target = target, |
| 15 | 15 | }); |
| 16 | 16 | |
| 17 | 17 | const obj2 = b.addStaticLibrary(.{ |
| 18 | 18 | .name = "obj2", |
| 19 | .root_source_file = .{ .path = "obj2.zig" }, | |
| 19 | .root_source_file = b.path("obj2.zig"), | |
| 20 | 20 | .optimize = optimize, |
| 21 | 21 | .target = target, |
| 22 | 22 | }); |
| 23 | 23 | |
| 24 | 24 | const main = b.addTest(.{ |
| 25 | .root_source_file = .{ .path = "main.zig" }, | |
| 25 | .root_source_file = b.path("main.zig"), | |
| 26 | 26 | .optimize = optimize, |
| 27 | 27 | }); |
| 28 | 28 | main.linkLibrary(obj1); |
test/standalone/install_headers/build.zig+2-2| ... | ... | @@ -32,7 +32,7 @@ pub fn build(b: *std.Build) void { |
| 32 | 32 | \\} |
| 33 | 33 | ) }); |
| 34 | 34 | |
| 35 | libfoo.installHeadersDirectory(.{ .path = "include" }, "foo", .{ .exclude_extensions = &.{".ignore_me.h"} }); | |
| 35 | libfoo.installHeadersDirectory(b.path("include"), "foo", .{ .exclude_extensions = &.{".ignore_me.h"} }); | |
| 36 | 36 | libfoo.installHeader(b.addWriteFiles().add("d.h", |
| 37 | 37 | \\#define FOO_D "D" |
| 38 | 38 | \\ |
| ... | ... | @@ -78,7 +78,7 @@ pub fn build(b: *std.Build) void { |
| 78 | 78 | }); |
| 79 | 79 | const check_exists = b.addExecutable(.{ |
| 80 | 80 | .name = "check_exists", |
| 81 | .root_source_file = .{ .path = "check_exists.zig" }, | |
| 81 | .root_source_file = b.path("check_exists.zig"), | |
| 82 | 82 | .target = b.resolveTargetQuery(.{}), |
| 83 | 83 | .optimize = .Debug, |
| 84 | 84 | }); |
test/standalone/install_raw_hex/build.zig+1-1| ... | ... | @@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void { |
| 16 | 16 | |
| 17 | 17 | const elf = b.addExecutable(.{ |
| 18 | 18 | .name = "zig-nrf52-blink.elf", |
| 19 | .root_source_file = .{ .path = "main.zig" }, | |
| 19 | .root_source_file = b.path("main.zig"), | |
| 20 | 20 | .target = target, |
| 21 | 21 | .optimize = optimize, |
| 22 | 22 | }); |
test/standalone/ios/build.zig+4-4| ... | ... | @@ -21,10 +21,10 @@ pub fn build(b: *std.Build) void { |
| 21 | 21 | .optimize = optimize, |
| 22 | 22 | .target = target, |
| 23 | 23 | }); |
| 24 | exe.addCSourceFile(.{ .file = .{ .path = "main.m" }, .flags = &.{} }); | |
| 25 | exe.addSystemIncludePath(.{ .path = b.pathJoin(&.{ sdk, "/usr/include" }) }); | |
| 26 | exe.addSystemFrameworkPath(.{ .path = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) }); | |
| 27 | exe.addLibraryPath(.{ .path = b.pathJoin(&.{ sdk, "/usr/lib" }) }); | |
| 24 | exe.addCSourceFile(.{ .file = b.path("main.m"), .flags = &.{} }); | |
| 25 | exe.addSystemIncludePath(b.path(b.pathJoin(&.{ sdk, "/usr/include" }))); | |
| 26 | exe.addSystemFrameworkPath(b.path(b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }))); | |
| 27 | exe.addLibraryPath(b.path(b.pathJoin(&.{ sdk, "/usr/lib" }))); | |
| 28 | 28 | exe.linkFramework("Foundation"); |
| 29 | 29 | exe.linkFramework("UIKit"); |
| 30 | 30 | exe.linkLibC(); |
test/standalone/issue_11595/build.zig+1-1| ... | ... | @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { |
| 15 | 15 | |
| 16 | 16 | const exe = b.addExecutable(.{ |
| 17 | 17 | .name = "zigtest", |
| 18 | .root_source_file = .{ .path = "main.zig" }, | |
| 18 | .root_source_file = b.path("main.zig"), | |
| 19 | 19 | .target = target, |
| 20 | 20 | .optimize = optimize, |
| 21 | 21 | }); |
test/standalone/issue_12706/build.zig+1-1| ... | ... | @@ -10,7 +10,7 @@ pub fn build(b: *std.Build) void { |
| 10 | 10 | |
| 11 | 11 | const exe = b.addExecutable(.{ |
| 12 | 12 | .name = "main", |
| 13 | .root_source_file = .{ .path = "main.zig" }, | |
| 13 | .root_source_file = b.path("main.zig"), | |
| 14 | 14 | .optimize = optimize, |
| 15 | 15 | .target = target, |
| 16 | 16 | }); |
test/standalone/issue_339/build.zig+1-1| ... | ... | @@ -9,7 +9,7 @@ pub fn build(b: *std.Build) void { |
| 9 | 9 | |
| 10 | 10 | const obj = b.addObject(.{ |
| 11 | 11 | .name = "test", |
| 12 | .root_source_file = .{ .path = "test.zig" }, | |
| 12 | .root_source_file = b.path("test.zig"), | |
| 13 | 13 | .target = target, |
| 14 | 14 | .optimize = optimize, |
| 15 | 15 | }); |
test/standalone/issue_794/build.zig+2-2| ... | ... | @@ -5,9 +5,9 @@ pub fn build(b: *std.Build) void { |
| 5 | 5 | b.default_step = test_step; |
| 6 | 6 | |
| 7 | 7 | const test_artifact = b.addTest(.{ |
| 8 | .root_source_file = .{ .path = "main.zig" }, | |
| 8 | .root_source_file = b.path("main.zig"), | |
| 9 | 9 | }); |
| 10 | test_artifact.addIncludePath(.{ .path = "a_directory" }); | |
| 10 | test_artifact.addIncludePath(b.path("a_directory")); | |
| 11 | 11 | |
| 12 | 12 | // TODO: actually check the output |
| 13 | 13 | _ = test_artifact.getEmittedBin(); |
test/standalone/issue_8550/build.zig+3-3| ... | ... | @@ -15,12 +15,12 @@ pub fn build(b: *std.Build) !void { |
| 15 | 15 | |
| 16 | 16 | const kernel = b.addExecutable(.{ |
| 17 | 17 | .name = "kernel", |
| 18 | .root_source_file = .{ .path = "./main.zig" }, | |
| 18 | .root_source_file = b.path("./main.zig"), | |
| 19 | 19 | .optimize = optimize, |
| 20 | 20 | .target = target, |
| 21 | 21 | }); |
| 22 | kernel.addObjectFile(.{ .path = "./boot.S" }); | |
| 23 | kernel.setLinkerScript(.{ .path = "./linker.ld" }); | |
| 22 | kernel.addObjectFile(b.path("./boot.S")); | |
| 23 | kernel.setLinkerScript(b.path("./linker.ld")); | |
| 24 | 24 | b.installArtifact(kernel); |
| 25 | 25 | |
| 26 | 26 | test_step.dependOn(&kernel.step); |
test/standalone/load_dynamic_library/build.zig+2-2| ... | ... | @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void { |
| 17 | 17 | |
| 18 | 18 | const lib = b.addSharedLibrary(.{ |
| 19 | 19 | .name = "add", |
| 20 | .root_source_file = .{ .path = "add.zig" }, | |
| 20 | .root_source_file = b.path("add.zig"), | |
| 21 | 21 | .version = .{ .major = 1, .minor = 0, .patch = 0 }, |
| 22 | 22 | .optimize = optimize, |
| 23 | 23 | .target = target, |
| ... | ... | @@ -25,7 +25,7 @@ pub fn build(b: *std.Build) void { |
| 25 | 25 | |
| 26 | 26 | const main = b.addExecutable(.{ |
| 27 | 27 | .name = "main", |
| 28 | .root_source_file = .{ .path = "main.zig" }, | |
| 28 | .root_source_file = b.path("main.zig"), | |
| 29 | 29 | .optimize = optimize, |
| 30 | 30 | .target = target, |
| 31 | 31 | }); |
test/standalone/mix_c_files/build.zig+2-2| ... | ... | @@ -18,11 +18,11 @@ pub fn build(b: *std.Build) void { |
| 18 | 18 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { |
| 19 | 19 | const exe = b.addExecutable(.{ |
| 20 | 20 | .name = "test", |
| 21 | .root_source_file = .{ .path = "main.zig" }, | |
| 21 | .root_source_file = b.path("main.zig"), | |
| 22 | 22 | .target = b.host, |
| 23 | 23 | .optimize = optimize, |
| 24 | 24 | }); |
| 25 | exe.addCSourceFile(.{ .file = .{ .path = "test.c" }, .flags = &[_][]const u8{"-std=c11"} }); | |
| 25 | exe.addCSourceFile(.{ .file = b.path("test.c"), .flags = &[_][]const u8{"-std=c11"} }); | |
| 26 | 26 | exe.linkLibC(); |
| 27 | 27 | |
| 28 | 28 | const run_cmd = b.addRunArtifact(exe); |
test/standalone/mix_o_files/build.zig+2-2| ... | ... | @@ -9,7 +9,7 @@ pub fn build(b: *std.Build) void { |
| 9 | 9 | |
| 10 | 10 | const obj = b.addObject(.{ |
| 11 | 11 | .name = "base64", |
| 12 | .root_source_file = .{ .path = "base64.zig" }, | |
| 12 | .root_source_file = b.path("base64.zig"), | |
| 13 | 13 | .optimize = optimize, |
| 14 | 14 | .target = target, |
| 15 | 15 | }); |
| ... | ... | @@ -20,7 +20,7 @@ pub fn build(b: *std.Build) void { |
| 20 | 20 | .target = target, |
| 21 | 21 | }); |
| 22 | 22 | exe.addCSourceFile(.{ |
| 23 | .file = .{ .path = "test.c" }, | |
| 23 | .file = b.path("test.c"), | |
| 24 | 24 | .flags = &[_][]const u8{"-std=c99"}, |
| 25 | 25 | }); |
| 26 | 26 | exe.addObject(obj); |
test/standalone/pie/build.zig+1-1| ... | ... | @@ -11,7 +11,7 @@ pub fn build(b: *std.Build) void { |
| 11 | 11 | }); |
| 12 | 12 | |
| 13 | 13 | const main = b.addTest(.{ |
| 14 | .root_source_file = .{ .path = "main.zig" }, | |
| 14 | .root_source_file = b.path("main.zig"), | |
| 15 | 15 | .optimize = optimize, |
| 16 | 16 | .target = target, |
| 17 | 17 | }); |
test/standalone/pkg_import/build.zig+2-2| ... | ... | @@ -8,11 +8,11 @@ pub fn build(b: *std.Build) void { |
| 8 | 8 | |
| 9 | 9 | const exe = b.addExecutable(.{ |
| 10 | 10 | .name = "test", |
| 11 | .root_source_file = .{ .path = "test.zig" }, | |
| 11 | .root_source_file = b.path("test.zig"), | |
| 12 | 12 | .optimize = optimize, |
| 13 | 13 | .target = b.host, |
| 14 | 14 | }); |
| 15 | exe.root_module.addAnonymousImport("my_pkg", .{ .root_source_file = .{ .path = "pkg.zig" } }); | |
| 15 | exe.root_module.addAnonymousImport("my_pkg", .{ .root_source_file = b.path("pkg.zig") }); | |
| 16 | 16 | |
| 17 | 17 | const run = b.addRunArtifact(exe); |
| 18 | 18 | test_step.dependOn(&run.step); |
test/standalone/self_exe_symlink/build.zig+2-2| ... | ... | @@ -15,14 +15,14 @@ pub fn build(b: *std.Build) void { |
| 15 | 15 | |
| 16 | 16 | const main = b.addExecutable(.{ |
| 17 | 17 | .name = "main", |
| 18 | .root_source_file = .{ .path = "main.zig" }, | |
| 18 | .root_source_file = b.path("main.zig"), | |
| 19 | 19 | .optimize = optimize, |
| 20 | 20 | .target = target, |
| 21 | 21 | }); |
| 22 | 22 | |
| 23 | 23 | const create_symlink_exe = b.addExecutable(.{ |
| 24 | 24 | .name = "create-symlink", |
| 25 | .root_source_file = .{ .path = "create-symlink.zig" }, | |
| 25 | .root_source_file = b.path("create-symlink.zig"), | |
| 26 | 26 | .optimize = optimize, |
| 27 | 27 | .target = target, |
| 28 | 28 | }); |
test/standalone/shared_library/build.zig+2-2| ... | ... | @@ -13,7 +13,7 @@ pub fn build(b: *std.Build) void { |
| 13 | 13 | const target = b.host; |
| 14 | 14 | const lib = b.addSharedLibrary(.{ |
| 15 | 15 | .name = "mathtest", |
| 16 | .root_source_file = .{ .path = "mathtest.zig" }, | |
| 16 | .root_source_file = b.path("mathtest.zig"), | |
| 17 | 17 | .version = .{ .major = 1, .minor = 0, .patch = 0 }, |
| 18 | 18 | .target = target, |
| 19 | 19 | .optimize = optimize, |
| ... | ... | @@ -25,7 +25,7 @@ pub fn build(b: *std.Build) void { |
| 25 | 25 | .optimize = optimize, |
| 26 | 26 | }); |
| 27 | 27 | exe.addCSourceFile(.{ |
| 28 | .file = .{ .path = "test.c" }, | |
| 28 | .file = b.path("test.c"), | |
| 29 | 29 | .flags = &[_][]const u8{"-std=c99"}, |
| 30 | 30 | }); |
| 31 | 31 | exe.linkLibrary(lib); |
test/standalone/simple/build.zig+2-2| ... | ... | @@ -42,7 +42,7 @@ pub fn build(b: *std.Build) void { |
| 42 | 42 | if (case.is_exe) { |
| 43 | 43 | const exe = b.addExecutable(.{ |
| 44 | 44 | .name = std.fs.path.stem(case.src_path), |
| 45 | .root_source_file = .{ .path = case.src_path }, | |
| 45 | .root_source_file = b.path(case.src_path), | |
| 46 | 46 | .optimize = optimize, |
| 47 | 47 | .target = resolved_target, |
| 48 | 48 | }); |
| ... | ... | @@ -56,7 +56,7 @@ pub fn build(b: *std.Build) void { |
| 56 | 56 | if (case.is_test) { |
| 57 | 57 | const exe = b.addTest(.{ |
| 58 | 58 | .name = std.fs.path.stem(case.src_path), |
| 59 | .root_source_file = .{ .path = case.src_path }, | |
| 59 | .root_source_file = b.path(case.src_path), | |
| 60 | 60 | .optimize = optimize, |
| 61 | 61 | .target = resolved_target, |
| 62 | 62 | }); |
test/standalone/stack_iterator/build.zig+4-4| ... | ... | @@ -19,7 +19,7 @@ pub fn build(b: *std.Build) void { |
| 19 | 19 | { |
| 20 | 20 | const exe = b.addExecutable(.{ |
| 21 | 21 | .name = "unwind_fp", |
| 22 | .root_source_file = .{ .path = "unwind.zig" }, | |
| 22 | .root_source_file = b.path("unwind.zig"), | |
| 23 | 23 | .target = target, |
| 24 | 24 | .optimize = optimize, |
| 25 | 25 | .unwind_tables = if (target.result.isDarwin()) true else null, |
| ... | ... | @@ -42,7 +42,7 @@ pub fn build(b: *std.Build) void { |
| 42 | 42 | { |
| 43 | 43 | const exe = b.addExecutable(.{ |
| 44 | 44 | .name = "unwind_nofp", |
| 45 | .root_source_file = .{ .path = "unwind.zig" }, | |
| 45 | .root_source_file = b.path("unwind.zig"), | |
| 46 | 46 | .target = target, |
| 47 | 47 | .optimize = optimize, |
| 48 | 48 | .unwind_tables = true, |
| ... | ... | @@ -74,14 +74,14 @@ pub fn build(b: *std.Build) void { |
| 74 | 74 | c_shared_lib.defineCMacro("LIB_API", "__declspec(dllexport)"); |
| 75 | 75 | |
| 76 | 76 | c_shared_lib.addCSourceFile(.{ |
| 77 | .file = .{ .path = "shared_lib.c" }, | |
| 77 | .file = b.path("shared_lib.c"), | |
| 78 | 78 | .flags = &.{"-fomit-frame-pointer"}, |
| 79 | 79 | }); |
| 80 | 80 | c_shared_lib.linkLibC(); |
| 81 | 81 | |
| 82 | 82 | const exe = b.addExecutable(.{ |
| 83 | 83 | .name = "shared_lib_unwind", |
| 84 | .root_source_file = .{ .path = "shared_lib_unwind.zig" }, | |
| 84 | .root_source_file = b.path("shared_lib_unwind.zig"), | |
| 85 | 85 | .target = target, |
| 86 | 86 | .optimize = optimize, |
| 87 | 87 | .unwind_tables = if (target.result.isDarwin()) true else null, |
test/standalone/static_c_lib/build.zig+4-4| ... | ... | @@ -11,15 +11,15 @@ pub fn build(b: *std.Build) void { |
| 11 | 11 | .optimize = optimize, |
| 12 | 12 | .target = b.host, |
| 13 | 13 | }); |
| 14 | foo.addCSourceFile(.{ .file = .{ .path = "foo.c" }, .flags = &[_][]const u8{} }); | |
| 15 | foo.addIncludePath(.{ .path = "." }); | |
| 14 | foo.addCSourceFile(.{ .file = b.path("foo.c"), .flags = &[_][]const u8{} }); | |
| 15 | foo.addIncludePath(b.path(".")); | |
| 16 | 16 | |
| 17 | 17 | const test_exe = b.addTest(.{ |
| 18 | .root_source_file = .{ .path = "foo.zig" }, | |
| 18 | .root_source_file = b.path("foo.zig"), | |
| 19 | 19 | .optimize = optimize, |
| 20 | 20 | }); |
| 21 | 21 | test_exe.linkLibrary(foo); |
| 22 | test_exe.addIncludePath(.{ .path = "." }); | |
| 22 | test_exe.addIncludePath(b.path(".")); | |
| 23 | 23 | |
| 24 | 24 | test_step.dependOn(&b.addRunArtifact(test_exe).step); |
| 25 | 25 | } |
test/standalone/strip_empty_loop/build.zig+1-1| ... | ... | @@ -9,7 +9,7 @@ pub fn build(b: *std.Build) void { |
| 9 | 9 | |
| 10 | 10 | const main = b.addExecutable(.{ |
| 11 | 11 | .name = "main", |
| 12 | .root_source_file = .{ .path = "main.zig" }, | |
| 12 | .root_source_file = b.path("main.zig"), | |
| 13 | 13 | .optimize = optimize, |
| 14 | 14 | .target = target, |
| 15 | 15 | .strip = true, |
test/standalone/strip_struct_init/build.zig+1-1| ... | ... | @@ -7,7 +7,7 @@ pub fn build(b: *std.Build) void { |
| 7 | 7 | const optimize: std.builtin.OptimizeMode = .Debug; |
| 8 | 8 | |
| 9 | 9 | const main = b.addTest(.{ |
| 10 | .root_source_file = .{ .path = "main.zig" }, | |
| 10 | .root_source_file = b.path("main.zig"), | |
| 11 | 11 | .optimize = optimize, |
| 12 | 12 | .strip = true, |
| 13 | 13 | }); |
test/standalone/test_runner_module_imports/build.zig+3-3| ... | ... | @@ -2,13 +2,13 @@ const std = @import("std"); |
| 2 | 2 | |
| 3 | 3 | pub fn build(b: *std.Build) void { |
| 4 | 4 | const t = b.addTest(.{ |
| 5 | .root_source_file = .{ .path = "src/main.zig" }, | |
| 5 | .root_source_file = b.path("src/main.zig"), | |
| 6 | 6 | .test_runner = b.path("test_runner/main.zig"), |
| 7 | 7 | }); |
| 8 | 8 | |
| 9 | const module1 = b.createModule(.{ .root_source_file = .{ .path = "module1/main.zig" } }); | |
| 9 | const module1 = b.createModule(.{ .root_source_file = b.path("module1/main.zig") }); | |
| 10 | 10 | const module2 = b.createModule(.{ |
| 11 | .root_source_file = .{ .path = "module2/main.zig" }, | |
| 11 | .root_source_file = b.path("module2/main.zig"), | |
| 12 | 12 | .imports = &.{.{ .name = "module1", .module = module1 }}, |
| 13 | 13 | }); |
| 14 | 14 |
test/standalone/test_runner_path/build.zig+1-1| ... | ... | @@ -7,7 +7,7 @@ pub fn build(b: *std.Build) void { |
| 7 | 7 | b.default_step = test_step; |
| 8 | 8 | |
| 9 | 9 | const test_exe = b.addTest(.{ |
| 10 | .root_source_file = .{ .path = "test.zig" }, | |
| 10 | .root_source_file = b.path("test.zig"), | |
| 11 | 11 | }); |
| 12 | 12 | test_exe.test_runner = b.path("test_runner.zig"); |
| 13 | 13 |
test/standalone/use_alias/build.zig+2-2| ... | ... | @@ -7,10 +7,10 @@ pub fn build(b: *std.Build) void { |
| 7 | 7 | const optimize: std.builtin.OptimizeMode = .Debug; |
| 8 | 8 | |
| 9 | 9 | const main = b.addTest(.{ |
| 10 | .root_source_file = .{ .path = "main.zig" }, | |
| 10 | .root_source_file = b.path("main.zig"), | |
| 11 | 11 | .optimize = optimize, |
| 12 | 12 | }); |
| 13 | main.addIncludePath(.{ .path = "." }); | |
| 13 | main.addIncludePath(b.path(".")); | |
| 14 | 14 | |
| 15 | 15 | test_step.dependOn(&b.addRunArtifact(main).step); |
| 16 | 16 | } |
test/standalone/windows_entry_points/build.zig+4-4| ... | ... | @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) void { |
| 17 | 17 | .optimize = .Debug, |
| 18 | 18 | .link_libc = true, |
| 19 | 19 | }); |
| 20 | exe.addCSourceFile(.{ .file = .{ .path = "main.c" } }); | |
| 20 | exe.addCSourceFile(.{ .file = b.path("main.c") }); | |
| 21 | 21 | |
| 22 | 22 | _ = exe.getEmittedBin(); |
| 23 | 23 | test_step.dependOn(&exe.step); |
| ... | ... | @@ -31,7 +31,7 @@ pub fn build(b: *std.Build) void { |
| 31 | 31 | .link_libc = true, |
| 32 | 32 | }); |
| 33 | 33 | exe.mingw_unicode_entry_point = true; |
| 34 | exe.addCSourceFile(.{ .file = .{ .path = "wmain.c" } }); | |
| 34 | exe.addCSourceFile(.{ .file = b.path("wmain.c") }); | |
| 35 | 35 | |
| 36 | 36 | _ = exe.getEmittedBin(); |
| 37 | 37 | test_step.dependOn(&exe.step); |
| ... | ... | @@ -45,7 +45,7 @@ pub fn build(b: *std.Build) void { |
| 45 | 45 | .link_libc = true, |
| 46 | 46 | }); |
| 47 | 47 | // Note: `exe.subsystem = .Windows;` is not necessary |
| 48 | exe.addCSourceFile(.{ .file = .{ .path = "winmain.c" } }); | |
| 48 | exe.addCSourceFile(.{ .file = b.path("winmain.c") }); | |
| 49 | 49 | |
| 50 | 50 | _ = exe.getEmittedBin(); |
| 51 | 51 | test_step.dependOn(&exe.step); |
| ... | ... | @@ -60,7 +60,7 @@ pub fn build(b: *std.Build) void { |
| 60 | 60 | }); |
| 61 | 61 | exe.mingw_unicode_entry_point = true; |
| 62 | 62 | // Note: `exe.subsystem = .Windows;` is not necessary |
| 63 | exe.addCSourceFile(.{ .file = .{ .path = "wwinmain.c" } }); | |
| 63 | exe.addCSourceFile(.{ .file = b.path("wwinmain.c") }); | |
| 64 | 64 | |
| 65 | 65 | _ = exe.getEmittedBin(); |
| 66 | 66 | test_step.dependOn(&exe.step); |
test/standalone/windows_resources/build.zig+2-2| ... | ... | @@ -25,12 +25,12 @@ fn add( |
| 25 | 25 | ) void { |
| 26 | 26 | const exe = b.addExecutable(.{ |
| 27 | 27 | .name = "zig_resource_test", |
| 28 | .root_source_file = .{ .path = "main.zig" }, | |
| 28 | .root_source_file = b.path("main.zig"), | |
| 29 | 29 | .target = target, |
| 30 | 30 | .optimize = .Debug, |
| 31 | 31 | }); |
| 32 | 32 | exe.addWin32ResourceFile(.{ |
| 33 | .file = .{ .path = "res/zig.rc" }, | |
| 33 | .file = b.path("res/zig.rc"), | |
| 34 | 34 | .flags = &.{"/c65001"}, // UTF-8 code page |
| 35 | 35 | }); |
| 36 | 36 | exe.rc_includes = switch (rc_includes) { |
test/standalone/zerolength_check/build.zig+1-1| ... | ... | @@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void { |
| 12 | 12 | |
| 13 | 13 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { |
| 14 | 14 | const unit_tests = b.addTest(.{ |
| 15 | .root_source_file = .{ .path = "src/main.zig" }, | |
| 15 | .root_source_file = b.path("src/main.zig"), | |
| 16 | 16 | .target = b.resolveTargetQuery(.{ |
| 17 | 17 | .os_tag = .wasi, |
| 18 | 18 | .cpu_arch = .wasm32, |
test/tests.zig+9-9| ... | ... | @@ -641,7 +641,7 @@ pub fn addStackTraceTests( |
| 641 | 641 | ) *Step { |
| 642 | 642 | const check_exe = b.addExecutable(.{ |
| 643 | 643 | .name = "check-stack-trace", |
| 644 | .root_source_file = .{ .path = "test/src/check-stack-trace.zig" }, | |
| 644 | .root_source_file = b.path("test/src/check-stack-trace.zig"), | |
| 645 | 645 | .target = b.host, |
| 646 | 646 | .optimize = .Debug, |
| 647 | 647 | }); |
| ... | ... | @@ -879,7 +879,7 @@ pub fn addCliTests(b: *std.Build) *Step { |
| 879 | 879 | run6.step.dependOn(&write6.step); |
| 880 | 880 | |
| 881 | 881 | // TODO change this to an exact match |
| 882 | const check6 = b.addCheckFile(.{ .path = fmt6_path }, .{ | |
| 882 | const check6 = b.addCheckFile(.{ .cwd_relative = fmt6_path }, .{ | |
| 883 | 883 | .expected_matches = &.{ |
| 884 | 884 | "// no reason", |
| 885 | 885 | }, |
| ... | ... | @@ -1037,7 +1037,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 1037 | 1037 | options.max_rss; |
| 1038 | 1038 | |
| 1039 | 1039 | const these_tests = b.addTest(.{ |
| 1040 | .root_source_file = .{ .path = options.root_src }, | |
| 1040 | .root_source_file = b.path(options.root_src), | |
| 1041 | 1041 | .optimize = test_target.optimize_mode, |
| 1042 | 1042 | .target = resolved_target, |
| 1043 | 1043 | .max_rss = max_rss, |
| ... | ... | @@ -1046,7 +1046,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 1046 | 1046 | .single_threaded = test_target.single_threaded, |
| 1047 | 1047 | .use_llvm = test_target.use_llvm, |
| 1048 | 1048 | .use_lld = test_target.use_lld, |
| 1049 | .zig_lib_dir = .{ .path = "lib" }, | |
| 1049 | .zig_lib_dir = b.path("lib"), | |
| 1050 | 1050 | .pic = test_target.pic, |
| 1051 | 1051 | .strip = test_target.strip, |
| 1052 | 1052 | }); |
| ... | ... | @@ -1062,7 +1062,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 1062 | 1062 | const use_lld = if (test_target.use_lld == false) "-no-lld" else ""; |
| 1063 | 1063 | const use_pic = if (test_target.pic == true) "-pic" else ""; |
| 1064 | 1064 | |
| 1065 | for (options.include_paths) |include_path| these_tests.addIncludePath(.{ .path = include_path }); | |
| 1065 | for (options.include_paths) |include_path| these_tests.addIncludePath(b.path(include_path)); | |
| 1066 | 1066 | |
| 1067 | 1067 | const qualified_name = b.fmt("{s}-{s}-{s}-{s}{s}{s}{s}{s}{s}", .{ |
| 1068 | 1068 | options.name, |
| ... | ... | @@ -1084,7 +1084,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 1084 | 1084 | .name = qualified_name, |
| 1085 | 1085 | .link_libc = test_target.link_libc, |
| 1086 | 1086 | .target = b.resolveTargetQuery(altered_query), |
| 1087 | .zig_lib_dir = .{ .path = "lib" }, | |
| 1087 | .zig_lib_dir = b.path("lib"), | |
| 1088 | 1088 | }); |
| 1089 | 1089 | compile_c.addCSourceFile(.{ |
| 1090 | 1090 | .file = these_tests.getEmittedBin(), |
| ... | ... | @@ -1113,7 +1113,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 1113 | 1113 | "-Wno-absolute-value", |
| 1114 | 1114 | }, |
| 1115 | 1115 | }); |
| 1116 | compile_c.addIncludePath(.{ .path = "lib" }); // for zig.h | |
| 1116 | compile_c.addIncludePath(b.path("lib")); // for zig.h | |
| 1117 | 1117 | if (target.os.tag == .windows) { |
| 1118 | 1118 | if (true) { |
| 1119 | 1119 | // 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 |
| 1189 | 1189 | if (c_abi_target.use_lld == false) "-no-lld" else "", |
| 1190 | 1190 | if (c_abi_target.pic == true) "-pic" else "", |
| 1191 | 1191 | }), |
| 1192 | .root_source_file = .{ .path = "test/c_abi/main.zig" }, | |
| 1192 | .root_source_file = b.path("test/c_abi/main.zig"), | |
| 1193 | 1193 | .target = resolved_target, |
| 1194 | 1194 | .optimize = optimize_mode, |
| 1195 | 1195 | .link_libc = true, |
| ... | ... | @@ -1199,7 +1199,7 @@ pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *S |
| 1199 | 1199 | .strip = c_abi_target.strip, |
| 1200 | 1200 | }); |
| 1201 | 1201 | test_step.addCSourceFile(.{ |
| 1202 | .file = .{ .path = "test/c_abi/cfuncs.c" }, | |
| 1202 | .file = b.path("test/c_abi/cfuncs.c"), | |
| 1203 | 1203 | .flags = &.{"-std=c99"}, |
| 1204 | 1204 | }); |
| 1205 | 1205 | for (c_abi_target.c_defines) |define| test_step.defineCMacro(define, null); |