diff options
Diffstat (limited to 'test/core_compat.mk')
-rw-r--r-- | test/core_compat.mk | 58 |
1 files changed, 43 insertions, 15 deletions
diff --git a/test/core_compat.mk b/test/core_compat.mk index 06d5211..8d6cabc 100644 --- a/test/core_compat.mk +++ b/test/core_compat.mk @@ -2,22 +2,17 @@ # # Note: autopatch functionality is covered separately. -CORE_COMPAT_CASES = auto-rebar rebar rebar-deps rebar-deps-pkg rebar-erlc-opts rebar-pt +CORE_COMPAT_CASES = auto-rebar rebar rebar-deps-git rebar-deps-hex rebar-deps-pkg rebar-erlc-opts rebar-pt 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 +REBAR3_BINARY = https://s3.amazonaws.com/rebar3/rebar3 -.PHONY: core-compat $(CORE_COMPAT_TARGETS) clean-core-compat $(CORE_COMPAT_CLEAN_TARGETS) - -clean-core-compat: $(CORE_COMPAT_CLEAN_TARGETS) - -$(CORE_COMPAT_CLEAN_TARGETS): - $t rm -rf $(APP_TO_CLEAN)/ +.PHONY: core-compat $(CORE_COMPAT_TARGETS) core-compat: $(CORE_COMPAT_TARGETS) -core-compat-auto-rebar: build clean-core-compat-auto-rebar +core-compat-auto-rebar: build clean $i "Bootstrap a new OTP library named $(APP)" $t mkdir $(APP)/ @@ -59,7 +54,7 @@ core-compat-auto-rebar: build clean-core-compat-auto-rebar $i "Use rebar to build the application" $t cd $(APP) && ./rebar compile $v -core-compat-rebar: build clean-core-compat-rebar +core-compat-rebar: build clean $i "Bootstrap a new OTP library named $(APP)" $t mkdir $(APP)/ @@ -98,7 +93,7 @@ core-compat-rebar: build clean-core-compat-rebar $i "Use rebar to build the application" $t cd $(APP) && ./rebar compile $v -core-compat-rebar-deps: build clean-core-compat-rebar-deps +core-compat-rebar-deps-git: build clean $i "Bootstrap a new OTP library named $(APP)" $t mkdir $(APP)/ @@ -130,7 +125,39 @@ core-compat-rebar-deps: build clean-core-compat-rebar-deps $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 +core-compat-rebar-deps-hex: 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 Cowboy as a dependency" + $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile + + $i "Run 'make rebar.config'" + $t $(MAKE) -C $(APP) rebar.config $v + + $i "Check that rebar.config was created" + $t test -f $(APP)/rebar.config + + $i "Check that Cowboy is listed in rebar.config" + $t $(ERL) -eval " \ + {ok, C} = file:consult(\"$(APP)/rebar.config\"), \ + {_, [{cowboy, \"1.0.0\"}]} = lists:keyfind(deps, 1, C), \ + halt()" + + $i "Distclean the application" + $t $(MAKE) -C $(APP) distclean $v + + $i "Download rebar3" + $t curl -s -L -o $(APP)/rebar3 $(REBAR3_BINARY) + $t chmod +x $(APP)/rebar3 + + $i "Use rebar to build the application" + $t cd $(APP) && ./rebar3 compile $v + +core-compat-rebar-deps-pkg: build clean $i "Bootstrap a new OTP library named $(APP)" $t mkdir $(APP)/ @@ -162,7 +189,7 @@ core-compat-rebar-deps-pkg: build clean-core-compat-rebar-deps-pkg $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 +core-compat-rebar-erlc-opts: build clean $i "Bootstrap a new OTP library named $(APP)" $t mkdir $(APP)/ @@ -211,7 +238,7 @@ core-compat-rebar-erlc-opts: build clean-core-compat-rebar-erlc-opts $i "Use rebar to build the application" $t cd $(APP) && ./rebar compile $v -core-compat-rebar-pt: build clean-core-compat-rebar-pt +core-compat-rebar-pt: build clean $i "Bootstrap a new OTP library named $(APP)" $t mkdir $(APP)/ @@ -226,7 +253,7 @@ core-compat-rebar-pt: build clean-core-compat-rebar-pt $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile $i "Add the lager_transform parse_transform to ERLC_OPTS" - $t echo "ERLC_OPTS += +'{parse_transform, lager_transform}'" >> $(APP)/Makefile + $t echo "ERLC_OPTS += +'{parse_transform, lager_transform}' +'{lager_truncation_size, 1234}'" >> $(APP)/Makefile $i "Build the application" $t $(MAKE) -C $(APP) $v @@ -242,6 +269,7 @@ core-compat-rebar-pt: build clean-core-compat-rebar-pt {ok, C} = file:consult(\"$(APP)/rebar.config\"), \ {_, Opts} = lists:keyfind(erl_opts, 1, C), \ true = lists:member({parse_transform, lager_transform}, Opts), \ + true = lists:member({lager_truncation_size, 1234}, Opts), \ halt()" # For the new build method, we have to simulate keeping the .app file |