mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-11-09 19:40:48 -05:00
Compare commits
8 commits
2e5efa8f64
...
dcde00e30c
Author | SHA1 | Date | |
---|---|---|---|
dcde00e30c | |||
|
5c9b9bdc34 | ||
|
0279826f5b | ||
|
914141ec5a | ||
|
c2caf1a32e | ||
|
227bcb18db | ||
|
b224ed510e | ||
|
a6d13af0c2 |
4 changed files with 13 additions and 11 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,7 +1,9 @@
|
||||||
/zig-cache/
|
/.zig-cache/
|
||||||
/zig-out/
|
/zig-out/
|
||||||
/answers/
|
/answers/
|
||||||
/patches/healed/
|
/patches/healed/
|
||||||
*.md
|
*.md
|
||||||
/output/
|
/output/
|
||||||
|
|
||||||
|
# Leave this in here for older zig versions
|
||||||
|
/zig-cache/
|
||||||
|
|
10
build.zig
10
build.zig
|
@ -15,7 +15,7 @@ const print = std.debug.print;
|
||||||
// 1) Getting Started
|
// 1) Getting Started
|
||||||
// 2) Version Changes
|
// 2) Version Changes
|
||||||
comptime {
|
comptime {
|
||||||
const required_zig = "0.12.0-dev.3518";
|
const required_zig = "0.13.0-dev.339";
|
||||||
const current_zig = builtin.zig_version;
|
const current_zig = builtin.zig_version;
|
||||||
const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable;
|
const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable;
|
||||||
if (current_zig.order(min_zig) == .lt) {
|
if (current_zig.order(min_zig) == .lt) {
|
||||||
|
@ -244,7 +244,7 @@ const ZiglingStep = struct {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
fn make(step: *Step, prog_node: std.Progress.Node) !void {
|
||||||
// NOTE: Using exit code 2 will prevent the Zig compiler to print the message:
|
// NOTE: Using exit code 2 will prevent the Zig compiler to print the message:
|
||||||
// "error: the following build command failed with exit code 1:..."
|
// "error: the following build command failed with exit code 1:..."
|
||||||
const self: *ZiglingStep = @alignCast(@fieldParentPtr("step", step));
|
const self: *ZiglingStep = @alignCast(@fieldParentPtr("step", step));
|
||||||
|
@ -279,7 +279,7 @@ const ZiglingStep = struct {
|
||||||
self.printErrors();
|
self.printErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(self: *ZiglingStep, exe_path: []const u8, _: *std.Progress.Node) !void {
|
fn run(self: *ZiglingStep, exe_path: []const u8, _: std.Progress.Node) !void {
|
||||||
resetLine();
|
resetLine();
|
||||||
print("Checking: {s}\n", .{self.exercise.main_file});
|
print("Checking: {s}\n", .{self.exercise.main_file});
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ const ZiglingStep = struct {
|
||||||
print("{s}PASSED{s}\n\n", .{ green_text, reset_text });
|
print("{s}PASSED{s}\n\n", .{ green_text, reset_text });
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compile(self: *ZiglingStep, prog_node: *std.Progress.Node) !?[]const u8 {
|
fn compile(self: *ZiglingStep, prog_node: std.Progress.Node) !?[]const u8 {
|
||||||
print("Compiling: {s}\n", .{self.exercise.main_file});
|
print("Compiling: {s}\n", .{self.exercise.main_file});
|
||||||
|
|
||||||
const b = self.step.owner;
|
const b = self.step.owner;
|
||||||
|
@ -494,7 +494,7 @@ const PrintStep = struct {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make(step: *Step, _: *std.Progress.Node) !void {
|
fn make(step: *Step, _: std.Progress.Node) !void {
|
||||||
const self: *PrintStep = @alignCast(@fieldParentPtr("step", step));
|
const self: *PrintStep = @alignCast(@fieldParentPtr("step", step));
|
||||||
print("{s}", .{self.message});
|
print("{s}", .{self.message});
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
// Okay, you're armed.
|
// Okay, you're armed.
|
||||||
//
|
//
|
||||||
// Now, please zap the alien structs until they're all gone or
|
// Now, please zap the alien structs until they're all gone or
|
||||||
// Earth will be doomed!
|
// the Earth will be doomed!
|
||||||
//
|
//
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ const CheckNamedStep = struct {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make(step: *Step, _: *std.Progress.Node) !void {
|
fn make(step: *Step, _: std.Progress.Node) !void {
|
||||||
const b = step.owner;
|
const b = step.owner;
|
||||||
const self: *CheckNamedStep = @alignCast(@fieldParentPtr("step", step));
|
const self: *CheckNamedStep = @alignCast(@fieldParentPtr("step", step));
|
||||||
const ex = self.exercise;
|
const ex = self.exercise;
|
||||||
|
@ -202,7 +202,7 @@ const CheckStep = struct {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make(step: *Step, _: *std.Progress.Node) !void {
|
fn make(step: *Step, _: std.Progress.Node) !void {
|
||||||
const b = step.owner;
|
const b = step.owner;
|
||||||
const self: *CheckStep = @alignCast(@fieldParentPtr("step", step));
|
const self: *CheckStep = @alignCast(@fieldParentPtr("step", step));
|
||||||
const exercises = self.exercises;
|
const exercises = self.exercises;
|
||||||
|
@ -325,7 +325,7 @@ const FailStep = struct {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make(step: *Step, _: *std.Progress.Node) !void {
|
fn make(step: *Step, _: std.Progress.Node) !void {
|
||||||
const b = step.owner;
|
const b = step.owner;
|
||||||
const self: *FailStep = @alignCast(@fieldParentPtr("step", step));
|
const self: *FailStep = @alignCast(@fieldParentPtr("step", step));
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ const HealStep = struct {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make(step: *Step, _: *std.Progress.Node) !void {
|
fn make(step: *Step, _: std.Progress.Node) !void {
|
||||||
const b = step.owner;
|
const b = step.owner;
|
||||||
const self: *HealStep = @alignCast(@fieldParentPtr("step", step));
|
const self: *HealStep = @alignCast(@fieldParentPtr("step", step));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue