Change deprecated b.host to b.graph.host in tests and Zig's build.zig

This commit is contained in:
Krzysztof Wolicki 2024-06-13 14:00:22 +02:00 committed by Andrew Kelley
parent 76fb2b685b
commit 45c77931c2
39 changed files with 69 additions and 69 deletions

View File

@ -72,7 +72,7 @@ pub fn build(b: *std.Build) !void {
const check_case_exe = b.addExecutable(.{
.name = "check-case",
.root_source_file = b.path("test/src/Cases.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
.single_threaded = single_threaded,
});
@ -541,7 +541,7 @@ pub fn build(b: *std.Build) !void {
const opt_mingw_src_path = b.option([]const u8, "mingw-src", "path to mingw-w64 source directory");
const update_mingw_exe = b.addExecutable(.{
.name = "update_mingw",
.target = b.host,
.target = b.graph.host,
.root_source_file = b.path("tools/update_mingw.zig"),
});
const update_mingw_run = b.addRunArtifact(update_mingw_exe);
@ -1259,7 +1259,7 @@ fn generateLangRef(b: *std.Build) std.Build.LazyPath {
const doctest_exe = b.addExecutable(.{
.name = "doctest",
.root_source_file = b.path("tools/doctest.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = .Debug,
});
@ -1297,7 +1297,7 @@ fn generateLangRef(b: *std.Build) std.Build.LazyPath {
const docgen_exe = b.addExecutable(.{
.name = "docgen",
.root_source_file = b.path("tools/docgen.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = .Debug,
});

View File

@ -4,7 +4,7 @@ const Cases = @import("src/Cases.zig");
pub fn addCases(ctx: *Cases, b: *std.Build) !void {
{
const case = ctx.obj("multiline error messages", b.host);
const case = ctx.obj("multiline error messages", b.graph.host);
case.addError(
\\comptime {
@ -39,7 +39,7 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void {
}
{
const case = ctx.obj("isolated carriage return in multiline string literal", b.host);
const case = ctx.obj("isolated carriage return in multiline string literal", b.graph.host);
case.addError("const foo = \\\\\test\r\r rogue carriage return\n;", &[_][]const u8{
":1:19: error: expected ';' after declaration",
@ -48,7 +48,7 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void {
}
{
const case = ctx.obj("missing semicolon at EOF", b.host);
const case = ctx.obj("missing semicolon at EOF", b.graph.host);
case.addError(
\\const foo = 1
, &[_][]const u8{
@ -57,7 +57,7 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void {
}
{
const case = ctx.obj("argument causes error", b.host);
const case = ctx.obj("argument causes error", b.graph.host);
case.addError(
\\pub export fn entry() void {
@ -80,7 +80,7 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void {
}
{
const case = ctx.obj("astgen failure in file struct", b.host);
const case = ctx.obj("astgen failure in file struct", b.graph.host);
case.addError(
\\pub export fn entry() void {
@ -95,7 +95,7 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void {
}
{
const case = ctx.obj("invalid store to comptime field", b.host);
const case = ctx.obj("invalid store to comptime field", b.graph.host);
case.addError(
\\const a = @import("a.zig");
@ -119,7 +119,7 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void {
}
{
const case = ctx.obj("file in multiple modules", b.host);
const case = ctx.obj("file in multiple modules", b.graph.host);
case.addDepModule("foo", "foo.zig");
case.addError(
@ -138,7 +138,7 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void {
}
{
const case = ctx.obj("wrong same named struct", b.host);
const case = ctx.obj("wrong same named struct", b.graph.host);
case.addError(
\\const a = @import("a.zig");
@ -172,7 +172,7 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void {
}
{
const case = ctx.obj("non-printable invalid character", b.host);
const case = ctx.obj("non-printable invalid character", b.graph.host);
case.addError("\xff\xfe" ++
\\export fn foo() bool {
@ -185,7 +185,7 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void {
}
{
const case = ctx.obj("imported generic method call with invalid param", b.host);
const case = ctx.obj("imported generic method call with invalid param", b.graph.host);
case.addError(
\\pub const import = @import("import.zig");

View File

@ -7,7 +7,7 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "bss",
.root_source_file = b.path("main.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = .Debug,
});

View File

@ -14,7 +14,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
const lib_a = b.addStaticLibrary(.{
.name = "a",
.optimize = optimize,
.target = b.host,
.target = b.graph.host,
});
lib_a.addCSourceFiles(.{
.files = &.{ "c.c", "a.c", "b.c" },

View File

@ -14,7 +14,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
const lib_a = b.addStaticLibrary(.{
.name = "a",
.optimize = optimize,
.target = b.host,
.target = b.graph.host,
});
lib_a.addCSourceFiles(.{
.files = &.{"a.c"},

View File

@ -14,7 +14,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
const lib_a = b.addStaticLibrary(.{
.name = "a",
.optimize = optimize,
.target = b.host,
.target = b.graph.host,
});
lib_a.addCSourceFile(.{ .file = b.path("a.c"), .flags = &[_][]const u8{} });
lib_a.addIncludePath(b.path("."));
@ -22,7 +22,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
const lib_b = b.addStaticLibrary(.{
.name = "b",
.optimize = optimize,
.target = b.host,
.target = b.graph.host,
});
lib_b.addCSourceFile(.{ .file = b.path("b.c"), .flags = &[_][]const u8{} });
lib_b.addIncludePath(b.path("."));

View File

@ -83,14 +83,14 @@ pub fn testAll(b: *Build, build_opts: BuildOptions) *Step {
// Tests requiring presence of macOS SDK in system path
if (build_opts.has_macos_sdk) {
macho_step.dependOn(testDeadStripDylibs(b, .{ .target = b.host }));
macho_step.dependOn(testHeaderpad(b, .{ .target = b.host }));
macho_step.dependOn(testLinkDirectlyCppTbd(b, .{ .target = b.host }));
macho_step.dependOn(testMergeLiteralsObjc(b, .{ .target = b.host }));
macho_step.dependOn(testNeededFramework(b, .{ .target = b.host }));
macho_step.dependOn(testObjc(b, .{ .target = b.host }));
macho_step.dependOn(testObjcpp(b, .{ .target = b.host }));
macho_step.dependOn(testWeakFramework(b, .{ .target = b.host }));
macho_step.dependOn(testDeadStripDylibs(b, .{ .target = b.graph.host }));
macho_step.dependOn(testHeaderpad(b, .{ .target = b.graph.host }));
macho_step.dependOn(testLinkDirectlyCppTbd(b, .{ .target = b.graph.host }));
macho_step.dependOn(testMergeLiteralsObjc(b, .{ .target = b.graph.host }));
macho_step.dependOn(testNeededFramework(b, .{ .target = b.graph.host }));
macho_step.dependOn(testObjc(b, .{ .target = b.graph.host }));
macho_step.dependOn(testObjcpp(b, .{ .target = b.graph.host }));
macho_step.dependOn(testWeakFramework(b, .{ .target = b.graph.host }));
}
}

View File

@ -59,7 +59,7 @@ fn add(b: *Build, test_step: *Step, files: []const LazyPath, optimize: std.built
.name = "test1",
.root_source_file = b.path("main.zig"),
.optimize = optimize,
.target = b.host,
.target = b.graph.host,
});
for (files) |file| {
@ -77,12 +77,12 @@ fn add(b: *Build, test_step: *Step, files: []const LazyPath, optimize: std.built
{
const lib_a = b.addStaticLibrary(.{
.name = "test2_a",
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});
const lib_b = b.addStaticLibrary(.{
.name = "test2_b",
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});
@ -94,7 +94,7 @@ fn add(b: *Build, test_step: *Step, files: []const LazyPath, optimize: std.built
const exe = b.addExecutable(.{
.name = "test2",
.root_source_file = b.path("main.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});
exe.linkLibrary(lib_a);
@ -111,19 +111,19 @@ fn add(b: *Build, test_step: *Step, files: []const LazyPath, optimize: std.built
{
const lib_a = b.addStaticLibrary(.{
.name = "test3_a",
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});
const lib_b = b.addStaticLibrary(.{
.name = "test3_b",
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});
for (files, 1..) |file, i| {
const obj = b.addObject(.{
.name = b.fmt("obj_{}", .{i}),
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});
obj.addCSourceFile(.{ .file = file, .flags = &flags });
@ -135,7 +135,7 @@ fn add(b: *Build, test_step: *Step, files: []const LazyPath, optimize: std.built
const exe = b.addExecutable(.{
.name = "test3",
.root_source_file = b.path("main.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});
exe.linkLibrary(lib_a);

View File

@ -96,7 +96,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void {
const exe = b.addExecutable(.{
.name = "test",
.target = b.host,
.target = b.graph.host,
.optimize = .Debug,
});
exe.addAssemblyFile(write_src.files.items[0].getPath());
@ -121,7 +121,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void {
.name = "test",
.root_source_file = write_src.files.items[0].getPath(),
.optimize = optimize,
.target = b.host,
.target = b.graph.host,
});
if (case.link_libc) {
exe.linkSystemLibrary("c");
@ -146,7 +146,7 @@ pub fn addCase(self: *CompareOutput, case: TestCase) void {
const exe = b.addExecutable(.{
.name = "test",
.root_source_file = write_src.files.items[0].getPath(),
.target = b.host,
.target = b.graph.host,
.optimize = .Debug,
});
if (case.link_libc) {

View File

@ -77,7 +77,7 @@ pub fn addCase(self: *RunTranslatedCContext, case: *const TestCase) void {
}
const translate_c = b.addTranslateC(.{
.root_source_file = write_src.files.items[0].getPath(),
.target = b.host,
.target = b.graph.host,
.optimize = .Debug,
});

View File

@ -56,7 +56,7 @@ fn addExpect(
.name = "test",
.root_source_file = write_src.files.items[0].getPath(),
.optimize = optimize_mode,
.target = b.host,
.target = b.graph.host,
.error_tracing = mode_config.error_tracing,
});

View File

@ -23,7 +23,7 @@ fn add(
cpp_name: []const u8,
optimize: std.builtin.OptimizeMode,
) void {
const target = b.host;
const target = b.graph.host;
const exe_c = b.addExecutable(.{
.name = c_name,

View File

@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
b.default_step = test_step;
const optimize: std.builtin.OptimizeMode = .Debug;
const target = b.host;
const target = b.graph.host;
if (builtin.os.tag == .wasi) return;

View File

@ -13,7 +13,7 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "test",
.root_source_file = b.path("test.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});
exe.root_module.addAnonymousImport("foo", .{

View File

@ -18,7 +18,7 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "test",
.root_source_file = b.path("test.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});
exe.root_module.addImport("foo", foo);

View File

@ -14,7 +14,7 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "test",
.root_source_file = b.path("test.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});
exe.root_module.addImport("foo", foo);

View File

@ -9,7 +9,7 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "test",
.root_source_file = b.path("test.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});
exe.root_module.addAnonymousImport("foo", .{

View File

@ -13,7 +13,7 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "test",
.root_source_file = b.path("test.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});
exe.root_module.addAnonymousImport("foo", .{

View File

@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void {
const main = b.addExecutable(.{
.name = "main",
.root_source_file = b.path("main.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});

View File

@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
const obj = b.addObject(.{
.name = "exports",
.root_source_file = b.path("exports.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});
const main = b.addTest(.{

View File

@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
b.default_step = test_step;
const optimize: std.builtin.OptimizeMode = .Debug;
const target = b.host;
const target = b.graph.host;
const obj1 = b.addStaticLibrary(.{
.name = "obj1",

View File

@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
b.default_step = test_step;
const optimize: std.builtin.OptimizeMode = .Debug;
const target = b.host;
const target = b.graph.host;
if (builtin.os.tag == .windows) {
// https://github.com/ziglang/zig/issues/12419

View File

@ -10,7 +10,7 @@ pub fn build(b: *std.Build) void {
.name = "main",
.root_source_file = b.path("main.zig"),
.optimize = optimize,
.target = b.host,
.target = b.graph.host,
});
_ = obj.getEmittedLlvmIr();
_ = obj.getEmittedLlvmBc();

View File

@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
b.default_step = test_step;
const optimize: std.builtin.OptimizeMode = .Debug;
const target = b.host;
const target = b.graph.host;
const exe = b.addExecutable(.{
.name = "main",

View File

@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
b.default_step = test_step;
const optimize: std.builtin.OptimizeMode = .Debug;
const target = b.host;
const target = b.graph.host;
const obj = b.addObject(.{
.name = "test",

View File

@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
b.default_step = test_step;
const optimize: std.builtin.OptimizeMode = .Debug;
const target = b.host;
const target = b.graph.host;
if (builtin.os.tag == .wasi) return;

View File

@ -19,7 +19,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
const exe = b.addExecutable(.{
.name = "test",
.root_source_file = b.path("main.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});
exe.addCSourceFile(.{ .file = b.path("test.c"), .flags = &[_][]const u8{"-std=c11"} });

View File

@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
b.default_step = test_step;
const optimize: std.builtin.OptimizeMode = .Debug;
const target = b.host;
const target = b.graph.host;
const obj = b.addObject(.{
.name = "base64",

View File

@ -3,7 +3,7 @@ const std = @import("std");
pub fn build(b: *std.Build) void {
const main = b.addTest(.{
.root_source_file = b.path("src/main.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = .Debug,
});

View File

@ -10,7 +10,7 @@ pub fn build(b: *std.Build) void {
.name = "test",
.root_source_file = b.path("test.zig"),
.optimize = optimize,
.target = b.host,
.target = b.graph.host,
});
exe.root_module.addAnonymousImport("my_pkg", .{ .root_source_file = b.path("pkg.zig") });

View File

@ -7,7 +7,7 @@ pub fn build(b: *std.Build) void {
b.default_step = test_step;
const optimize: std.builtin.OptimizeMode = .Debug;
const target = b.host;
const target = b.graph.host;
// The test requires getFdPath in order to to get the path of the
// File returned by openSelfExe

View File

@ -10,7 +10,7 @@ pub fn build(b: *std.Build) void {
}
const optimize: std.builtin.OptimizeMode = .Debug;
const target = b.host;
const target = b.graph.host;
const lib = b.addSharedLibrary(.{
.name = "mathtest",
.root_source_file = b.path("mathtest.zig"),

View File

@ -9,7 +9,7 @@ pub fn build(b: *std.Build) void {
const foo = b.addStaticLibrary(.{
.name = "foo",
.optimize = optimize,
.target = b.host,
.target = b.graph.host,
});
foo.addCSourceFile(.{ .file = b.path("foo.c"), .flags = &[_][]const u8{} });
foo.addIncludePath(b.path("."));

View File

@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
b.default_step = test_step;
const optimize = std.builtin.OptimizeMode.Debug;
const target = b.host;
const target = b.graph.host;
const main = b.addExecutable(.{
.name = "main",

View File

@ -35,7 +35,7 @@ pub fn build(b: *std.Build) !void {
const fuzz = b.addExecutable(.{
.name = "fuzz",
.root_source_file = b.path("fuzz.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = optimize,
});

View File

@ -6,7 +6,7 @@ pub fn build(b: *std.Build) !void {
b.default_step = test_step;
const optimize: std.builtin.OptimizeMode = .Debug;
const target = b.host;
const target = b.graph.host;
if (builtin.os.tag != .windows) return;

View File

@ -12,10 +12,10 @@ pub fn build(b: *std.Build) void {
const generated_h_step = b.addWriteFile("generated.h", "#define GENERATED_DEFINE \"foo\"");
add(b, b.host, .any, test_step, generated_h_step);
add(b, b.graph.host, .any, test_step, generated_h_step);
add(b, target, .any, test_step, generated_h_step);
add(b, b.host, .gnu, test_step, generated_h_step);
add(b, b.graph.host, .gnu, test_step, generated_h_step);
add(b, target, .gnu, test_step, generated_h_step);
}

View File

@ -6,7 +6,7 @@ pub fn build(b: *std.Build) void {
b.default_step = test_step;
const optimize: std.builtin.OptimizeMode = .Debug;
const target = b.host;
const target = b.graph.host;
if (builtin.os.tag != .windows) return;

View File

@ -658,7 +658,7 @@ pub fn addStackTraceTests(
const check_exe = b.addExecutable(.{
.name = "check-stack-trace",
.root_source_file = b.path("test/src/check-stack-trace.zig"),
.target = b.host,
.target = b.graph.host,
.optimize = .Debug,
});