aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-06-04 13:29:08 +0300
committerLoïc Hoguin <[email protected]>2015-06-04 13:29:08 +0300
commita73fa1a7375b51d3c4bf5ea2b7d684793a236cbc (patch)
treec5f7fe9dfc7cd71f4aeb603d70a1962291c6fd62
parent7dc8c4fd44f483a5f1b6ec2002b7e312d5b34581 (diff)
downloaderlang.mk-a73fa1a7375b51d3c4bf5ea2b7d684793a236cbc.tar.gz
erlang.mk-a73fa1a7375b51d3c4bf5ea2b7d684793a236cbc.tar.bz2
erlang.mk-a73fa1a7375b51d3c4bf5ea2b7d684793a236cbc.zip
Fetch the whole of rebar when patching rebar deps
Necessary for increased compatibility as we de-rebarize those dependencies.
-rw-r--r--core/core.mk2
-rw-r--r--core/deps.mk38
2 files changed, 11 insertions, 29 deletions
diff --git a/core/core.mk b/core/core.mk
index 75a3706..dd66bec 100644
--- a/core/core.mk
+++ b/core/core.mk
@@ -124,7 +124,7 @@ endef
# Adding erlang.mk to make Erlang scripts who call init:get_plain_arguments() happy.
define erlang
-$(ERL) -pa $(ERLANG_MK_TMP)/ebin -eval "$(subst $(newline),,$(subst ",\",$(1)))" -- erlang.mk
+$(ERL) -pa $(ERLANG_MK_TMP)/rebar/ebin -eval "$(subst $(newline),,$(subst ",\",$(1)))" -- erlang.mk
endef
ifeq ($(shell which wget 2>/dev/null | wc -l), 1)
diff --git a/core/deps.mk b/core/deps.mk
index 5318052..e6cae93 100644
--- a/core/deps.mk
+++ b/core/deps.mk
@@ -85,7 +85,7 @@ endef
define dep_autopatch2
$(call erlang,$(call dep_autopatch_appsrc.erl,$(1))); \
if [ -f $(DEPS_DIR)/$(1)/rebar.config -o -f $(DEPS_DIR)/$(1)/rebar.config.script ]; then \
- $(call dep_autopatch_rebar_utils); \
+ $(call dep_autopatch_fetch_rebar); \
$(call dep_autopatch_rebar,$(1)); \
else \
$(call dep_autopatch_gen,$(1)); \
@@ -114,22 +114,14 @@ define dep_autopatch_gen
"include ../../erlang.mk" > $(DEPS_DIR)/$(1)/Makefile
endef
-define dep_autopatch_rebar_utils
+define dep_autopatch_fetch_rebar
mkdir -p $(ERLANG_MK_TMP)/ebin; \
- if [ ! -f $(ERLANG_MK_TMP)/rebar.hrl ]; then \
- $(call core_http_get,$(ERLANG_MK_TMP)/rebar.hrl,https://raw.githubusercontent.com/rebar/rebar/791db716b5a3a7671e0b351f95ddf24b848ee173/include/rebar.hrl); \
- fi; \
- if [ ! -f $(ERLANG_MK_TMP)/rebar_utils.erl ]; then \
- $(call core_http_get,$(ERLANG_MK_TMP)/rebar_utils.erl,https://raw.githubusercontent.com/rebar/rebar/791db716b5a3a7671e0b351f95ddf24b848ee173/src/rebar_utils.erl); \
- fi; \
- if [ ! -f $(ERLANG_MK_TMP)/ebin/rebar_utils.beam ]; then \
- erlc -o $(ERLANG_MK_TMP)/ebin $(ERLANG_MK_TMP)/rebar_utils.erl; \
- fi; \
- if [ ! -f $(ERLANG_MK_TMP)/rebar_log.erl ]; then \
- $(call core_http_get,$(ERLANG_MK_TMP)/rebar_log.erl,https://raw.githubusercontent.com/rebar/rebar/791db716b5a3a7671e0b351f95ddf24b848ee173/src/rebar_log.erl); \
- fi; \
- if [ ! -f $(ERLANG_MK_TMP)/ebin/rebar_log.beam ]; then \
- erlc -o $(ERLANG_MK_TMP)/ebin $(ERLANG_MK_TMP)/rebar_log.erl; \
+ if [ ! -d $(ERLANG_MK_TMP)/rebar ]; then \
+ git clone -q -n -- https://github.com/rebar/rebar $(ERLANG_MK_TMP)/rebar; \
+ cd $(ERLANG_MK_TMP)/rebar; \
+ git checkout -q 791db716b5a3a7671e0b351f95ddf24b848ee173; \
+ make; \
+ cd -; \
fi
endef
@@ -377,22 +369,13 @@ define dep_autopatch_rebar.erl
[PortSpec(S) || S <- PortSpecs]
end,
Write("\ninclude ../../erlang.mk"),
- PatchPlugin = fun(ErlFile) ->
- {ok, F0} = file:read_file(ErlFile),
- case re:replace(F0, "rebar_config:", "rebar_config_", [global]) of
- F0 -> ok;
- F ->
- ok = file:write_file(ErlFile, [F,
- "\nrebar_config_get(_, current_command, _) -> compile.\n"
- ])
- end
- end,
RunPlugin = fun(Plugin, Step) ->
case erlang:function_exported(Plugin, Step, 2) of
false -> ok;
true ->
c:cd("$(DEPS_DIR)/$(1)/"),
- Ret = Plugin:Step(Conf, undefined),
+ Ret = Plugin:Step({config, "", Conf, dict:new(), dict:new(), dict:new(),
+ dict:store(base_dir, "", dict:new())}, undefined),
io:format("rebar plugin ~p step ~p ret ~p~n", [Plugin, Step, Ret])
end
end,
@@ -421,7 +404,6 @@ define dep_autopatch_rebar.erl
false -> ok;
{_, PluginsDir} ->
ErlFile = "$(DEPS_DIR)/$(1)/" ++ PluginsDir ++ "/" ++ atom_to_list(P) ++ ".erl",
- PatchPlugin(ErlFile),
{ok, P, Bin} = compile:file(ErlFile, [binary]),
{module, P} = code:load_binary(P, ErlFile, Bin)
end