feat: bun patch (#11470)

Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Co-authored-by: zackradisic <zackradisic@users.noreply.github.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
This commit is contained in:
Zack Radisic
2024-06-06 17:48:05 -07:00
committed by GitHub
parent 12f070d1a0
commit c85dd4e3bf
31 changed files with 6273 additions and 1420 deletions

View File

@@ -65,6 +65,7 @@ fn addInternalPackages(b: *Build, step: *CompileStep, _: std.mem.Allocator, _: [
}
const BunBuildOptions = struct {
enable_logs: bool = false,
is_canary: bool = false,
canary_revision: u32 = 0,
sha: [:0]const u8 = "",
@@ -111,6 +112,7 @@ const BunBuildOptions = struct {
pub fn step(this: BunBuildOptions, b: anytype) *std.build.OptionsStep {
var opts = b.addOptions();
opts.addOption(@TypeOf(this.enable_logs), "enable_logs", this.enable_logs);
opts.addOption(@TypeOf(this.is_canary), "is_canary", this.is_canary);
opts.addOption(@TypeOf(this.canary_revision), "canary_revision", this.canary_revision);
opts.addOption(
@@ -313,6 +315,8 @@ pub fn build_(b: *Build) !void {
}
}
const enable_logs = if (b.option(bool, "enable_logs", "Enable logs in release")) |l| l else false;
const is_canary, const canary_revision = if (b.option(u32, "canary", "Treat this as a canary build")) |rev|
if (rev == 0)
.{ false, 0 }
@@ -321,6 +325,7 @@ pub fn build_(b: *Build) !void {
else
.{ false, 0 };
break :brk .{
.enable_logs = enable_logs,
.is_canary = is_canary,
.canary_revision = canary_revision,
.version = b.option([]const u8, "version", "Value of `Bun.version`") orelse "0.0.0",