build: remove unused declarations

Remove the `Exercise.addExecutable` method and the `SkipStep` struct, since
they are no longer used.
This commit is contained in:
Manlio Perillo 2023-05-13 21:18:40 +02:00
parent 0304dc3d37
commit 9b7ef7d8cf

View file

@ -64,20 +64,6 @@ pub const Exercise = struct {
pub fn number(self: Exercise) usize { pub fn number(self: Exercise) usize {
return std.fmt.parseInt(usize, self.key(), 10) catch unreachable; return std.fmt.parseInt(usize, self.key(), 10) catch unreachable;
} }
/// Returns the CompileStep for this exercise.
///
/// TODO: currently this method is no longer used.
pub fn addExecutable(self: Exercise, b: *Build, work_path: []const u8) *CompileStep {
const path = join(b.allocator, &.{ work_path, self.main_file }) catch
@panic("OOM");
return b.addExecutable(.{
.name = self.name(),
.root_source_file = .{ .path = path },
.link_libc = self.link_libc,
});
}
}; };
pub const logo = pub const logo =
@ -643,35 +629,6 @@ const PrintStep = struct {
} }
}; };
/// Skips an exercise.
const SkipStep = struct {
step: Step,
exercise: Exercise,
pub fn create(owner: *Build, exercise: Exercise) *SkipStep {
const self = owner.allocator.create(SkipStep) catch @panic("OOM");
self.* = .{
.step = Step.init(.{
.id = .custom,
.name = owner.fmt("skip {s}", .{exercise.main_file}),
.owner = owner,
.makeFn = make,
}),
.exercise = exercise,
};
return self;
}
fn make(step: *Step, _: *std.Progress.Node) !void {
const self = @fieldParentPtr(SkipStep, "step", step);
if (self.exercise.skip) {
print("{s} skipped\n", .{self.exercise.main_file});
}
}
};
/// Checks that each exercise number, excluding the last, forms the sequence /// Checks that each exercise number, excluding the last, forms the sequence
/// `[1, exercise.len)`. /// `[1, exercise.len)`.
/// ///