Merge pull request #177 from jolt-lang/build-target-output
jolt build: default output under target/{debug,release}
This commit is contained in:
commit
9a68f96b6c
2 changed files with 24 additions and 5 deletions
|
|
@ -74,10 +74,15 @@ project inherits its dependencies' `:jolt/native`.
|
|||
|
||||
## Standalone binaries
|
||||
|
||||
`joltc build -m NS -o OUT` compiles the app and every library into one
|
||||
executable (the runtime + compiler are baked in). It loads the resolved
|
||||
`:jolt/native` libs at startup, so an FFI app — sockets, SQLite — runs with no
|
||||
jolt or Chez on the path.
|
||||
`joltc build -m NS` compiles the app and every library into one executable (the
|
||||
runtime + compiler are baked in). It loads the resolved `:jolt/native` libs at
|
||||
startup, so an FFI app — sockets, SQLite — runs with no jolt or Chez on the path.
|
||||
|
||||
Output goes under the project's `target/`, cargo-style: `target/release/<project>`
|
||||
by default and with `--opt`, `target/debug/<project>` with `--dev` (the
|
||||
`<name>.build` scratch dir sits beside it). `-o PATH` overrides — absolute as-is,
|
||||
relative against the project dir. Paths resolve against the project (`JOLT_PWD`),
|
||||
not the CLI's cwd, since `bin/joltc` runs from the jolt repo.
|
||||
|
||||
`:jolt/build {:embed ["resources" …]}` bakes those directories' files into the
|
||||
binary; `io/resource` serves them from the image with no files on disk. Resources
|
||||
|
|
|
|||
|
|
@ -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