Permalink
Browse files

Clean up make-manifest. Fixes #46.

  • Loading branch information...
1 parent d0e1678 commit 0966229899f42c98680f22c5d0eefb6aea14ebd0 @technomancy committed Aug 8, 2010
Showing with 15 additions and 9 deletions.
  1. +2 −0 sample.project.clj
  2. +11 −8 src/leiningen/jar.clj
  3. +2 −1 todo.org
View
@@ -74,5 +74,7 @@
:jar-dir "target/" ; where to place the project's jar file
:jar-name "sample.jar" ; name of the jar produced by 'lein jar'
:uberjar-name "sample-standalone.jar" ; as above for uberjar
+ ;; Set arbitrary key/value pairs for the jar's manifest.
+ :manifest {"Project-awesome-level" "super-great"}
;; You can set JVM-level options here.
:jvm-opts ["-Xmx1g"])
View
@@ -9,18 +9,21 @@
[java.io BufferedOutputStream FileOutputStream
ByteArrayInputStream]))
+(def default-manifest
+ {"Created-By" (str "Leiningen " (System/getProperty "leiningen.version"))
+ "Built-By" (System/getProperty "user.name")
+ "Build-Jdk" (System/getProperty "java.version")})
+
(defn make-manifest [project]
(Manifest.
(ByteArrayInputStream.
(to-byte-array
- (str (join "\n"
- ["Manifest-Version: 1.0" ; DO NOT REMOVE!
- "Created-By: Leiningen"
- (str "Built-By: " (System/getProperty "user.name"))
- (str "Build-Jdk: " (System/getProperty "java.version"))
- (when-let [main (:main project)]
- (str "Main-Class: " (.replaceAll (str main) "-" "_")))])
- "\n")))))
+ (reduce (fn [manifest [k v]]
+ (str manifest "\n" k ": " v))
+ "Manifest-Version: 1.0"
+ (merge default-manifest (:manifest project)
+ (when-let [main (:main project)]
+ {"Main-Class" (.replaceAll (str main) "-" "_")})))))))
(defn unix-path [path]
(.replaceAll path "\\\\" "/"))
View
@@ -11,12 +11,13 @@ Leiningen TODOs
** TODO test classification using metadata; run a subset of tests
** TODO a list of dirs to include in the jar when building
** TODO re-compile all deps with current clojure version
-** TODO set arbitrary jar metadata
** TODO specify min. lein version in project.clj
* For 1.3.0
** TODO lein install $PROJECT (works outside project root)
Possibly take some of this from cljr?
** TODO write shell wrappers on install
+** TODO include shell wrapper in jar file from template
+** DONE set arbitrary jar metadata
** DONE errors in read-project should show filename
** DONE user-level plugin installation and activation
** DONE user-level config file (with hook list)

0 comments on commit 0966229

Please sign in to comment.