Skip to content

Commit a96bd8a

Browse files
Merge pull request #55 from lightpanda-io/catch-get-DEPS-error
Catch get Deps error
2 parents 9d0f9b0 + 093ac90 commit a96bd8a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

build.zig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ pub fn build(b: *std.Build) !void {
7272
}
7373
}
7474

75-
7675
// V8's build process is complex and porting it to zig could take quite awhile.
7776
// It would be nice if there was a way to import .gn files into the zig build system.
7877
// For now we just use gn/ninja like rusty_v8 does: https://github.com/denoland/rusty_v8/blob/main/build.rs
@@ -307,8 +306,7 @@ fn createV8_Build(b: *std.Build, target: std.Build.ResolvedTarget, mode: std.bui
307306
// We can't see our own config because gn desc doesn't accept a --root-target.
308307
// One idea is to append our BUILD.gn to the v8 BUILD.gn instead of putting it in a subdirectory.
309308

310-
311-
const root_path = std.Build.LazyPath{.cwd_relative = "."};
309+
const root_path = std.Build.LazyPath{ .cwd_relative = "." };
312310
var copy_gn = b.addSystemCommand(&.{ "cp", "-R", b.pathFromRoot(".gn"), "v8/" });
313311
copy_gn.setCwd(root_path);
314312
copy_gn.step.dependOn(&cp.step);
@@ -387,7 +385,7 @@ fn createGetTools(b: *std.Build) *std.Build.Step {
387385

388386
const root_path = std.Build.LazyPath{ .cwd_relative = "." };
389387

390-
var mkdir_step = b.addSystemCommand(&.{ "mkdir", "-p", "v8"});
388+
var mkdir_step = b.addSystemCommand(&.{ "mkdir", "-p", "v8" });
391389
mkdir_step.setCwd(root_path);
392390

393391
var cp_step = b.addSystemCommand(&.{ "cp", "-R", b.pathFromRoot("tools"), "v8/tools" });
@@ -497,7 +495,7 @@ const CopyFileStep = struct {
497495
var dst = self.dst_path;
498496
if (std.fs.path.isAbsolute(dst) == false) {
499497
const allocator = step.owner.allocator;
500-
dst = try std.fs.path.join(allocator, &.{try std.fs.cwd().realpathAlloc(allocator, "."), dst});
498+
dst = try std.fs.path.join(allocator, &.{ try std.fs.cwd().realpathAlloc(allocator, "."), dst });
501499
}
502500
try std.fs.copyFileAbsolute(self.src_path, dst, .{});
503501
}
@@ -691,6 +689,9 @@ pub const GetV8SourceStep = struct {
691689
.allocator = step.owner.allocator,
692690
.argv = argv,
693691
}) catch |err| return step.fail("unable to spawn {s}: {s}", .{ argv[0], @errorName(err) });
692+
if (result.term != .Exited or result.term.Exited != 0) {
693+
return step.fail("failed to get DEPS. Error:\n{s}\n Most likely `zig build` was called before running `zig build get-v8`. Delete the v8 dir and try again.\n", .{result.stderr});
694+
}
694695

695696
var parsed = try json.parseFromSlice(json.Value, step.owner.allocator, result.stdout, .{});
696697
defer parsed.deinit();
@@ -795,7 +796,6 @@ const PathStat = enum {
795796
};
796797

797798
fn statPathFromRoot(path_rel: []const u8) !PathStat {
798-
799799
const file = std.fs.cwd().openFile(path_rel, .{ .mode = .read_only }) catch |err| {
800800
if (err == error.FileNotFound) {
801801
return .NotExist;

0 commit comments

Comments
 (0)