Merge pull request #2379 from conormcd/jar-versions-in-manifest
Add project coordinate data to JAR metadata
This commit is contained in:
commit
c73d4557c2
2 changed files with 15 additions and 5 deletions
|
@ -22,10 +22,13 @@
|
||||||
(defn- unix-path [path]
|
(defn- unix-path [path]
|
||||||
(.replace path "\\" "/"))
|
(.replace path "\\" "/"))
|
||||||
|
|
||||||
(def ^:private default-manifest
|
(defn- default-manifest [project]
|
||||||
{"Created-By" (str "Leiningen " (main/leiningen-version))
|
{"Created-By" (str "Leiningen " (main/leiningen-version))
|
||||||
"Built-By" (System/getProperty "user.name")
|
"Built-By" (System/getProperty "user.name")
|
||||||
"Build-Jdk" (System/getProperty "java.version")})
|
"Build-Jdk" (System/getProperty "java.version")
|
||||||
|
"Leiningen-Project-ArtifactId" (:name project)
|
||||||
|
"Leiningen-Project-GroupId" (:group project)
|
||||||
|
"Leiningen-Project-Version" (:version project)})
|
||||||
|
|
||||||
(declare ^:private manifest-entry)
|
(declare ^:private manifest-entry)
|
||||||
|
|
||||||
|
@ -55,7 +58,7 @@
|
||||||
|
|
||||||
(defn ^:internal make-manifest [project]
|
(defn ^:internal make-manifest [project]
|
||||||
(let [project-manifest (into {} (:manifest project))
|
(let [project-manifest (into {} (:manifest project))
|
||||||
default-manifest' (cond-> default-manifest
|
default-manifest' (cond-> (default-manifest project)
|
||||||
;; Add default "Main-Class" only if :main is not
|
;; Add default "Main-Class" only if :main is not
|
||||||
;; explicitly set to nil
|
;; explicitly set to nil
|
||||||
(:main project :not-found)
|
(:main project :not-found)
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
(def mock-project-1
|
(def mock-project-1
|
||||||
{:name "mock-project"
|
{:name "mock-project"
|
||||||
|
:group "mock-group"
|
||||||
:version "1.0"
|
:version "1.0"
|
||||||
:main 'foo.one-two.three-four.bar
|
:main 'foo.one-two.three-four.bar
|
||||||
:manifest [["hello" "world"]
|
:manifest [["hello" "world"]
|
||||||
|
@ -26,6 +27,7 @@
|
||||||
|
|
||||||
(def mock-project-2
|
(def mock-project-2
|
||||||
{:name "mock-project"
|
{:name "mock-project"
|
||||||
|
:group "mock-group"
|
||||||
:version "1.0"
|
:version "1.0"
|
||||||
:main 'foo.one-two.three-four.bar
|
:main 'foo.one-two.three-four.bar
|
||||||
:manifest {"hello" "world"
|
:manifest {"hello" "world"
|
||||||
|
@ -45,9 +47,14 @@
|
||||||
manifest-map)]
|
manifest-map)]
|
||||||
(is (= {"Main-Class" "foo.one_two.three_four.bar", "hello" "world"}
|
(is (= {"Main-Class" "foo.one_two.three_four.bar", "hello" "world"}
|
||||||
(select-keys mm ["hello" "Main-Class"])))
|
(select-keys mm ["hello" "Main-Class"])))
|
||||||
(is (= #{"Manifest-Version" "Main-Class" "hello" "A" "G" "Created-By" "Built-By"
|
(is (= #{"A" "Build-Jdk" "Built-By" "Created-By" "G"
|
||||||
"Build-Jdk" "long-line"}
|
"Leiningen-Project-ArtifactId" "Leiningen-Project-GroupId"
|
||||||
|
"Leiningen-Project-Version" "Main-Class" "Manifest-Version"
|
||||||
|
"hello" "long-line"}
|
||||||
(-> mm keys set)))
|
(-> mm keys set)))
|
||||||
|
(is (= (get mm "Leiningen-Project-ArtifactId") "mock-project"))
|
||||||
|
(is (= (get mm "Leiningen-Project-GroupId") "mock-group"))
|
||||||
|
(is (= (get mm "Leiningen-Project-Version") "1.0"))
|
||||||
(is (= (get mm "long-line") long-line))
|
(is (= (get mm "long-line") long-line))
|
||||||
(is (= #{"my-section-1" "my-section-2"}
|
(is (= #{"my-section-1" "my-section-2"}
|
||||||
(-> mock-project
|
(-> mock-project
|
||||||
|
|
Loading…
Reference in a new issue