mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-22 14:03:10 -05:00
build: remove ZiglingStep.builder field
It is not necessary, since the builder is available in self.step.owner.
This commit is contained in:
parent
11d8468539
commit
3ec978d73f
1 changed files with 6 additions and 8 deletions
14
build.zig
14
build.zig
|
@ -223,7 +223,6 @@ var reset_text: []const u8 = "";
|
||||||
const ZiglingStep = struct {
|
const ZiglingStep = struct {
|
||||||
step: Step,
|
step: Step,
|
||||||
exercise: Exercise,
|
exercise: Exercise,
|
||||||
builder: *Build,
|
|
||||||
work_path: []const u8,
|
work_path: []const u8,
|
||||||
|
|
||||||
result_messages: []const u8 = "",
|
result_messages: []const u8 = "",
|
||||||
|
@ -234,7 +233,6 @@ const ZiglingStep = struct {
|
||||||
self.* = .{
|
self.* = .{
|
||||||
.step = Step.init(Step.Options{ .id = .custom, .name = exercise.main_file, .owner = builder, .makeFn = make }),
|
.step = Step.init(Step.Options{ .id = .custom, .name = exercise.main_file, .owner = builder, .makeFn = make }),
|
||||||
.exercise = exercise,
|
.exercise = exercise,
|
||||||
.builder = builder,
|
|
||||||
.work_path = work_path,
|
.work_path = work_path,
|
||||||
};
|
};
|
||||||
return self;
|
return self;
|
||||||
|
@ -331,12 +329,12 @@ const ZiglingStep = struct {
|
||||||
fn compile(self: *@This(), prog_node: *std.Progress.Node) ![]const u8 {
|
fn compile(self: *@This(), prog_node: *std.Progress.Node) ![]const u8 {
|
||||||
print("Compiling {s}...\n", .{self.exercise.main_file});
|
print("Compiling {s}...\n", .{self.exercise.main_file});
|
||||||
|
|
||||||
const builder = self.builder;
|
const b = self.step.owner;
|
||||||
|
|
||||||
var zig_args = std.ArrayList([]const u8).init(builder.allocator);
|
var zig_args = std.ArrayList([]const u8).init(b.allocator);
|
||||||
defer zig_args.deinit();
|
defer zig_args.deinit();
|
||||||
|
|
||||||
zig_args.append(builder.zig_exe) catch unreachable;
|
zig_args.append(b.zig_exe) catch unreachable;
|
||||||
zig_args.append("build-exe") catch unreachable;
|
zig_args.append("build-exe") catch unreachable;
|
||||||
|
|
||||||
// Enable C support for exercises that use C functions
|
// Enable C support for exercises that use C functions
|
||||||
|
@ -344,11 +342,11 @@ const ZiglingStep = struct {
|
||||||
zig_args.append("-lc") catch unreachable;
|
zig_args.append("-lc") catch unreachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
const zig_file = join(builder.allocator, &.{ self.work_path, self.exercise.main_file }) catch unreachable;
|
const zig_file = join(b.allocator, &.{ self.work_path, self.exercise.main_file }) catch unreachable;
|
||||||
zig_args.append(builder.pathFromRoot(zig_file)) catch unreachable;
|
zig_args.append(b.pathFromRoot(zig_file)) catch unreachable;
|
||||||
|
|
||||||
zig_args.append("--cache-dir") catch unreachable;
|
zig_args.append("--cache-dir") catch unreachable;
|
||||||
zig_args.append(builder.pathFromRoot(builder.cache_root.path.?)) catch unreachable;
|
zig_args.append(b.pathFromRoot(b.cache_root.path.?)) catch unreachable;
|
||||||
|
|
||||||
zig_args.append("--listen=-") catch unreachable;
|
zig_args.append("--listen=-") catch unreachable;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue