Merge pull request #624 from Techatrix/embed-build-runner

embedFile build_runner.zig in executable
This commit is contained in:
Techatrix 2022-09-04 22:54:26 +00:00 committed by GitHub
commit 9e20516599
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) {