aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <[email protected]>2017-05-12 09:30:45 +0200
committerLoïc Hoguin <[email protected]>2017-05-12 11:57:30 +0200
commitcd99adbb98d8965c65f68da2853f14506756d7b3 (patch)
tree697617c1a027e425ad67d0fc6f042bf81abbd585 /test
parentae5415d4a1000022c568932e7a6efa96e684b016 (diff)
downloaderlang.mk-cd99adbb98d8965c65f68da2853f14506756d7b3.tar.gz
erlang.mk-cd99adbb98d8965c65f68da2853f14506756d7b3.tar.bz2
erlang.mk-cd99adbb98d8965c65f68da2853f14506756d7b3.zip
Support early-stage plugins through `$(DEP_EARLY_PLUGINS)`
Regular plugins (`$(DEP_PLUGINS)`) are loaded near the end of Erlang.mk. This is fine when you want to modify variables initialized earlier in Erlang.mk or add new targets and variables. However, it doesn't allow you to declare more dependencies because they are loaded too late for that. This commit introduces a new variable, `$(DEP_EARLY_PLUGINS)`, which can be used to list plugins meant to be loaded near the beginning of Erlang.mk. Those allow to append to the list of dependencies. They work exactly like regular plugins otherwise. The default filename loaded is `early-plugins.mk`.
Diffstat (limited to 'test')
-rw-r--r--test/core_plugins.mk28
1 files changed, 27 insertions, 1 deletions
diff --git a/test/core_plugins.mk b/test/core_plugins.mk
index c58b063..060999a 100644
--- a/test/core_plugins.mk
+++ b/test/core_plugins.mk
@@ -1,6 +1,6 @@
# Core: External plugins.
-CORE_PLUGINS_CASES = all one templates test
+CORE_PLUGINS_CASES = all early one templates test
CORE_PLUGINS_TARGETS = $(addprefix core-plugins-,$(CORE_PLUGINS_CASES))
.PHONY: core-plugins $(CORE_PLUGINS_TARGETS)
@@ -39,6 +39,32 @@ core-plugins-all: build clean
$i "Run 'make plugin2' and check that it prints plugin2"
$t test -n "`$(MAKE) -C $(APP) plugin2 | grep plugin2`"
+core-plugins-early: build clean
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Write external plugin adddep_plugin"
+ $t mkdir $(APP)/adddep_plugin
+ $t echo -e "DEPS += cowlib" >> $(APP)/adddep_plugin/early-plugins.mk
+
+ $i "Inject external plugin dependencies into $(APP)"
+ $t echo 'DEPS = ranch' >>$(APP)/Makefile.tmp
+ $t echo 'BUILD_DEPS = adddep_plugin' >>$(APP)/Makefile.tmp
+ $t echo 'DEP_EARLY_PLUGINS = adddep_plugin' >>$(APP)/Makefile.tmp
+ $t echo 'dep_adddep_plugin = cp adddep_plugin' >>$(APP)/Makefile.tmp
+ $t cat $(APP)/Makefile >>$(APP)/Makefile.tmp
+ $t mv $(APP)/Makefile.tmp $(APP)/Makefile
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that all dependencies were fetched"
+ $t test -e $(APP)/deps/cowlib
+ $t test -e $(APP)/deps/ranch
+
core-plugins-one: build clean
$i "Bootstrap a new OTP library named $(APP)"