-
Notifications
You must be signed in to change notification settings - Fork 319
/
Makefile
240 lines (199 loc) · 9.52 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
PUBLIC_API_PREFIX = public-api
# $(1) modules' names(e.g. "libnavigation-core, libnavigation-base...")
define reports-copy-to
for module in $(1) ; do \
if [ -d "$${module}/build/jacoco" ]; then \
cp $${module}/build/jacoco/jacoco.xml $(2)/$${module}.xml || exit 1 & \
else \
echo "Directory $${module}/build/jacoco does not exist. Skipping." ; \
fi \
done
endef
RELEASED_CORE_MODULES = \
libnavigation-base \
libnavigation-metrics \
libnavigation-util \
libnavigator \
libtrip-notification \
libnavigation-core \
libnavigation-copilot \
libnavigation-tripdata \
libnavigation-voice \
libtesting-router
CORE_MODULES = $(RELEASED_CORE_MODULES)
RELEASED_UI_MODULES = \
libnavui-maps \
ui-components \
androidauto \
libnavui-base \
libnavui-util \
libnavigation-android
UI_MODULES = $(RELEASED_UI_MODULES)
PUBLIC_API_MODULES = $(CORE_MODULES) $(UI_MODULES)
APPLICATION_MODULES = \
instrumentation-tests
define run-gradle-tasks
COMMAND="./gradlew"; \
for module in $(1); do \
COMMAND="$${COMMAND} $$module:$(2)"; \
done; \
echo "executing $$COMMAND"; \
eval $$COMMAND;
endef
.PHONY: check-kotlin-lint
check-kotlin-lint:
$(call run-gradle-tasks,$(CORE_MODULES),ktlint)
$(call run-gradle-tasks,$(UI_MODULES),ktlint)
$(call run-gradle-tasks,$(APPLICATION_MODULES),ktlint)
.PHONY: format-kotlin-lint
format-kotlin-lint:
$(call run-gradle-tasks,$(CORE_MODULES),ktlintFormat)
$(call run-gradle-tasks,$(UI_MODULES),ktlintFormat)
$(call run-gradle-tasks,$(APPLICATION_MODULES),ktlintFormat)
.PHONY: check-android-lint
check-android-lint:
$(call run-gradle-tasks,$(CORE_MODULES),lint)
$(call run-gradle-tasks,$(UI_MODULES),lint)
$(call run-gradle-tasks,$(APPLICATION_MODULES),lint)
.PHONY: license-verification
license-verification:
python ./scripts/validate-license.py
.PHONY: license
license:
./gradlew licenseReleaseReport
python3 ./scripts/generate-license.py
.PHONY: javadoc-dokka
javadoc-dokka:
./gradlew dokkaHtmlMultiModule
./docs/replace-styles.sh
.PHONY: dependency-graphs
dependency-graphs:
$(call run-gradle-tasks,$(CORE_MODULES),generateDependencyGraphMapboxLibraries)
$(call run-gradle-tasks,$(UI_MODULES),generateDependencyGraphMapboxLibraries)
.PHONY: dependency-updates
dependency-updates:
$(call run-gradle-tasks,$(CORE_MODULES),dependencyUpdates)
$(call run-gradle-tasks,$(UI_MODULES),dependencyUpdates)
.PHONY: find-all-common-sdk-versions
find-all-common-sdk-versions:
./gradlew findAllCommonSdkVersions
.PHONY: dex-count
dex-count:
./gradlew countDebugDexMethods
./gradlew countReleaseDexMethods
.PHONY: assemble-core-debug
assemble-core-debug:
$(call run-gradle-tasks,$(CORE_MODULES),assembleDebug)
.PHONY: assemble-core-release
assemble-core-release:
$(call run-gradle-tasks,$(CORE_MODULES),assembleRelease $(additional_gradle_parameters))
.PHONY: core-unit-tests
core-unit-tests:
$(call run-gradle-tasks,$(CORE_MODULES),test)
.PHONY: core-unit-tests-jacoco
core-unit-tests-jacoco:
$(call run-gradle-tasks,$(CORE_MODULES),jacocoTestReport)
.PHONY: core-unit-tests-release-jacoco
.SILENT: core-unit-tests-release-jacoco
core-unit-tests-release-jacoco:
$(call run-gradle-tasks,$(CORE_MODULES),jacocoTestReleaseUnitTestReport)
# Prepare core coverage
.PHONY: prepare-core-coverage-reports
.SILENT: prepare-core-coverage-reports
prepare-core-coverage-reports: core-unit-tests-release-jacoco
rm -rf $(CORE_REPORTS_DIR) \
&& mkdir -p $(CORE_REPORTS_DIR) \
&& $(call reports-copy-to,$(RELEASED_CORE_MODULES),$(CORE_REPORTS_DIR)) \
&& wait
.PHONY: core-dependency-graph
core-dependency-graph:
$(call run-gradle-tasks,$(CORE_MODULES),generateDependencyGraphMapboxLibraries)
.PHONY: core-check-api
core-check-api: assemble-core-release
./gradlew :libnavigation-base:checkApi -PhidePackage=com.mapbox.navigation.base.internal
./gradlew :libnavigation-metrics:checkApi -PhidePackage=com.mapbox.navigation.metrics.internal
./gradlew :libnavigation-util:checkApi -PhidePackage=com.mapbox.navigation.utils.internal
./gradlew :libnavigator:checkApi -PhidePackage=com.mapbox.navigation.navigator.internal
./gradlew :libtrip-notification:checkApi -PhidePackage=com.mapbox.navigation.trip.notification.internal
./gradlew :libnavigation-core:checkApi -PhidePackage=com.mapbox.navigation.core.internal
./gradlew :libnavigation-copilot:checkApi -PhidePackage=com.mapbox.navigation.copilot.internal
./gradlew :libnavigation-tripdata:checkApi -PhidePackage=com.mapbox.navigation.tripdata.internal,com.mapbox.navigation.tripdata.maneuver.internal,com.mapbox.navigation.tripdata.progress.internal,com.mapbox.navigation.tripdata.shield.internal,com.mapbox.navigation.tripdata.speedlimit.internal
./gradlew :libnavigation-voice:checkApi -PhidePackage=com.mapbox.navigation.voice.internal -PhideId=ReferencesHidden
./gradlew :libtesting-router:checkApi -PhidePackage=com.mapbox.navigation.testing.router.internal
.PHONY: core-update-api
core-update-api: assemble-core-release
./gradlew :libnavigation-base:updateApi -PhidePackage=com.mapbox.navigation.base.internal
./gradlew :libnavigation-metrics:updateApi -PhidePackage=com.mapbox.navigation.metrics.internal
./gradlew :libnavigation-util:updateApi -PhidePackage=com.mapbox.navigation.utils.internal
./gradlew :libnavigator:updateApi -PhidePackage=com.mapbox.navigation.navigator.internal
./gradlew :libtrip-notification:updateApi -PhidePackage=com.mapbox.navigation.trip.notification.internal
./gradlew :libnavigation-core:updateApi -PhidePackage=com.mapbox.navigation.core.internal
./gradlew :libnavigation-copilot:updateApi -PhidePackage=com.mapbox.navigation.copilot.internal
./gradlew :libnavigation-tripdata:updateApi -PhidePackage=com.mapbox.navigation.tripdata.internal,com.mapbox.navigation.tripdata.maneuver.internal,com.mapbox.navigation.tripdata.progress.internal,com.mapbox.navigation.tripdata.shield.internal,com.mapbox.navigation.tripdata.speedlimit.internal
./gradlew :libnavigation-voice:updateApi -PhidePackage=com.mapbox.navigation.voice.internal
./gradlew :libtesting-router:updateApi -PhidePackage=com.mapbox.navigation.testing.router.internal
.PHONY: assemble-ui-debug
assemble-ui-debug:
$(call run-gradle-tasks,$(UI_MODULES),assembleDebug)
.PHONY: assemble-ui-release
assemble-ui-release:
$(call run-gradle-tasks,$(UI_MODULES),assembleRelease $(additional_gradle_parameters))
.PHONY: ui-unit-tests
ui-unit-tests:
$(call run-gradle-tasks,$(UI_MODULES),test)
.PHONY: ui-unit-tests-jacoco
ui-unit-tests-jacoco:
$(call run-gradle-tasks,$(UI_MODULES),jacocoTestReport)
.PHONY: ui-unit-tests-release-jacoco
.SILENT: core-unit-tests-release-jacoco
ui-unit-tests-release-jacoco:
$(call run-gradle-tasks,$(UI_MODULES),jacocoTestReleaseUnitTestReport)
# Prepare ui coverage
.PHONY: prepare-ui-coverage-reports
.SILENT: prepare-ui-coverage-reports
prepare-ui-coverage-reports: ui-unit-tests-release-jacoco
rm -rf $(UI_REPORTS_DIR) \
&& mkdir -p $(UI_REPORTS_DIR) \
&& $(call reports-copy-to,$(RELEASED_UI_MODULES),$(UI_REPORTS_DIR)) \
&& wait
.PHONY: publish-local
publish-local:
./gradlew publishToMavenLocal
.PHONY: upload-to-sdk-registry-snapshot
upload-to-sdk-registry-snapshot:
./gradlew mapboxSDKRegistryUpload -Psnapshot=true -PVERSION_NAME=$(VERSION_NAME);
.PHONY: upload-to-sdk-registry
upload-to-sdk-registry:
./gradlew mapboxSDKRegistryUpload;
.PHONY: publish-to-sdk-registry
publish-to-sdk-registry:
@if [ -z "$(GITHUB_TOKEN)" ]; then \
echo "GITHUB_TOKEN env variable has to be set"; \
else \
python3 -m pip install git-pull-request; \
./gradlew mapboxSDKRegistryPublishAll; \
fi
.PHONY: ui-check-api
ui-check-api: assemble-ui-release
# TODO Remove -PhideId=ReferencesHidden after fixing errors
./gradlew :libnavui-maps:checkApi -PhidePackage=com.mapbox.navigation.ui.maps.internal -PhideId=ReferencesHidden
./gradlew :ui-components:updateApi -PhidePackage=com.mapbox.navigation.ui.components.internal,com.mapbox.navigation.ui.components.maneuver.internal,com.mapbox.navigation.ui.components.maps.internal,com.mapbox.navigation.ui.components.speedlimit.internal,com.mapbox.navigation.ui.components.status.internal,com.mapbox.navigation.ui.components.tripprogress.internal,com.mapbox.navigation.ui.components.voice.internal
./gradlew :androidauto:updateApi -PhidePackage=com.mapbox.navigation.ui.androidauto.internal
./gradlew :libnavui-base:checkApi -PhidePackage=com.mapbox.navigation.ui.base.internal -PhideId=ReferencesHidden
./gradlew :libnavui-util:checkApi -PhidePackage=com.mapbox.navigation.ui.utils.internal -PhideId=ReferencesHidden
.PHONY: ui-update-api
ui-update-api: assemble-ui-release
./gradlew :libnavui-maps:updateApi -PhidePackage=com.mapbox.navigation.ui.maps.internal
./gradlew :ui-components:updateApi -PhidePackage=com.mapbox.navigation.ui.components.internal,com.mapbox.navigation.ui.components.maneuver.internal,com.mapbox.navigation.ui.components.maps.internal,com.mapbox.navigation.ui.components.speedlimit.internal,com.mapbox.navigation.ui.components.status.internal,com.mapbox.navigation.ui.components.tripprogress.internal,com.mapbox.navigation.ui.components.voice.internal
./gradlew :androidauto:updateApi -PhidePackage=com.mapbox.navigation.ui.androidauto.internal
./gradlew :libnavui-base:updateApi -PhidePackage=com.mapbox.navigation.ui.base.internal
./gradlew :libnavui-util:updateApi -PhidePackage=com.mapbox.navigation.ui.utils.internal
.PHONY: update-metalava
update-metalava:
sh ./scripts/update_metalava.sh
# Android Auto helper command. Set up your environment to run the desktop car emulator.
# Guidance available in the android-auto README: /libnavigation-extensions/androidauto/README.md
.PHONY: car
car:
adb forward tcp:5277 tcp:5277
cd $(ANDROID_HOME)/extras/google/auto/ && ./desktop-head-unit