jolt build: default output under target/{debug,release}, resolved against the project
Build output landed in the CLI's cwd (the jolt repo, since bin/joltc cd's there), not the project — so a bare -o path or the default binary appeared in the wrong place. Resolve output against JOLT_PWD, and default it cargo- style under the project's target/: target/release for release/--opt, target/debug for --dev, named after the project dir. The <name>.build scratch dir sits beside the binary, so it lands under the same target dir. -o is honored — absolute as-is, relative against the project.
This commit is contained in:
parent
d9d55fd533
commit
56d5707bfe
2 changed files with 24 additions and 5 deletions
|
|
@ -149,7 +149,21 @@
|
|||
:else "release")]
|
||||
(when (nil? entry)
|
||||
(throw (ex-info "build needs an entry: -m NS" {})))
|
||||
(let [out (or (:out opts) (first (str/split entry #"\.")))
|
||||
;; Output paths resolve against the project dir (JOLT_PWD), not the CLI's
|
||||
;; cwd — bin/joltc cd's to the jolt repo, so a bare relative path would land
|
||||
;; there. Default output is cargo-style under target/: --dev -> target/debug,
|
||||
;; release/--opt -> target/release, the binary named after the project dir
|
||||
;; (falling back to the entry's first segment). The <name>.build scratch dir
|
||||
;; the driver creates sits next to it, so it lands under the same target dir.
|
||||
;; An explicit -o is honored: absolute as-is, relative against the project.
|
||||
(let [pdir (project-dir)
|
||||
proj (let [seg (last (str/split pdir #"/"))]
|
||||
(if (or (str/blank? seg) (= "." seg)) (first (str/split entry #"\.")) seg))
|
||||
out (let [o (:out opts)]
|
||||
(cond
|
||||
(nil? o) (str pdir "/target/" (if (= mode "dev") "debug" "release") "/" proj)
|
||||
(str/starts-with? o "/") o
|
||||
:else (str pdir "/" o)))
|
||||
natives (encode-natives (:natives resolved))]
|
||||
;; embed-dirs (absolute) are walked + baked into the binary by the driver;
|
||||
;; project-paths (relative) become runtime io/resource roots (ship-alongside).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue