Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update uberjar for new api

  • Loading branch information...
commit 39892e19fa1bd8cf6a6a7b9117cb474f5c5974fd 1 parent ef2b0f0
@xeqi xeqi authored
View
5 src/leiningen/jar.clj
@@ -116,8 +116,9 @@
(defmethod copy-to-jar :path [project jar-os spec]
(doseq [child (file-seq (io/file (:path spec)))]
- (let [path (trim-leading-str (unix-path (str child))
- (unix-path (:path spec)))]
+ (let [path (trim-leading-str (trim-leading-str (unix-path (str child))
+ (unix-path (:path spec)))
+ "/")]
(when-not (skip-file? child path (:jar-exclusions project))
(.putNextEntry jar-os (doto (JarEntry. path)
(.setTime (.lastModified child))))
View
10 src/leiningen/uberjar.clj
@@ -1,12 +1,12 @@
(ns leiningen.uberjar
"Package up the project files and deps into a jar file."
- (:require [clojure.xml :as xml])
+ (:require [clojure.xml :as xml]
+ [leiningen.core.classpath :as classpath])
(:use [clojure.zip :only [xml-zip children]]
[clojure.java.io :only [file copy]]
- [leiningen.core :only [abort]]
+ [leiningen.core.main :only [abort]]
[leiningen.clean :only [clean]]
- [leiningen.jar :only [get-jar-filename jar]]
- [leiningen.deps :only [deps]])
+ [leiningen.jar :only [get-jar-filename jar]])
(:import (java.util.zip ZipFile ZipOutputStream ZipEntry)
(java.io File FileOutputStream PrintWriter)))
@@ -85,7 +85,7 @@ as well as defining a -main function."
(with-open [out (-> standalone-filename
(FileOutputStream.)
(ZipOutputStream.))]
- (let [deps (->> (.listFiles (file (:library-path project)))
+ (let [deps (->> (classpath/resolve-dependencies project)
(filter #(.endsWith (.getName %) ".jar")))
jars (cons (file (get-jar-filename project)) deps)]
(write-components project jars out)))
View
10 test/leiningen/test/uberjar.clj
@@ -1,13 +1,11 @@
(ns leiningen.test.uberjar
(:use [leiningen.uberjar] :reload)
(:use [clojure.test]
- [leiningen.jar :only [jar]]
- [leiningen.core :only [read-project]]
- [leiningen.test.helper :only [sample-no-aot-project]])
+ [leiningen.test.helper :only [sample-no-aot-project]])
(:import [java.util.zip ZipFile]))
(deftest test-uberjar
- (let [filename "TODO"
+ (let [filename "test_projects/sample_no_aot/target/nomnomnom-0.5.0-SNAPSHOT-standalone.jar"
_ (with-out-str (uberjar sample-no-aot-project))
entries (->> (ZipFile. filename)
.entries
@@ -16,6 +14,4 @@
set)]
(is (entries "nom/nom/nom.clj"))
(is (entries "org/codehaus/janino/Compiler$1.class"))
- (is (not (some #(re-find #"dummy" %) entries)))))
-
-(doseq [[_ var] (ns-publics *ns*)] (alter-meta! var assoc :busted true))
+ (is (not (some #(re-find #"dummy" %) entries)))))
View
2  todo.org
@@ -52,7 +52,7 @@ See also https://github.com/technomancy/leiningen/issues
- [X] search
- [X] pom (steal from depot)
- [ ] install (minus shell wrappers)
- - [ ] uberjar
+ - [X] uberjar
- [ ] repl (figure out nrepl integration)
*** Tasks for full release (currently tagged :busted)
- [ ] deps (native-deps and :repositories options)
Please sign in to comment.
Something went wrong with that request. Please try again.