diff options
author | Loïc Hoguin <[email protected]> | 2015-09-23 18:15:40 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-09-23 18:15:40 +0200 |
commit | dd4b1fd93e45d6c645aae68dfdd6658697a13e04 (patch) | |
tree | c61253b009b7da4244209b95611bd551020e5a9e | |
parent | b60900f47650edbeb575ba2740db48e99afbbd30 (diff) | |
download | erlang.mk-dd4b1fd93e45d6c645aae68dfdd6658697a13e04.tar.gz erlang.mk-dd4b1fd93e45d6c645aae68dfdd6658697a13e04.tar.bz2 erlang.mk-dd4b1fd93e45d6c645aae68dfdd6658697a13e04.zip |
Implement, add test for dep_$(DEP)_commit variables
-rw-r--r-- | core/deps.mk | 3 | ||||
-rw-r--r-- | test/core_deps.mk | 37 |
2 files changed, 38 insertions, 2 deletions
diff --git a/core/deps.mk b/core/deps.mk index fe70c26..8134cb7 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -533,7 +533,8 @@ endef dep_name = $(if $(dep_$(1)),$(1),$(pkg_$(1)_name)) dep_repo = $(patsubst git://github.com/%,https://github.com/%, \ $(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_repo))) -dep_commit = $(if $(dep_$(1)),$(word 3,$(dep_$(1))),$(pkg_$(1)_commit)) +dep_commit = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),\ + $(if $(dep_$(1)),$(word 3,$(dep_$(1))),$(pkg_$(1)_commit))) define dep_target $(DEPS_DIR)/$(1): diff --git a/test/core_deps.mk b/test/core_deps.mk index c9862ed..7190c8b 100644 --- a/test/core_deps.mk +++ b/test/core_deps.mk @@ -1,6 +1,6 @@ # Core: Packages and dependencies. -CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl build-js doc otp pkg rel search shell test +CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl build-js dep-commit doc otp pkg rel search shell test CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES)) CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS)) @@ -125,6 +125,41 @@ dep_jquery = git https://github.com/jquery/jquery master\ false = lists:member(jquery, Deps), \ halt()" +core-deps-dep-commit: build clean-core-deps-dep-commit + + $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 Cowboy 1.0.0 to the list of dependencies" + $t sed -i.bak '2i\ +DEPS = cowboy\ +dep_cowboy_commit = 1.0.0\ +' $(APP)/Makefile + +ifdef LEGACY + $i "Add Cowboy to the applications key in the .app.src file" + $t sed -i.bak '8i\ + cowboy,' $(APP)/src/$(APP).app.src +endif + + $i "Build the application" + $t $(MAKE) -C $(APP) $v + + $i "Check that all dependencies were fetched" + $t test -d $(APP)/deps/cowboy + $t test -d $(APP)/deps/cowlib + $t test -d $(APP)/deps/ranch + + $i "Check that the application was compiled correctly" + $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \ + [ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \ + {ok, Deps} = application:get_key($(APP), applications), \ + true = lists:member(cowboy, Deps), \ + {ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \ + halt()" + core-deps-doc: build clean-core-deps-doc $i "Bootstrap a new OTP library named $(APP)" |