-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
135 lines (113 loc) · 4.47 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
# Makefile for building, testing and publishing
# charts_common_cf and charts_flutter_cf
AT=@
.PHONY: all
all: help
.PHONY: help
help:
@echo "Usage charts_cf: make [Target]"
@echo " Run commands for building, testing and publishing"
@echo " charts_common_cf and charts_flutter_cf"
@echo
@echo "Targets:"
@echo " get: Get packages needed for charts_common_cf and charts_flutter_cf"
@echo " test: Test charts_common_cf and charts_flutter_cf"
@echo " dry-run: Dry-run publish for charts_common_cf and charts_flutter_cf"
@echo " release: Updates version numbers in pubspec.yaml files,"
@echo " generates new changelog's, creates Release-x.y.z+cf branch,"
@echo " commits changes, creates tag, does a get, test and dry-run"
@echo " Example usage: make release charts_ver=0.10.3+cf"
@echo " publish: Publish charts_common_cf and charts_flutter_cf"
@echo " test_common_failing: Test failures are reported in charts_common_cf"
@echo " test_flutter_failing: Test failures are reported in charts_flutter_cf"
@echo " help: This help message"
.PHONY: get
get: get_common get_flutter
.PHONY: get_common
get_common:
$(AT)(cd charts_common_cf ; pub get)
.PHONY: get_flutter
get_flutter:
$(AT)(cd charts_flutter_cf ; flutter pub get)
.PHONY: test
test: test_common test_flutter
.PHONY: test_common
test_common:
$(AT)(cd charts_common_cf ; pub run test)
.PHONY: test_flutter
test_flutter:
$(AT)(cd charts_flutter_cf ; flutter test)
.PHONY: test_common_failing
test_common_failing:
$(AT)(cd charts_common_cf; \
cp ../tools_cf/failing_test.dart test/; \
pub run test; \
result=$$?; \
rm -f test/failing_test.dart; \
exit $${result})
.PHONY: test_flutter_failing
test_flutter_failing:
$(AT)(cd charts_flutter_cf; \
cp ../tools_cf/failing_test.dart test/; \
flutter test; \
result=$$?; \
rm -f test/failing_test.dart; \
exit $${result})
.PHONY: gen-changelog
gen-changelog: gen-changelog_common gen-changelog_flutter
.PHONY: gen-changelog_common
gen-changelog_common:
$(AT)(cd charts_common_cf; \
if [[ "$${charts_ver}" == "" ]]; then echo "No 'charts_ver=xxxx' parameter, aborting"; exit 1; fi; \
auto-changelog --latest-version $${charts_ver} --stdout | cat - ../tools_cf/charts_common.original.CHANGELOG.md > CHANGELOG.md)
.PHONY: gen-changelog_flutter
gen-changelog_flutter:
$(AT)(cd charts_flutter_cf; \
if [[ "$${charts_ver}" == "" ]]; then echo "No 'charts_ver=xxxx' parameter, aborting"; exit 1; fi; \
auto-changelog --latest-version $${charts_ver} --stdout | cat - ../tools_cf/charts_flutter.original.CHANGELOG.md > CHANGELOG.md)
.PHONY: dry-run
dry-run: dry-run_common dry-run_flutter
.PHONY: dry-run_common
dry-run_common:
$(AT)(cd charts_common_cf ; pub publish --dry-run)
.PHONY: dry-run_flutter
dry-run_flutter:
$(AT)(cd charts_flutter_cf; \
../tools_cf/change_common_to_package.sh; \
flutter pub publish --dry-run; \
../tools_cf/change_common_to_path.sh)
.PHONY: update-version
update-version:
$(AT)(charts_ver=$${charts_ver} tools_cf/update_version.sh)
# The weird bit where we do:
# git commit -am "Release $${charts_ver}"
# make gen-changelog charts_ver=$${charts_ver}
# git commit -a --amend -C $${cur_git_branch}
# Is needed because the first commit doesn't contain
# the "Direct Commit" "Release x.y.x+cf:". So we run
# `make gen-changelog charts_ver=$${charts_ver}` a
# second time, which does create the desired output
# and then ammed the first commit.
.PHONY: release
release: update-version gen-changelog
$(AT)( \
if [[ "$${expected_branch}" == "" ]]; then expected_branch="release"; fi; \
cur_git_branch=`git rev-parse --abbrev-ref HEAD`; \
if [[ "$${cur_git_branch}" != "$${expected_branch}" ]]; then echo "Not on '$${expected_branch}' branch, aborting"; exit 1; fi; \
if [[ "$${charts_ver}" == "" ]]; then echo "No 'charts_ver=xxxx' parameter, aborting"; exit 1; fi; \
git commit -am "Release $${charts_ver}" && \
make gen-changelog charts_ver=$${charts_ver} && \
git commit -a --amend -C $${cur_git_branch} && \
git tag $${charts_ver} && \
make get test dry-run)
.PHONY: publish
publish: get test publish_common publish_flutter
.PHONY: publish_common
publish_common:
$(AT)(cd charts_common_cf ; pub publish)
.PHONY: publish_flutter
publish_flutter:
$(AT)(cd charts_flutter_cf; \
../tools_cf/change_common_to_package.sh; \
flutter pub publish; \
../tools_cf/change_common_to_path.sh)