| author | |
| committer | |
| log | ef92c156b5ce1fade3106fc0d79af36bb4409246 |
| tree | 1331b959b7cbfca6cc222426a56234317a94af97 |
| parent | f925e1379aa53228610df9b7ffc3d87dbcce0dbb |
| parent | cdba1d591aae2f5ac5dcd5ae186f5696f218710c |
| signature |
std.Build.Step.Run: inherit build runner cwd3 files changed, 18 insertions(+), 14 deletions(-)
lib/std/Build/Step/Run.zig-3| ... | @@ -1334,9 +1334,6 @@ fn spawnChildAndCollect( | ... | @@ -1334,9 +1334,6 @@ fn spawnChildAndCollect( |
| 1334 | var child = std.process.Child.init(argv, arena); | 1334 | var child = std.process.Child.init(argv, arena); |
| 1335 | if (run.cwd) |lazy_cwd| { | 1335 | if (run.cwd) |lazy_cwd| { |
| 1336 | child.cwd = lazy_cwd.getPath2(b, &run.step); | 1336 | child.cwd = lazy_cwd.getPath2(b, &run.step); |
| 1337 | } else { | ||
| 1338 | child.cwd = b.build_root.path; | ||
| 1339 | child.cwd_dir = b.build_root.handle; | ||
| 1340 | } | 1337 | } |
| 1341 | child.env_map = run.env_map orelse &b.graph.env_map; | 1338 | child.env_map = run.env_map orelse &b.graph.env_map; |
| 1342 | child.request_resource_usage_statistics = true; | 1339 | child.request_resource_usage_statistics = true; |
test/standalone/options/build.zig+1-1| ... | @@ -8,7 +8,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -8,7 +8,7 @@ pub fn build(b: *std.Build) void { |
| 8 | }) }); | 8 | }) }); |
| 9 | 9 | ||
| 10 | const options = b.addOptions(); | 10 | const options = b.addOptions(); |
| 11 | main.addOptions("build_options", options); | 11 | main.root_module.addOptions("build_options", options); |
| 12 | options.addOption(bool, "bool_true", b.option(bool, "bool_true", "t").?); | 12 | options.addOption(bool, "bool_true", b.option(bool, "bool_true", "t").?); |
| 13 | options.addOption(bool, "bool_false", b.option(bool, "bool_false", "f").?); | 13 | options.addOption(bool, "bool_false", b.option(bool, "bool_false", "f").?); |
| 14 | options.addOption(u32, "int", b.option(u32, "int", "i").?); | 14 | options.addOption(u32, "int", b.option(u32, "int", "i").?); |
test/tests.zig+17-10| ... | @@ -1657,16 +1657,23 @@ pub fn addCliTests(b: *std.Build) *Step { | ... | @@ -1657,16 +1657,23 @@ pub fn addCliTests(b: *std.Build) *Step { |
| 1657 | } | 1657 | } |
| 1658 | 1658 | ||
| 1659 | { | 1659 | { |
| 1660 | // TODO this should move to become a CLI test rather than standalone | 1660 | const run_test = b.addSystemCommand(&.{ |
| 1661 | // cases.addBuildFile("test/standalone/options/build.zig", .{ | 1661 | b.graph.zig_exe, |
| 1662 | // .extra_argv = &.{ | 1662 | "build", |
| 1663 | // "-Dbool_true", | 1663 | "test", |
| 1664 | // "-Dbool_false=false", | 1664 | "-Dbool_true", |
| 1665 | // "-Dint=1234", | 1665 | "-Dbool_false=false", |
| 1666 | // "-De=two", | 1666 | "-Dint=1234", |
| 1667 | // "-Dstring=hello", | 1667 | "-De=two", |
| 1668 | // }, | 1668 | "-Dstring=hello", |
| 1669 | // }); | 1669 | }); |
| 1670 | run_test.addArg("--build-file"); | ||
| 1671 | run_test.addFileArg(b.path("test/standalone/options/build.zig")); | ||
| 1672 | run_test.addArg("--cache-dir"); | ||
| 1673 | run_test.addFileArg(.{ .cwd_relative = b.cache_root.join(b.allocator, &.{}) catch @panic("OOM") }); | ||
| 1674 | run_test.setName("test build options"); | ||
| 1675 | |||
| 1676 | step.dependOn(&run_test.step); | ||
| 1670 | } | 1677 | } |
| 1671 | 1678 | ||
| 1672 | return step; | 1679 | return step; |