Skip to content

Commit 1bf5d08

Browse files
committed
address review feedback (shadowenv, CONTRIBUTING dev tooling, swift clean/build)
1 parent 4b939a7 commit 1bf5d08

6 files changed

Lines changed: 63 additions & 31 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ When in doubt about whether we will be interested in including a new feature, pl
3939
7. Ensure all checks (tests, lint) are passing in GitHub.
4040
8. Open a pull request with a detailed description of what is changing and why.
4141

42+
### Dev tooling
43+
44+
Shopify employees can use the root `dev.yml` from the repo root:
45+
46+
```bash
47+
dev up
48+
dev check
49+
```
50+
51+
Platform-scoped commands are available as `dev android <command>`, `dev swift <command>`, and `dev react-native <command>` (or `dev rn`). Protocol schema/model commands are available as `dev protocol <command>`. For cross-platform changes, use `dev lint`, `dev test`, `dev check`, `dev format`, and `dev build`.
52+
4253
---
4354

4455
## Swift (`platforms/swift/`)

AGENTS.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,24 @@ e2e/ # cross-platform end-to-end tests
1212

1313
## Dev workflow
1414

15+
> **AI agents:** All commands require the `shadowenv exec --` prefix to run inside the shadowenv-managed environment.
16+
>
17+
> ```
18+
> shadowenv exec --dir <repo_root> -- /opt/dev/bin/dev up
19+
> shadowenv exec --dir <repo_root> -- /opt/dev/bin/dev test [ARGS]
20+
> ```
21+
1522
Run `dev` commands from the repo root. Use `dev up` before running commands when
1623
the environment may not be provisioned.
1724
1825
For platform-scoped work, prefer the root `dev.yml` commands:
1926
2027
- Android: `dev android <command>`
2128
- Swift: `dev swift <command>`
22-
- Protocol: `dev protocol <command>`
2329
- React Native: `dev react-native <command>` or `dev rn <command>`
2430
31+
For protocol schema/model work, use `dev protocol <command>`.
32+
2533
For cross-platform changes, use the repo-wide aggregates: `dev lint`,
2634
`dev test`, `dev check`, `dev format`, and `dev build`. Use
2735
`dev <platform> format` for formatting; `fix` remains an alias for existing

