forked from erlcloud/erlcloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
136 lines (115 loc) · 2.81 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
.PHONY: all get-deps clean compile run eunit check check-eunit doc
# determine which Rebar we want to be running
REBAR2=$(shell which rebar || echo ./rebar)
REBAR3=$(shell which rebar3)
ifeq ($(FORCE_REBAR2),true)
REBAR=$(REBAR2)
REBAR_VSN=2
else ifeq ($(REBAR3),)
REBAR=$(REBAR2)
REBAR_VSN=2
else
REBAR=$(REBAR3)
REBAR_VSN=3
endif
# eventually this should be just ebin/*.beam, but there are a number
# of warnings in other files. Just check the clean files for now.
CHECK_FILES=\
ebin/erlcloud_aws.beam \
ebin/erlcloud_cloudtrail.beam \
ebin/erlcloud_cloudsearch.beam \
ebin/erlcloud_ddb.beam \
ebin/erlcloud_ddb1.beam \
ebin/erlcloud_ddb2.beam \
ebin/erlcloud_ddb_impl.beam \
ebin/erlcloud_ddb_util.beam \
ebin/erlcloud_http.beam \
ebin/erlcloud_httpc.beam \
ebin/erlcloud_retry.beam \
ebin/erlcloud_sts.beam \
ebin/erlcloud_s3.beam \
ebin/erlcloud_sns.beam
# Checks on the eunit files can help find bad specs and other issues,
# however there are some expected errors in some of the exception
# tests that should be ignored.
CHECK_EUNIT_FILES=\
$(CHECK_FILES) \
.eunit/erlcloud_ddb_tests.beam \
.eunit/erlcloud_ddb2_tests.beam \
.eunit/erlcloud_ddb_util_tests.beam \
.eunit/erlcloud_ec2_tests.beam \
.eunit/erlcloud_s3_tests.beam
all: get-deps compile
get-deps:
ifeq ($(REBAR_VSN),2)
@$(REBAR) get-deps
endif
clean:
@$(REBAR) clean
compile:
@$(REBAR) compile
run:
ifeq ($(REBAR_VSN),2)
erl -pa deps/*/ebin -pa ./ebin
else
$(REBAR) shell
endif
check_warnings:
ifeq ($(REBAR_VSN),2)
@echo skip checking warnings
else
@$(REBAR) as warnings compile
endif
eunit:
ifeq ($(REBAR_VSN),2)
@$(REBAR) compile
@$(REBAR) eunit skip_deps=true
else
@$(REBAR) eunit
endif
check:
ifeq ($(REBAR_VSN),2)
@$(REBAR) compile
dialyzer --verbose --no_check_plt --no_native --fullpath \
$(CHECK_FILES) \
-Wunmatched_returns \
-Werror_handling
else
@$(REBAR) dialyzer
endif
check-eunit: eunit
ifeq ($(REBAR_VSN),2)
dialyzer --verbose --no_check_plt --no_native --fullpath \
$(CHECK_EUNIT_FILES) \
-Wunmatched_returns \
-Werror_handling
else
@$(REBAR) dialyzer
endif
doc:
ifeq ($(REBAR_VSN),2)
@$(REBAR) doc skip_deps=true
else
@$(REBAR) edoc
endif
# The "install" step for Travis
travis-install:
ifeq ($(FORCE_REBAR2),true)
rebar get-deps
else
wget https://s3.amazonaws.com/rebar3/rebar3
chmod a+x rebar3
endif
travis-publish:
@echo Create directories
mkdir -p ~/.hex
mkdir -p ~/.config/rebar3
@echo Decrypt secrets
@openssl aes-256-cbc -K $encrypted_9abc06b32f03_key -iv $encrypted_9abc06b32f03_iv -in hex.config.enc -out ~/.hex/hex.config -d
@echo Create global config
echo '{plugins, [rebar3_hex]}.' > ~/.config/rebar3/rebar.config
@echo Edit version tag in app.src
vi -e -c '%s/{vsn, *.*}/{vsn, "'${TRAVIS_TAG}'"}/g|w|q' src/erlcloud.app.src
@echo Publish to Hex
echo 'Y' | ./rebar3 hex publish
@echo Done