From 5401192f38ff407a749fccfdb8f2f9aab012efea Mon Sep 17 00:00:00 2001 From: Krister Svanlund Date: Mon, 11 Jul 2016 16:45:26 +0200 Subject: Build apps/* only once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replicating the behavior for deps/*. With refactoring from Loïc. --- test/core_deps.mk | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'test/core_deps.mk') diff --git a/test/core_deps.mk b/test/core_deps.mk index 490f3d8..767b66b 100644 --- a/test/core_deps.mk +++ b/test/core_deps.mk @@ -1,6 +1,6 @@ # Core: Packages and dependencies. -CORE_DEPS_CASES = apps apps-conflict apps-deep-conflict apps-dir apps-dir-include-lib apps-new-app apps-new-lib apps-new-tpl apps-only autopatch-rebar build-c-8cc build-c-imagejs build-erl build-js dep-commit dir doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-git-submodule fetch-hex fetch-hg fetch-legacy fetch-svn ignore mv mv-rebar no-autopatch no-autopatch-erlang-mk no-autopatch-rebar order-first order-top otp pkg rel search shell skip test +CORE_DEPS_CASES = apps apps-build-count apps-conflict apps-deep-conflict apps-dir apps-dir-include-lib apps-new-app apps-new-lib apps-new-tpl apps-only autopatch-rebar build-c-8cc build-c-imagejs build-erl build-js dep-commit dir doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-git-submodule fetch-hex fetch-hg fetch-legacy fetch-svn ignore mv mv-rebar no-autopatch no-autopatch-erlang-mk no-autopatch-rebar order-first order-top otp pkg rel search shell skip test CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES)) .PHONY: core-deps $(CORE_DEPS_TARGETS) @@ -101,6 +101,42 @@ endif [{module, M} = code:load_file(M) || M <- Mods], \ halt()" +core-deps-apps-build-count: 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 + + $t mkdir -p "$(APP)/priv/dep" + $t echo "PROJECT = fake_dep" > $(APP)/priv/dep/Makefile + $t echo "include ../../erlang.mk" >> $(APP)/priv/dep/Makefile + + $i "Bootstrap a repository-local application my_app" + $t echo "DEPS = dep1 dep2 dep3 dep4" > $(APP)/Makefile + $t echo "dep_dep1 = cp ./priv/dep" >> $(APP)/Makefile + $t echo "dep_dep2 = cp ./priv/dep" >> $(APP)/Makefile + $t echo "dep_dep3 = cp ./priv/dep" >> $(APP)/Makefile + $t echo "dep_dep4 = cp ./priv/dep" >> $(APP)/Makefile + $t echo "include erlang.mk" >> $(APP)/Makefile + + $i "Create a new application app_one" + $t $(MAKE) -C $(APP) new-app in=app_one $v + $t echo "all::" >> $(APP)/apps/app_one/Makefile + $t echo " @echo -n '#' >> count" >> $(APP)/apps/app_one/Makefile + + $i "Create a new application app_two" + $t $(MAKE) -C $(APP) new-app in=app_two $v + $t echo "all::" >> $(APP)/apps/app_two/Makefile + $t echo " @echo -n '#' >> count" >> $(APP)/apps/app_two/Makefile + + $i "Build the application" + $t $(MAKE) -C $(APP) $v + + $i "Check the number of times each app was compiled" + $t test "`wc -c $(APP)/apps/app_one/count | awk '{printf $$1}'`" -eq 1 + $t test "`wc -c $(APP)/apps/app_two/count | awk '{printf $$1}'`" -eq 1 + core-deps-apps-conflict: build clean $i "Bootstrap a new OTP library named $(APP)" -- cgit v1.2.3