aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-10-31 12:58:13 +0100
committerLoïc Hoguin <[email protected]>2014-10-31 12:58:13 +0100
commitd009b7e27315b07802cffc07f8d6b8785e6048c0 (patch)
treec66cbb6347662b2882d5f0b3a60ca3f1bb8bf7c0
parentbf28af49d39be2ce2b6f5e453e24989f5e73403f (diff)
parentee97e84f8b606736ebe3bb9991f89ec65a9bdfd3 (diff)
downloaderlang.mk-d009b7e27315b07802cffc07f8d6b8785e6048c0.tar.gz
erlang.mk-d009b7e27315b07802cffc07f8d6b8785e6048c0.tar.bz2
erlang.mk-d009b7e27315b07802cffc07f8d6b8785e6048c0.zip
Merge branch 'add-git-describe-to-id-field' of git://github.com/dch/erlang.mk
-rw-r--r--README.md4
-rw-r--r--core/erlc.mk2
-rw-r--r--erlang.mk4
-rw-r--r--plugins/bootstrap.mk2
4 files changed, 12 insertions, 0 deletions
diff --git a/README.md b/README.md
index ac35b8e..8a02002 100644
--- a/README.md
+++ b/README.md
@@ -215,6 +215,10 @@ variable. It takes the arguments that will then be passed to
You can specify a list of modules to be compiled first using
the `COMPILE_FIRST` variable.
+If `{id, "git"},` is found in your project's `.app.src`, the
+extended output of `git describe ...` will replace it. This
+can be retrieved at runtime via `application:get_key/2`.
+
Bootstrap plugin
----------------
diff --git a/core/erlc.mk b/core/erlc.mk
index 03e174e..a7f73f8 100644
--- a/core/erlc.mk
+++ b/core/erlc.mk
@@ -30,8 +30,10 @@ app:: erlc-include ebin/$(PROJECT).app
echo "Empty modules entry not found in $(PROJECT).app.src. Please consult the erlang.mk README for instructions." >&2; \
exit 1; \
fi
+ $(eval GITDESCRIBE := $(shell git describe --dirty --abbrev=7 --tags --always --first-parent 2>/dev/null || true))
$(appsrc_verbose) cat src/$(PROJECT).app.src \
| sed "s/{modules,[[:space:]]*\[\]}/{modules, \[$(MODULES)\]}/" \
+ | sed "s/{id,[[:space:]]*\"git\"}/{id, \"$(GITDESCRIBE)\"}/" \
> ebin/$(PROJECT).app
define compile_erl
diff --git a/erlang.mk b/erlang.mk
index daa42f1..5691532 100644
--- a/erlang.mk
+++ b/erlang.mk
@@ -217,8 +217,10 @@ app:: erlc-include ebin/$(PROJECT).app
echo "Empty modules entry not found in $(PROJECT).app.src. Please consult the erlang.mk README for instructions." >&2; \
exit 1; \
fi
+ $(eval GITDESCRIBE := $(shell git describe --dirty --abbrev=7 --tags --always --first-parent 2>/dev/null || true))
$(appsrc_verbose) cat src/$(PROJECT).app.src \
| sed "s/{modules,[[:space:]]*\[\]}/{modules, \[$(MODULES)\]}/" \
+ | sed "s/{id,[[:space:]]*\"git\"}/{id, \"$(GITDESCRIBE)\"}/" \
> ebin/$(PROJECT).app
define compile_erl
@@ -278,6 +280,7 @@ help::
bs_appsrc = "{application, $(PROJECT), [" \
" {description, \"\"}," \
" {vsn, \"0.1.0\"}," \
+ " {id, \"git\"}," \
" {modules, []}," \
" {registered, []}," \
" {applications, [" \
@@ -290,6 +293,7 @@ bs_appsrc = "{application, $(PROJECT), [" \
bs_appsrc_lib = "{application, $(PROJECT), [" \
" {description, \"\"}," \
" {vsn, \"0.1.0\"}," \
+ " {id, \"git\"}," \
" {modules, []}," \
" {registered, []}," \
" {applications, [" \
diff --git a/plugins/bootstrap.mk b/plugins/bootstrap.mk
index 084cde3..9397253 100644
--- a/plugins/bootstrap.mk
+++ b/plugins/bootstrap.mk
@@ -19,6 +19,7 @@ help::
bs_appsrc = "{application, $(PROJECT), [" \
" {description, \"\"}," \
" {vsn, \"0.1.0\"}," \
+ " {id, \"git\"}," \
" {modules, []}," \
" {registered, []}," \
" {applications, [" \
@@ -31,6 +32,7 @@ bs_appsrc = "{application, $(PROJECT), [" \
bs_appsrc_lib = "{application, $(PROJECT), [" \
" {description, \"\"}," \
" {vsn, \"0.1.0\"}," \
+ " {id, \"git\"}," \
" {modules, []}," \
" {registered, []}," \
" {applications, [" \