Browse Source

Merge pull request #164 from seriyps/r16-compat-rebar3

Use R16-compatible rebar3 on R16
Sergey Prokhorov 7 years ago
parent
commit
da2603364f
2 changed files with 15 additions and 7 deletions
  1. 0 3
      .travis.yml
  2. 15 4
      Makefile

+ 0 - 3
.travis.yml

@@ -4,9 +4,6 @@ addons:
     packages:
       - postgresql-9.6-postgis-2.3
       - postgresql-contrib-9.6
-before_script:
-  - wget https://s3.amazonaws.com/rebar3/rebar3
-  - chmod u+x ./rebar3
 env:
   - PATH=".:/usr/lib/postgresql/9.6/bin:$PATH"
 install: "true"

+ 15 - 4
Makefile

@@ -1,12 +1,23 @@
-REBAR = rebar3
+REBAR = ./rebar3
 ERL_VSN = $(shell erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().'  -noshell)
 
 all: compile
 
-compile: src/epgsql_errcodes.erl
+$(REBAR):
+	@case "$(ERL_VSN)" in\
+		"R16"*)\
+			wget https://github.com/erlang/rebar3/releases/download/3.5.2/rebar3 \
+			;;\
+		*)\
+			wget https://s3.amazonaws.com/rebar3/rebar3 \
+			;;\
+	esac
+	chmod +x rebar3
+
+compile: src/epgsql_errcodes.erl $(REBAR)
 	@$(REBAR) compile
 
-clean:
+clean: $(REBAR)
 	@$(REBAR) clean
 
 src/epgsql_errcodes.erl:
@@ -18,7 +29,7 @@ test: compile
 dialyzer: compile
 	@$(REBAR) dialyzer
 
-elvis:
+elvis: $(REBAR)
 	@case "$(ERL_VSN)" in\
 		"R16"*)\
 			echo "Elvis is disabled on erl 16"\