aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-11-20 14:58:25 +0100
committerLoïc Hoguin <[email protected]>2016-11-20 15:07:05 +0100
commit8a2ccf7a8f8d1f9c85afa81f339ba926330a71fc (patch)
tree75df47397481e058383f1303be82913af0c60946 /core
parenta8fffe130e6ad047c2b04afe4fd1d3df532f0d1d (diff)
downloaderlang.mk-8a2ccf7a8f8d1f9c85afa81f339ba926330a71fc.tar.gz
erlang.mk-8a2ccf7a8f8d1f9c85afa81f339ba926330a71fc.tar.bz2
erlang.mk-8a2ccf7a8f8d1f9c85afa81f339ba926330a71fc.zip
Better .app autopatch handling
If we have a .app and a .app.src we delete the .app. If we have a Rebar project with a .app file, rename it to .app.src and continue with autopatch. If we have a non-Rebar project, leave the .app file, and then... For all cases, delete the ebin/ folder after autopatch completes.
Diffstat (limited to 'core')
-rw-r--r--core/deps.mk21
1 files changed, 3 insertions, 18 deletions
diff --git a/core/deps.mk b/core/deps.mk
index 1964a52..747bb7b 100644
--- a/core/deps.mk
+++ b/core/deps.mk
@@ -115,8 +115,6 @@ define dep_autopatch
$(call dep_autopatch2,$(1)); \
elif [ -n "`find $(DEPS_DIR)/$(1)/ -type f -name \*.mk -not -name erlang.mk -exec grep -i "^[^#].*rebar" '{}' \;`" ]; then \
$(call dep_autopatch2,$(1)); \
- else \
- $(call erlang,$(call dep_autopatch_app.erl,$(1))); \
fi \
else \
if [ ! -d $(DEPS_DIR)/$(1)/src/ ]; then \
@@ -128,6 +126,8 @@ define dep_autopatch
endef
define dep_autopatch2
+ mv -n $(DEPS_DIR)/$1/ebin/$1.app $(DEPS_DIR)/$1/src/$1.app.src; \
+ rm -f $(DEPS_DIR)/$1/ebin/$1.app; \
if [ -f $(DEPS_DIR)/$1/src/$1.app.src.script ]; then \
$(call erlang,$(call dep_autopatch_appsrc_script.erl,$(1))); \
fi; \
@@ -439,22 +439,6 @@ define dep_autopatch_rebar.erl
halt()
endef
-define dep_autopatch_app.erl
- UpdateModules = fun(App) ->
- case filelib:is_regular(App) of
- false -> ok;
- true ->
- {ok, [{application, '$(1)', L0}]} = file:consult(App),
- Mods = filelib:fold_files("$(call core_native_path,$(DEPS_DIR)/$1/src)", "\\\\.erl$$", true,
- fun (F, Acc) -> [list_to_atom(filename:rootname(filename:basename(F)))|Acc] end, []),
- L = lists:keystore(modules, 1, L0, {modules, Mods}),
- ok = file:write_file(App, io_lib:format("~p.~n", [{application, '$(1)', L}]))
- end
- end,
- UpdateModules("$(call core_native_path,$(DEPS_DIR)/$1/ebin/$1.app)"),
- halt()
-endef
-
define dep_autopatch_appsrc_script.erl
AppSrc = "$(call core_native_path,$(DEPS_DIR)/$1/src/$1.app.src)",
AppSrcScript = AppSrc ++ ".script",
@@ -571,6 +555,7 @@ ifeq ($(filter $(1),$(NO_AUTOPATCH)),)
$$(call dep_autopatch,$(DEP_NAME)) \
fi
endif
+ $(verbose) rm -rf $(DEPS_DIR)/$(DEP_NAME)/ebin/
endef
$(foreach dep,$(BUILD_DEPS) $(DEPS),$(eval $(call dep_target,$(dep))))