Skip to content

Commit

Permalink
Include a build id
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Sep 14, 2021
1 parent bdd5502 commit 4173b03
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ jsc-bindings-headers:
mkdir -p src/JavaScript/jsc/bindings-obj/
zig build headers

bump:
expr $(BUILD_ID) + 1 > build-id

BUILD_ID := $(shell cat ./build-id)

jsc-copy-headers:
find src/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/Headers/JavaScriptCore/ -name "*.h" -exec cp {} src/JavaScript/jsc/WebKit/WebKitBuild/Release/JavaScriptCore/PrivateHeaders/JavaScriptCore \;

Expand Down
1 change: 1 addition & 0 deletions build-id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8
2 changes: 2 additions & 0 deletions src/global.zig
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ pub const Output = struct {
};

pub const Global = struct {
pub const build_id = std.fmt.parseInt(u64, @embedFile("../build-id"), 10) catch unreachable;

pub fn panic(comptime fmt: string, args: anytype) noreturn {
@setCold(true);
if (comptime isWasm) {
Expand Down
10 changes: 7 additions & 3 deletions src/http.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2538,25 +2538,29 @@ pub const Server = struct {
if (std.mem.readIntNative(u32, &addr.ipv4.host.octets) == 0 or std.mem.readIntNative(u128, &addr.ipv6.host.octets) == 0) {
if (server.bundler.options.routes.single_page_app_routing) {
Output.prettyError(
" Bun!!<r>\n\n\n<d> Link:<r> <b><cyan>http://localhost:{d}<r>\n <d>./{s}/index.html<r> \n\n\n",
" Bun!! <d>build {d}<r>\n\n\n<d> Link:<r> <b><cyan>http://localhost:{d}<r>\n <d>./{s}/index.html<r> \n\n\n",
.{
Global.build_id,
addr.ipv4.port,
resolve_path.relative(server.bundler.fs.top_level_dir, server.bundler.options.routes.static_dir),
},
);
} else {
Output.prettyError(" Bun!!<r>\n\n\n<d> Link:<r> <b><cyan>http://localhost:{d}<r>\n\n\n", .{
Output.prettyError(" Bun!! <d>build {d}<r>\n\n\n<d> Link:<r> <b><cyan>http://localhost:{d}<r>\n\n\n", .{
Global.build_id,
addr.ipv4.port,
});
}
} else {
if (server.bundler.options.routes.single_page_app_routing) {
Output.prettyError(" Bun!!<r>\n\n\n<d> Link:<r> <b><cyan>http://{s}<r>\n <d>./{s}/index.html<r> \n\n\n", .{
Global.build_id,
addr,
resolve_path.relative(server.bundler.fs.top_level_dir, server.bundler.options.routes.static_dir),
});
} else {
Output.prettyError(" Bun!!<r>\n\n\n<d> Link:<r> <b><cyan>http://{s}<r>\n\n\n", .{
Output.prettyError(" Bun!! <d>build {d}\n\n\n<d> Link:<r> <b><cyan>http://{s}<r>\n\n\n", .{
Global.build_id,
addr,
});
}
Expand Down

0 comments on commit 4173b03

Please sign in to comment.