aboutsummaryrefslogtreecommitdiffstats
path: root/test/core_deps.mk
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-12-03 19:22:12 +0100
committerLoïc Hoguin <[email protected]>2018-12-03 19:22:12 +0100
commit983f82bdfcb3e78f04468fcfd02d6a6ee5869b13 (patch)
treec2dc607d4fac2e5d0e42e57dd5b88837e82543ff /test/core_deps.mk
parent225fb9046e8bf05c647cbcfdd2a074901700236a (diff)
downloaderlang.mk-983f82bdfcb3e78f04468fcfd02d6a6ee5869b13.tar.gz
erlang.mk-983f82bdfcb3e78f04468fcfd02d6a6ee5869b13.tar.bz2
erlang.mk-983f82bdfcb3e78f04468fcfd02d6a6ee5869b13.zip
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.
Diffstat (limited to 'test/core_deps.mk')
-rw-r--r--test/core_deps.mk103
1 files changed, 103 insertions, 0 deletions
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)"