commit 4e1599e031729e479f2f071e015ee0dc0ed2e43e
parent 053967e6fffcee02a58a6ded2823c8912044494a
Author: Eyal Sawady <ecs@d2evs.net>
Date: Sun, 6 Jun 2021 22:51:13 +0000
hare::module: incorporate +test into cache
Other tags are implicitly incorporated based on the file list, +test is
special because the same file can compile to two different things
depending on whether or not it's set
Signed-off-by: Eyal Sawady <ecs@d2evs.net>
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/hare/module/scan.ha b/hare/module/scan.ha
@@ -21,6 +21,15 @@ export fn scan(ctx: *context, path: str) (version | error) = {
// TODO: Incorporate defines into the hash
let sha = sha256::sha256();
defer hash::close(sha);
+ let found = false;
+ for (let i = 0z; i < len(ctx.tags); i += 1) {
+ if (ctx.tags[i].mode == tag_mode::INCLUSIVE
+ && ctx.tags[i].name == "test") {
+ found = true;
+ break;
+ };
+ };
+ hash::write(sha, [if (found) 1 else 0]);
let iter = match (fs::iter(ctx.fs, path)) {
fs::wrongtype => {
// Single file case