From 262c669b26867627854427454503d7ca1e4354e0 Mon Sep 17 00:00:00 2001 From: David Santiago Date: Mon, 7 May 2012 17:10:44 -0700 Subject: [PATCH 01/44] Make merge-profile private. --- leiningen-core/src/leiningen/core/project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leiningen-core/src/leiningen/core/project.clj b/leiningen-core/src/leiningen/core/project.clj index ce8770f68..b92c2beea 100755 --- a/leiningen-core/src/leiningen/core/project.clj +++ b/leiningen-core/src/leiningen/core/project.clj @@ -148,7 +148,7 @@ :else (doto latter (println "has a type mismatch merging profiles.")))) -(defn merge-profile [project profile] +(defn- merge-profile [project profile] (merge-with profile-key-merge project profile)) (defn- lookup-profile [profiles profile-name] From 1a8c9211dcf1f9f4891f2e86083bb01f166f3ff6 Mon Sep 17 00:00:00 2001 From: David Santiago Date: Wed, 9 May 2012 00:07:42 -0700 Subject: [PATCH 02/44] Add add-profiles function. --- leiningen-core/src/leiningen/core/project.clj | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/leiningen-core/src/leiningen/core/project.clj b/leiningen-core/src/leiningen/core/project.clj index b92c2beea..5070a110e 100755 --- a/leiningen-core/src/leiningen/core/project.clj +++ b/leiningen-core/src/leiningen/core/project.clj @@ -233,6 +233,18 @@ (println "WARNING: conj-dependencies is deprecated.") (update-in project [:dependencies] conj dependency)) +(defn add-profiles + "Add the profiles in the given profiles map to the project map, taking care + to preserve project map metadata. Note that these profiles are not merged, + merely made available to merge by name." + [project profiles-map] + ;; Merge new profiles into both the project and without-profiles meta + (vary-meta (update-in project [:profiles] merge profiles-map) + merge + {:without-profiles (update-in (:without-profiles (meta project)) + [:profiles] merge + profiles-map)})) + (defn read "Read project map out of file, which defaults to project.clj." ([file profiles] From 6bbf4fc5d6b12c5a4955df7d6e6fdabf3e7bab94 Mon Sep 17 00:00:00 2001 From: David Santiago Date: Wed, 9 May 2012 00:34:26 -0700 Subject: [PATCH 03/44] Return merge-profile to a public function, instead make it record the map it merges in the :included-profiles metadata. --- leiningen-core/src/leiningen/core/project.clj | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/leiningen-core/src/leiningen/core/project.clj b/leiningen-core/src/leiningen/core/project.clj index 5070a110e..bbc299e7e 100755 --- a/leiningen-core/src/leiningen/core/project.clj +++ b/leiningen-core/src/leiningen/core/project.clj @@ -148,8 +148,11 @@ :else (doto latter (println "has a type mismatch merging profiles.")))) -(defn- merge-profile [project profile] - (merge-with profile-key-merge project profile)) +(defn merge-profile [project profile] + (vary-meta (merge-with profile-key-merge project profile) + merge + {:included-profiles (concat (:included-profiles (meta project)) + profile)})) (defn- lookup-profile [profiles profile-name] (let [result (profiles profile-name)] From 155d32aef51233c12e82cd4f4604041ead3f3bd2 Mon Sep 17 00:00:00 2001 From: David Santiago Date: Wed, 9 May 2012 00:53:57 -0700 Subject: [PATCH 04/44] Add unmerge-profiles function. --- leiningen-core/src/leiningen/core/project.clj | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/leiningen-core/src/leiningen/core/project.clj b/leiningen-core/src/leiningen/core/project.clj index bbc299e7e..3c03a76f6 100755 --- a/leiningen-core/src/leiningen/core/project.clj +++ b/leiningen-core/src/leiningen/core/project.clj @@ -248,6 +248,16 @@ [:profiles] merge profiles-map)})) +(defn unmerge-profiles + "Given a project map, return the project map you would have if the specified + profiles had never been merged into it. Expects a list of profiles, where + each element is either the name of a profile in the :profiles key of the + project, or the map of the profile itself." + [project profiles-to-unmerge] + (let [result-profiles (filter (comp not (into #{} profiles-to-unmerge)) + (:included-profiles project))] + (merge-profiles (:without-profiles project project) result-profiles))) + (defn read "Read project map out of file, which defaults to project.clj." ([file profiles] From 53fb5cbf52dd199beecc43c9ff70302f9be91df0 Mon Sep 17 00:00:00 2001 From: David Santiago Date: Wed, 9 May 2012 02:01:29 -0700 Subject: [PATCH 05/44] Update profiles-for to accept both keywords and direct maps. --- leiningen-core/src/leiningen/core/project.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/leiningen-core/src/leiningen/core/project.clj b/leiningen-core/src/leiningen/core/project.clj index 3c03a76f6..5a70bd078 100755 --- a/leiningen-core/src/leiningen/core/project.clj +++ b/leiningen-core/src/leiningen/core/project.clj @@ -177,7 +177,8 @@ ;; We reverse because we want profile values to override the ;; project, so we need "last wins" in the reduce, but we want the ;; first profile specified by the user to take precedence. - (map (partial lookup-profile profiles) (reverse profiles-to-apply)))) + (map #(if (keyword? %) (lookup-profile profiles %) %) + (reverse profiles-to-apply)))) (defn ensure-dynamic-classloader [] (let [thread (Thread/currentThread) From 482680ad24546053aeba7dd3e27a18b9bf5607cb Mon Sep 17 00:00:00 2001 From: David Santiago Date: Wed, 9 May 2012 02:36:27 -0700 Subject: [PATCH 06/44] Make add-profiles work even when there is no without-profiles metadata. Add a test for add-profiles. --- leiningen-core/src/leiningen/core/project.clj | 3 ++- .../test/leiningen/core/test/project.clj | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/leiningen-core/src/leiningen/core/project.clj b/leiningen-core/src/leiningen/core/project.clj index 5a70bd078..45ce646c5 100755 --- a/leiningen-core/src/leiningen/core/project.clj +++ b/leiningen-core/src/leiningen/core/project.clj @@ -245,7 +245,8 @@ ;; Merge new profiles into both the project and without-profiles meta (vary-meta (update-in project [:profiles] merge profiles-map) merge - {:without-profiles (update-in (:without-profiles (meta project)) + {:without-profiles (update-in (:without-profiles (meta project) + project) [:profiles] merge profiles-map)})) diff --git a/leiningen-core/test/leiningen/core/test/project.clj b/leiningen-core/test/leiningen/core/test/project.clj index 2c19bb670..1fce14126 100755 --- a/leiningen-core/test/leiningen/core/test/project.clj +++ b/leiningen-core/test/leiningen/core/test/project.clj @@ -97,3 +97,17 @@ read (merge-profiles [:middler]) init-project))))) + +(deftest test-add-profiles + (let [expected-result {:dependencies [] :profiles {:a1 {:src-paths ["a1/"]} + :a2 {:src-paths ["a2/"]}}}] + (is (= expected-result + (-> {:dependencies []} + (add-profiles {:a1 {:src-paths ["a1/"]} + :a2 {:src-paths ["a2/"]}})))) + (is (= expected-result + (-> {:dependencies []} + (add-profiles {:a1 {:src-paths ["a1/"]} + :a2 {:src-paths ["a2/"]}}) + meta + :without-profiles))))) \ No newline at end of file From 3fe6650a195f88d249df8321403469e09f12d349 Mon Sep 17 00:00:00 2001 From: David Santiago Date: Wed, 9 May 2012 03:00:13 -0700 Subject: [PATCH 07/44] Fix bugs in unmerge-profiles. Add a test for unmerge-profiles. --- leiningen-core/src/leiningen/core/project.clj | 5 +++-- .../test/leiningen/core/test/project.clj | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/leiningen-core/src/leiningen/core/project.clj b/leiningen-core/src/leiningen/core/project.clj index 45ce646c5..048c0866e 100755 --- a/leiningen-core/src/leiningen/core/project.clj +++ b/leiningen-core/src/leiningen/core/project.clj @@ -257,8 +257,9 @@ project, or the map of the profile itself." [project profiles-to-unmerge] (let [result-profiles (filter (comp not (into #{} profiles-to-unmerge)) - (:included-profiles project))] - (merge-profiles (:without-profiles project project) result-profiles))) + (:included-profiles (meta project)))] + (merge-profiles (:without-profiles (meta project) project) + result-profiles))) (defn read "Read project map out of file, which defaults to project.clj." diff --git a/leiningen-core/test/leiningen/core/test/project.clj b/leiningen-core/test/leiningen/core/test/project.clj index 1fce14126..8f030e0d9 100755 --- a/leiningen-core/test/leiningen/core/test/project.clj +++ b/leiningen-core/test/leiningen/core/test/project.clj @@ -110,4 +110,18 @@ (add-profiles {:a1 {:src-paths ["a1/"]} :a2 {:src-paths ["a2/"]}}) meta - :without-profiles))))) \ No newline at end of file + :without-profiles))))) + +(deftest test-unmerge-profiles + (let [expected-result {:A 1 :C 3 :profiles {:a {:A 1} + :b {:B 2} + :c {:C 3}} + :repositories {"central" {:url "http://repo1.maven.org/maven2"} + "clojars" {:url "http://clojars.org/repo/"}} + :dependencies [], :compile-path "classes"}] + (is (= expected-result + (-> {:profiles {:a {:A 1} + :b {:B 2} + :c {:C 3}}} + (merge-profiles [:a :b :c]) + (unmerge-profiles [:b])))))) \ No newline at end of file From 27346f0f628bae81832e570fa343504ed47dbaf6 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Wed, 9 May 2012 11:05:17 -0700 Subject: [PATCH 08/44] Fix install test. --- test/leiningen/test/install.clj | 40 ++------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/test/leiningen/test/install.clj b/test/leiningen/test/install.clj index bac230942..f625b0ad1 100644 --- a/test/leiningen/test/install.clj +++ b/test/leiningen/test/install.clj @@ -5,52 +5,16 @@ [leiningen.test.helper] [clojure.java.io :only [file]])) -;; (def unix-shell-wrapper (file (user/leiningen-home) "bin" "nom")) -;; (def windows-shell-wrapper (file (user/leiningen-home) "bin" "nom.bat")) - -;; (defn delete-shell-wrappers [] -;; (.delete unix-shell-wrapper) -;; (.delete windows-shell-wrapper)) - (deftest test-install (delete-file-recursively (m2-dir "nomnomnom" "0.5.0-SNAPSHOT") true) - ;; (delete-shell-wrappers) (install sample-project) - (is (not (empty? (.listFiles (m2-dir "nomnomnom" "0.5.0-SNAPSHOT"))))) - ;; (is (.exists unix-shell-wrapper)) - ;; (if (= :windows (get-os)) - ;; (is (.exists windows-shell-wrapper)) - ;; (is (not (.exists windows-shell-wrapper)))) - ) + (is (not (empty? (.listFiles (m2-dir "nomnomnom" "0.5.0-SNAPSHOT")))))) (def jdom-dir (file local-repo "jdom" "jdom" "1.0")) -(deftest ^:online test-standalone-install - (delete-file-recursively jdom-dir true) - ;; (delete-shell-wrappers) - (install nil "nomnomnom" "0.5.0-SNAPSHOT") - (is (not (empty? (.listFiles jdom-dir)))) -;; (is (.exists unix-shell-wrapper)) - ) - (def tricky-m2-dir (file local-repo "org" "domain" "tricky-name" "1.0")) -;; (def tricky-unix-shell-wrapper (file (user/leiningen-home) -;; "bin" "tricky-name")) -;; (def tricky-windows-shell-wrapper (file (user/leiningen-home) -;; "bin" "tricky-name.bat")) - -;; (defn delete-tricky-shell-wrappers [] -;; (.delete tricky-unix-shell-wrapper) -;; (.delete tricky-windows-shell-wrapper)) (deftest test-tricky-name-install (delete-file-recursively tricky-m2-dir true) - ;; (delete-shell-wrappers) (install tricky-name-project) - (install nil "org.domain/tricky-name" "1.0") - (is (not (empty? (.listFiles tricky-m2-dir)))) - ;; (is (.exists tricky-unix-shell-wrapper)) - ;; (if (= :windows (get-os)) - ;; (is (.exists tricky-windows-shell-wrapper)) - ;; (is (not (.exists tricky-windows-shell-wrapper)))) - ) + (is (not (empty? (.listFiles tricky-m2-dir))))) From af618379a994bd21304bef1d82c1320c90433cee Mon Sep 17 00:00:00 2001 From: David Santiago Date: Wed, 9 May 2012 11:23:12 -0700 Subject: [PATCH 09/44] Fix merge-profile, which was incorrectly appending to the :included-profiles meta. --- leiningen-core/src/leiningen/core/project.clj | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/leiningen-core/src/leiningen/core/project.clj b/leiningen-core/src/leiningen/core/project.clj index 048c0866e..b91104a9a 100755 --- a/leiningen-core/src/leiningen/core/project.clj +++ b/leiningen-core/src/leiningen/core/project.clj @@ -150,9 +150,7 @@ (defn merge-profile [project profile] (vary-meta (merge-with profile-key-merge project profile) - merge - {:included-profiles (concat (:included-profiles (meta project)) - profile)})) + update-in [:included-profiles] conj profile)) (defn- lookup-profile [profiles profile-name] (let [result (profiles profile-name)] From 0f07df9f4ced89a8a2a652536026dd0b36cc3667 Mon Sep 17 00:00:00 2001 From: David Santiago Date: Wed, 9 May 2012 11:23:30 -0700 Subject: [PATCH 10/44] Add tests for unmerge-profiles and merging anonymous profiles through merge-profiles. --- .../test/leiningen/core/test/project.clj | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/leiningen-core/test/leiningen/core/test/project.clj b/leiningen-core/test/leiningen/core/test/project.clj index 8f030e0d9..870488d5c 100755 --- a/leiningen-core/test/leiningen/core/test/project.clj +++ b/leiningen-core/test/leiningen/core/test/project.clj @@ -112,6 +112,17 @@ meta :without-profiles))))) +(deftest test-merge-anon-profiles + (let [expected-result {:A 1 :C 3 :profiles {:a {:A 1} + :b {:B 2}} + :repositories {"central" {:url "http://repo1.maven.org/maven2"} + "clojars" {:url "http://clojars.org/repo/"}} + :dependencies [], :compile-path "classes"}] + (is (= expected-result + (-> {:profiles {:a {:A 1} :b {:B 2}}} + (merge-profiles [:a {:C 3}])))) + )) + (deftest test-unmerge-profiles (let [expected-result {:A 1 :C 3 :profiles {:a {:A 1} :b {:B 2} @@ -124,4 +135,10 @@ :b {:B 2} :c {:C 3}}} (merge-profiles [:a :b :c]) - (unmerge-profiles [:b])))))) \ No newline at end of file + (unmerge-profiles [:b])))) + (is (= expected-result + (-> {:profiles {:a {:A 1} + :b {:B 2} + :c {:C 3}}} + (merge-profiles [:a :b :c {:D 4}]) + (unmerge-profiles [:b {:D 4}])))))) From a7707f0ffffed88673e5b4f9ce6d6edf2c4bab65 Mon Sep 17 00:00:00 2001 From: David Santiago Date: Wed, 9 May 2012 12:29:32 -0700 Subject: [PATCH 11/44] Fix formatting of lein-core/project test. --- leiningen-core/test/leiningen/core/test/project.clj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/leiningen-core/test/leiningen/core/test/project.clj b/leiningen-core/test/leiningen/core/test/project.clj index 870488d5c..d0b8ea232 100755 --- a/leiningen-core/test/leiningen/core/test/project.clj +++ b/leiningen-core/test/leiningen/core/test/project.clj @@ -120,8 +120,7 @@ :dependencies [], :compile-path "classes"}] (is (= expected-result (-> {:profiles {:a {:A 1} :b {:B 2}}} - (merge-profiles [:a {:C 3}])))) - )) + (merge-profiles [:a {:C 3}])))))) (deftest test-unmerge-profiles (let [expected-result {:A 1 :C 3 :profiles {:a {:A 1} From 36120d822447bd41b971b5eaeccdd3d217a42a91 Mon Sep 17 00:00:00 2001 From: David Santiago Date: Wed, 9 May 2012 12:33:36 -0700 Subject: [PATCH 12/44] Make merge-profile private and convert found uses of it to merge-profiles. --- leiningen-core/src/leiningen/core/project.clj | 2 +- src/leiningen/repl.clj | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/leiningen-core/src/leiningen/core/project.clj b/leiningen-core/src/leiningen/core/project.clj index b91104a9a..b3562721a 100755 --- a/leiningen-core/src/leiningen/core/project.clj +++ b/leiningen-core/src/leiningen/core/project.clj @@ -148,7 +148,7 @@ :else (doto latter (println "has a type mismatch merging profiles.")))) -(defn merge-profile [project profile] +(defn- merge-profile [project profile] (vary-meta (merge-with profile-key-merge project profile) update-in [:included-profiles] conj profile)) diff --git a/src/leiningen/repl.clj b/src/leiningen/repl.clj index 6740c9b74..27b7ed1ef 100644 --- a/src/leiningen/repl.clj +++ b/src/leiningen/repl.clj @@ -32,7 +32,7 @@ (while true (Thread/sleep Long/MAX_VALUE)))] (if project (eval/eval-in-project - (project/merge-profile project profile) + (project/merge-profiles project [profile]) server-starting-form '(do (require 'clojure.tools.nrepl.server) (require 'complete.core))) @@ -100,8 +100,8 @@ and port." (let [options (options-for-reply project :port (repl-port project))] (eval/eval-in-project (-> project - (project/merge-profile profile) - (project/merge-profile trampoline-profile)) + (project/merge-profiles [profile]) + (project/merge-profiles [trampoline-profile])) `(reply.main/launch-nrepl ~options) '(do (require 'reply.main) (require 'clojure.tools.nrepl.server) From 2bf458b7a20c8713e8bc0351358a2fc9d9eac359 Mon Sep 17 00:00:00 2001 From: Nils Grunwald Date: Wed, 9 May 2012 23:31:12 +0200 Subject: [PATCH 13/44] added -o as an alias --- leiningen-core/src/leiningen/core/main.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/leiningen-core/src/leiningen/core/main.clj b/leiningen-core/src/leiningen/core/main.clj index 10119c688..26d9b1e68 100644 --- a/leiningen-core/src/leiningen/core/main.clj +++ b/leiningen-core/src/leiningen/core/main.clj @@ -7,6 +7,7 @@ (def aliases (atom {"--help" "help", "-h" "help", "-?" "help", "-v" "version" "--version" "version", "überjar" "uberjar" + "-o" ["with-profile" "offline,dev,user,default"] "cp" "classpath" "halp" "help" "with-profiles" "with-profile" "readme" ["help" "readme"] @@ -150,7 +151,7 @@ or by executing \"lein upgrade\". ") (exit 0)) (defn - leiningen-version + leiningen-version "Returns leiningen version as a string." [] (System/getenv "LEIN_VERSION")) From 9bf24fe5e97de9e78a6401dd6d4d3fac99b97e5f Mon Sep 17 00:00:00 2001 From: Colin Jones Date: Wed, 9 May 2012 20:00:08 -0500 Subject: [PATCH 14/44] Bump reply Fixes #557 --- project.clj | 2 +- src/leiningen/repl.clj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/project.clj b/project.clj index 45be63a30..1babafd07 100644 --- a/project.clj +++ b/project.clj @@ -9,7 +9,7 @@ :dependencies [[leiningen-core "2.0.0-SNAPSHOT"] [clucy "0.2.3"] [lein-newnew "0.3.1"] - [reply "0.1.0-beta5"] + [reply "0.1.0-beta6"] [org.clojure/data.xml "0.0.3"] [bultitude "0.1.5"] [clj-http "0.3.6"]] diff --git a/src/leiningen/repl.clj b/src/leiningen/repl.clj index 27b7ed1ef..41ef74d3d 100644 --- a/src/leiningen/repl.clj +++ b/src/leiningen/repl.clj @@ -20,7 +20,7 @@ [org.thnetos/cd-client "0.3.4" :exclusions [org.clojure/clojure]]]}) -(def trampoline-profile {:dependencies '[[reply "0.1.0-beta5" +(def trampoline-profile {:dependencies '[[reply "0.1.0-beta6" :exclusions [org.clojure/clojure]]]}) (defn- start-server [project port ack-port] From 37460dc32cdd5b7beeca4f51165d57b064da7c15 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Wed, 9 May 2012 19:17:14 -0700 Subject: [PATCH 15/44] Remove --update argument to search task. Deleting your clojars index is something you would want to do often; deleting your central index is something you never want to do. So having one command to do both doesn't make sense. --- src/leiningen/search.clj | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/leiningen/search.clj b/src/leiningen/search.clj index e67d734cd..55dd4cdb6 100644 --- a/src/leiningen/search.clj +++ b/src/leiningen/search.clj @@ -110,24 +110,16 @@ (defn ^:no-project-needed search "Search remote maven repositories for matching jars. -The first run will download a set of indices, which will take a while. -Pass in --update as the query to force a fresh download of all -indices. +The first run will download a set of indices, which will take a very long time. -The query is evaluated as a lucene search. You can search for simple -string matches or do more advanced queries such as this -'lein search \"clojure AND http AND NOT g:org.clojars*\"' +The query is evaluated as a lucene search. You can search for simple string +matches or do more advanced queries such as this: -Also accepts a second parameter for fetching successive -pages." + $ lein search \"clojure AND http AND NOT g:org.clojars*\" + +Also accepts a second parameter for fetching successive pages." ([project query] (search project query 1)) ([project query page] - (let [repos (:repositories project (:repositories project/defaults))] - (if (= "--update" query) - (doseq [[_ {url :url} :as repo] repos] - (doseq [f (reverse (rest (file-seq (index-location url))))] - (.delete f)) ; no delete-file-recursively; bleh - (ensure-fresh-index repo)) - (doseq [repo repos - :let [page (Integer. page)]] - (print-results repo (search-repository repo query page) page)))))) + (doseq [repo (:repositories project (:repositories project/defaults)) + :let [page (Integer. page)]] + (print-results repo (search-repository repo query page) page)))) From 3afbbb8bcd1f4998189fa3b32be2c4ee65213469 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Wed, 9 May 2012 19:17:37 -0700 Subject: [PATCH 16/44] Make sure cygpath affects LEIN_JAR. --- bin/lein | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/lein b/bin/lein index 6f8661c39..ee4ae44a8 100755 --- a/bin/lein +++ b/bin/lein @@ -27,12 +27,13 @@ do done export LEIN_HOME=${LEIN_HOME:-"$HOME/.lein"} -LEIN_JAR="$LEIN_HOME/self-installs/leiningen-$LEIN_VERSION-standalone.jar" if [ "$OSTYPE" = "cygwin" ]; then - LEIN_HOME=`cygpath -w $LEIN_HOME` + export LEIN_HOME=`cygpath -w $LEIN_HOME` fi +LEIN_JAR="$LEIN_HOME/self-installs/leiningen-$LEIN_VERSION-standalone.jar" + # normalize $0 on certain BSDs if [ "$(dirname "$0")" = "." ]; then SCRIPT="$(which $(basename "$0"))" From e8ec94cfcdbb8660be11ae5da57fc728fa27174d Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Wed, 9 May 2012 19:21:32 -0700 Subject: [PATCH 17/44] Update NEWS for preview4. --- NEWS.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/NEWS.md b/NEWS.md index 6f3574a69..4250d8bd7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,20 @@ # Leiningen News -- history of user-visible changes +## 2.0.0-preview4 / 2012-05-11 + +* Blink matching parens in repl. (Colin Jones) +* Fix a bug where repl would interfere with project agents. (Chas Emerick) +* Show repl output that is emitted after return value. (Colin Jones) +* Make it easier for plugins to undo profile merging. (David Santiago) +* Add -o alias for activating offline profile. +* Ignore $CLASSPATH environment variable. +* Fix bug where repl task couldn't be trampolined. (Colin Jones) +* Allow jar manifest entries to be dynamically calculated. +* Support map-style :javac-opts like Leiningen 1.x used. (Michael Klishin) +* Allow group-id to be specified when creating new projects. (Michael Klishin) +* Fix a bug where :dev dependencies would be exposed in pom. +* Use Clojure 1.4.0 internally; plugins have access to new Clojure features. + ## 2.0.0-preview3 / 2012-04-12 * Add HTTP nREPL support for repl task via :connect option. (Chas Emerick, From 2df87f3dda5c4cc64a5c0ac0ccbf749ad981ec0b Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Wed, 9 May 2012 19:22:04 -0700 Subject: [PATCH 18/44] Reword a few things in READMEs, todo tweaks. --- README.md | 63 ++++++++++++---------- leiningen-core/README.md | 31 ++++++----- leiningen-core/src/leiningen/core/user.clj | 1 + project.clj | 1 + todo.org | 5 +- 5 files changed, 58 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index ad0a9b27d..b2b008ef0 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@ alt="Leiningen logo" title="The man himself" align="right" /> > "Leiningen!" he shouted. "You're insane! They're not creatures you can -> fight--they're an elemental--an 'act of God!' Ten miles long, two -> miles wide--ants, nothing but ants! And every single one of them a +> fight—they're an elemental—an 'act of God!' Ten miles long, two +> miles wide—ants, nothing but ants! And every single one of them a > fiend from hell..." -> -- from Leiningen Versus the Ants by Carl Stephenson +> - from Leiningen Versus the Ants by Carl Stephenson Leiningen is for automating Clojure projects without setting your hair on fire. @@ -26,7 +26,7 @@ upon the first run on unix, so the first run will take longer. 2. Place it on your `$PATH`. (I like to use `~/bin`) 3. Set it to be executable. (`chmod 755 ~/bin/lein`) -The instructions above will install the stable release. The Leiningen 2 +The link above will get you the stable release. The Leiningen 2 [preview release](https://raw.github.com/technomancy/leiningen/preview/bin/lein) has some great new features, but not all projects and plugins have been upgraded to work with it yet. Please see the @@ -56,7 +56,7 @@ project, but here are the commonly-used tasks: $ lein jar # package up the whole project as a .jar file - $ lein install # install a project + $ lein install # install a project into the local repository $ lein search [TERM] # find jars for your project.clj dependencies @@ -83,19 +83,14 @@ The `project.clj` file in the project root should look like this: :plugins [[lein-ring "0.4.5"]]) ``` -To find specific versions of a dependency, use `lein search`. +To find specific versions of a dependency, use `lein search`, though +note that this can be extremely slow the first time you use it. -The `lein new` task generates a project skeleton with an -appropriate starting point from which you can work. See the +The `lein new` task generates a project skeleton with an appropriate +starting point from which you can work. See the [sample.project.clj](https://github.com/technomancy/leiningen/blob/preview/sample.project.clj) -file for a detailed listing of configuration options. - -You can also have user-level configuration that applies for all -projects. The `~/.lein/init.clj` file will be loaded every time -Leiningen launches; any arbitrary code may go there. This code is -executed inside Leiningen itself, not in your project. Set the -`:init-ns` key in `:repl-options` in project.clj to point to a -namespace if you want code executed inside your project in the repl. +file (also available via `lein help sample`) for a detailed listing of +configuration options. ### Profiles @@ -107,9 +102,11 @@ Clojure available in every project you hack on without modifying every single project.clj you use. By default the `:dev`, `:user`, and `:default` profiles are activated -for each task. Each profile is defined as a map which gets merged into -your project map. To add resources directories during development, add -a `:profiles` key to project.clj like so: +for each task, but the settings they provide are not propagated +downstream to projects that depend upon yours. Each profile is defined +as a map which gets merged into your project map. To add resources +directories during development, add a `:profiles` key to project.clj +like so: ```clj (defproject myproject "0.5.0-SNAPSHOT" @@ -230,6 +227,15 @@ explains how to write plugins. any of their dependencies by using the `:exclusions` key. See `lein help sample` for details. +**Q:** Why doesn't `deps` task populate the `lib` directory in version 2? +**A:** The only reason version 1 copied the jars around in the first + place was to support existing tooling that needed a cheap way to + calculate a project's classpath. Now that Leiningen has a mature + plugin ecosystem, this is no longer needed; jars can be referenced + directly out of the `~/.m2/repository` directory. If you need to see + a listing of all the dependencies that will be used and their + versions, use `lein deps :tree`. + **Q:** What does `java.lang.NoSuchMethodError: clojure.lang.RestFn.(I)V` mean? **A:** It means you have some code that was AOT (ahead-of-time) compiled with a different version of Clojure than the one you're @@ -251,7 +257,7 @@ explains how to write plugins. **Q:** What can be done to speed up launch? **A:** The main delay involved in Leiningen comes from starting the JVM. Most people use a development cycle that involves keeping a - single process running for as long as you're working on that + single REPL process running for as long as you're working on that project. Depending on your editor you may be able to do this via its Clojure integration. (See [swank-clojure](http://github.com/technomancy/swank-clojure) or @@ -267,10 +273,10 @@ explains how to write plugins. **Q:** Why is Leiningen 2 still in a preview release? **A:** As of the preview3 release, Leiningen 2 is very stable and recommended for general use. The main thing keeping it from a final - release is the fact that the Clojars repository + release is the fact that the current Clojars repository [mingles snapshots with releases](https://github.com/ato/clojars-web/issues/24), which is undesirable. Since switching the default repositories to a - releases-only Clojars (which hasn't been implemented yet) would be a + releases-only Clojars (which is still in development) would be a breaking change, a series of previews is being released in the mean time. **Q:** I don't have access to stdin inside my project. @@ -284,15 +290,16 @@ explains how to write plugins. ## Contributing Please report issues on the -[Github issue tracker](https://github.com/technomancy/leiningen/issues) +[GitHub issue tracker](https://github.com/technomancy/leiningen/issues) or the [mailing list](http://groups.google.com/group/leiningen). Personal email addresses are **not** appropriate for bug reports. See -the readme for the `leiningen-core` library and `doc/PLUGINS.md` for -more details on how Leiningen's codebase is structured. Design -discussions also occur in the +the +[readme for the leiningen-core library](https://github.com/technomancy/leiningen/blob/master/leiningen-core/README.md) +and `doc/PLUGINS.md` for more details on how Leiningen's codebase is +structured. Design discussions also occur in the [#leiningen channel on Freenode](irc://chat.freenode.net#leiningen). -Patches are preferred as Github pull requests, though patches from +Patches are preferred as GitHub pull requests, though patches from `git format-patch` are also welcome on the mailing list. Please use topic branches when sending pull requests rather than committing directly to master in order to minimize unnecessary merge commit @@ -306,7 +313,7 @@ merging if you ask on IRC or the mailing list. Contributors are also welcome to request a free [Leiningen sticker](http://twitpic.com/2e33r1) by asking on the -mailing list and mailing a SASE. +mailing list and mailing a self-addressed, stamped envelope. ## Building diff --git a/leiningen-core/README.md b/leiningen-core/README.md index b3d2e8f2c..df688e95f 100644 --- a/leiningen-core/README.md +++ b/leiningen-core/README.md @@ -1,13 +1,12 @@ # Leiningen Core This library provides the core functionality of Leiningen. This -consists of the task execution implementation and helper functions -without any of the tasks or launcher scripts. +consists of the task execution implementation, project configuration, +and helper functions. The built-in tasks and the launcher scripts are +kept in the main `leiningen` project. -More [copious documentation is available](http://technomancy.github.com/leiningen/). - -The tasks that get run come from Leiningen itself as well as any -Leiningen plugins that may be active. +More detailed [API reference](http://leiningen.org/reference.html) is +available. ## Namespaces @@ -23,8 +22,6 @@ Leiningen plugins that may be active. implements the isolation of project code from Leiningen's own code. * **leiningen.core.user** just has a handful of functions which handle user-level configuration. -* **leiningen.core.ns** contains helper functions for finding - namespaces on the classpath. ## Running Tasks @@ -51,11 +48,19 @@ visible to the project's functions. Leiningen currently implements this by launching a sub-process using `leiningen.core.eval/eval-in-project`. Any code that must execute within the context of the project (AOT compilation, test runs, repls) -needs to go through this function. This sub-process (referred to as -the "project JVM") is an entirely new invocation of the `java` command -with its own classpath calculated from functions in the -`leiningen.core.classpath` namespace. It can only communicate with -Leiningen's process via the file system, sockets, and its exit code. +needs to go through this function. Before the process is launched, the +project must be "prepped", which consists of running all the tasks +named in the project's `:prep-tasks` key. This defaults to `javac` and +`compile`, but `defproject` or profiles may add additional tasks as +necessary. All prep tasks must be cheap to call if nothing has changed +since their last invocation. + +The sub-process (referred to as the "project JVM") is an entirely new +invocation of the `java` command with its own classpath calculated +from functions in the `leiningen.core.classpath` namespace. It can +even use a different version of the JVM from Leiningen if the +`:java-cmd` key is provided. It can only communicate with Leiningen's +process via the file system, sockets, and its exit code. The exception to this rule is when `:eval-in-leiningen` in `project.clj` is true, as is commonly used for Leiningen plugins. diff --git a/leiningen-core/src/leiningen/core/user.clj b/leiningen-core/src/leiningen/core/user.clj index 4badd18d9..8ea3c24a2 100644 --- a/leiningen-core/src/leiningen/core/user.clj +++ b/leiningen-core/src/leiningen/core/user.clj @@ -10,6 +10,7 @@ (io/file (System/getProperty "user.home") ".lein"))] (.getAbsolutePath (doto lein-home .mkdirs)))) +;; TODO: is this still needed now that we have the user profile? (def init "Load the user's ~/.lein/init.clj file, if present." (memoize (fn [] diff --git a/project.clj b/project.clj index 1babafd07..a8c1dc3a6 100644 --- a/project.clj +++ b/project.clj @@ -34,6 +34,7 @@ ;; * test self-install ;; * git tag ;; * push, push tags, update stable branch +;; * publish leiningen-core docs ;; * announce on mailing list ;; * bump version numbers back to snapshot ;; * regenerate pom.xml diff --git a/todo.org b/todo.org index 7d5e53edc..e372ded5e 100644 --- a/todo.org +++ b/todo.org @@ -5,9 +5,10 @@ See also https://github.com/technomancy/leiningen/issues * For 2.0.0 ** preview4 - [X] Don't re-extract native deps (#535) - - [ ] Install task outside projects (#546) (LHF) + - [X] Make offline profile use dev profile (#514) (LHF) + - [ ] Fix $JVM_OPTS (#565) + - [ ] Move lein-newnew plugin into default profile (#540) - [ ] Force checking of snapshots (#518) (LHF) - - [ ] Make offline profile use dev profile (#514) (LHF) ** Intermediate - [X] Pretty-print pom - [X] deps :tree From edb1745f32710bbf387d2ac85d2c19f7650ce118 Mon Sep 17 00:00:00 2001 From: Juergen Hoetzel Date: Thu, 10 May 2012 17:27:13 +0200 Subject: [PATCH 19/44] Improve namespace completion performance Dont execute a grep command for each single Clojure file: Use exec '+' variant to search all Clojure files via sed only once. --- bash_completion.bash | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bash_completion.bash b/bash_completion.bash index d502a1a6e..26a5e5ea3 100644 --- a/bash_completion.bash +++ b/bash_completion.bash @@ -20,14 +20,12 @@ _lein_completion() { ;; test | retest ) # list project's test namespaces: - local namespaces=$(find test/ -type f -name "*.clj" -exec grep -E \ - '^\(ns[[:space:]]+\w+' '{}' ';' | sed -n 's/(ns[ ]*//p') + local namespaces=$(find test/ -type f -name "*.clj" -exec sed -n 's/^(ns[ ]*//p' '{}' '+') COMPREPLY=( $(compgen -W "${namespaces}" -- ${cur}) ) ;; run | compile) # list project's src namespaces: - local namespaces=$(find src/ -type f -name "*.clj" -exec grep -E \ - '^\(ns[[:space:]]+\w+' '{}' ';' | sed -n 's/(ns[ ]*//p') + local namespaces=$(find src/ -type f -name "*.clj" -exec sed -n 's/^(ns[ ]*//p' '{}' '+') COMPREPLY=( $(compgen -W "${namespaces}" -- ${cur}) ) ;; lein) From 9af28dfe8321d51d0fcf0f1178fc963afd27f40b Mon Sep 17 00:00:00 2001 From: Leonel Gayard Date: Thu, 10 May 2012 10:30:16 -0300 Subject: [PATCH 20/44] Changed launcher lein.bat to determine whether it's a source checkout by looking for directory 'src' --- bin/lein.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 bin/lein.bat diff --git a/bin/lein.bat b/bin/lein.bat old mode 100644 new mode 100755 index f2e49b2b5..c26c5d593 --- a/bin/lein.bat +++ b/bin/lein.bat @@ -34,9 +34,9 @@ set CONTEXT_CP= if exist ".lein-classpath" set /P CONTEXT_CP=<.lein-classpath if NOT "%CONTEXT_CP%"=="" set CLASSPATH="%CONTEXT_CP%";%CLASSPATH% -if exist "%~f0\..\..\src\leiningen\core.clj" ( +if exist "%~dp0..\src" ( :: Running from source checkout. - call :SET_LEIN_ROOT "%~f0\..\.." + call :SET_LEIN_ROOT "%~dp0.." set LEIN_LIBS=" for %%j in ("!LEIN_ROOT!\lib\*") do set LEIN_LIBS=!LEIN_LIBS!;%%~fj From df6e39b38a9a23fc721f85f98d580b6951f939b8 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Thu, 10 May 2012 10:32:25 -0700 Subject: [PATCH 21/44] Fix JVM_OPTS with spaces, mostly. Closes #565. Spaces in opts will still break when a space is followed by a dash. Use :jvm-opts in profiles if you can. --- leiningen-core/src/leiningen/core/eval.clj | 15 +++++++++++++-- leiningen-core/test/leiningen/core/test/eval.clj | 5 +++++ todo.org | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/leiningen-core/src/leiningen/core/eval.clj b/leiningen-core/src/leiningen/core/eval.clj index 3cc410a11..66621bd4a 100644 --- a/leiningen-core/src/leiningen/core/eval.clj +++ b/leiningen-core/src/leiningen/core/eval.clj @@ -87,12 +87,23 @@ (defn- d-property [[k v]] (format "-D%s=%s" (as-str k) v)) +;; TODO: this would still screw up with something like this: +;; export JAVA_OPTS="-Dmain.greeting=\"hello -main\" -Xmx512m" +(defn- join-broken-arg [args x] + (if (= \- (first x)) + (conj args x) + (conj (vec (butlast args)) + (str (last args) " " x)))) + +(defn ^{:internal true} get-jvm-opts-from-env [env-opts] + (when (seq env-opts) + (reduce join-broken-arg [] (.split env-opts " ")))) + (defn- get-jvm-args "Calculate command-line arguments for launching java subprocess." [project] (let [native-arch-path (native-arch-path project)] - `(~@(let [opts (System/getenv "JVM_OPTS")] - (when (seq opts) [opts])) + `(~@(get-jvm-opts-from-env (System/getenv "JVM_OPTS")) ~@(:jvm-opts project) ~@(map d-property {:clojure.compile.path (:compile-path project) (str (:name project) ".version") (:version project) diff --git a/leiningen-core/test/leiningen/core/test/eval.clj b/leiningen-core/test/leiningen/core/test/eval.clj index de740aaf4..df852ec51 100644 --- a/leiningen-core/test/leiningen/core/test/eval.clj +++ b/leiningen-core/test/leiningen/core/test/eval.clj @@ -20,3 +20,8 @@ `(spit ~(.getPath file) "foo")) (is (= "foo" (slurp file))) (.delete file)))) + +(deftest test-jvm-opts + (is (= ["-Dhello=\"guten tag\"" "-XX:+HeapDumpOnOutOfMemoryError"] + (get-jvm-opts-from-env (str "-Dhello=\"guten tag\" " + "-XX:+HeapDumpOnOutOfMemoryError"))))) \ No newline at end of file diff --git a/todo.org b/todo.org index e372ded5e..df01b688f 100644 --- a/todo.org +++ b/todo.org @@ -6,7 +6,7 @@ See also https://github.com/technomancy/leiningen/issues ** preview4 - [X] Don't re-extract native deps (#535) - [X] Make offline profile use dev profile (#514) (LHF) - - [ ] Fix $JVM_OPTS (#565) + - [X] Fix $JVM_OPTS (#565) - [ ] Move lein-newnew plugin into default profile (#540) - [ ] Force checking of snapshots (#518) (LHF) ** Intermediate From 809519d05adec6d3a2056473e999955ec1fa3456 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Thu, 10 May 2012 10:32:39 -0700 Subject: [PATCH 22/44] Remove unused script templates. --- resources/script-template | 17 ----------------- resources/script-template.bat | 13 ------------- 2 files changed, 30 deletions(-) delete mode 100644 resources/script-template delete mode 100644 resources/script-template.bat diff --git a/resources/script-template b/resources/script-template deleted file mode 100644 index 140b27ad6..000000000 --- a/resources/script-template +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# This script was automatically generated by Leiningen. - -CLASSPATH="%s" -NULL_DEVICE=/dev/null -JVM_OPTS=${JVM_OPTS:-$JAVA_OPTS} -MAIN="%s" -VERSION="%s" - -if [ "$OSTYPE" = "cygwin" ]; then - CLASSPATH=`cygpath -wp "$CLASSPATH"` - NULL_DEVICE=NUL -fi - -java -cp "$CLASSPATH" $JVM_OPTS -Dproject.version=$VERSION \ - clojure.main -e "(use '$MAIN)(apply -main *command-line-args*)" $NULL_DEVICE "$@" diff --git a/resources/script-template.bat b/resources/script-template.bat deleted file mode 100644 index 518991283..000000000 --- a/resources/script-template.bat +++ /dev/null @@ -1,13 +0,0 @@ -@echo off - -rem This script was automatically generated by Leiningen. - -setLocal - -if "x%%JVM_OPTS%%" == "x" set JVM_OPTS=%%JAVA_OPTS%% -set CLASSPATH="%s" -set MAIN="%s" -set VERSION="%s" - -java -cp "%%CLASSPATH%%" %%JVM_OPTS%% -Dproject.version=%%VERSION%%^ - clojure.main -e "(use '%%MAIN%%)(apply -main *command-line-args*)" NUL %%* From 3ec53df7223f2cc4267e7d8653cb2e42ec35bbe5 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Thu, 10 May 2012 11:03:25 -0700 Subject: [PATCH 23/44] Fix tests to not spew out "stale" directories in root. --- leiningen-core/test/leiningen/core/test/classpath.clj | 1 + leiningen-core/test/leiningen/core/test/eval.clj | 1 + 2 files changed, 2 insertions(+) diff --git a/leiningen-core/test/leiningen/core/test/classpath.clj b/leiningen-core/test/leiningen/core/test/classpath.clj index 702c2b0c7..b273fb70b 100644 --- a/leiningen-core/test/leiningen/core/test/classpath.clj +++ b/leiningen-core/test/leiningen/core/test/classpath.clj @@ -20,6 +20,7 @@ :exclusions [commons-codec]]] :repositories (:repositories project/defaults) :root "/tmp/lein-sample-project" + :target-path "/tmp/lein-sample-project/target" :source-paths ["/tmp/lein-sample-project/src"] :resource-paths ["/tmp/lein-sample-project/resources"] :test-paths ["/tmp/lein-sample-project/test"]}) diff --git a/leiningen-core/test/leiningen/core/test/eval.clj b/leiningen-core/test/leiningen/core/test/eval.clj index df852ec51..96ae94a50 100644 --- a/leiningen-core/test/leiningen/core/test/eval.clj +++ b/leiningen-core/test/leiningen/core/test/eval.clj @@ -7,6 +7,7 @@ (def project {:dependencies '[[org.clojure/clojure "1.3.0"]] :root "/tmp/lein-sample-project" + :target-path "/tmp/lein-sample-project/target" :source-path ["/tmp/lein-sample-project/src"] :resources-path ["/tmp/lein-sample-project/resources"] :test-path ["/tmp/lein-sample-project/test"] From af2bcd1f0fe8797132c10f42d931b230a2fe4632 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Thu, 10 May 2012 11:14:52 -0700 Subject: [PATCH 24/44] Move lein-newnew plugin to default profile. Fixes #540. --- leiningen-core/src/leiningen/core/project.clj | 3 ++- project.clj | 1 - todo.org | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/leiningen-core/src/leiningen/core/project.clj b/leiningen-core/src/leiningen/core/project.clj index b3562721a..50639b83a 100755 --- a/leiningen-core/src/leiningen/core/project.clj +++ b/leiningen-core/src/leiningen/core/project.clj @@ -121,7 +121,8 @@ (def default-profiles "Profiles get merged into the project map. The :dev and :user profiles are active by default." - (atom {:default {:resource-paths ["dev-resources"]} + (atom {:default {:resource-paths ["dev-resources"] + :plugins [[lein-newnew "0.3.1"]]} :test {} :offline {:offline? true} :debug {:debug true}})) diff --git a/project.clj b/project.clj index a8c1dc3a6..a2fd11fef 100644 --- a/project.clj +++ b/project.clj @@ -8,7 +8,6 @@ :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[leiningen-core "2.0.0-SNAPSHOT"] [clucy "0.2.3"] - [lein-newnew "0.3.1"] [reply "0.1.0-beta6"] [org.clojure/data.xml "0.0.3"] [bultitude "0.1.5"] diff --git a/todo.org b/todo.org index df01b688f..a968e6b9c 100644 --- a/todo.org +++ b/todo.org @@ -7,7 +7,7 @@ See also https://github.com/technomancy/leiningen/issues - [X] Don't re-extract native deps (#535) - [X] Make offline profile use dev profile (#514) (LHF) - [X] Fix $JVM_OPTS (#565) - - [ ] Move lein-newnew plugin into default profile (#540) + - [X] Move lein-newnew plugin into default profile (#540) - [ ] Force checking of snapshots (#518) (LHF) ** Intermediate - [X] Pretty-print pom From bf7256ad944f466412526f36dfe3526b283e76a7 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Thu, 10 May 2012 11:44:31 -0700 Subject: [PATCH 25/44] Untabify bin/lein. --- bin/lein | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/lein b/bin/lein index ee4ae44a8..3e66b5d40 100755 --- a/bin/lein +++ b/bin/lein @@ -81,8 +81,9 @@ if [ -r "$BIN_DIR/../src/leiningen/version.clj" ]; then ORIG_PWD="$PWD" cd "$LEIN_DIR" - $0 classpath .lein-classpath - sum $LEIN_DIR/project.clj $LEIN_DIR/leiningen-core/project.clj > .lein-project-checksum + $0 classpath .lein-classpath + sum $LEIN_DIR/project.clj $LEIN_DIR/leiningen-core/project.clj > \ + .lein-project-checksum cd "$ORIG_PWD" fi From 0386485b8780b8ba0b96b112fa414a35524554ca Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Thu, 10 May 2012 12:05:09 -0700 Subject: [PATCH 26/44] Quote lein-newnew in default profile. --- leiningen-core/src/leiningen/core/project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leiningen-core/src/leiningen/core/project.clj b/leiningen-core/src/leiningen/core/project.clj index 50639b83a..394fc4cf2 100755 --- a/leiningen-core/src/leiningen/core/project.clj +++ b/leiningen-core/src/leiningen/core/project.clj @@ -122,7 +122,7 @@ "Profiles get merged into the project map. The :dev and :user profiles are active by default." (atom {:default {:resource-paths ["dev-resources"] - :plugins [[lein-newnew "0.3.1"]]} + :plugins [['lein-newnew "0.3.1"]]} :test {} :offline {:offline? true} :debug {:debug true}})) From cdd79b29065c58e906493b8b06cae582e3b39506 Mon Sep 17 00:00:00 2001 From: John Szakmeister Date: Fri, 11 May 2012 08:25:44 -0400 Subject: [PATCH 27/44] Update the news symlink to point at NEWS.md --- resources/leiningen/help/news | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/leiningen/help/news b/resources/leiningen/help/news index 1689a37e1..1ee46aa38 120000 --- a/resources/leiningen/help/news +++ b/resources/leiningen/help/news @@ -1 +1 @@ -../../../NEWS \ No newline at end of file +../../../NEWS.md \ No newline at end of file From ef11cb44800dc57a2ea1c97ddbe9c2cdd113384c Mon Sep 17 00:00:00 2001 From: Leonel Gayard Date: Fri, 11 May 2012 14:14:02 -0300 Subject: [PATCH 28/44] Improvements in lein.bat. Changed to look for file .lein-classpath only when running from source checkout. Fixed construction of variable CLASSPATH to avoid unnecessary quotes and semi colons. Removed option Xbootclasspath from command line. --- bin/lein.bat | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/bin/lein.bat b/bin/lein.bat index c26c5d593..ca5772b67 100755 --- a/bin/lein.bat +++ b/bin/lein.bat @@ -24,34 +24,38 @@ if "x%LEIN_HOME%" == "x" ( set LEIN_HOME=%USERPROFILE%\.lein ) -if "x%LEIN_JAR%" == "x" set LEIN_JAR="!LEIN_HOME!\self-installs\leiningen-!LEIN_VERSION!-standalone.jar" +if "x%LEIN_JAR%" == "x" set LEIN_JAR=!LEIN_HOME!\self-installs\leiningen-!LEIN_VERSION!-standalone.jar if "%1" == "self-install" goto SELF_INSTALL if "%1" == "upgrade" goto NO_UPGRADE -:: Apply context specific CLASSPATH entries -set CONTEXT_CP= -if exist ".lein-classpath" set /P CONTEXT_CP=<.lein-classpath -if NOT "%CONTEXT_CP%"=="" set CLASSPATH="%CONTEXT_CP%";%CLASSPATH% - -if exist "%~dp0..\src" ( +if exist "%~dp0..\src\leiningen" ( :: Running from source checkout. call :SET_LEIN_ROOT "%~dp0.." - set LEIN_LIBS=" - for %%j in ("!LEIN_ROOT!\lib\*") do set LEIN_LIBS=!LEIN_LIBS!;%%~fj - set LEIN_LIBS=!LEIN_LIBS!" + set LEIN_LIBS= + for %%j in ("!LEIN_ROOT!\leiningen-core\lib\*") do set LEIN_LIBS=!LEIN_LIBS!%%~fj; + set LEIN_LIBS=!LEIN_LIBS! + + if "x!LEIN_LIBS!" == "x" goto NO_DEPENDENCIES - if "x!LEIN_LIBS!" == "x" if not exist %LEIN_JAR% goto NO_DEPENDENCIES + set CLASSPATH=!LEIN_LIBS!!LEIN_ROOT!\leiningen-core\src;!LEIN_ROOT!\leiningen-core\test;!LEIN_ROOT!\src;!LEIN_ROOT!\resources - set CLASSPATH=%CONTEXT_CP%;!LEIN_LIBS!;"!LEIN_ROOT!\src";"!LEIN_ROOT!\resources";%LEIN_JAR% + :: Apply context specific CLASSPATH entries + if exist %~dp0..\.lein-classpath ( + set /P CONTEXT_CP=< %~dp0..\.lein-classpath + + if NOT "x!CONTEXT_CP!"=="x" ( + set CLASSPATH=!CONTEXT_CP!;!CLASSPATH! + ) + ) ) else ( :: Not running from a checkout. if not exist %LEIN_JAR% goto NO_LEIN_JAR - set CLASSPATH=%CONTEXT_CP%;%LEIN_JAR% + set CLASSPATH=%LEIN_JAR% ) -if not "x%DEBUG%" == "x" echo CLASSPATH=%CLASSPATH% +if not "x%DEBUG%" == "x" echo CLASSPATH=!CLASSPATH! :: ################################################## @@ -184,7 +188,7 @@ del "%TRAMPOLINE_FILE%" goto EOF :RUN_NORMAL -%JAVA_CMD% -client %LEIN_JVM_OPTS% -Xbootclasspath/a:"%CLOJURE_JAR%" ^ +%JAVA_CMD% -client %LEIN_JVM_OPTS% ^ -Dleiningen.original.pwd="%ORIGINAL_PWD%" ^ -cp "%CLASSPATH%" clojure.main -m leiningen.core.main %* From 176bcf5e6d574589464e3ff96cc23540231a9e28 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 11:29:57 -0700 Subject: [PATCH 29/44] Add :update support at the top-level of the project map. --- leiningen-core/src/leiningen/core/classpath.clj | 12 +++++++----- .../test/leiningen/core/test/classpath.clj | 5 +++-- sample.project.clj | 9 ++++++++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/leiningen-core/src/leiningen/core/classpath.clj b/leiningen-core/src/leiningen/core/classpath.clj index 4b1b0795e..2e45b52d8 100644 --- a/leiningen-core/src/leiningen/core/classpath.clj +++ b/leiningen-core/src/leiningen/core/classpath.clj @@ -87,9 +87,6 @@ (re-matches re? url))] cred)))]))) -(defn add-auth [repositories] - (map add-repo-auth repositories)) - (defn get-proxy-settings "Returns a map of the JVM proxy settings" [] @@ -104,11 +101,14 @@ :username username :password password}))) +(defn- update-policy [update [repo-name opts]] + [repo-name (if update (assoc opts :update update) opts)]) + (defn- root-cause [e] (last (take-while identity (iterate (memfn getCause) e)))) (defn- get-dependencies - [dependencies-key {:keys [repositories local-repo offline?] :as project} + [dependencies-key {:keys [repositories local-repo offline? update] :as project} & {:keys [add-classpath?]}] {:pre [(every? vector? (project dependencies-key))]} (try @@ -117,7 +117,9 @@ aether/resolve-dependencies) :local-repo local-repo :offline? offline? - :repositories (add-auth repositories) + :repositories (->> repositories + (map add-repo-auth) + (map (partial update-policy update))) :coordinates (project dependencies-key) :transfer-listener :stdout :proxy (get-proxy-settings)) diff --git a/leiningen-core/test/leiningen/core/test/classpath.clj b/leiningen-core/test/leiningen/core/test/classpath.clj index b273fb70b..6b58ced1c 100644 --- a/leiningen-core/test/leiningen/core/test/classpath.clj +++ b/leiningen-core/test/leiningen/core/test/classpath.clj @@ -87,5 +87,6 @@ (is (= [["sonatype" {:url "https://oss.sonatype.org/"}] ["internal" {:password "reindur" :username "milgrim" :url "https://sekrit.info/repo"}]] - (add-auth [["sonatype" {:url "https://oss.sonatype.org/"}] - ["internal" {:url "https://sekrit.info/repo"}]]))))) + (map add-repo-auth + [["sonatype" {:url "https://oss.sonatype.org/"}] + ["internal" {:url "https://sekrit.info/repo"}]]))))) diff --git a/sample.project.clj b/sample.project.clj index 59f7641d4..8a8460d7a 100644 --- a/sample.project.clj +++ b/sample.project.clj @@ -127,7 +127,10 @@ ;; You can also set the policies for how to handle :checksum ;; failures to :fail, :warn, or :ignore. In :releases, :daily, ;; :always, and :never are supported. - :releases {:checksum :fail :update :always}} + :releases {:checksum :fail :update :always} + ;; You can set :checksum and :update here for them + ;; to apply to both :releases and :snapshots: + :update :always, :checksum :fail} ;; Repositories named "snapshots" and "releases" automatically ;; have their :snapshots and :releases disabled as appropriate. ;; Credentials for repositories should *not* be stored @@ -137,6 +140,10 @@ ;; :password "locative.1"}}}} "snapshots" "http://blueant.com/archiva/snapshots" "releases" "http://blueant.com/archiva/internal"} + ;; You can set :update and :checksum policies here to have them + ;; apply for all :repositories. Usually you will not set this + ;; directly but apply the "update" profile instead. + :update :always ;; the deploy task will give preference to repositories specified in ;; :deploy-repositories, and repos listed there will not be used for ;; dependency resolution. From 2af8f1fcb84e4a349fb81258cbb8efe7e9dc304d Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 11:30:31 -0700 Subject: [PATCH 30/44] Add :update profile and -U alias for applying it. --- leiningen-core/src/leiningen/core/main.clj | 1 + leiningen-core/src/leiningen/core/project.clj | 1 + 2 files changed, 2 insertions(+) diff --git a/leiningen-core/src/leiningen/core/main.clj b/leiningen-core/src/leiningen/core/main.clj index 26d9b1e68..053b05290 100644 --- a/leiningen-core/src/leiningen/core/main.clj +++ b/leiningen-core/src/leiningen/core/main.clj @@ -8,6 +8,7 @@ (def aliases (atom {"--help" "help", "-h" "help", "-?" "help", "-v" "version" "--version" "version", "überjar" "uberjar" "-o" ["with-profile" "offline,dev,user,default"] + "-U" ["with-profile" "update,dev,user,default"] "cp" "classpath" "halp" "help" "with-profiles" "with-profile" "readme" ["help" "readme"] diff --git a/leiningen-core/src/leiningen/core/project.clj b/leiningen-core/src/leiningen/core/project.clj index 394fc4cf2..7853de362 100755 --- a/leiningen-core/src/leiningen/core/project.clj +++ b/leiningen-core/src/leiningen/core/project.clj @@ -124,6 +124,7 @@ (atom {:default {:resource-paths ["dev-resources"] :plugins [['lein-newnew "0.3.1"]]} :test {} + :update {:update :always} :offline {:offline? true} :debug {:debug true}})) From 221ba6ff3721e5528234a0e351cfe34de845042a Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 11:30:49 -0700 Subject: [PATCH 31/44] Move pom.xml file back to the root of the project. --- src/leiningen/pom.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/leiningen/pom.clj b/src/leiningen/pom.clj index c978df5ef..83ca8672a 100644 --- a/src/leiningen/pom.clj +++ b/src/leiningen/pom.clj @@ -326,7 +326,7 @@ "Write a pom.xml file to disk for Maven interoperability." ([project pom-location] (let [pom (make-pom project true) - pom-file (io/file (:target-path project) pom-location)] + pom-file (io/file (:root project) pom-location)] (.mkdirs (.getParentFile pom-file)) (with-open [pom-writer (io/writer pom-file)] (.write pom-writer pom)) From 3780bf6699b4f7465f3a982e0c8bc07aec333602 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 11:38:48 -0700 Subject: [PATCH 32/44] Ignore target-path from project reading test. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e23ec5c45..ce94ee5b8 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ docs /leiningen-core/.lein-plugins/checksum /wiki TAGS +/leiningen-core/dev-resources/target From 7d641026e4a0ba38dc9f1f3fb18832dc03949e67 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 11:43:37 -0700 Subject: [PATCH 33/44] Allow :checksum policy to be set at the top-level of project.clj as well. --- leiningen-core/src/leiningen/core/classpath.clj | 15 +++++++++++---- sample.project.clj | 2 +- todo.org | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/leiningen-core/src/leiningen/core/classpath.clj b/leiningen-core/src/leiningen/core/classpath.clj index 2e45b52d8..fd00bc4b5 100644 --- a/leiningen-core/src/leiningen/core/classpath.clj +++ b/leiningen-core/src/leiningen/core/classpath.clj @@ -53,6 +53,10 @@ "Call f with args when keys in project.clj have changed since the last run. Stores value of project keys in stale directory inside :target-path." [keys project f & args] + (prn :target-path (:target-path project)) + (when-not (:target-path project) + (prn :no-target project) + (throw (Exception. "No target path!"))) (let [file (io/file (:target-path project) "stale" (str/join "+" (map name keys))) current-value (pr-str (map (juxt identity project) keys)) @@ -101,14 +105,17 @@ :username username :password password}))) -(defn- update-policy [update [repo-name opts]] - [repo-name (if update (assoc opts :update update) opts)]) +(defn- update-policies [update checksum [repo-name opts]] + (let [opts (if update (assoc opts :update update) opts) + opts (if checksum (assoc opts :checksum checksum) opts)] + [repo-name opts])) (defn- root-cause [e] (last (take-while identity (iterate (memfn getCause) e)))) (defn- get-dependencies - [dependencies-key {:keys [repositories local-repo offline? update] :as project} + [dependencies-key {:keys [repositories local-repo offline? update checksum] + :as project} & {:keys [add-classpath?]}] {:pre [(every? vector? (project dependencies-key))]} (try @@ -119,7 +126,7 @@ :offline? offline? :repositories (->> repositories (map add-repo-auth) - (map (partial update-policy update))) + (map (partial update-policies update checksum))) :coordinates (project dependencies-key) :transfer-listener :stdout :proxy (get-proxy-settings)) diff --git a/sample.project.clj b/sample.project.clj index 8a8460d7a..ea83b6840 100644 --- a/sample.project.clj +++ b/sample.project.clj @@ -141,7 +141,7 @@ "snapshots" "http://blueant.com/archiva/snapshots" "releases" "http://blueant.com/archiva/internal"} ;; You can set :update and :checksum policies here to have them - ;; apply for all :repositories. Usually you will not set this + ;; apply for all :repositories. Usually you will not set :update ;; directly but apply the "update" profile instead. :update :always ;; the deploy task will give preference to repositories specified in diff --git a/todo.org b/todo.org index a968e6b9c..439501511 100644 --- a/todo.org +++ b/todo.org @@ -8,7 +8,7 @@ See also https://github.com/technomancy/leiningen/issues - [X] Make offline profile use dev profile (#514) (LHF) - [X] Fix $JVM_OPTS (#565) - [X] Move lein-newnew plugin into default profile (#540) - - [ ] Force checking of snapshots (#518) (LHF) + - [X] Force checking of snapshots (#518) (LHF) ** Intermediate - [X] Pretty-print pom - [X] deps :tree From 893dbd4b82c70eb573f7c75541fb5d2d7ebc88ec Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 13:45:53 -0700 Subject: [PATCH 34/44] Remove stray printing. [ci skip] --- leiningen-core/src/leiningen/core/classpath.clj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/leiningen-core/src/leiningen/core/classpath.clj b/leiningen-core/src/leiningen/core/classpath.clj index fd00bc4b5..854466378 100644 --- a/leiningen-core/src/leiningen/core/classpath.clj +++ b/leiningen-core/src/leiningen/core/classpath.clj @@ -53,10 +53,6 @@ "Call f with args when keys in project.clj have changed since the last run. Stores value of project keys in stale directory inside :target-path." [keys project f & args] - (prn :target-path (:target-path project)) - (when-not (:target-path project) - (prn :no-target project) - (throw (Exception. "No target path!"))) (let [file (io/file (:target-path project) "stale" (str/join "+" (map name keys))) current-value (pr-str (map (juxt identity project) keys)) From 54cc37867196139527a014c89798820179f2dd25 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 14:10:18 -0700 Subject: [PATCH 35/44] Move :checkout-deps-shares to default profile. This will prevent checkout deps from being used when just the production profile is active. Also, this may be the first legitimate use of flatten I've ever seen. --- leiningen-core/src/leiningen/core/classpath.clj | 6 +----- leiningen-core/src/leiningen/core/project.clj | 6 +++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/leiningen-core/src/leiningen/core/classpath.clj b/leiningen-core/src/leiningen/core/classpath.clj index 854466378..69ac4960c 100644 --- a/leiningen-core/src/leiningen/core/classpath.clj +++ b/leiningen-core/src/leiningen/core/classpath.clj @@ -24,11 +24,7 @@ "as it does not contain a project.clj file.")))) (defn- checkout-dep-paths [project dep dep-project] - (if-let [shares (:checkout-deps-shares project)] - (map #(% dep-project) shares) - (concat (:source-paths dep-project) - (:resource-paths dep-project) - [(:compile-path dep-project)]))) + (flatten (map dep-project shares))) (defn- checkout-deps-paths "Checkout dependencies are used to place source for a dependency diff --git a/leiningen-core/src/leiningen/core/project.clj b/leiningen-core/src/leiningen/core/project.clj index 7853de362..ccc8b6d57 100755 --- a/leiningen-core/src/leiningen/core/project.clj +++ b/leiningen-core/src/leiningen/core/project.clj @@ -122,7 +122,11 @@ "Profiles get merged into the project map. The :dev and :user profiles are active by default." (atom {:default {:resource-paths ["dev-resources"] - :plugins [['lein-newnew "0.3.1"]]} + :plugins [['lein-newnew "0.3.1"]] + :checkout-deps-shares [:source-paths + :resource-paths + :compile-path]} + :production {} :test {} :update {:update :always} :offline {:offline? true} From c918f53b0f0666154ab5b1a421d2174c72784860 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 14:14:19 -0700 Subject: [PATCH 36/44] Fix typo. --- leiningen-core/src/leiningen/core/classpath.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leiningen-core/src/leiningen/core/classpath.clj b/leiningen-core/src/leiningen/core/classpath.clj index 69ac4960c..1fb0924fd 100644 --- a/leiningen-core/src/leiningen/core/classpath.clj +++ b/leiningen-core/src/leiningen/core/classpath.clj @@ -24,7 +24,7 @@ "as it does not contain a project.clj file.")))) (defn- checkout-dep-paths [project dep dep-project] - (flatten (map dep-project shares))) + (flatten (map dep-project (:checkout-deps-shares project)))) (defn- checkout-deps-paths "Checkout dependencies are used to place source for a dependency From 0217536ffa8925c94ed7ba1f80428ed8953ceb58 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 14:20:20 -0700 Subject: [PATCH 37/44] Fix classpath test. --- leiningen-core/test/leiningen/core/test/classpath.clj | 1 + 1 file changed, 1 insertion(+) diff --git a/leiningen-core/test/leiningen/core/test/classpath.clj b/leiningen-core/test/leiningen/core/test/classpath.clj index 6b58ced1c..426ae0397 100644 --- a/leiningen-core/test/leiningen/core/test/classpath.clj +++ b/leiningen-core/test/leiningen/core/test/classpath.clj @@ -18,6 +18,7 @@ (def project {:dependencies '[[org.clojure/clojure "1.3.0"] [ring/ring-core "1.0.0-RC1" :exclusions [commons-codec]]] + :checkout-deps-shares [:source-paths :resource-paths :compile-path] :repositories (:repositories project/defaults) :root "/tmp/lein-sample-project" :target-path "/tmp/lein-sample-project/target" From 625da9aa5cb6dbee32b327c7e2cede335f6e1b8f Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 14:52:52 -0700 Subject: [PATCH 38/44] Apply tiered compilation to the project JVM, not just Leiningen's own. --- leiningen-core/src/leiningen/core/project.clj | 1 + 1 file changed, 1 insertion(+) diff --git a/leiningen-core/src/leiningen/core/project.clj b/leiningen-core/src/leiningen/core/project.clj index ccc8b6d57..4f76937ee 100755 --- a/leiningen-core/src/leiningen/core/project.clj +++ b/leiningen-core/src/leiningen/core/project.clj @@ -123,6 +123,7 @@ profiles are active by default." (atom {:default {:resource-paths ["dev-resources"] :plugins [['lein-newnew "0.3.1"]] + :jvm-opts ["-XX:+TieredCompilation"] :checkout-deps-shares [:source-paths :resource-paths :compile-path]} From 139e1014d57f0b7b138728318ce02ab0a0a89815 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 12 May 2012 01:15:47 +0300 Subject: [PATCH 39/44] Fixed some quotes. --- bin/lein.bat | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/lein.bat b/bin/lein.bat index ca5772b67..7fae04982 100755 --- a/bin/lein.bat +++ b/bin/lein.bat @@ -51,7 +51,7 @@ if exist "%~dp0..\src\leiningen" ( ) ) else ( :: Not running from a checkout. - if not exist %LEIN_JAR% goto NO_LEIN_JAR + if not exist "%LEIN_JAR%" goto NO_LEIN_JAR set CLASSPATH=%LEIN_JAR% ) @@ -81,11 +81,12 @@ echo. goto EOF :SELF_INSTALL -if exist %LEIN_JAR% ( +if exist "%LEIN_JAR%" ( echo %LEIN_JAR% already exists. Delete and retry. goto EOF ) -for %%f in (%LEIN_JAR%) do set LEIN_INSTALL_DIR="%%~dpf" + +for %%f in ("%LEIN_JAR%") do set LEIN_INSTALL_DIR="%%~dpf" if not exist %LEIN_INSTALL_DIR% mkdir %LEIN_INSTALL_DIR% echo Downloading Leiningen now... @@ -99,7 +100,7 @@ if ERRORLEVEL 9009 ( ) :: set LEIN_JAR_URL=https://github.com/downloads/technomancy/leiningen/leiningen-%LEIN_VERSION%-standalone.jar set LEIN_JAR_URL=https://cloud.github.com/downloads/technomancy/leiningen/leiningen-%LEIN_VERSION%-standalone.jar -%HTTP_CLIENT% %LEIN_JAR% %LEIN_JAR_URL% +%HTTP_CLIENT% "%LEIN_JAR%" %LEIN_JAR_URL% if ERRORLEVEL 1 ( del %LEIN_JAR%>nul 2>&1 goto DOWNLOAD_FAILED From 432bded45616435ea8d98d40e44482c021d2c4a6 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 16:13:43 -0700 Subject: [PATCH 40/44] More news. [ci skip] --- NEWS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index 4250d8bd7..80358895a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,10 @@ ## 2.0.0-preview4 / 2012-05-11 +* Checkout dependencies are not applied with production profile. +* Move pom.xml back to the project root. +* Add -U alias for forcing updates of snapshots. +* Support setting :update and :checksum profiles at top level of project. * Blink matching parens in repl. (Colin Jones) * Fix a bug where repl would interfere with project agents. (Chas Emerick) * Show repl output that is emitted after return value. (Colin Jones) From 95e3863d3f2f64910d2f19f3ae1ede0b447feaf2 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 16:21:17 -0700 Subject: [PATCH 41/44] Make in-project .lein-classpath work for specifying plugins. Fixes #508. --- bin/lein | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/lein b/bin/lein index 3e66b5d40..920f66f21 100755 --- a/bin/lein +++ b/bin/lein @@ -94,6 +94,9 @@ if [ -r "$BIN_DIR/../src/leiningen/version.clj" ]; then CLASSPATH="$CLASSPATH:$LEIN_DIR/leiningen-core/lib/*" CLASSPATH="$CLASSPATH:$LEIN_DIR/test:$LEIN_DIR/target/classes" CLASSPATH="$CLASSPATH:$LEIN_DIR/src:$LEIN_DIR/resources:$LEIN_JAR" + if [ -f .lein-classpath ]; then + CLASSPATH="`cat .lein-classpath`:$CLASSPATH" + fi else # Not running from a checkout # apply context specific CLASSPATH entries if [ -f .lein-classpath ]; then From 20a6cacdfc9d7e038436a224f4bbf14c266bd892 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 18:01:49 -0700 Subject: [PATCH 42/44] Use unmerge-profiles in jar and uberjar. --- src/leiningen/jar.clj | 5 ++--- src/leiningen/uberjar.clj | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/leiningen/jar.clj b/src/leiningen/jar.clj index a8db197a3..30aec6fbd 100644 --- a/src/leiningen/jar.clj +++ b/src/leiningen/jar.clj @@ -2,6 +2,7 @@ "Package up all the project's files into a jar file." (:require [leiningen.pom :as pom] [leiningen.core.classpath :as classpath] + [leiningen.core.project :as project] [leiningen.core.eval :as eval] [leiningen.core.main :as main] [clojure.string :as string] @@ -192,9 +193,7 @@ Create a $PROJECT-$VERSION.jar file containing project's source files as well as .class files if applicable. If project.clj contains a :main key, the -main function in that namespace will be used as the main-class for executable jar." [project] - ;; TODO: we should just remove the default profiles, not use :without-profiles - ;; Fix once #512 lands - (let [project (:without-profiles (meta project) project)] + (let [project (project/unmerge-profiles project [:default :dev :user])] (eval/prep project) (let [jar-file (get-jar-filename project)] (write-jar project jar-file (filespecs project [])) diff --git a/src/leiningen/uberjar.clj b/src/leiningen/uberjar.clj index a086f3f00..1eb8ffac9 100644 --- a/src/leiningen/uberjar.clj +++ b/src/leiningen/uberjar.clj @@ -4,6 +4,7 @@ [clojure.zip :as zip] [clojure.java.io :as io] [leiningen.core.classpath :as classpath] + [leiningen.core.project :as project] [leiningen.core.main :as main] [leiningen.jar :as jar]) (:import (java.util.zip ZipFile ZipOutputStream ZipEntry) @@ -87,7 +88,7 @@ as well as defining a -main function." (with-open [out (-> standalone-filename (FileOutputStream.) (ZipOutputStream.))] - (let [project (:without-profiles (meta project) project) + (let [project (project/unmerge-profiles project [:default :dev :user]) deps (->> (classpath/resolve-dependencies :dependencies project) (filter #(.endsWith (.getName %) ".jar"))) jars (cons (io/file (jar/get-jar-filename project)) deps)] From 104726ee717dc0c5095eb9dba8cabbd41126aee1 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 18:07:07 -0700 Subject: [PATCH 43/44] Release 2.0.0-preview4. --- bin/lein | 2 +- bin/lein.bat | 2 +- leiningen-core/project.clj | 2 +- project.clj | 16 +++++++++++----- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/bin/lein b/bin/lein index 920f66f21..6496aaf30 100755 --- a/bin/lein +++ b/bin/lein @@ -1,6 +1,6 @@ #!/bin/bash -LEIN_VERSION="2.0.0-SNAPSHOT" +LEIN_VERSION="2.0.0-preview4" export LEIN_VERSION case $LEIN_VERSION in diff --git a/bin/lein.bat b/bin/lein.bat index 7fae04982..f9c6c22e8 100755 --- a/bin/lein.bat +++ b/bin/lein.bat @@ -1,6 +1,6 @@ @echo off -set LEIN_VERSION=2.0.0-preview3 +set LEIN_VERSION=2.0.0-preview4 setLocal EnableExtensions EnableDelayedExpansion diff --git a/leiningen-core/project.clj b/leiningen-core/project.clj index 7bc74a7e8..12ac78c89 100644 --- a/leiningen-core/project.clj +++ b/leiningen-core/project.clj @@ -1,4 +1,4 @@ -(defproject leiningen-core "2.0.0-SNAPSHOT" +(defproject leiningen-core "2.0.0-preview4" :url "https://github.com/technomancy/leiningen" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} diff --git a/project.clj b/project.clj index a2fd11fef..4eed1dec6 100644 --- a/project.clj +++ b/project.clj @@ -1,12 +1,12 @@ ;; This is Leiningen's own project configuration. See doc/TUTORIAL.md ;; file as well as sample.project.clj for help writing your own. -(defproject leiningen "2.0.0-SNAPSHOT" +(defproject leiningen "2.0.0-preview4" :description "Automate Clojure projects without setting your hair on fire." :url "https://github.com/technomancy/leiningen" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} - :dependencies [[leiningen-core "2.0.0-SNAPSHOT"] + :dependencies [[leiningen-core "2.0.0-preview4"] [clucy "0.2.3"] [reply "0.1.0-beta6"] [org.clojure/data.xml "0.0.3"] @@ -15,7 +15,13 @@ ;; checkout-deps don't work with :eval-in :leiningen :profiles {:dev {:resource-paths ["leiningen-core/dev-resources"] :test-paths ["leiningen-core/test"]} - :release {:aot [#"leiningen"]}} + :release {:aot [#"leiningen" + cemerick.pomegranate + cemerick.drawbridge + classlojure.core + clojure.tools.nrepl + clj-http.core + ordered.map]}} :test-selectors {:default (complement :post-preview) :offline (complement :online)} :source-paths ["leiningen-core/src" "src"] @@ -25,9 +31,9 @@ ;; * update NEWS, bin/lein, bin/lein.bat, project.clj, leiningen-core/project.clj ;; * publish leiningen-core to clojars -;; * rm -rf target ~/.lein/self-installs/leiningen-*-SNAPSHOT-standalone.jar +;; * rm -rf target leiningen-core/target ;; * temporarily add :aot :all to leiningen-core/project.clj; lein install -;; * bin/lein uberjar, copy standalone to ~/.lein/self-installs +;; * bin/lein with-profile release uberjar, copy standalone to ~/.lein/self-installs ;; * ensure "time lein version" isn't bad ;; * upload to github ;; * test self-install From 93bb6a1e146a674c6e91ea6aa5f01163073556ee Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 11 May 2012 18:46:25 -0700 Subject: [PATCH 44/44] Bump back to 2.0.0-SNAPSHOT. --- bin/lein | 2 +- bin/lein.bat | 2 +- leiningen-core/project.clj | 2 +- project.clj | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/lein b/bin/lein index 6496aaf30..920f66f21 100755 --- a/bin/lein +++ b/bin/lein @@ -1,6 +1,6 @@ #!/bin/bash -LEIN_VERSION="2.0.0-preview4" +LEIN_VERSION="2.0.0-SNAPSHOT" export LEIN_VERSION case $LEIN_VERSION in diff --git a/bin/lein.bat b/bin/lein.bat index f9c6c22e8..7c67f60a1 100755 --- a/bin/lein.bat +++ b/bin/lein.bat @@ -1,6 +1,6 @@ @echo off -set LEIN_VERSION=2.0.0-preview4 +set LEIN_VERSION=2.0.0-SNAPSHOT setLocal EnableExtensions EnableDelayedExpansion diff --git a/leiningen-core/project.clj b/leiningen-core/project.clj index 12ac78c89..7bc74a7e8 100644 --- a/leiningen-core/project.clj +++ b/leiningen-core/project.clj @@ -1,4 +1,4 @@ -(defproject leiningen-core "2.0.0-preview4" +(defproject leiningen-core "2.0.0-SNAPSHOT" :url "https://github.com/technomancy/leiningen" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} diff --git a/project.clj b/project.clj index 4eed1dec6..7d2dbd9d5 100644 --- a/project.clj +++ b/project.clj @@ -1,12 +1,12 @@ ;; This is Leiningen's own project configuration. See doc/TUTORIAL.md ;; file as well as sample.project.clj for help writing your own. -(defproject leiningen "2.0.0-preview4" +(defproject leiningen "2.0.0-SNAPSHOT" :description "Automate Clojure projects without setting your hair on fire." :url "https://github.com/technomancy/leiningen" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} - :dependencies [[leiningen-core "2.0.0-preview4"] + :dependencies [[leiningen-core "2.0.0-SNAPSHOT"] [clucy "0.2.3"] [reply "0.1.0-beta6"] [org.clojure/data.xml "0.0.3"] @@ -42,4 +42,3 @@ ;; * publish leiningen-core docs ;; * announce on mailing list ;; * bump version numbers back to snapshot -;; * regenerate pom.xml