-
-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathMakefile
More file actions
115 lines (92 loc) · 3.73 KB
/
Makefile
File metadata and controls
115 lines (92 loc) · 3.73 KB
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
SHELL := /usr/bin/env bash
flutter := ./flutter/bin/flutter
dart := ./flutter/bin/dart
version_define = --dart-define=ORGRO_VERSION=$(shell sed -nE 's/version: *(([0-9.])+)\+.*/\1/p' pubspec.yaml)
walled_garden_define := --dart-define=ORGRO_WALLED_GARDEN=true
dart_defines = $(version_define) $(walled_garden_define)
ui_string_keys = jq -r 'keys | .[] | select(startswith("@") | not)' $(1)
ui_string_values = jq -r 'to_entries | .[] | select(.key | startswith("@") | not) | .value' $(1)
spellcheck = $(call ui_string_values,lib/l10n/app_$(1).arb) | \
aspell pipe --lang=$(1) --home-dir=. --personal=.aspell.$(1).pws | \
awk '/^&/ {w++; print} END {exit w}'
key_store = $(shell sed -nE 's/storeFile=(.+)/\1/p' android/key.properties)
.PHONY: all
all: release
.PHONY: run
run: ## Run app with full environment
$(flutter) run $(dart_defines) $(args)
.PHONY: clean
clean: ## Clean project
clean:
$(flutter) clean
.PHONY: test
test: ## Run tests
$(flutter) analyze
$(flutter) test
.PHONY: test-watch
test-watch:
fswatch -0 -e '*~$$' -e '/\.#' -e '#$$' lib test \
| xargs -0 -I {} bash -c '$(flutter) test $$([[ {} =~ test/.* ]] && echo {})'
.PHONY: generate
generate:
$(flutter) pub get
$(flutter) gen-l10n
.PHONY: dirty-check
dirty-check: generate
$(if $(shell git status --porcelain),$(error 'You have uncommitted changes. Aborting.'))
.PHONY: format-check
format-check:
$(dart) format --set-exit-if-changed lib test
required_locales := en_US en_GB ja
.PHONY: l10n-check
l10n-check: ## Check l10n data for issues
$(foreach _,$(required_locales:%=lib/l10n/app_%.arb),\
diff <($(call ui_string_keys,lib/l10n/app_en.arb)) <($(call ui_string_keys,$(_))) &&) true
$(call spellcheck,en_US)
$(call spellcheck,en_GB)
.PHONY: build
build:
find ./assets -name '*~' -delete
$(flutter) build appbundle $(dart_defines)
$(flutter) build ipa $(dart_defines)
.PHONY: release
release: ## Prepare Android bundle and iOS archive for release
release: dirty-check keystore-check format-check l10n-check web-assets-deploy-check test build
open -a Transporter build/ios/ipa/Orgro.ipa
.PHONY: release-wait
release-wait: keystore-wait release
.PHONY: keystore-wait
keystore-wait:
$(if $(wildcard android/key.properties),,$(error android/key.properties not found))
while [ ! -f $(key_store) ]; do echo "Waiting for key store..."; ls -al $(key_store); sleep 3; done
.PHONY: keystore-check
keystore-check:
$(if $(wildcard android/key.properties),,$(error android/key.properties not found))
$(if $(wildcard $(key_store)),,$(error key_store not found))
@exit 0
dryrun := --dryrun
config_get = awk -F ' = ' '/^$(1) *=/ {print $$2}' config.ini
.PHONY: deploy-web-assets
deploy-web-assets:
deploy_path=s3://$$($(call config_get,deploy_bucket)) && \
aws s3 cp $(dryrun) --recursive --exclude '*~' --exclude .DS_Store assets/web $$deploy_path
check_web_asset_deploy = cd ./assets/web/$(1)/ && find . -type f ! -name '*~' -print0 | xargs -0 -I % $(SHELL) -c 'diff <(curl -s https://$(2)/%) %'
.PHONY: web-assets-deploy-check
web-assets-deploy-check:
$(call check_web_asset_deploy,debug,debug.orgro.org)
$(call check_web_asset_deploy,profile,profile.orgro.org)
$(call check_web_asset_deploy,release,orgro.org)
app_site_cdn := https://app-site-association.cdn-apple.com/a/v1
check_app_site_cdn = diff <(curl -s $(app_site_cdn)/$(2)) ./assets/web/$(1)/.well-known/apple-app-site-association
.PHONY: web-assets-cdn-check
web-assets-cdn-check:
$(call check_app_site_cdn,debug,debug.orgro.org)
$(call check_app_site_cdn,profile,profile.orgro.org)
$(call check_app_site_cdn,release,orgro.org)
.PHONY: help
help: ## Show this help text
$(info usage: make [target])
$(info )
$(info Available targets:)
@awk -F ':.*?## *' '/^[^\t].+?:.*?##/ \
{printf " %-24s %s\n", $$1, $$2}' $(MAKEFILE_LIST)