diff --git a/README.md b/README.md index d525415..3e07984 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,7 @@ project runs again, so they are never ticked for you. | .NET | `bin` `obj` | | | Elixir (Mix) | `_build` | `deps` | | PHP (Composer) | | `vendor` | +| Zig | `.zig-cache` `zig-cache` `zig-out` | | Add your own rules in `~/Library/Application Support/OpenSweep/rules`, or keep a `.opensweep.toml` in a repository to pin it or exclude folders diff --git a/engine/crates/opensweep-cli/tests/snapshots/rules-check.json b/engine/crates/opensweep-cli/tests/snapshots/rules-check.json index 1e5e20d..260f172 100644 --- a/engine/crates/opensweep-cli/tests/snapshots/rules-check.json +++ b/engine/crates/opensweep-cli/tests/snapshots/rules-check.json @@ -1,8 +1,8 @@ [ { - "artifacts": 34, + "artifacts": 37, "command": "rules-check", - "rule_files": 12, + "rule_files": 13, "schema_version": 1 } ] diff --git a/engine/crates/opensweep-core/src/rules.rs b/engine/crates/opensweep-core/src/rules.rs index 0b11f6c..5e8c1cd 100644 --- a/engine/crates/opensweep-core/src/rules.rs +++ b/engine/crates/opensweep-core/src/rules.rs @@ -587,6 +587,7 @@ const BUNDLED: &[(&str, &str)] = &[ ("rust.toml", include_str!("../../../rules/rust.toml")), ("swiftpm.toml", include_str!("../../../rules/swiftpm.toml")), ("xcode.toml", include_str!("../../../rules/xcode.toml")), + ("zig.toml", include_str!("../../../rules/zig.toml")), ]; /// The catalogue plus the user's own rule files in `dir` (P8), linted the diff --git a/engine/rules/fixtures/zig/match/app/.zig-cache/o/.keep b/engine/rules/fixtures/zig/match/app/.zig-cache/o/.keep new file mode 100644 index 0000000..e69de29 diff --git a/engine/rules/fixtures/zig/match/app/build.zig b/engine/rules/fixtures/zig/match/app/build.zig new file mode 100644 index 0000000..e69de29 diff --git a/engine/rules/fixtures/zig/match/app/build.zig.zon b/engine/rules/fixtures/zig/match/app/build.zig.zon new file mode 100644 index 0000000..e69de29 diff --git a/engine/rules/fixtures/zig/match/app/expected.txt b/engine/rules/fixtures/zig/match/app/expected.txt new file mode 100644 index 0000000..d8c8979 --- /dev/null +++ b/engine/rules/fixtures/zig/match/app/expected.txt @@ -0,0 +1,2 @@ +.zig-cache +zig-out diff --git a/engine/rules/fixtures/zig/match/app/src/main.zig b/engine/rules/fixtures/zig/match/app/src/main.zig new file mode 100644 index 0000000..e69de29 diff --git a/engine/rules/fixtures/zig/match/app/zig-out/bin/.keep b/engine/rules/fixtures/zig/match/app/zig-out/bin/.keep new file mode 100644 index 0000000..e69de29 diff --git a/engine/rules/fixtures/zig/match/old-cache/build.zig b/engine/rules/fixtures/zig/match/old-cache/build.zig new file mode 100644 index 0000000..e69de29 diff --git a/engine/rules/fixtures/zig/match/old-cache/expected.txt b/engine/rules/fixtures/zig/match/old-cache/expected.txt new file mode 100644 index 0000000..2040c29 --- /dev/null +++ b/engine/rules/fixtures/zig/match/old-cache/expected.txt @@ -0,0 +1 @@ +zig-cache diff --git a/engine/rules/fixtures/zig/match/old-cache/zig-cache/.keep b/engine/rules/fixtures/zig/match/old-cache/zig-cache/.keep new file mode 100644 index 0000000..e69de29 diff --git a/engine/rules/fixtures/zig/nomatch/no-build-file/.zig-cache/.keep b/engine/rules/fixtures/zig/nomatch/no-build-file/.zig-cache/.keep new file mode 100644 index 0000000..e69de29 diff --git a/engine/rules/fixtures/zig/nomatch/no-build-file/README.md b/engine/rules/fixtures/zig/nomatch/no-build-file/README.md new file mode 100644 index 0000000..e69de29 diff --git a/engine/rules/fixtures/zig/nomatch/no-build-file/zig-out/.keep b/engine/rules/fixtures/zig/nomatch/no-build-file/zig-out/.keep new file mode 100644 index 0000000..e69de29 diff --git a/engine/rules/zig.toml b/engine/rules/zig.toml new file mode 100644 index 0000000..60973b7 --- /dev/null +++ b/engine/rules/zig.toml @@ -0,0 +1,28 @@ +schema = 2 +id = "zig" +name = "Zig" + +# https://ziglang.org/learn/build-system/: "There are two generated +# directories in this output: `.zig-cache` and `zig-out`", where zig-out is +# the "installation prefix" (`zig build --help`: "default: zig-out"). Zig +# before 0.13 named the cache `zig-cache`, without the dot. +[detect] +any_files = ["build.zig"] + +[[artifact]] +path = ".zig-cache" +class = "safe" +reason = "Zig build cache. Recreated by the next zig build." +restore = "zig build" + +[[artifact]] +path = "zig-cache" +class = "safe" +reason = "Zig build cache (Zig 0.12 and older). Recreated by the next zig build." +restore = "zig build" + +[[artifact]] +path = "zig-out" +class = "safe" +reason = "Zig install output. Recreated by the next zig build." +restore = "zig build"