diff options
author | Rich Hickey <richhickey@gmail.com> | 2009-04-27 23:10:53 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2009-04-27 23:10:53 +0000 |
commit | 37ae4fb81152735afbc12a3334c59be5fecda81e (patch) | |
tree | f88dbdb1ca8db3c99922c3a9a7552988ecd6ee7a /src | |
parent | e9212ed36488b6fab3809082e8771c19be81da84 (diff) |
added support for versioned builds, alignment with *clojure-version*, (clojure-version) function. Note this will create jars with names like: clojure-1.0.0-RC1-SNAPSHOT.jar [issue 110], patch from laurent.petit
Diffstat (limited to 'src')
-rw-r--r-- | src/clj/clojure/core.clj | 42 | ||||
-rw-r--r-- | src/clj/clojure/main.clj | 4 | ||||
-rw-r--r-- | src/clj/clojure/version.properties | 5 |
3 files changed, 42 insertions, 9 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj index 2f126fb8..5e6c20f1 100644 --- a/src/clj/clojure/core.clj +++ b/src/clj/clojure/core.clj @@ -10,7 +10,6 @@ (def unquote) (def unquote-splicing) -(def *clojure-version* {:major 1 :minor 0 :incremental 0 :qualifier "RC1"}) (def #^{:arglists '([& items]) @@ -3939,11 +3938,6 @@ (defmacro add-doc {:private true} [name docstring] `(alter-meta! (var ~name) assoc :doc ~docstring)) -(add-doc *clojure-version* - "The version info for Clojure core, as a map containing :major :minor :incremental and :qualifier keys. - Feature releases may increment :minor and/or :major, bugfix releases will increment :incremental. - Possible values of :qualifier include \"GA\", \"SNAPSHOT\", \"RC-x\" \"BETA-x\"") - (add-doc *file* "The path of the file being evaluated, as a String. @@ -4023,7 +4017,6 @@ (load "core_print") (load "genclass") - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; futures (needs proxy);;;;;;;;;;;;;;;;;; (defn future-call "Takes a function of no args and yields a future object that will @@ -4091,3 +4084,38 @@ `(letfn* ~(vec (interleave (map first fnspecs) (map #(cons `fn %) fnspecs))) ~@body)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; clojure version number ;;;;;;;;;;;;;;;;;;;;;; + +(let [version-stream (.getResourceAsStream (clojure.lang.RT/baseLoader) + "clojure/version.properties") + properties (doto (new java.util.Properties) (.load version-stream)) + prop (fn [k] (.getProperty properties (str "clojure.version." k))) + clojure-version {:major (prop "major") + :minor (prop "minor") + :incremental (prop "incremental") + :qualifier (prop "qualifier")}] + (def *clojure-version* + (if (not (= (prop "interim") "false")) + (clojure.lang.RT/assoc clojure-version :interim true) + clojure-version))) + +(add-doc *clojure-version* + "The version info for Clojure core, as a map containing :major :minor + :incremental and :qualifier keys. Feature releases may increment + :minor and/or :major, bugfix releases will increment :incremental. + Possible values of :qualifier include \"GA\", \"SNAPSHOT\", \"RC-x\" \"BETA-x\"") + +(defn + clojure-version + "Returns clojure version as a printable string." + [] + (str (:major *clojure-version*) + "." + (:minor *clojure-version*) + (when-let [i (:incremental *clojure-version*)] + (str "." i)) + (when-let [q (:qualifier *clojure-version*)] + (str "-" q)) + (when (:interim *clojure-version*) + "-SNAPSHOT"))) diff --git a/src/clj/clojure/main.clj b/src/clj/clojure/main.clj index f549ece3..176fa13f 100644 --- a/src/clj/clojure/main.clj +++ b/src/clj/clojure/main.clj @@ -243,7 +243,7 @@ present" [[_ & args] inits] (when-not (some #(= eval-opt (init-dispatch (first %))) inits) - (println "Clojure")) + (println "Clojure" (clojure-version))) (repl :init #(initialize args inits)) (prn) (System/exit 0)) @@ -320,7 +320,7 @@ The init options may be repeated and mixed freely, but must appear before any main option. The appearance of any eval option before running a repl - suppresses the usual repl greeting message: \"Clojure\". + suppresses the usual repl greeting message: \"Clojure ~(clojure-version)\". Paths may be absolute or relative in the filesystem or relative to classpath. Classpath-relative paths have prefix of @ or @/" diff --git a/src/clj/clojure/version.properties b/src/clj/clojure/version.properties new file mode 100644 index 00000000..e3a26c55 --- /dev/null +++ b/src/clj/clojure/version.properties @@ -0,0 +1,5 @@ +clojure.version.major=1 +clojure.version.minor=0 +clojure.version.incremental=0 +clojure.version.qualifier=RC1 +clojure.version.interim=true |