Skip to content

Commit

Permalink
Add file name option to uber (#2)
Browse files Browse the repository at this point in the history
* uberjar 의 file-name 을 optional 하게 입력할 수 있도록 수정
* Add classes to copy-dir
  • Loading branch information
yyna authored Apr 1, 2022
1 parent 35afbd2 commit f2220c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ tools.build 사용하듯이 `:build` 별칭으로 사용할 수 있습니다.
```clojure
{,,,
:aliases {:build {:deps {io.github.green-labs/build-clj
{:git/tag "v0.0.4" :git/sha "d2811ca"}}
{:git/tag "v0.0.5" :git/sha "cadbdb2"}}
:ns-default greenlabs.build}}
,,,}
```
Expand Down
13 changes: 8 additions & 5 deletions src/greenlabs/build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,24 @@
(b/git-process {:git-args "status --porcelain"}))

(defn uber
"\"target/{{hash}}.jar\" 경로에 uberjar를 생성합니다.
"\"target/{{file-name}}.jar\" 경로에 uberjar를 생성합니다.
같은 이름의 파일이 있다면 덮어씌워집니다.
만약 git 저장소라면 HEAD 커밋 이후로 변경된 파일이 없어야 합니다."
[_]
만약 git 저장소라면 HEAD 커밋 이후로 변경된 파일이 없어야 합니다.
Options:
:file-name - optional, 생성될 uberjar의 이름입니다. default 값은 커밋 hash 입니다."
[{:keys [file-name]}]
(clean nil)
(let [commit-hash (repo-hash)
uber-file (format "target/%s.jar" (or commit-hash "uber"))]
uber-file (format "target/%s.jar" (or file-name commit-hash "uber"))]

(when commit-hash
(assert (nil? (repo-status)) "The repository is not clean."))

(b/write-file {:path "target/target.json"
:string (json/write-str {:file uber-file :version commit-hash}
:escape-slash false)})
(b/copy-dir {:src-dirs ["src" "resources"]
(b/copy-dir {:src-dirs ["src" "resources" "classes"]
:target-dir class-dir})
(b/compile-clj {:basis basis
:src-dirs ["src"]
Expand Down

0 comments on commit f2220c9

Please sign in to comment.