mirror of
https://github.com/janet-lang/janet
synced 2024-11-19 23:24:49 +00:00
Add sh-rule and sh-phony to jpm dialect.
Provides useful shorthand for writing rules that invoke shell commands.
This commit is contained in:
parent
71882475d6
commit
058f63b440
12
auxbin/jpm
12
auxbin/jpm
@ -34,7 +34,7 @@
|
||||
(defmacro rule
|
||||
"Add a rule to the rule graph."
|
||||
[target deps & body]
|
||||
~(,rule-impl ,target ,deps (fn [] nil ,;body)))
|
||||
~(,rule-impl ,target ,deps (fn [] ,;body)))
|
||||
|
||||
(defmacro phony
|
||||
"Add a phony rule to the rule graph. A phony rule will run every time
|
||||
@ -43,6 +43,16 @@
|
||||
[target deps & body]
|
||||
~(,rule-impl ,target ,deps (fn [] nil ,;body) true))
|
||||
|
||||
(defmacro sh-rule
|
||||
"Add a rule that invokes a shell command, and fails if the command returns non-zero."
|
||||
[target deps & body]
|
||||
~(,rule-impl ,target ,deps (fn [] (,assert (,zero? (,os/shell (,string ,;body)))))))
|
||||
|
||||
(defmacro sh-phony
|
||||
"Add a phony rule that invokes a shell command, and fails if the command returns non-zero."
|
||||
[target deps & body]
|
||||
~(,rule-impl ,target ,deps (fn [] (,assert (,zero? (,os/shell (,string ,;body))))) true))
|
||||
|
||||
(defn add-dep
|
||||
"Add a dependency to an existing rule. Useful for extending phony
|
||||
rules or extending the dependency graph of existing rules."
|
||||
|
Loading…
Reference in New Issue
Block a user