-
Notifications
You must be signed in to change notification settings - Fork 114
Expand file tree
/
Copy pathJustfile
More file actions
106 lines (90 loc) · 3.47 KB
/
Copy pathJustfile
File metadata and controls
106 lines (90 loc) · 3.47 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
mod lib '../../../lib.just'
default: dev
# --------------------------------------------------------------------------
# Development
# --------------------------------------------------------------------------
# checks required tools are installed
doctor:
@echo '{{ style("command") }}doctor:{{ NORMAL }}'
@just lib::check-apple
# installs Rust targets required for Apple packaging with cargo-swift
install-targets:
@echo '{{ style("command") }}install-targets:{{ NORMAL }}'
TOOLCHAIN="${RUSTUP_TOOLCHAIN:-$(rustup show active-toolchain | awk '{print $1}')}" ; \
echo " Toolchain: $TOOLCHAIN" ; \
rustup target add --toolchain "$TOOLCHAIN" \
aarch64-apple-ios \
aarch64-apple-ios-sim \
x86_64-apple-darwin \
x86_64-apple-ios
# auto-fix formatting and lint issues
fix:
@echo '{{ style("command") }}fix:{{ NORMAL }}'
swiftlint --fix CounterApp/
# validate formatting and lint
check:
@echo '{{ style("command") }}check:{{ NORMAL }}'
swiftlint lint CounterApp/
# generates Swift types via codegen binary
typegen:
@echo '{{ style("command") }}typegen:{{ NORMAL }}'
RUST_LOG=info cargo run \
--package shared \
--bin codegen \
--features codegen,facet_typegen \
-- \
--language swift \
--output-dir generated
# builds the shared library as a Swift package using BoltFFI, then fixes the
# macOS XCFramework slice from a shallow (iOS-style) bundle to the versioned
# bundle structure that macOS requires. boltffi currently generates shallow
# bundles for all platforms (see https://github.com/boltffi/boltffi/issues/560).
[working-directory('../shared')]
package: install-targets
@echo '{{ style("command") }}package:{{ NORMAL }}'
rm -rf ../apple/generated/Shared
boltffi pack apple
FW="../apple/generated/Shared/Shared.xcframework/macos-arm64_x86_64/SharedFFI.framework" ; \
mkdir -p "$FW/Versions/A/Resources" ; \
mv "$FW/SharedFFI" "$FW/Versions/A/SharedFFI" ; \
mv "$FW/Headers" "$FW/Versions/A/Headers" ; \
mv "$FW/Modules" "$FW/Versions/A/Modules" ; \
mv "$FW/Info.plist" "$FW/Versions/A/Resources/Info.plist" ; \
ln -sf A "$FW/Versions/Current" ; \
ln -sf Versions/Current/SharedFFI "$FW/SharedFFI" ; \
ln -sf Versions/Current/Headers "$FW/Headers" ; \
ln -sf Versions/Current/Modules "$FW/Modules" ; \
ln -sf Versions/Current/Resources "$FW/Resources"
# rebuilds the Xcode project from project.yml
generate-project:
@echo '{{ style("command") }}generate-project:{{ NORMAL }}'
xcodegen
# generates types, builds shared package, and regenerates Xcode project
generate: typegen package generate-project
# builds the project (generates first)
build: generate
@echo '{{ style("command") }}build:{{ NORMAL }}'
xcodebuild \
-project CounterApp.xcodeproj \
-scheme CounterApp-macOS \
-configuration Debug \
ONLY_ACTIVE_ARCH=YES \
-skipPackagePluginValidation \
build
# runs tests
test:
@echo '{{ style("command") }}test:{{ NORMAL }}'
@echo " Tests require generated packages — run 'just build' first"
# cleans build artifacts
clean:
@echo '{{ style("command") }}clean:{{ NORMAL }}'
rm -rf generated *.xcodeproj *.xcworkspace DerivedData build
cargo clean
# local development workflow
dev: fix check build test
# CI workflow
ci: check build test
# open in Xcode
open:
@echo '{{ style("command") }}open:{{ NORMAL }}'
xed .