mirror of
https://codeberg.org/ziglings/exercises.git
synced 2024-12-25 09:10:26 +00: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 {
|
||||
step: Step,
|
||||
exercise: Exercise,
|
||||
builder: *Build,
|
||||
work_path: []const u8,
|
||||
|
||||
result_messages: []const u8 = "",
|
||||
|
@ -234,7 +233,6 @@ const ZiglingStep = struct {
|
|||
self.* = .{
|
||||
.step = Step.init(Step.Options{ .id = .custom, .name = exercise.main_file, .owner = builder, .makeFn = make }),
|
||||
.exercise = exercise,
|
||||
.builder = builder,
|
||||
.work_path = work_path,
|
||||
};
|
||||
return self;
|
||||
|
@ -331,12 +329,12 @@ const ZiglingStep = struct {
|
|||
fn compile(self: *@This(), prog_node: *std.Progress.Node) ![]const u8 {
|
||||
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();
|
||||
|
||||
zig_args.append(builder.zig_exe) catch unreachable;
|
||||
zig_args.append(b.zig_exe) catch unreachable;
|
||||
zig_args.append("build-exe") catch unreachable;
|
||||
|
||||
// Enable C support for exercises that use C functions
|
||||
|
@ -344,11 +342,11 @@ const ZiglingStep = struct {
|
|||
zig_args.append("-lc") catch unreachable;
|
||||
}
|
||||
|
||||
const zig_file = join(builder.allocator, &.{ self.work_path, self.exercise.main_file }) catch unreachable;
|
||||
zig_args.append(builder.pathFromRoot(zig_file)) catch unreachable;
|
||||
const zig_file = join(b.allocator, &.{ self.work_path, self.exercise.main_file }) catch unreachable;
|
||||
zig_args.append(b.pathFromRoot(zig_file)) 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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue