-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathMakefile
More file actions
165 lines (135 loc) · 4.81 KB
/
Makefile
File metadata and controls
165 lines (135 loc) · 4.81 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
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
# FlowDown build automation
SHELL := /bin/bash
.SHELLFLAGS := -o pipefail -c
ROOT_DIR := $(abspath $(CURDIR))
WORKSPACE := $(ROOT_DIR)/FlowDown.xcworkspace
IOS_SCHEME := FlowDown
EXTENSION_SCHEME := FlowDownTranslationProvider
CONFIGURATION ?= Debug
DERIVED_DATA ?= /private/tmp/flowdown-deriveddata
BUILD_HOME := $(DERIVED_DATA)/home
XDG_CACHE_HOME := $(DERIVED_DATA)/xdg-cache
MODULE_CACHE := $(DERIVED_DATA)/ModuleCache.noindex
IOS_DESTINATION := generic/platform=iOS
CATALYST_DESTINATION := generic/platform=macOS,variant=Mac Catalyst
XCODEBUILD_WRAPPER := ./Resources/DevKit/scripts/run_xcodebuild.sh
TRANSLATION_CHECK_SCRIPT := Resources/DevKit/scripts/check_untranslated.py
TRANSLATION_STALE_SCRIPT := Resources/DevKit/scripts/check_translations.py
XCODEBUILD := $(XCODEBUILD_WRAPPER) \
-workspace "$(WORKSPACE)" \
-configuration $(CONFIGURATION) \
-derivedDataPath "$(DERIVED_DATA)" \
-skipMacroValidation \
-skipPackagePluginValidation \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_IDENTITY=""
LOCALIZATION_FILES := \
FlowDown/Resources/Localizable.xcstrings \
FlowDownTranslationProvider/Localizable.xcstrings \
FlowDownWidgets/Localizable.xcstrings
ifeq ($(dirty),1)
export ALLOW_DIRTY := 1
endif
BUILD_ENV := HOME="$(BUILD_HOME)" XDG_CACHE_HOME="$(XDG_CACHE_HOME)" CLANG_MODULE_CACHE_PATH="$(MODULE_CACHE)" SWIFTPM_MODULECACHE_OVERRIDE="$(MODULE_CACHE)"
define prepare-build-dirs
mkdir -p "$(BUILD_HOME)" "$(XDG_CACHE_HOME)" "$(MODULE_CACHE)"
endef
define run-localization-script
for file in $(LOCALIZATION_FILES); do \
python3 $(1) "$$file"; \
done
endef
.PHONY: all help \
build build-ios build-catalyst build-extension \
test test-unit test-online-e2e \
package-resolve scan-license \
localization-check localization-stale-check \
archive archive-ios archive-macos \
chore clean clean-build
all: build
help:
@echo "Build:"
@echo " build Build the iOS and Mac Catalyst app"
@echo " build-ios Build the iOS app"
@echo " build-catalyst Build the Mac Catalyst app"
@echo " build-extension Build the translation provider extension"
@echo ""
@echo "Test:"
@echo " test Run the default test flow"
@echo " test-unit Run app tests on the first available iOS simulator"
@echo " test-online-e2e Run online e2e tests"
@echo ""
@echo "Packages & licenses:"
@echo " package-resolve Resolve SwiftPM packages"
@echo " scan-license Refresh open source licenses"
@echo ""
@echo "Localization:"
@echo " localization-check Check for missing translations"
@echo " localization-stale-check Prune stale keys and verify completeness"
@echo ""
@echo "Archive:"
@echo " archive Archive iOS and macOS release builds"
@echo " archive-ios Archive the iOS release build"
@echo " archive-macos Archive the macOS release build"
@echo ""
@echo "Housekeeping:"
@echo " chore Run localization hygiene and license refresh"
@echo " clean-build Remove repo-local build artifacts"
@echo " clean Remove repo-local build artifacts and derived data"
@echo ""
@echo "Flags:"
@echo " dirty=1 Allow flows that intentionally run on a dirty tree"
build: build-ios build-catalyst
build-ios:
$(prepare-build-dirs)
$(BUILD_ENV) XCBUILD_LABEL=build-ios $(XCODEBUILD) \
-scheme $(IOS_SCHEME) \
-destination "$(IOS_DESTINATION)" \
build
build-catalyst:
$(prepare-build-dirs)
$(BUILD_ENV) XCBUILD_LABEL=build-catalyst $(XCODEBUILD) \
-scheme $(IOS_SCHEME) \
-destination "$(CATALYST_DESTINATION)" \
SUPPORTS_MACCATALYST=YES \
build
build-extension:
$(prepare-build-dirs)
$(BUILD_ENV) XCBUILD_LABEL=build-extension $(XCODEBUILD) \
-scheme $(EXTENSION_SCHEME) \
-destination "$(IOS_DESTINATION)" \
build
test: test-unit
test-unit:
$(prepare-build-dirs)
DESTINATION="$$(./Resources/DevKit/scripts/get_first_ios_simulator.sh)"; \
$(BUILD_ENV) XCBUILD_LABEL=test-unit $(XCODEBUILD) \
-scheme $(IOS_SCHEME) \
-destination "$$DESTINATION" \
test
test-online-e2e:
./Resources/DevKit/scripts/run_online_e2e_tests.sh
package-resolve:
./Resources/DevKit/scripts/resolve-packages.sh
scan-license:
./Resources/DevKit/scripts/scan.license.sh
localization-check:
$(call run-localization-script,$(TRANSLATION_CHECK_SCRIPT))
localization-stale-check:
$(call run-localization-script,$(TRANSLATION_STALE_SCRIPT))
archive:
./Resources/DevKit/scripts/archive.all.sh all
archive-ios:
./Resources/DevKit/scripts/archive.all.sh ios
archive-macos:
./Resources/DevKit/scripts/archive.all.sh macos
chore:
$(MAKE) localization-stale-check
$(MAKE) localization-check
$(MAKE) package-resolve
$(MAKE) scan-license dirty=1
clean-build:
rm -rf "$(ROOT_DIR)/.build" "$(ROOT_DIR)/BuildArtifacts"
clean: clean-build
rm -rf "$(DERIVED_DATA)"