From 983f82bdfcb3e78f04468fcfd02d6a6ee5869b13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 3 Dec 2018 19:22:12 +0100 Subject: Don't rebuild dependencies by default Unless it's a symbolic link, it's built directly, FULL=1 is set or the file ebin/dep_built in the dependency is removed. See the documentation changes for more details. This provides immense build speed gains, for example on a RabbitMQ project it went from 10s to 1s for the 2nd+ builds. --- test/Makefile | 2 +- test/core_deps.mk | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/Makefile b/test/Makefile index 2f9e875..a66e9db 100644 --- a/test/Makefile +++ b/test/Makefile @@ -190,7 +190,7 @@ pkg-$1: build clean fi $i "Recompile package $1" - $t if ! ( cd packages/$1_pkg/ && $(MAKE) $(PATCHES) $v ); then \ + $t if ! ( cd packages/$1_pkg/ && $(MAKE) $(PATCHES) FULL=1 $v ); then \ echo "$(1): recompile error" >> packages/errors.log; \ false; \ fi diff --git a/test/core_deps.mk b/test/core_deps.mk index 3b44a13..78180f3 100644 --- a/test/core_deps.mk +++ b/test/core_deps.mk @@ -106,6 +106,109 @@ core-deps-build-js: build clean false = lists:member(jquery, Deps), \ halt()" +core-deps-dep-built: 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 "Add cowlib to the list of dependencies" + $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile + + $i "Build the application" + $t $(MAKE) -C $(APP) $v + + $i "Touch one cowlib file to mark it for recompilation" + $t $(SLEEP) + $t touch $(APP)/deps/cowlib/src/cow_http.erl + + $i "Check that cowlib is not rebuilt" + $t touch $(APP)/EXPECT + $t $(SLEEP) + $t $(MAKE) -C $(APP) $v + $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | sort | diff $(APP)/EXPECT - + $t rm $(APP)/EXPECT + + $i "Delete the dep_built file" + $t rm $(APP)/deps/cowlib/ebin/dep_built + + $i "Check that cowlib was rebuilt" + $t printf "%s\n" \ + $(APP)/deps/cowlib/cowlib.d \ + $(APP)/deps/cowlib/ebin/cowlib.app \ + $(APP)/deps/cowlib/ebin/cow_http.beam \ + $(APP)/deps/cowlib/ebin/dep_built | sort > $(APP)/EXPECT + $t $(SLEEP) + $t $(MAKE) -C $(APP) $v +# Files in .git might end up modified due to the id generation in the .app file. + $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT - + $t rm $(APP)/EXPECT + +core-deps-dep-built-full: 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 "Add cowlib to the list of dependencies" + $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile + + $i "Build the application" + $t $(MAKE) -C $(APP) $v + + $i "Touch one cowlib file to mark it for recompilation" + $t $(SLEEP) + $t touch $(APP)/deps/cowlib/src/cow_http.erl + + $i "Check that cowlib is rebuilt with FULL=1" + $t printf "%s\n" \ + $(APP)/deps/cowlib/cowlib.d \ + $(APP)/deps/cowlib/ebin/cowlib.app \ + $(APP)/deps/cowlib/ebin/cow_http.beam \ + $(APP)/deps/cowlib/ebin/dep_built | sort > $(APP)/EXPECT + $t $(SLEEP) + $t $(MAKE) -C $(APP) FULL=1 $v +# Files in .git might end up modified due to the id generation in the .app file. + $t find $(APP)/deps/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT - + $t rm $(APP)/EXPECT + +core-deps-dep-built-ln: 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 "Add cowlib to the list of dependencies" + $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile + + $i "Clone cowlib manually inside $(APP)" + $t git clone -q https://github.com/ninenines/cowlib $(APP)/cowlib + + $i "Link to cowlib instead of fetching the dependency" + $t mkdir -p $(APP)/deps + $t ln -s ../cowlib $(APP)/deps/cowlib + + $i "Build the application" + $t $(MAKE) -C $(APP) $v + + $i "Touch one cowlib file to mark it for recompilation" + $t $(SLEEP) + $t touch $(APP)/deps/cowlib/src/cow_http.erl + + $i "Check that cowlib is rebuilt; symlinked deps don't create dep_built" + $t printf "%s\n" \ + $(APP)/cowlib/cowlib.d \ + $(APP)/cowlib/ebin/cowlib.app \ + $(APP)/cowlib/ebin/cow_http.beam | sort > $(APP)/EXPECT + $t $(SLEEP) + $t $(MAKE) -C $(APP) $v +# Files in .git might end up modified due to the id generation in the .app file. + $t find $(APP)/cowlib -type f -newer $(APP)/EXPECT | grep -v ".git" | sort | diff $(APP)/EXPECT - + $t rm $(APP)/EXPECT + core-deps-dep-commit: build clean $i "Bootstrap a new OTP library named $(APP)" -- cgit v1.2.3