mirror of
https://github.com/janet-lang/janet
synced 2024-12-23 15:00:27 +00:00
Update cook.janet and jpm
They should throw better error messages when project.janet not found.
This commit is contained in:
parent
264c5bc02b
commit
9943bdd907
@ -17,8 +17,8 @@
|
|||||||
(print `
|
(print `
|
||||||
|
|
||||||
Keys are:
|
Keys are:
|
||||||
--modpath : The directory to install modules to. Defaults to $JANET_MODPATH or module/*syspath*
|
--modpath : The directory to install modules to. Defaults to $JANET_MODPATH or (dyn :syspath)
|
||||||
--headerpath : The directory containing janet headers. Defaults to $JANET_HEADERPATH or module/*headerpath*
|
--headerpath : The directory containing janet headers. Defaults to $JANET_HEADERPATH or (dyn :headerpath)
|
||||||
--binpath : The directory to install binaries and scripts. Defaults to $JANET_BINPATH.
|
--binpath : The directory to install binaries and scripts. Defaults to $JANET_BINPATH.
|
||||||
--optimize : Optimization level for natives. Defaults to $OPTIMIZE or 2.
|
--optimize : Optimization level for natives. Defaults to $OPTIMIZE or 2.
|
||||||
--compiler : C compiler to use for natives. Defaults to $COMPILER or cc.
|
--compiler : C compiler to use for natives. Defaults to $COMPILER or cc.
|
||||||
|
@ -92,24 +92,22 @@
|
|||||||
(unless phony target))
|
(unless phony target))
|
||||||
|
|
||||||
(def- _env (fiber/getenv (fiber/current)))
|
(def- _env (fiber/getenv (fiber/current)))
|
||||||
(defn- import-rules*
|
|
||||||
[path & args]
|
(defn import-rules
|
||||||
(def [realpath] (module/find path))
|
"Import another file that defines more cook rules. This ruleset
|
||||||
|
is merged into the current ruleset."
|
||||||
|
[path]
|
||||||
(def env (make-env))
|
(def env (make-env))
|
||||||
|
(unless (os/stat path :mode)
|
||||||
|
(error (string "cannot open " path)))
|
||||||
(loop [k :keys _env :when (symbol? k)]
|
(loop [k :keys _env :when (symbol? k)]
|
||||||
(unless ((_env k) :private) (put env k (_env k))))
|
(unless ((_env k) :private) (put env k (_env k))))
|
||||||
(def currenv (fiber/getenv (fiber/current)))
|
(def currenv (fiber/getenv (fiber/current)))
|
||||||
(loop [k :keys currenv :when (keyword? k)]
|
(loop [k :keys currenv :when (keyword? k)]
|
||||||
(put env k (currenv k)))
|
(put env k (currenv k)))
|
||||||
(require path :env env ;args)
|
(dofile path :env env)
|
||||||
(when-let [rules (env :rules)] (merge-into (getrules) rules)))
|
(when-let [rules (env :rules)] (merge-into (getrules) rules)))
|
||||||
|
|
||||||
(defmacro import-rules
|
|
||||||
"Import another file that defines more cook rules. This ruleset
|
|
||||||
is merged into the current ruleset."
|
|
||||||
[path & args]
|
|
||||||
~(,import-rules* ,(string path) ,;args))
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Configuration
|
# Configuration
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user