| author | |
| committer | |
| log | 455899668b620dfda40252501c748c0a983555bd |
| tree | 3e9afb62aad2d00361c0632d6b6e61f77c363e46 |
| parent | fda2458f6ac9c4f5ddc7d0fb70ab6194ce1adc47 |
| parent | 1e9e29398a8e35917fd044f21b7cd0ab7394e5fb |
| signature |
add -Denable-tidy flag and use it in the CI5 files changed, 30 insertions(+), 20 deletions(-)
build.zig+22| ... | @@ -31,9 +31,21 @@ pub fn build(b: *std.Build) !void { | ... | @@ -31,9 +31,21 @@ pub fn build(b: *std.Build) !void { |
| 31 | const skip_install_langref = b.option(bool, "no-langref", "skip copying of langref to the installation prefix") orelse skip_install_lib_files; | 31 | const skip_install_langref = b.option(bool, "no-langref", "skip copying of langref to the installation prefix") orelse skip_install_lib_files; |
| 32 | const std_docs = b.option(bool, "std-docs", "include standard library autodocs") orelse false; | 32 | const std_docs = b.option(bool, "std-docs", "include standard library autodocs") orelse false; |
| 33 | const no_bin = b.option(bool, "no-bin", "skip emitting compiler binary") orelse false; | 33 | const no_bin = b.option(bool, "no-bin", "skip emitting compiler binary") orelse false; |
| 34 | const enable_tidy = b.option(bool, "enable-tidy", "Check langref output HTML validity") orelse false; | ||
| 34 | 35 | ||
| 35 | const langref_file = generateLangRef(b); | 36 | const langref_file = generateLangRef(b); |
| 36 | const install_langref = b.addInstallFileWithDir(langref_file, .prefix, "doc/langref.html"); | 37 | const install_langref = b.addInstallFileWithDir(langref_file, .prefix, "doc/langref.html"); |
| 38 | const check_langref = tidyCheck(b, langref_file); | ||
| 39 | if (enable_tidy) install_langref.step.dependOn(check_langref); | ||
| 40 | // Checking autodocs is disabled because tidy gives a false positive: | ||
| 41 | // line 304 column 9 - Warning: moved <style> tag to <head>! fix-style-tags: no to avoid. | ||
| 42 | // I noticed that `--show-warnings no` still incorrectly causes exit code 1. | ||
| 43 | // I was unable to find an alternative to tidy. | ||
| 44 | //const check_autodocs = tidyCheck(b, b.path("lib/docs/index.html")); | ||
| 45 | if (enable_tidy) { | ||
| 46 | test_step.dependOn(check_langref); | ||
| 47 | //test_step.dependOn(check_autodocs); | ||
| 48 | } | ||
| 37 | if (!skip_install_langref) { | 49 | if (!skip_install_langref) { |
| 38 | b.getInstallStep().dependOn(&install_langref.step); | 50 | b.getInstallStep().dependOn(&install_langref.step); |
| 39 | } | 51 | } |
| ... | @@ -50,6 +62,7 @@ pub fn build(b: *std.Build) !void { | ... | @@ -50,6 +62,7 @@ pub fn build(b: *std.Build) !void { |
| 50 | .install_dir = .prefix, | 62 | .install_dir = .prefix, |
| 51 | .install_subdir = "doc/std", | 63 | .install_subdir = "doc/std", |
| 52 | }); | 64 | }); |
| 65 | //if (enable_tidy) install_std_docs.step.dependOn(check_autodocs); | ||
| 53 | if (std_docs) { | 66 | if (std_docs) { |
| 54 | b.getInstallStep().dependOn(&install_std_docs.step); | 67 | b.getInstallStep().dependOn(&install_std_docs.step); |
| 55 | } | 68 | } |
| ... | @@ -1308,3 +1321,12 @@ fn generateLangRef(b: *std.Build) std.Build.LazyPath { | ... | @@ -1308,3 +1321,12 @@ fn generateLangRef(b: *std.Build) std.Build.LazyPath { |
| 1308 | docgen_cmd.addFileArg(b.path("doc/langref.html.in")); | 1321 | docgen_cmd.addFileArg(b.path("doc/langref.html.in")); |
| 1309 | return docgen_cmd.addOutputFileArg("langref.html"); | 1322 | return docgen_cmd.addOutputFileArg("langref.html"); |
| 1310 | } | 1323 | } |
| 1324 | |||
| 1325 | fn tidyCheck(b: *std.Build, html_file: std.Build.LazyPath) *std.Build.Step { | ||
| 1326 | const run_tidy = b.addSystemCommand(&.{ | ||
| 1327 | "tidy", "--drop-empty-elements", "no", "-qe", | ||
| 1328 | }); | ||
| 1329 | run_tidy.addFileArg(html_file); | ||
| 1330 | run_tidy.expectExitCode(0); | ||
| 1331 | return &run_tidy.step; | ||
| 1332 | } |
ci/aarch64-linux-debug.sh+2-5| ... | @@ -61,11 +61,8 @@ stage3-debug/bin/zig build test docs \ | ... | @@ -61,11 +61,8 @@ stage3-debug/bin/zig build test docs \ |
| 61 | -Dstatic-llvm \ | 61 | -Dstatic-llvm \ |
| 62 | -Dtarget=native-native-musl \ | 62 | -Dtarget=native-native-musl \ |
| 63 | --search-prefix "$PREFIX" \ | 63 | --search-prefix "$PREFIX" \ |
| 64 | --zig-lib-dir "$PWD/../lib" | 64 | --zig-lib-dir "$PWD/../lib" \ |
| 65 | 65 | -Denable-tidy | |
| 66 | # Look for HTML errors. | ||
| 67 | # TODO: move this to a build.zig flag (-Denable-tidy) | ||
| 68 | tidy --drop-empty-elements no -qe "../zig-out/doc/langref.html" | ||
| 69 | 66 | ||
| 70 | # Ensure that updating the wasm binary from this commit will result in a viable build. | 67 | # Ensure that updating the wasm binary from this commit will result in a viable build. |
| 71 | stage3-debug/bin/zig build update-zig1 | 68 | stage3-debug/bin/zig build update-zig1 |
ci/aarch64-linux-release.sh+2-5| ... | @@ -61,11 +61,8 @@ stage3-release/bin/zig build test docs \ | ... | @@ -61,11 +61,8 @@ stage3-release/bin/zig build test docs \ |
| 61 | -Dstatic-llvm \ | 61 | -Dstatic-llvm \ |
| 62 | -Dtarget=native-native-musl \ | 62 | -Dtarget=native-native-musl \ |
| 63 | --search-prefix "$PREFIX" \ | 63 | --search-prefix "$PREFIX" \ |
| 64 | --zig-lib-dir "$PWD/../lib" | 64 | --zig-lib-dir "$PWD/../lib" \ |
| 65 | 65 | -Denable-tidy | |
| 66 | # Look for HTML errors. | ||
| 67 | # TODO: move this to a build.zig flag (-Denable-tidy) | ||
| 68 | tidy --drop-empty-elements no -qe "../zig-out/doc/langref.html" | ||
| 69 | 66 | ||
| 70 | # Ensure that updating the wasm binary from this commit will result in a viable build. | 67 | # Ensure that updating the wasm binary from this commit will result in a viable build. |
| 71 | stage3-release/bin/zig build update-zig1 | 68 | stage3-release/bin/zig build update-zig1 |
ci/x86_64-linux-debug.sh+2-5| ... | @@ -69,11 +69,8 @@ stage3-debug/bin/zig build test docs \ | ... | @@ -69,11 +69,8 @@ stage3-debug/bin/zig build test docs \ |
| 69 | -Dstatic-llvm \ | 69 | -Dstatic-llvm \ |
| 70 | -Dtarget=native-native-musl \ | 70 | -Dtarget=native-native-musl \ |
| 71 | --search-prefix "$PREFIX" \ | 71 | --search-prefix "$PREFIX" \ |
| 72 | --zig-lib-dir "$PWD/../lib" | 72 | --zig-lib-dir "$PWD/../lib" \ |
| 73 | 73 | -Denable-tidy | |
| 74 | # Look for HTML errors. | ||
| 75 | # TODO: move this to a build.zig flag (-Denable-tidy) | ||
| 76 | tidy --drop-empty-elements no -qe "../zig-out/doc/langref.html" | ||
| 77 | 74 | ||
| 78 | # Ensure that updating the wasm binary from this commit will result in a viable build. | 75 | # Ensure that updating the wasm binary from this commit will result in a viable build. |
| 79 | stage3-debug/bin/zig build update-zig1 | 76 | stage3-debug/bin/zig build update-zig1 |
ci/x86_64-linux-release.sh+2-5| ... | @@ -69,11 +69,8 @@ stage3-release/bin/zig build test docs \ | ... | @@ -69,11 +69,8 @@ stage3-release/bin/zig build test docs \ |
| 69 | -Dstatic-llvm \ | 69 | -Dstatic-llvm \ |
| 70 | -Dtarget=native-native-musl \ | 70 | -Dtarget=native-native-musl \ |
| 71 | --search-prefix "$PREFIX" \ | 71 | --search-prefix "$PREFIX" \ |
| 72 | --zig-lib-dir "$PWD/../lib" | 72 | --zig-lib-dir "$PWD/../lib" \ |
| 73 | 73 | -Denable-tidy | |
| 74 | # Look for HTML errors. | ||
| 75 | # TODO: move this to a build.zig flag (-Denable-tidy) | ||
| 76 | tidy --drop-empty-elements no -qe "../zig-out/doc/langref.html" | ||
| 77 | 74 | ||
| 78 | # Ensure that stage3 and stage4 are byte-for-byte identical. | 75 | # Ensure that stage3 and stage4 are byte-for-byte identical. |
| 79 | stage3-release/bin/zig build \ | 76 | stage3-release/bin/zig build \ |