mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-04-01 18:06:46 +00:00
Compare commits
2 Commits
percent-en
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6800e53b0e | ||
|
|
3aeba97fc9 |
33
build.zig
33
build.zig
@@ -46,12 +46,8 @@ pub fn build(b: *Build) !void {
|
||||
var stdout = std.fs.File.stdout().writer(&.{});
|
||||
try stdout.interface.print("Lightpanda {f}\n", .{version});
|
||||
|
||||
const version_string = b.fmt("{f}", .{version});
|
||||
const version_encoded = std.mem.replaceOwned(u8, b.allocator, version_string, "+", "%2B") catch @panic("OOM");
|
||||
|
||||
var opts = b.addOptions();
|
||||
opts.addOption([]const u8, "version", version_string);
|
||||
opts.addOption([]const u8, "version_encoded", version_encoded);
|
||||
opts.addOption([]const u8, "version", b.fmt("{f}", .{version}));
|
||||
opts.addOption(?[]const u8, "snapshot_path", snapshot_path);
|
||||
|
||||
const enable_tsan = b.option(bool, "tsan", "Enable Thread Sanitizer") orelse false;
|
||||
@@ -89,6 +85,15 @@ pub fn build(b: *Build) !void {
|
||||
break :blk mod;
|
||||
};
|
||||
|
||||
// Check compilation
|
||||
const check = b.step("check", "Check if lightpanda compiles");
|
||||
|
||||
const check_lib = b.addLibrary(.{
|
||||
.name = "lightpanda_check",
|
||||
.root_module = lightpanda_module,
|
||||
});
|
||||
check.dependOn(&check_lib.step);
|
||||
|
||||
{
|
||||
// browser
|
||||
const exe = b.addExecutable(.{
|
||||
@@ -107,6 +112,12 @@ pub fn build(b: *Build) !void {
|
||||
});
|
||||
b.installArtifact(exe);
|
||||
|
||||
const exe_check = b.addLibrary(.{
|
||||
.name = "lightpanda_exe_check",
|
||||
.root_module = exe.root_module,
|
||||
});
|
||||
check.dependOn(&exe_check.step);
|
||||
|
||||
const run_cmd = b.addRunArtifact(exe);
|
||||
if (b.args) |args| {
|
||||
run_cmd.addArgs(args);
|
||||
@@ -136,6 +147,12 @@ pub fn build(b: *Build) !void {
|
||||
});
|
||||
b.installArtifact(exe);
|
||||
|
||||
const exe_check = b.addLibrary(.{
|
||||
.name = "snapshot_creator_check",
|
||||
.root_module = exe.root_module,
|
||||
});
|
||||
check.dependOn(&exe_check.step);
|
||||
|
||||
const run_cmd = b.addRunArtifact(exe);
|
||||
if (b.args) |args| {
|
||||
run_cmd.addArgs(args);
|
||||
@@ -174,6 +191,12 @@ pub fn build(b: *Build) !void {
|
||||
});
|
||||
b.installArtifact(exe);
|
||||
|
||||
const exe_check = b.addLibrary(.{
|
||||
.name = "legacy_test_check",
|
||||
.root_module = exe.root_module,
|
||||
});
|
||||
check.dependOn(&exe_check.step);
|
||||
|
||||
const run_cmd = b.addRunArtifact(exe);
|
||||
if (b.args) |args| {
|
||||
run_cmd.addArgs(args);
|
||||
|
||||
@@ -47,7 +47,7 @@ pub noinline fn crash(
|
||||
writer.print("\nreason: {s}\n", .{reason}) catch abort();
|
||||
writer.print("OS: {s}\n", .{@tagName(builtin.os.tag)}) catch abort();
|
||||
writer.print("mode: {s}\n", .{@tagName(builtin.mode)}) catch abort();
|
||||
writer.print("version: {s}\n", .{lp.build_config.version_encoded}) catch abort();
|
||||
writer.print("version: {s}\n", .{lp.build_config.version}) catch abort();
|
||||
inline for (@typeInfo(@TypeOf(args)).@"struct".fields) |f| {
|
||||
writer.writeAll(f.name ++ ": ") catch break;
|
||||
@import("log.zig").writeValue(.pretty, @field(args, f.name), writer) catch abort();
|
||||
@@ -86,15 +86,7 @@ fn report(reason: []const u8, begin_addr: usize, args: anytype) !void {
|
||||
var url_buffer: [4096]u8 = undefined;
|
||||
const url = blk: {
|
||||
var writer: std.Io.Writer = .fixed(&url_buffer);
|
||||
try writer.writeAll("https://crash.lightpanda.io/c?v=");
|
||||
for (lp.build_config.version) |b| {
|
||||
if (b == '+') {
|
||||
try writer.writeAll("%2B");
|
||||
} else {
|
||||
try writer.writeByte(b);
|
||||
}
|
||||
}
|
||||
try writer.writeAll("&r=");
|
||||
try writer.print("https://crash.lightpanda.io/c?v={s}&r=", .{lp.build_config.version});
|
||||
for (reason) |b| {
|
||||
switch (b) {
|
||||
'A'...'Z', 'a'...'z', '0'...'9', '-', '.', '_' => try writer.writeByte(b),
|
||||
|
||||
Reference in New Issue
Block a user