Skip to content

Commit

Permalink
Build Clojure application (#26)
Browse files Browse the repository at this point in the history
* Build Clojure application

* Test build app

* check build folder

* Delete test

* Add changelog
  • Loading branch information
franpilot authored Nov 18, 2022
1 parent 4003692 commit 9d2c004
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Added
- Exposes command for building Clojure application `build`: [#26](https://github.com/nubank/vessel/pull/26).

## [0.2.142] - 2021-04-01

### Added
Expand Down
7 changes: 7 additions & 0 deletions src/vessel/api.clj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
(image/render-image-spec opts)
jib.containerizer/containerize)))))

(defn build
"Builds a Clojure application."
[{:keys [verbose?] :as options}]
(binding [misc/*verbose-logs* verbose?]
(with-elapsed-time "Successfully built in"
(builder/build-app options))))

(defn- write-manifest
"Writes the manifest to the output as a JSON object."
[^Writer output manifest]
Expand Down
32 changes: 31 additions & 1 deletion src/vessel/program.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,37 @@
(def vessel
{:desc "A containerization tool for Clojure applications"
:commands
{"containerize"
{"build"
{:desc "Build a Clojure application"
:fn api/build
:opts [["-c" "--classpath PATHS"
:id :classpath-files
:desc "Directories and zip/jar files on the classpath in the same format expected by the java command"
:parse-fn (comp (partial map io/file) #(string/split % #":"))]
["-s" "--source-path PATH"
:id :source-paths
:desc "Directories containing source files. This option can be repeated many times"
:parse-fn io/file
:validate cli/file-or-dir-must-exist
:assoc-fn cli/repeat-option]
["-m" "--main-class NAMESPACE"
:id :main-class
:desc "Namespace that contains the application's entrypoint, with a :gen-class directive and a -main function"
:parse-fn symbol]
["-r" "--resource-path PATH"
:id :resource-paths
:desc "Directories containing resource files. This option can be repeated many times"
:parse-fn io/file
:validate cli/file-or-dir-must-exist
:assoc-fn cli/repeat-option]
["-o" "--output PATH"
:id :target-dir
:desc "Directory where the application's files will be written to"
:parse-fn io/file
:validate cli/file-or-dir-must-exist]
verbose]}

"containerize"
{:desc "Containerize a Clojure application"
:fn api/containerize
:opts [["-a" "--app-root PATH"
Expand Down

0 comments on commit 9d2c004

Please sign in to comment.