Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
30 changes: 15 additions & 15 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ When in doubt about whether we will be interested in including a new feature, pl

---

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

### Prerequisites

This project uses [Mint](https://github.com/yonaskolb/Mint) to manage Swift linting tools (SwiftLint and SwiftFormat) at pinned versions via `swift/Mintfile`. This ensures consistent formatting across all contributors and CI.
This project uses [Mint](https://github.com/yonaskolb/Mint) to manage Swift linting tools (SwiftLint and SwiftFormat) at pinned versions via `platforms/swift/Mintfile`. This ensures consistent formatting across all contributors and CI.

**Shopify employees** (from `swift/`):
**Shopify employees** (from `platforms/swift/`):

```bash
dev up
Expand All @@ -57,22 +57,22 @@ dev up

```bash
brew install mint
cd swift && mint bootstrap
cd platforms/swift && mint bootstrap
```

### Formatting

```bash
cd swift && ./Scripts/lint fix
cd platforms/swift && ./Scripts/lint fix
```

### Releasing a new Swift version

Open a pull request with the following changes:

1. Bump the package version in `swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift`.
2. Bump the podspec version in `swift/ShopifyCheckoutKit.podspec`.
3. Add an entry to the top of `swift/CHANGELOG.md`.
1. Bump the package version in `platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift`.
2. Bump the podspec version in `platforms/swift/ShopifyCheckoutKit.podspec`.
3. Add an entry to the top of `platforms/swift/CHANGELOG.md`.

Once merged, draft a release on GitHub:

Expand All @@ -84,11 +84,11 @@ Once merged, draft a release on GitHub:

---

## Android (`android/`)
## Android (`platforms/android/`)

### Formatting

This project uses [detekt](https://detekt.dev/) for Kotlin linting and formatting. From `android/`:
This project uses [detekt](https://detekt.dev/) for Kotlin linting and formatting. From `platforms/android/`:

```bash
./gradlew detekt --auto-correct
Expand All @@ -102,12 +102,12 @@ To check for lint issues without auto-correcting:

### Public API surface

The library's public API is tracked via a committed baseline at `android/lib/api/lib.api`, managed by the [binary-compatibility-validator](https://github.com/Kotlin/binary-compatibility-validator) Gradle plugin. CI runs `./gradlew :lib:apiCheck` on every PR and fails if the compiled public API diverges from the baseline.
The library's public API is tracked via a committed baseline at `platforms/android/lib/api/lib.api`, managed by the [binary-compatibility-validator](https://github.com/Kotlin/binary-compatibility-validator) Gradle plugin. CI runs `./gradlew :lib:apiCheck` on every PR and fails if the compiled public API diverges from the baseline.

If your change intentionally modifies the public API:

1. Run `dev api dump` (or `./gradlew :lib:apiDump`) from `android/` to regenerate the baseline.
2. Review the diff in `android/lib/api/lib.api` alongside your code changes.
1. Run `dev api dump` (or `./gradlew :lib:apiDump`) from `platforms/android/` to regenerate the baseline.
2. Review the diff in `platforms/android/lib/api/lib.api` alongside your code changes.
3. Commit the updated `.api` file in the same PR.

If you did *not* intend to change public API and `apiCheck` is failing, the diff shows what your change inadvertently affected — treat it as a signal that something in your PR has consumer-visible impact.
Expand All @@ -116,8 +116,8 @@ If you did *not* intend to change public API and `apiCheck` is failing, the diff

Open a pull request with the following changes:

1. Bump the `versionName` in `android/lib/build.gradle`.
2. Add an entry to the top of `android/CHANGELOG.md`.
1. Bump the `versionName` in `platforms/android/lib/build.gradle`.
2. Add an entry to the top of `platforms/android/CHANGELOG.md`.

Once merged, draft a release on GitHub:

Expand Down
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ updates:

# Android library
- package-ecosystem: gradle
directory: "/android"
directory: "/platforms/android"
schedule:
interval: daily
open-pull-requests-limit: 10
Expand All @@ -38,7 +38,7 @@ updates:

# Android sample app
- package-ecosystem: gradle
directory: "/android/samples/MobileBuyIntegration"
directory: "/platforms/android/samples/MobileBuyIntegration"
schedule:
interval: daily
open-pull-requests-limit: 5
Expand Down
16 changes: 8 additions & 8 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
> - [ ] I've added tests to support my implementation
> - [ ] I have read and agree with the [Contribution Guidelines](./CONTRIBUTING.md)
> - [ ] I have read and agree with the [Code of Conduct](./CODE_OF_CONDUCT.md)
> - [ ] I've updated the relevant platform README (`swift/README.md` and/or `android/README.md`)
> - [ ] I've updated the relevant platform README (`platforms/swift/README.md` and/or `platforms/android/README.md`)

---

<details>
<summary>Releasing a new Swift version?</summary>

- [ ] I have bumped the version in `swift/ShopifyCheckoutKit.podspec`
- [ ] I have bumped the version in `swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift`
- [ ] I have updated `swift/CHANGELOG.md`
- [ ] I have updated the SwiftPM/CocoaPods version snippets in `swift/README.md` (major version only)
- [ ] I have bumped the version in `platforms/swift/ShopifyCheckoutKit.podspec`
- [ ] I have bumped the version in `platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift`
- [ ] I have updated `platforms/swift/CHANGELOG.md`
- [ ] I have updated the SwiftPM/CocoaPods version snippets in `platforms/swift/README.md` (major version only)

</details>

<details>
<summary>Releasing a new Android version?</summary>

- [ ] I have bumped the `versionName` in `android/lib/build.gradle`
- [ ] I have updated `android/CHANGELOG.md`
- [ ] I have updated the Gradle/Maven version snippets in `android/README.md`
- [ ] I have bumped the `versionName` in `platforms/android/lib/build.gradle`
- [ ] I have updated `platforms/android/CHANGELOG.md`
- [ ] I have updated the Gradle/Maven version snippets in `platforms/android/README.md`

</details>

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/android-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

defaults:
run:
working-directory: android
working-directory: platforms/android

steps:
- name: Checkout Repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/android-license-headers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: android
working-directory: platforms/android

steps:
- name: Checkout Repository
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/android-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: android
working-directory: platforms/android

steps:
- name: Checkout Repository
Expand Down Expand Up @@ -48,17 +48,17 @@ jobs:

- name: Setup sample app environment
run: cp .env.example .env
working-directory: android/samples/MobileBuyIntegration
working-directory: platforms/android/samples/MobileBuyIntegration

- name: Build Sample App
run: ./gradlew assembleDebug
working-directory: android/samples/MobileBuyIntegration
working-directory: platforms/android/samples/MobileBuyIntegration

lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: android
working-directory: platforms/android

steps:
- name: Checkout Repository
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ jobs:
with:
filters: |
android:
- 'android/**'
- 'platforms/android/**'
- '.github/workflows/android-test.yml'
- '.github/workflows/android-license-headers.yml'
- '.github/workflows/ci.yml'
swift:
- 'swift/**'
- 'platforms/swift/**'
- 'Package.swift'
- 'Package.resolved'
- '.github/workflows/swift-test-package.yml'
Expand All @@ -49,7 +49,7 @@ jobs:
- '.github/workflows/swift-lint.yml'
- '.github/workflows/ci.yml'
reactNative:
- 'react-native/**'
- 'platforms/react-native/**'
- '.github/workflows/ci.yml'

android-test:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/swift-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ jobs:
if: ${{ github.event_name == 'workflow_dispatch' || !startsWith(github.event.release.tag_name, 'android/') }}
runs-on: ${{ vars.MACOS_RUNNER }}
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/swift/Gemfile
BUNDLE_GEMFILE: ${{ github.workspace }}/platforms/swift/Gemfile
defaults:
run:
working-directory: swift
working-directory: platforms/swift

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
bundler-cache: true
working-directory: swift
working-directory: platforms/swift

- name: Deploy to Cocoapods
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/swift-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
MINT_LINK_PATH: ${{ github.workspace }}/.mint/bin
defaults:
run:
working-directory: swift
working-directory: platforms/swift
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

Expand All @@ -32,7 +32,7 @@ jobs:
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: .mint
key: ${{ runner.os }}-mint-${{ hashFiles('swift/Mintfile') }}
key: ${{ runner.os }}-mint-${{ hashFiles('platforms/swift/Mintfile') }}
restore-keys: |
${{ runner.os }}-mint-

Expand All @@ -53,7 +53,7 @@ jobs:
runs-on: ${{ vars.MACOS_RUNNER }}
defaults:
run:
working-directory: swift
working-directory: platforms/swift
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- run: ./Scripts/ensure_license
Expand All @@ -62,10 +62,10 @@ jobs:
name: CocoaPods
runs-on: ${{ vars.MACOS_RUNNER }}
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/swift/Gemfile
BUNDLE_GEMFILE: ${{ github.workspace }}/platforms/swift/Gemfile
defaults:
run:
working-directory: swift
working-directory: platforms/swift
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/swift-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
timeout-minutes: 20
defaults:
run:
working-directory: swift
working-directory: platforms/swift

steps:
- name: Checkout Repository
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/swift-update-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- name: Read current versions from Mintfile
id: current
run: |
SWIFTLINT=$(grep 'realm/SwiftLint@' swift/Mintfile | sed 's/.*@//')
SWIFTFORMAT=$(grep 'nicklockwood/SwiftFormat@' swift/Mintfile | sed 's/.*@//')
SWIFTLINT=$(grep 'realm/SwiftLint@' platforms/swift/Mintfile | sed 's/.*@//')
SWIFTFORMAT=$(grep 'nicklockwood/SwiftFormat@' platforms/swift/Mintfile | sed 's/.*@//')
echo "swiftlint=$SWIFTLINT" >> "$GITHUB_OUTPUT"
echo "swiftformat=$SWIFTFORMAT" >> "$GITHUB_OUTPUT"

Expand Down Expand Up @@ -66,19 +66,19 @@ jobs:
printf '%s\n' \
"realm/SwiftLint@${{ steps.latest.outputs.swiftlint }}" \
"nicklockwood/SwiftFormat@${{ steps.latest.outputs.swiftformat }}" \
> swift/Mintfile
> platforms/swift/Mintfile

- name: Install Mint and bootstrap new versions
if: steps.check.outputs.has_updates == 'true' && steps.existing_pr.outputs.exists != 'true'
working-directory: swift
working-directory: platforms/swift
run: |
brew install mint
echo "${{ github.workspace }}/.mint/bin" >> "$GITHUB_PATH"
mint bootstrap --link

- name: Run lint fix
if: steps.check.outputs.has_updates == 'true' && steps.existing_pr.outputs.exists != 'true'
working-directory: swift
working-directory: platforms/swift
run: ./Scripts/lint fix --verbose

- name: Commit and push
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Claude / dev tooling
.claude/
CLAUDE.md
!platforms/android/CLAUDE.md
.dev/
.mint

Expand All @@ -23,6 +24,7 @@ xcuserdata/

# Apollo / GraphQL
*.graphqls
!platforms/android/samples/MobileBuyIntegration/app/src/main/graphql/schema.graphqls
apollo-ios-cli

# Android / Gradle
Expand Down
8 changes: 4 additions & 4 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ disabled_rules:
- function_body_length

included:
- swift/Sources
- swift/Tests
- platforms/swift/Sources
- platforms/swift/Tests

excluded:
- swift/Samples
- swift/Sources/ShopifyCheckoutKit/Models.swift
- platforms/swift/Samples
- platforms/swift/Sources/ShopifyCheckoutKit/Models.swift

opt_in_rules:
- array_init
Expand Down
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,27 @@ let package = Package(
.target(
name: "ShopifyCheckoutKit",
dependencies: [],
path: "swift/Sources/ShopifyCheckoutKit",
path: "platforms/swift/Sources/ShopifyCheckoutKit",
resources: [.process("Assets.xcassets")]
),
.target(
name: "ShopifyAcceleratedCheckouts",
dependencies: ["ShopifyCheckoutKit"],
path: "swift/Sources/ShopifyAcceleratedCheckouts",
path: "platforms/swift/Sources/ShopifyAcceleratedCheckouts",
resources: [.process("Localizable.xcstrings"), .process("Media.xcassets")]
),
.testTarget(
name: "ShopifyCheckoutKitTests",
dependencies: ["ShopifyCheckoutKit"],
path: "swift/Tests/ShopifyCheckoutKitTests"
path: "platforms/swift/Tests/ShopifyCheckoutKitTests"
),
.testTarget(
name: "ShopifyAcceleratedCheckoutsTests",
dependencies: [
"ShopifyAcceleratedCheckouts",
.product(name: "ViewInspector", package: "ViewInspector")
],
path: "swift/Tests/ShopifyAcceleratedCheckoutsTests"
path: "platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests"
)
]
)
Loading
Loading