authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-12-16 15:18:07+00:00
committergravatar for bratishkaerik@landless-city.netEric Joldasov <bratishkaerik@landless-city.net> 2024-12-18 01:49:00+05:00
log6d4e2a9171a2616f6a744f8f842fb4042b868fc8
tree30fba794c92bed2f7cd50fe7ff7dd4520538da42
parentb8472db215a892754b7e834ce44b2d7f254ff60d
signaturelock-open Commit is signed but in an unrecognized format.

test-cases: migrate from deprecated std.Build APIs


1 files changed, 16 insertions(+), 19 deletions(-)

test/src/Cases.zig+16-19
......@@ -660,34 +660,37 @@ pub fn lowerToBuildSteps(
660660 file_sources.put(file.path, writefiles.add(file.path, file.src)) catch @panic("OOM");
661661 }
662662
663 const artifact = if (case.is_test) b.addTest(.{
663 const mod = b.createModule(.{
664664 .root_source_file = root_source_file,
665 .name = case.name,
666665 .target = case.target,
667666 .optimize = case.optimize_mode,
667 });
668 if (case.link_libc) mod.link_libc = true;
669 if (case.pic) |pic| mod.pic = pic;
670 for (case.deps.items) |dep| {
671 mod.addAnonymousImport(dep.name, .{
672 .root_source_file = file_sources.get(dep.path).?,
673 });
674 }
675
676 const artifact = if (case.is_test) b.addTest(.{
677 .name = case.name,
678 .root_module = mod,
668679 }) else switch (case.output_mode) {
669680 .Obj => b.addObject(.{
670 .root_source_file = root_source_file,
671681 .name = case.name,
672 .target = case.target,
673 .optimize = case.optimize_mode,
682 .root_module = mod,
674683 }),
675684 .Lib => b.addStaticLibrary(.{
676 .root_source_file = root_source_file,
677685 .name = case.name,
678 .target = case.target,
679 .optimize = case.optimize_mode,
686 .root_module = mod,
680687 }),
681688 .Exe => b.addExecutable(.{
682 .root_source_file = root_source_file,
683689 .name = case.name,
684 .target = case.target,
685 .optimize = case.optimize_mode,
690 .root_module = mod,
686691 }),
687692 };
688693
689 if (case.link_libc) artifact.linkLibC();
690 if (case.pic) |pic| artifact.root_module.pic = pic;
691694 if (case.pie) |pie| artifact.pie = pie;
692695
693696 switch (case.backend) {
......@@ -701,12 +704,6 @@ pub fn lowerToBuildSteps(
701704 },
702705 }
703706
704 for (case.deps.items) |dep| {
705 artifact.root_module.addAnonymousImport(dep.name, .{
706 .root_source_file = file_sources.get(dep.path).?,
707 });
708 }
709
710707 switch (update.case) {
711708 .Compile => {
712709 // Force the binary to be emitted if requested.