From: Richard W.M. Jones Date: Fri, 27 Dec 2019 19:05:03 +0000 (+0000) Subject: Hard code *file tactic. X-Git-Tag: v'0.2'~130 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=e019d14d15d5caa90892f4c21d8424dbc95067ae;p=goals.git Hard code *file tactic. --- diff --git a/src/eval.ml b/src/eval.ml index 260cbd9..c6cbda1 100644 --- a/src/eval.ml +++ b/src/eval.ml @@ -98,7 +98,18 @@ and run_goal env loc name args (params, patterns, deps, code) = (* Return whether the target (pattern) needs to be rebuilt. *) and needs_rebuild env loc name deps pattern = - false (* XXX *) + match pattern with + | Ast.PTactic (loc, tactic, targs) -> + (* Resolve the targs down to constants. *) + let targs = List.map (Ast.substitute env loc) targs in + (* XXX Look up the tactic. + * We would do that, but for now hard code the *file tactic. XXX + *) + assert (tactic = "file"); + assert (List.length targs = 1); + let targ = List.hd targs in + not (Sys.file_exists targ) + | Ast.PVar _ -> assert false (* XXX not implemented *) (* Find the goal which matches the given tactic and run it. * cargs is a list of parameters (all constants). diff --git a/tests/file1.c b/tests/file1.c new file mode 100644 index 0000000..e69de29 diff --git a/tests/test1.gl b/tests/test1.gl index afdcc34..ec4011f 100644 --- a/tests/test1.gl +++ b/tests/test1.gl @@ -2,7 +2,8 @@ goal all = : "file1.o", *file("file2.o") -"file1.o" : "file1.c" { - echo file1.c "->" file1.o - touch file1.o +goal compile (name) = +"%name.o" : "%name.c" { + echo %< "->" %@ + touch %@ }