aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-03-19 22:27:16 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-03-19 23:03:08 -0700
commit343721627ee65caf504d67c5046b0da94bfeba72 (patch)
tree357c38470cab614f6f5805c7990ab7daed257f72
parent6e0e140f2f4c58b5b0d9e98154df5197359cf92e (diff)
downloadbun-343721627ee65caf504d67c5046b0da94bfeba72.tar.gz
bun-343721627ee65caf504d67c5046b0da94bfeba72.tar.zst
bun-343721627ee65caf504d67c5046b0da94bfeba72.zip
Finish the upgrade
-rw-r--r--build.zig22
1 files changed, 10 insertions, 12 deletions
diff --git a/build.zig b/build.zig
index 512646676..cc9e9fdfe 100644
--- a/build.zig
+++ b/build.zig
@@ -1,5 +1,4 @@
const std = @import("std");
-const Output = @import("src/output.zig");
fn moduleSource(comptime out: []const u8) FileSource {
if (comptime std.fs.path.dirname(@src().file)) |base| {
@@ -224,12 +223,12 @@ pub fn build(b: *Build) !void {
!std.Target.x86.featureSetHas(target.getCpuFeatures(), .avx2));
var git_sha: [:0]const u8 = "";
- if (std.os.getenvZ("GITHUB_SHA") orelse std.os.getenvZ("GIT_SHA")) |sha| {
- git_sha = std.heap.page_allocator.dupeZ(u8, sha) catch unreachable;
+ if (b.env_map.get("GITHUB_SHA") orelse b.env_map.get("GIT_SHA")) |sha| {
+ git_sha = b.allocator.dupeZ(u8, sha) catch unreachable;
} else {
sha: {
const result = std.ChildProcess.exec(.{
- .allocator = std.heap.page_allocator,
+ .allocator = b.allocator,
.argv = &.{
"git",
"rev-parse",
@@ -238,12 +237,9 @@ pub fn build(b: *Build) !void {
},
.cwd = b.pathFromRoot("."),
.expand_arg0 = .expand,
- }) catch {
- std.debug.print("Warning: failed to get git HEAD", .{});
- break :sha;
- };
+ }) catch break :sha;
- git_sha = std.heap.page_allocator.dupeZ(u8, std.mem.trim(u8, result.stdout, "\n \t")) catch unreachable;
+ git_sha = b.allocator.dupeZ(u8, std.mem.trim(u8, result.stdout, "\n \t")) catch unreachable;
}
}
@@ -279,13 +275,14 @@ pub fn build(b: *Build) !void {
obj.target.cpu_model = .{ .explicit = &std.Target.aarch64.cpu.generic };
}
- std.log.info("Build {s} v{} - v{} ({s})", .{
+ // we have to dump to stderr because stdout is read by zls
+ std.io.getStdErr().writer().print("Build {s} v{} - v{} ({s})\n", .{
triplet,
min_version,
max_version,
obj.target.getCpuModel().name,
- });
- std.log.info("Output: {s}/{s}\n", .{ output_dir, bun_executable_name });
+ }) catch unreachable;
+ std.io.getStdErr().writer().print("Output: {s}/{s}\n\n", .{ output_dir, bun_executable_name }) catch unreachable;
defer obj_step.dependOn(&obj.step);
@@ -494,6 +491,7 @@ pub fn build(b: *Build) !void {
}
if (obj.emit_bin != .no_emit)
obj.setOutputDir(output_dir);
+
b.default_step.dependOn(obj_step);
}