README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,6 @@ Feature guides:
2727
- [Privacy compliance](https://shopify.dev/docs/storefronts/mobile/checkout-kit/privacy-compliance) - pass GDPR, CCPA, and ATT consent through to Shopify.
2828
- [Accelerated checkouts](https://shopify.dev/docs/storefronts/mobile/checkout-kit/accelerated-checkouts?extension=react-native) - Shop Pay and Apple Pay buttons for one-tap purchase on product and cart pages.
2929

30-
## Development
31-
32-
Shopify employees can use the root `dev.yml` from the repo root:
33-
34-
```bash
35-
dev up
36-
dev check
37-
```
38-
39-
Platform-scoped commands are available as `dev android <command>`, `dev swift <command>`, `dev protocol <command>`, and `dev react-native <command>` or `dev rn <command>`. For cross-platform changes, use `dev lint`, `dev test`, `dev check`, `dev format`, and `dev build`.
40-
4130
## Packages in this repo
4231

4332
Checkout Kit is a monorepo containing all the platforms Checkout Kit supports together.

dev.yml

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ check:
8989
react-native-license-headers: cd platforms/react-native && ./scripts/copy_license --check
9090
web-lint: cd platforms/web && pnpm lint
9191
web-test: cd platforms/web && pnpm test
92-
protocol-build: cd protocol/languages/swift && swift build
9392

9493
commands:
9594
# Repo-wide
@@ -99,7 +98,6 @@ commands:
9998
set -e
10099
/opt/dev/bin/dev android build
101100
/opt/dev/bin/dev swift build
102-
/opt/dev/bin/dev protocol build
103101
/opt/dev/bin/dev react-native build
104102
105103
codegen:
@@ -135,7 +133,6 @@ commands:
135133
set -e
136134
/opt/dev/bin/dev android test
137135
/opt/dev/bin/dev swift test
138-
/opt/dev/bin/dev protocol test
139136
/opt/dev/bin/dev react-native test
140137
141138
apollo:
@@ -164,13 +161,13 @@ commands:
164161
desc: "Checkout protocol commands"
165162
subcommands:
166163
build:
167-
desc: Build the Swift protocol package
168-
run: cd protocol/languages/swift && swift build
164+
desc: Build the Swift protocol target
165+
run: swift build --target ShopifyCheckoutProtocol
169166
test:
170-
desc: Run Swift protocol package tests
171-
run: cd protocol/languages/swift && swift test
167+
desc: Run Swift protocol target tests
168+
run: cd platforms/swift && ./Scripts/xcode_run test ShopifyCheckoutKit-Package ShopifyCheckoutProtocolTests
172169
check:
173-
desc: Build and test the Swift protocol package
170+
desc: Build and test the Swift protocol target
174171
run: |
175172
set -e
176173
/opt/dev/bin/dev protocol build
@@ -257,12 +254,34 @@ commands:
257254
aliases: [fix]
258255
run: cd platforms/swift && ./Scripts/lint fix
259256
clean:
260-
desc: Clean Swift package build artifacts
261-
run: cd platforms/swift && ./Scripts/xcode_run clean ShopifyCheckoutKit-Package
257+
desc: Clean Swift packages and sample app build artifacts
258+
run: |
259+
set -e
260+
cd platforms/swift
261+
# ShopifyCheckoutKit-Package is the SPM-wide scheme: it cleans all
262+
# library targets in Package.swift (ShopifyCheckoutKit,
263+
# ShopifyAcceleratedCheckouts, ShopifyCheckoutProtocol) in one pass.
264+
./Scripts/xcode_run clean ShopifyCheckoutKit-Package
265+
cd Samples
266+
# Sample apps have a "Run Script" build phase that runs during clean
267+
# and exits non-zero when there is nothing to delete. Tolerate it so
268+
# the second sample still gets cleaned.
269+
../Scripts/xcode_run clean MobileBuyIntegration || true
270+
../Scripts/xcode_run clean ShopifyAcceleratedCheckoutsApp || true
262271
build:
263-
desc: Build the Swift package
264-
run: cd platforms/swift && ./Scripts/xcode_run build ShopifyCheckoutKit-Package
272+
desc: Build all Swift packages and sample apps
273+
run: |
274+
set -e
275+
cd platforms/swift
276+
# ShopifyCheckoutKit-Package builds every library target in
277+
# Package.swift in one xcodebuild invocation. The sample apps act as
278+
# integration compilation checks against the built libraries.
279+
./Scripts/xcode_run build ShopifyCheckoutKit-Package
280+
./Scripts/build_samples
265281
subcommands:
282+
packages:
283+
desc: Build Swift package targets
284+
run: cd platforms/swift && ./Scripts/xcode_run build ShopifyCheckoutKit-Package
266285
samples:
267286
desc: Build all sample applications to verify integration
268287
run: cd platforms/swift && ./Scripts/build_samples
@@ -336,9 +355,6 @@ commands:
336355
sccache --stop-server 2>/dev/null || true
337356
fi
338357
echo "Cleaned root, module and sample workspaces"
339-
build:
340-
desc: Build the @shopify/checkout-kit-react-native module
341-
run: cd platforms/react-native && pnpm module build
342358
lint:
343359
desc: Run all React Native lint checks (Swift, module, sample)
344360
aliases: [style]
@@ -353,13 +369,13 @@ commands:
353369
desc: Lint Swift code via SwiftLint
354370
run: cd platforms/react-native && ./scripts/lint_swift
355371
module:
356-
desc: Lint the @shopify/checkout-sheet-kit module
372+
desc: Lint the @shopify/checkout-kit-react-native module
357373
run: cd platforms/react-native && pnpm module lint
358374
sample:
359375
desc: Lint the sample app
360376
run: cd platforms/react-native && pnpm sample lint
361377
format:
362-
desc: Auto-fix Swift lint and format issues
378+
desc: Auto-format and apply safe lint autocorrections (Swift bridge only)
363379
aliases: [fix]
364380
run: cd platforms/react-native && ./scripts/lint_swift fix
365381
test:

platforms/swift/.cursor/rules/swift-development.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ alwaysApply: true
2626
Key commands for verification:
2727
- `dev swift lint` (alias: `dev swift style`) - Check format & lint issues
2828
- `dev swift format` - Auto-format and apply safe lint autocorrections
29-
- `dev swift build packages` - Build both packages
29+
- `dev swift build packages` - Build Swift package targets
3030
- `dev swift test` - Run all tests
3131

3232
## Concurrency Best Practices

platforms/swift/Scripts/xcode_run

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,18 @@ if [[ "$ACTION" == *"test"* && -n "$TEST_FILTER" ]]; then
5050
# Find which test target contains this test class (search all test targets automatically)
5151
project_root="$(cd "$SCRIPT_DIR/.." && pwd)"
5252
test_target=""
53+
target_filter_added=""
5354

5455
# Discover all test targets by looking for *Tests directories
5556
test_file=""
5657
for test_dir in "$project_root/Tests"/*Tests; do
5758
if [[ -d "$test_dir" ]]; then
5859
target_name=$(basename "$test_dir")
60+
if [[ "$TEST_FILTER" == "$target_name" ]]; then
61+
xcodebuild_cmd="$xcodebuild_cmd -only-testing:$target_name"
62+
target_filter_added="1"
63+
break
64+
fi
5965
# Check if TEST_FILTER matches a .swift filename
6066
if find "$test_dir" -name "$TEST_FILTER.swift" -type f | grep -q .; then
6167
test_target="$target_name"
@@ -65,7 +71,9 @@ if [[ "$ACTION" == *"test"* && -n "$TEST_FILTER" ]]; then
6571
fi
6672
done
6773

68-
if [[ -n "$test_target" && -n "$test_file" ]]; then
74+
if [[ -n "$target_filter_added" ]]; then
75+
:
76+
elif [[ -n "$test_target" && -n "$test_file" ]]; then
6977
# Extract all test class names from the file
7078
test_classes=$(grep "class.*XCTestCase" "$test_file" | sed 's/.*class \([^:]*\):.*/\1/')
7179

0 commit comments

Comments
 (0)