From 27a4afe8fcdf6293ef30ca7a91dbe31157b5cbb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 17 Sep 2015 19:51:40 +0200 Subject: Use rebar to confirm that generated rebar.config files work --- test/core_compat.mk | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) (limited to 'test/core_compat.mk') diff --git a/test/core_compat.mk b/test/core_compat.mk index 04921b2..93178d3 100644 --- a/test/core_compat.mk +++ b/test/core_compat.mk @@ -6,6 +6,8 @@ CORE_COMPAT_CASES = auto-rebar rebar rebar-deps rebar-deps-pkg rebar-erlc-opts CORE_COMPAT_TARGETS = $(addprefix core-compat-,$(CORE_COMPAT_CASES)) CORE_COMPAT_CLEAN_TARGETS = $(addprefix clean-,$(CORE_COMPAT_TARGETS)) +REBAR_BINARY = https://github.com/rebar/rebar/releases/download/2.6.0/rebar + .PHONY: core-compat $(CORE_COMPAT_TARGETS) clean-core-compat $(CORE_COMPAT_CLEAN_TARGETS) clean-core-compat: $(CORE_COMPAT_CLEAN_TARGETS) @@ -49,6 +51,16 @@ core-compat-auto-rebar: build clean-core-compat-auto-rebar $i "Check that rebar.config can be loaded" $t $(ERL) -eval "{ok, _} = file:consult(\"$(APP)/rebar.config\"), halt()" + $i "Distclean the application" + $t $(MAKE) -C $(APP) distclean $v + + $i "Download rebar" + $t curl -s -L -o $(APP)/rebar $(REBAR_BINARY) + $t chmod +x $(APP)/rebar + + $i "Use rebar to build the application" + $t cd $(APP) && ./rebar compile $v + core-compat-rebar: build clean-core-compat-rebar $i "Bootstrap a new OTP library named $(APP)" @@ -80,6 +92,16 @@ core-compat-rebar: build clean-core-compat-rebar $i "Check that rebar.config can be loaded" $t $(ERL) -eval "{ok, _} = file:consult(\"$(APP)/rebar.config\"), halt()" + $i "Distclean the application" + $t $(MAKE) -C $(APP) distclean $v + + $i "Download rebar" + $t curl -s -L -o $(APP)/rebar $(REBAR_BINARY) + $t chmod +x $(APP)/rebar + + $i "Use rebar to build the application" + $t cd $(APP) && ./rebar compile $v + core-compat-rebar-deps: build clean-core-compat-rebar-deps $i "Bootstrap a new OTP library named $(APP)" @@ -90,7 +112,7 @@ core-compat-rebar-deps: build clean-core-compat-rebar-deps $i "Add Cowboy as a dependency" $t sed -i.bak '2i\ DEPS = cowboy\ -dep_cowboy = git repo commit\ +dep_cowboy = git https://github.com/ninenines/cowboy master\ ' $(APP)/Makefile $i "Run 'make rebar.config'" @@ -102,9 +124,19 @@ dep_cowboy = git repo commit\ $i "Check that Cowboy is listed in rebar.config" $t $(ERL) -eval " \ {ok, C} = file:consult(\"$(APP)/rebar.config\"), \ - {_, [{cowboy, _, {git, \"repo\", \"commit\"}}]} = lists:keyfind(deps, 1, C), \ + {_, [{cowboy, _, {git, _, \"master\"}}]} = lists:keyfind(deps, 1, C), \ halt()" + $i "Distclean the application" + $t $(MAKE) -C $(APP) distclean $v + + $i "Download rebar" + $t curl -s -L -o $(APP)/rebar $(REBAR_BINARY) + $t chmod +x $(APP)/rebar + + $i "Use rebar to build the application" + $t cd $(APP) && ./rebar get-deps compile $v + core-compat-rebar-deps-pkg: build clean-core-compat-rebar-deps-pkg $i "Bootstrap a new OTP library named $(APP)" @@ -129,6 +161,16 @@ DEPS = cowboy\ {_, [{cowboy, _, {git, \"https://github.com/\" ++ _, _}}]} = lists:keyfind(deps, 1, C), \ halt()" + $i "Distclean the application" + $t $(MAKE) -C $(APP) distclean $v + + $i "Download rebar" + $t curl -s -L -o $(APP)/rebar $(REBAR_BINARY) + $t chmod +x $(APP)/rebar + + $i "Use rebar to build the application" + $t cd $(APP) && ./rebar get-deps compile $v + core-compat-rebar-erlc-opts: build clean-core-compat-rebar-erlc-opts $i "Bootstrap a new OTP library named $(APP)" @@ -167,3 +209,13 @@ core-compat-rebar-erlc-opts: build clean-core-compat-rebar-erlc-opts true = lists:member(warn_missing_spec, Opts), \ true = lists:member(warn_untyped_record, Opts), \ halt()" + + $i "Distclean the application" + $t $(MAKE) -C $(APP) distclean $v + + $i "Download rebar" + $t curl -s -L -o $(APP)/rebar $(REBAR_BINARY) + $t chmod +x $(APP)/rebar + + $i "Use rebar to build the application" + $t cd $(APP) && ./rebar compile $v -- cgit v1.2.3