CheckStep, FailStep, fail, HealStep and heal incorrectly used a normal
comment, instead of a doc-comment.
Additionally, improve the documentation for FailStep and HealStep.
In test case 1 and 2, remove the `i` variable and use `ex.number()`
instead.
In test case 2, when checking the exercise output from stderr, also
check that stdout is empty and vice versa.
- Use an anonymous struct when initializing std.Build.Step.
- Rename the builder parameter in the create method to b
- Avoid lines too long
Additionally:
- In the run method, rename output to raw_output in order to make the
next variable names shorter.
- In the compile method, rename zig_file to path.
The code in ZiglingStep copied the error handling used in std.Build in
the past.
Use @panic("OOM") when the error is caused by the allocator failing to
allocate memory.
When handling the error from the eval method, some possible errors are
ignored. The make method will only print the exercise hint and the
help message.
Print the unexpected error message, in the else prong.
Note that FileNotFound can also be considered unexpected.
Rename the doCompile method to compile and add the run method.
The two methods are now called from the make method.
Add the help method, since the error handling of compile and run methods
are now separate.
Remove the obsolete comment for the compile method.
In order to simplify the code, the heal function is called during the
configuration phase, thus resulting in the function being always called
when the build.zig file is run.
This behavior unfortunately causes a serious issue when the user fix a
broken exercise and, during the next step, the heal function tries to heal
the fixed exercise resulting in GNU patch assuming an attempt to reverse
a patch, waiting for input from the terminal.
Run the heal function from the new HealStep step, so that it is called
only during tests.
Rename the outdir constant to work_path, for consistency with build.zig.
Fixes#272
When running `zig build -Dn=n`, the install and uninstall steps where
overridden in order to improve the description.
In recent version of Zig this is no longer allowed.
The name "baseName" is confusing, since it refers to the UNIX basename
command, and not to the basename function in some programming languages
including Zig.
Use the std.fs.path.stem function to remove the file extension, instead
of slicing.
Remove the use of the assertion, since it is no longer necessary.
Instead, add a check to ensure that the exercise must be a Zig source
file in the validate_exercises function.
Update the validate_exercises function to check the last exercise, too.
Currently addExecutable is called 3 times, unnecessarily making the code
more complex.
The method takes as argument the path to the exercises directory.
Additionally, use the new std.Build.ExecutableOptions.link_libc field.
The new field was added in ziglang/zig@adc9b77d5f on 2023-04-13.
Update the required Zig compiler version.
Note that I added the **current** zig version to the changelog, since
the reason for the change is known only to the person updating the
version.
Currently, the code for defining the path to the exercises directory is
duplicate 4 times.
Add the constants `healed_path` and `work_path`, and use work_path
instead of the duplicated if expression. Update ZiglingStep to take
`work_path` instead of `use_healed` as argument.
Reduce code length by using `join` instead of `std.fs.path.join` and
replace the use of a slice with a tuple.
Additionally, in case of an error from the `join` function, use @panic
instead of unreachable.
Document why the special branch, when the exercises are healed by the
eowyn script, has been disabled.
The POSIX standard says that the patch command should not use stdout,
but GNU patch writes the message:
patching file patches/healed/xxx.zig (read from exercises/xxx.zig).
Add the -s flag to suppress these messages.
Note that the heal function from test/tests.zig is called when running
`zig build -Dhealed` because it is executed in the configure phase.
The deadlock was caused by setting stdout behavior to ignore, when
spawning the patch command. When the patch command writes to devnull it
causes some errors and a deadlock.
The cause of the bug is probably Zig using `\Device\Null` from `ntdll`
while git-bash uses `NUL` from `kernel32`.
Restore the job matrix to run on linux, macos and windows.
Remove lines with extra whitespace.
Improve the documentation of the Eowyn workflow.
Remove the single quoting of the workflow names.