hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 3151a494bf74cb3b015763f049444c702904c81d
parent 94a7bd4e32a5d3f6daa7f0c0f21191d24374129d
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sun, 14 Mar 2021 09:57:26 -0400

driver: add skeleton for cache manifest updates

Diffstat:
Mcmd/hare/plan.ha | 25++++++++++++++++++++++++-
Mcmd/hare/schedule.ha | 7++++++-
2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/cmd/hare/plan.ha b/cmd/hare/plan.ha @@ -10,6 +10,7 @@ use temp; type status = enum { SCHEDULED, COMPLETE, + SKIP, }; type task = struct { @@ -29,6 +30,8 @@ fn task_free(task: *task) void = { type modcache = struct { hash: u32, task: *task, + ident: ast::ident, + version: module::version, }; type plan = struct { @@ -94,7 +97,7 @@ fn plan_execute(plan: *plan, verbose: bool) void = { let task = plan.scheduled[i]; let eligible = true; for (let j = 0z; j < len(task.depend); j += 1) { - if (task.depend[j].status != status::COMPLETE) { + if (task.depend[j].status == status::SCHEDULED) { eligible = false; break; }; @@ -123,6 +126,26 @@ fn plan_execute(plan: *plan, verbose: bool) void = { delete(plan.scheduled[i]); append(plan.complete, task); }; + + update_modcache(plan); +}; + +fn update_cache(plan: *plan, mod: modcache) void = { + void; // TODO: Add module to cache manifest +}; + +fn update_modcache(plan: *plan) void = { + for (let i = 0z; i < len(plan.modmap); i += 1) { + let mods = plan.modmap[i]; + if (len(mods) == 0) { + continue; + }; + for (let j = 0z; j < len(mods); j += 1) { + if (mods[j].task.status == status::COMPLETE) { + update_cache(plan, mods[j]); + }; + }; + }; }; fn execute( diff --git a/cmd/hare/schedule.ha b/cmd/hare/schedule.ha @@ -47,7 +47,12 @@ fn sched_module(plan: *plan, ident: ast::ident, link: *[]*task) *task = { }; let obj = sched_hare_object(plan, ver, ident, depends...); - append(*bucket, modcache { hash = hash, task = obj }); + append(*bucket, modcache { + hash = hash, + task = obj, + ident = ident, + version = ver, + }); append(*link, obj); free(depends); return obj;