aboutsummaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorKrzysztof Wolicki <der.teufel.mail@gmail.com>2024-10-12 06:27:30 +0200
committerGitHub <noreply@github.com>2024-10-11 21:27:30 -0700
commit008acd0547751c43f42172eab4879c566698dce3 (patch)
tree3d84e85f16cda5613d7dcf560e75aecfcfafd57b /build.zig
parent0367f18cb9dc61090c27e29572a50810b9809822 (diff)
downloadzig-008acd0547751c43f42172eab4879c566698dce3.tar.gz
zig-008acd0547751c43f42172eab4879c566698dce3.zip
Replace tidy with superhtml as HTML validator (#21664)
Also add `$HOME/local/bin` to `PATH` in linux CI
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig29
1 files changed, 13 insertions, 16 deletions
diff --git a/build.zig b/build.zig
index a5f4cd5675..d42af9a0b7 100644
--- a/build.zig
+++ b/build.zig
@@ -32,20 +32,17 @@ pub fn build(b: *std.Build) !void {
const skip_install_langref = b.option(bool, "no-langref", "skip copying of langref to the installation prefix") orelse skip_install_lib_files;
const std_docs = b.option(bool, "std-docs", "include standard library autodocs") orelse false;
const no_bin = b.option(bool, "no-bin", "skip emitting compiler binary") orelse false;
- const enable_tidy = b.option(bool, "enable-tidy", "Check langref output HTML validity") orelse false;
+ const enable_superhtml = b.option(bool, "enable-superhtml", "Check langref output HTML validity") orelse false;
const langref_file = generateLangRef(b);
const install_langref = b.addInstallFileWithDir(langref_file, .prefix, "doc/langref.html");
- const check_langref = tidyCheck(b, langref_file);
- if (enable_tidy) install_langref.step.dependOn(check_langref);
- // Checking autodocs is disabled because tidy gives a false positive:
- // line 304 column 9 - Warning: moved <style> tag to <head>! fix-style-tags: no to avoid.
- // I noticed that `--show-warnings no` still incorrectly causes exit code 1.
- // I was unable to find an alternative to tidy.
- //const check_autodocs = tidyCheck(b, b.path("lib/docs/index.html"));
- if (enable_tidy) {
+ const check_langref = superHtmlCheck(b, langref_file);
+ if (enable_superhtml) install_langref.step.dependOn(check_langref);
+
+ const check_autodocs = superHtmlCheck(b, b.path("lib/docs/index.html"));
+ if (enable_superhtml) {
test_step.dependOn(check_langref);
- //test_step.dependOn(check_autodocs);
+ test_step.dependOn(check_autodocs);
}
if (!skip_install_langref) {
b.getInstallStep().dependOn(&install_langref.step);
@@ -1358,11 +1355,11 @@ fn generateLangRef(b: *std.Build) std.Build.LazyPath {
return docgen_cmd.addOutputFileArg("langref.html");
}
-fn tidyCheck(b: *std.Build, html_file: std.Build.LazyPath) *std.Build.Step {
- const run_tidy = b.addSystemCommand(&.{
- "tidy", "--drop-empty-elements", "no", "-qe",
+fn superHtmlCheck(b: *std.Build, html_file: std.Build.LazyPath) *std.Build.Step {
+ const run_superhtml = b.addSystemCommand(&.{
+ "superhtml", "check",
});
- run_tidy.addFileArg(html_file);
- run_tidy.expectExitCode(0);
- return &run_tidy.step;
+ run_superhtml.addFileArg(html_file);
+ run_superhtml.expectExitCode(0);
+ return &run_superhtml.step;
}