embedFile build_runner.zig in executable

This commit is contained in:
Techatrix 2022-09-04 21:44:07 +02:00
parent 48a053b65f
commit 38210d3e91
2 changed files with 5 additions and 2 deletions

View File

@ -111,8 +111,6 @@ pub fn build(b: *std.build.Builder) !void {
exe.setBuildMode(mode);
exe.install();
b.installFile("src/special/build_runner.zig", "bin/build_runner.zig");
const test_step = b.step("test", "Run all the tests");
test_step.dependOn(b.getInstallStep());

View File

@ -206,6 +206,11 @@ pub fn configChanged(config: *Config, allocator: std.mem.Allocator, builtin_crea
var exe_dir_bytes: [std.fs.MAX_PATH_BYTES]u8 = undefined;
const exe_dir_path = try std.fs.selfExeDirPath(&exe_dir_bytes);
config.build_runner_path = try std.fs.path.resolve(allocator, &[_][]const u8{ exe_dir_path, "build_runner.zig" });
const file = try std.fs.createFileAbsolute(config.build_runner_path.?, .{});
defer file.close();
try file.writeAll(@embedFile("special/build_runner.zig"));
}
if (null == config.global_cache_path) {