-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathjustfile
More file actions
198 lines (161 loc) · 7 KB
/
Copy pathjustfile
File metadata and controls
198 lines (161 loc) · 7 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
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
XCBEAUTIFY_ARGS := "--quieter --is-ci"
BUILD_THREADS := `getconf _NPROCESSORS_ONLN`
SIMULATOR_NAME := env("SIMULATOR_NAME", "iPhone 17")
SIMULATOR_DEST := "platform=iOS Simulator,name=" + SIMULATOR_NAME
XCODE_CONFIGURATION := env("CONFIGURATION", "Debug")
GEMSTONE_IOS_PROFILE := if XCODE_CONFIGURATION == "Release" { "release" } else { "debug" }
DERIVED_DATA := "build/DerivedData"
SPM_CACHE := "build/SourcePackages"
FAST_BUILD_FLAGS := "GCC_OPTIMIZATION_LEVEL=0 SWIFT_OPTIMIZATION_LEVEL=-Onone SWIFT_COMPILATION_MODE=incremental ENABLE_TESTABILITY=NO"
GEMSTONE_LINKER_FLAGS := '"LIBRARY_SEARCH_PATHS=\$(inherited) $PWD/../core/target/aarch64-apple-ios-sim/' + GEMSTONE_IOS_PROFILE + '" "OTHER_LDFLAGS=\$(inherited) -lgemstone"'
default:
@just --list
bootstrap: install generate-stone
@echo "<== Bootstrap done."
install: install-rust install-typeshare install-toolchains install-swifttools
install-rust:
@cd ../core && just install-rust
install-typeshare:
@echo "==> Install typeshare-cli"
@cd ../core && just install-typeshare
install-toolchains:
@echo "==> Install toolchains for uniffi"
@cd ../core && just gemstone install-ios-targets
install-swifttools:
@echo "==> Install SwiftGen and SwiftFormat"
@brew install swiftgen swiftformat
setup-git:
@echo "==> Setup git submodules"
@git submodule update --init --recursive
@git config submodule.recurse true
spm-resolve:
@xcodebuild -resolvePackageDependencies -project Gem.xcodeproj -scheme Gem -derivedDataPath {{DERIVED_DATA}} -clonedSourcePackagesDirPath {{SPM_CACHE}}
spm-resolve-all:
@sh scripts/spm-resolve-all.sh
lint:
@echo "==> Running SwiftLint"
@git ls-files -z '*.swift' | xargs -0 swiftlint lint --fix --config .swiftlint.yml --quiet --force-exclude
format:
@echo "==> Running SwiftFormat"
@git ls-files -z '*.swift' | xargs -0 swiftformat --config .swiftformat --quiet
_build action extra_flags="":
@set -o pipefail && xcodebuild -project Gem.xcodeproj \
-scheme Gem \
-configuration "{{XCODE_CONFIGURATION}}" \
ONLY_ACTIVE_ARCH=YES \
-destination "{{SIMULATOR_DEST}}" \
-derivedDataPath {{DERIVED_DATA}} \
-clonedSourcePackagesDirPath {{SPM_CACHE}} \
-parallelizeTargets \
-jobs {{BUILD_THREADS}} \
-showBuildTimingSummary \
{{ extra_flags }} \
{{ action }} | xcbeautify {{ XCBEAUTIFY_ARGS }}
# Example: just build
build: (_build "build" FAST_BUILD_FLAGS)
# Example: just build-for-testing
build-for-testing: (_build "build-for-testing" GEMSTONE_LINKER_FLAGS)
clean:
#!/usr/bin/env bash
set -euo pipefail
rm -rf build .build
while IFS= read -r -d '' manifest; do
package_directory="${manifest%/Package.swift}"
rm -rf "$package_directory/build" "$package_directory/.build"
done < <(find . -name Package.swift -print0)
echo "iOS build folders cleaned"
run: build
@echo "==> Installing app on simulator..."
@xcrun simctl boot "{{SIMULATOR_NAME}}" 2>/dev/null || true
@open -a Simulator
@xcrun simctl install "{{SIMULATOR_NAME}}" {{DERIVED_DATA}}/Build/Products/Debug-iphonesimulator/Gem.app
@echo "==> Launching app..."
@xcrun simctl launch --console-pty "{{SIMULATOR_NAME}}" com.gemwallet.ios
# Example: just build-package Primitives
build-package PACKAGE:
@set -o pipefail && xcodebuild -project Gem.xcodeproj \
-scheme {{PACKAGE}} \
ONLY_ACTIVE_ARCH=YES \
-destination "{{SIMULATOR_DEST}}" \
-derivedDataPath {{DERIVED_DATA}} \
-clonedSourcePackagesDirPath {{SPM_CACHE}} \
-parallelizeTargets \
-jobs {{BUILD_THREADS}} \
GCC_OPTIMIZATION_LEVEL=0 \
SWIFT_OPTIMIZATION_LEVEL=-Onone \
build | xcbeautify {{XCBEAUTIFY_ARGS}}
archive-release: clean
@set -o pipefail && xcodebuild -project Gem.xcodeproj \
-scheme Gem \
-configuration Release \
-sdk iphoneos \
-destination "generic/platform=iOS" \
-derivedDataPath {{DERIVED_DATA}} \
-clonedSourcePackagesDirPath {{SPM_CACHE}} \
-archivePath {{DERIVED_DATA}}/Gem.xcarchive \
-jobs {{BUILD_THREADS}} \
CODE_SIGNING_ALLOWED=NO \
archive | xcbeautify {{XCBEAUTIFY_ARGS}}
show-simulator:
@echo "Destination: {{SIMULATOR_DEST}}"
@xcrun simctl list devices | grep "iPhone" | head -5 || true
_test action target="":
@set -o pipefail && xcodebuild -project Gem.xcodeproj \
-scheme Gem \
-configuration "{{XCODE_CONFIGURATION}}" \
ONLY_ACTIVE_ARCH=YES \
-destination "{{SIMULATOR_DEST}}" \
-derivedDataPath {{DERIVED_DATA}} \
-clonedSourcePackagesDirPath {{SPM_CACHE}} \
{{ if target != "" { "-only-testing " + target } else { "" } }} \
-parallel-testing-enabled YES \
-parallelizeTargets \
-jobs {{ BUILD_THREADS }} \
{{ GEMSTONE_LINKER_FLAGS }} \
{{ action }} | xcbeautify {{ XCBEAUTIFY_ARGS }}
test-without-building: (_test "test-without-building")
# Example: just test
# Example: just test PrimitivesTests
test TARGET="": (_test "test" TARGET)
test-all: test
_test-integration action:
@set -o pipefail && xcodebuild -project Gem.xcodeproj \
-scheme GemUITests \
-configuration "{{XCODE_CONFIGURATION}}" \
-testPlan ui_tests \
ONLY_ACTIVE_ARCH=YES \
-destination "{{SIMULATOR_DEST}}" \
-derivedDataPath {{DERIVED_DATA}} \
-clonedSourcePackagesDirPath {{SPM_CACHE}} \
-allowProvisioningUpdates \
-allowProvisioningDeviceRegistration \
{{ GEMSTONE_LINKER_FLAGS }} \
{{action}} | xcbeautify {{XCBEAUTIFY_ARGS}}
test-integration: reset-simulator (_test-integration "test")
test-ui: reset-simulator (_test-integration "test")
build-for-testing-integration: (_test-integration "build-for-testing")
test-integration-without-building: reset-simulator (_test-integration "test-without-building")
# Run full upgrade test: build old version, create wallet, build current, verify wallet survives
test-upgrade COMMIT:
@bash ./scripts/upgrade-test.sh {{COMMIT}}
reset-simulator NAME=SIMULATOR_NAME:
@echo "==> Resetting {{NAME}} simulator to clean state"
@xcrun simctl shutdown "{{NAME}}" 2>/dev/null || true
@xcrun simctl erase "{{NAME}}" 2>/dev/null || true
@xcrun simctl boot "{{NAME}}" 2>/dev/null || true
localize:
@cd ../core && cargo run --package generate --bin generate localize ios ../localization/app ../ios/Packages/Localization/Sources/Resources
@cd ../core && cargo run --package generate --bin generate localize ios-plist ../localization/InfoPlist ../ios/Packages/Localization/Sources/Resources
@cd ../core && cargo run --package generate --bin generate localize ios ../localization/widget ../ios/Packages/Localization/WidgetSources/Resources
just generate-swiftgen
generate: generate-models generate-swiftgen
generate-models:
@echo "==> Generate typeshare for iOS"
@cd ../core && cargo run --package generate --bin generate ios ../ios/Packages
generate-swiftgen:
@echo "==> SwiftGen assets and Localizable.strings"
@swiftgen config run --quiet
generate-stone BUILD_MODE="":
@./scripts/generate-stone.sh --force {{BUILD_MODE}}
bump TARGET="patch":
@cd .. && just bump {{TARGET}}