Remove commented-out shell wrapper remainders.

This commit is contained in:
Phil Hagelberg 2012-08-01 09:42:20 -07:00
parent c2565d2455
commit e7dadcd7b9
6 changed files with 8 additions and 115 deletions

View file

@ -109,9 +109,8 @@
;; [& args]
;; (comment Do app initialization here))
;;
;; Set :skip-aot metadata on this symbol to use
;; it for other things like the run task or shell wrappers without
;; bringing in AOT if you don't need an executable uberjar.
;; Set :skip-aot metadata on this symbol to use it for other things like the
;; run task without triggering AOT if you don't need an executable uberjar.
:main my.service.runner
;; Options to change the way the REPL behaves
:repl-options {;; Specify the string to print when prompting for input.

View file

@ -13,73 +13,9 @@
(java.io BufferedOutputStream FileOutputStream
ByteArrayInputStream)))
;; (declare make-local-repo)
;; (defn- read-resource [resource-name]
;; (-> (.getContextClassLoader (Thread/currentThread))
;; (.getResourceAsStream resource-name)
;; (slurp)))
;; (defn- read-bin-template [system]
;; (case system
;; :unix (read-resource "script-template")
;; :windows (read-resource "script-template.bat")))
(defn- unix-path [path]
(.replace path "\\" "/"))
;; (defn windows-path [path]
;; (.replace path "/" "\\"))
;; (defn local-repo-path
;; ([group name version]
;; (local-repo-path {:group group :name name :version version}))
;; ([{:keys [group name version]}]
;; (unix-path (format
;; "%s/%s/%s/%s/%s-%s.jar"
;; (.getBasedir (make-local-repo)) (.replace group "." "/")
;; name version name version))))
;; (defn- script-classpath-for [project deps system]
;; (let [unix-paths (conj (for [dep deps]
;; (unix-path (format "$HOME/.m2/repository/%s" dep)))
;; (local-repo-path project))]
;; (case system
;; :unix (string/join ":" unix-paths)
;; :windows (string/join ";" (for [path unix-paths]
;; (windows-path
;; (.replace path "$HOME"
;; "%USERPROFILE%")))))))
;; (defn- shell-wrapper-name [project]
;; (get-in project [:shell-wrapper :bin]
;; (format "bin/%s" (:name project))))
;; (defn- shell-wrapper-contents [project bin-name main deps-fileset system]
;; (let [file-name (case system
;; :unix bin-name
;; :windows (format "%s.bat" bin-name))
;; bin-file (file file-name)]
;; (format (if (.exists bin-file)
;; (slurp bin-file)
;; (read-bin-template system))
;; (script-classpath-for project deps-fileset system)
;; main (:version project))))
;; (defn- shell-wrapper-filespecs [project deps-fileset]
;; (when (:shell-wrapper project)
;; (let [main (or (:main (:shell-wrapper project)) (:main project))
;; bin-name (shell-wrapper-name project)
;; read-bin #(shell-wrapper-contents
;; project bin-name main deps-fileset %)]
;; [{:type :bytes
;; :path bin-name
;; :bytes (.getBytes (read-bin :unix))}
;; {:type :bytes
;; :path (format "%s.bat" bin-name)
;; :bytes (.getBytes (read-bin :windows))}])))
(def ^:private default-manifest
{"Created-By" (str "Leiningen " (main/leiningen-version))
"Built-By" (System/getProperty "user.name")
@ -97,8 +33,6 @@
(reduce (partial manifest-entry project)
"Manifest-Version: 1.0"
(merge default-manifest (:manifest project)
;; (when (:shell-wrapper project)
;; {"Leiningen-shell-wrapper" (shell-wrapper-name project)})
(when-let [main (:main project)]
{"Main-Class" (.replaceAll (str main) "-" "_")})))))))
@ -175,9 +109,7 @@
(if-not (:omit-source project)
[{:type :paths :paths (:source-paths project)}
{:type :paths :paths (:java-source-paths project)}])
(:filespecs project)
;; (shell-wrapper-filespecs project deps-fileset)
))
(:filespecs project)))
(defn get-jar-filename
([project uberjar?]

View file

@ -19,35 +19,6 @@
manifest-map
(select-keys ["hello" "Main-Class"])))))
(deftest ^:post-preview test-shell-wrapper
(let [jar-file (JarFile. (jar sample-project))
manifest (manifest-map (.getManifest jar-file))
bin (slurp (.getInputStream jar-file (.getEntry jar-file "bin/nom")))
bin (slurp (.getInputStream jar-file (.getEntry jar-file "bytes.clj")))
bat (slurp (.getInputStream jar-file (.getEntry jar-file
"bin/nom.bat")))]
(is (= "bin/nom" (manifest "Leiningen-shell-wrapper")))
(is (= [:bytes "are" 'nomnomnom] (read-string bytes)))
(is (re-find #"org/clojure/clojure/1\.1\.0/" bin))
(is (re-find #"org\\clojure\\clojure\\1\.1\.0" bat))
(is (re-find #"MAIN=\"nom\.nom\.nom\"" bin))
(is (re-find #"set MAIN=\"nom\.nom\.nom\"" bat))
(is (re-find #"use '\$MAIN\)\(apply -main .command-line-args." bin))
(is (re-find #"use '%MAIN%\)\(apply -main .command-line-args." bat))
(is (re-find #"\$HOME/\.m2/repository/rome/rome/0\.9/rome-0\.9\.jar" bin))
(is (re-find
#"%USERPROFILE%\\\.m2\\repository\\rome\\rome\\0\.9\\rome-0\.9\.jar"
bat))))
(deftest test-no-bin-jar
(let [jar-file (JarFile. (jar (dissoc sample-project :shell-wrapper)))
manifest (manifest-map (.getManifest jar-file))]
(is (nil? (.getEntry jar-file
"META-INF/maven/nomnomnom/nomnomnom/pom.properties")))
(is (nil? (.getEntry jar-file "bin/nom")))
(is (nil? (.getEntry jar-file "bin/nom.bat")))
(is (nil? (manifest "Leiningen-shell-wrapper")))))
(deftest test-jar-fails
(binding [*err* (java.io.PrintWriter. (platform-nullsink))]
(is (thrown? Exception (jar sample-failing-project)))))
@ -56,17 +27,6 @@
(with-out-str
(is (jar sample-no-aot-project))))
(deftest ^:post-preview test-tricky-name
(let [jar-file (JarFile. (jar tricky-name-project))
manifest (manifest-map (.getManifest jar-file))
bin (slurp (.getInputStream
jar-file (.getEntry jar-file "bin/tricky-name")))
bat (slurp (.getInputStream
jar-file (.getEntry jar-file "bin/tricky-name.bat")))]
(is (= "bin/tricky-name" (manifest "Leiningen-shell-wrapper")))
(is (re-find #"org/domain/tricky-name/1\.0/tricky-name-1\.0\.jar" bin))
(is (re-find #"\\domain\\tricky-name\\1\.0\\tricky-name-1\.0\.jar" bat))))
(deftest test-no-deps-jar
(let [jar-file (jar (dissoc sample-project :dependencies :main))]
(and (is (not (number? jar-file)))

View file

@ -15,8 +15,6 @@
[ring "1.0.0"]]
:main nom.nom.nom
:warn-on-reflection true
:shell-wrapper {:main nom.nom.nom
:bin "bin/nom"}
:jar-exclusions [#"^META-INF"]
:filespecs [{:type :fn :fn (fn [p] {:type :bytes :path "bytes.clj"
:bytes (str "[:bytes \"are\" "

View file

@ -1,5 +1,4 @@
(defproject org.domain/tricky-name "1.0"
:description "One with a tricky group and project name"
:dependencies [[org.clojure/clojure "1.3.0"]]
:shell-wrapper true
:main ^{:skip-aot true} org.domain.tricky-name.core)

View file

@ -5,8 +5,13 @@ See also https://github.com/technomancy/leiningen/issues
* For 2.0.0
** 2.0.0-final
- [X] Allow trampoline to work with chaining in do task (#665)
- [ ] Honor :local-repo in trampoline (#695)
- [ ] OOM in repl with lots of output (#691)
- [ ] Search indices on Central have moved (#683)
- [ ] Store repl port on filesystem (#682)
- [ ] Improve speed of trampoline restarts (#573)
- [ ] Reduce Aether verbosity (#610)
- [ ] Honor hooks/metadata in from plugins (#401)
- [ ] Isolate target dir per profile (#468)
- [ ] Honor mirror for search indices (#281)
- [ ] Drop clojars snapshots from default repos (#241)