Permalink
Browse files

CLJS-402: runtime obtainable compiler version number

Change build script to add compiler version information to compiler.clj
and core.cljs.

In CLJ *clojurescript-version* will be bound to a map. Provide a
CLJ function that will produce a string. In CLJS
*clojurescript-version* is bound to a string.
  • Loading branch information...
1 parent 5c168ad commit 6a9cae995837223cc7d236d110e01d723ae81f8a @swannodette swannodette committed Nov 5, 2013
Showing with 22 additions and 0 deletions.
  1. +2 −0 script/build
  2. +17 −0 src/clj/cljs/compiler.clj
  3. +3 −0 src/cljs/cljs/core.cljs
View
@@ -27,6 +27,8 @@ REVISION=${REVISION:0:${#REVISION}-9} # drop the last 9 characters
TAG=r$REVISION
sed -e s/CLOJURESCRIPT_VERSION/0.0-$REVISION/ < "$POM_TEMPLATE" > "$POM_FILE"
+sed -i "" 's/^.def ^:dynamic \*clojurescript-version\*.*$/(def ^:dynamic *clojurescript-version* {:major 0, :minor 0, :qualifier '"$REVISION"'})/' src/clj/cljs/compiler.clj
+sed -i "" 's/^.def \*clojurescript-version\*.*$/(def *clojurescript-version* '\""0.0-$REVISION"\"')/' src/cljs/cljs/core.cljs
# For Hudson server
if [ "$HUDSON" = "true" ]; then
View
@@ -19,6 +19,23 @@
(:import java.lang.StringBuilder
java.io.File))
+;; next line is auto-generated by the build-script - Do not edit!
+(def ^:dynamic *clojurescript-version*)
+
+(defn clojurescript-version
+ "Returns clojurescript version as a printable string."
+ []
+ (str
+ (:major *clojurescript-version*)
+ "."
+ (:minor *clojurescript-version*)
+ (when-let [i (:incremental *clojurescript-version*)]
+ (str "." i))
+ (when-let [q (:qualifier *clojurescript-version*)]
+ (str "-" q))
+ (when (:interim *clojurescript-version*)
+ "-SNAPSHOT")))
+
(def js-reserved
#{"abstract" "boolean" "break" "byte" "case"
"catch" "char" "class" "const" "continue"
View
@@ -12,6 +12,9 @@
[goog.object :as gobject]
[goog.array :as garray]))
+;; next line is auto-generated by the build-script - Do not edit!
+(def *clojurescript-version*)
+
(def *unchecked-if* false)
(def

0 comments on commit 6a9cae9

Please sign in to comment.