aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-24 22:51:40 +0100
committerLoïc Hoguin <[email protected]>2018-11-24 22:51:40 +0100
commit1a5852f6750615f72e3523bb8685f98210f81e11 (patch)
tree8e3f95447d5378880b7bff1cab425bc0b5a1cfc8 /test
parent2110fb337b4457012d7a97fcc5071b095b7be861 (diff)
downloaderlang.mk-1a5852f6750615f72e3523bb8685f98210f81e11.tar.gz
erlang.mk-1a5852f6750615f72e3523bb8685f98210f81e11.tar.bz2
erlang.mk-1a5852f6750615f72e3523bb8685f98210f81e11.zip
Add the git-subfolder fetch method
It clones and checkouts like the git fetch method, but does so in the Erlang.mk temporary directory. It then creates a symbolic link to the subfolder for the dependency.
Diffstat (limited to 'test')
-rw-r--r--test/core_deps.mk41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/core_deps.mk b/test/core_deps.mk
index 922c69b..3403f58 100644
--- a/test/core_deps.mk
+++ b/test/core_deps.mk
@@ -342,6 +342,47 @@ endif
{ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
halt()"
+core-deps-fetch-git-subfolder: 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 "Bootstrap a new OTP library named my_dep as a subfolder inside $(APP)"
+ $t mkdir -p $(APP)/git_repo/my_dep
+ $t cp ../erlang.mk $(APP)/git_repo/my_dep/
+ $t $(MAKE) -C $(APP)/git_repo/my_dep/ -f erlang.mk bootstrap-lib $v
+# Create an empty file so src/ gets committed.
+ $t touch $(APP)/git_repo/my_dep/src/README
+ $t cd $(APP)/git_repo && \
+ git init -q && \
+ git config user.email "[email protected]" && \
+ git config user.name "test suite" && \
+ git add . && \
+ git commit -q --no-gpg-sign -m "Tests"
+
+ $i "Add my_dep to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = my_dep\ndep_my_dep = git-subfolder file://$(abspath $(APP)/git_repo) master my_dep\n"}' $(APP)/Makefile
+
+ifdef LEGACY
+ $i "Add my_dep to the applications key in the .app.src file"
+ $t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tmy_dep,\n"}' $(APP)/src/$(APP).app.src
+endif
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that the dependency was fetched"
+ $t test -d $(APP)/deps/my_dep
+
+ $i "Check that the application was compiled correctly"
+ $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \
+ [ok = application:load(App) || App <- [$(APP), my_dep]], \
+ {ok, Deps} = application:get_key($(APP), applications), \
+ true = lists:member(my_dep, Deps), \
+ halt()"
+
core-deps-fetch-git-submodule: build clean
$i "Bootstrap a new OTP library named $(APP)"