commit 84cd44300015c80cd48d192cc5349cdd0ba994be
parent e46629b68032614b066a7f7bd3ed1b3aa6b23c34
Author: Drew DeVault <sir@cmpwn.com>
Date: Tue, 5 Oct 2021 14:25:10 +0200
hare::module: add ABI_VERSION to hash
This will allow us to break the cache when we break ABI (and
conveniently, it will break everyone's cache following today's ABI
change)
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/hare/module/scan.ha b/hare/module/scan.ha
@@ -15,6 +15,8 @@ use strings;
use strio;
use fmt;
+def ABI_VERSION: u8 = 0;
+
// Scans the files in a directory for eligible build inputs and returns a
// [[version]] which includes all applicable files and their dependencies.
export fn scan(ctx: *context, path: str) (version | error) = {
@@ -326,6 +328,7 @@ fn scan_file(
defer io::close(f);
let sha = sha256::sha256();
hash::write(&sha, strings::toutf8(path));
+ hash::write(&sha, [ABI_VERSION]);
let tee = io::tee(f, &sha);
let lexer = lex::init(&tee, path);