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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ The library's public API is tracked via a committed baseline at `platforms/andro

If your change intentionally modifies the public API:

1. Run `dev api dump` (or `./gradlew :lib:apiDump`) from `platforms/android/` to regenerate the baseline.
1. Run `dev android api dump` from the repo root (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.

Expand Down
82 changes: 82 additions & 0 deletions dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,31 @@ name: checkout-kit
up:
- packages:
- quicktype
- rover
- ruby
- custom:
name: Install bundle packages
met?: BUNDLE_GEMFILE=platforms/swift/Gemfile bundle check
meet: BUNDLE_GEMFILE=platforms/swift/Gemfile bundle install
# Android
- custom:
name: Ensure Android sample app .env files exist
met?: |
([ -f "./platforms/android/samples/MobileBuyIntegration/.env" ] || exit 1)
meet: cd platforms/android && ./scripts/setup_env.sh

open:
"GitHub": "https://github.com/Shopify/checkout-kit"
"Issues": "https://github.com/Shopify/checkout-kit/issues"
"PRs": "https://github.com/Shopify/checkout-kit/pulls"

check:
android-license-headers: cd platforms/android && ./scripts/check_license_headers.rb
android-detekt: cd platforms/android && ./gradlew detekt
android-lint: cd platforms/android && ./gradlew lintRelease

commands:
# Repo-wide
codegen:
desc: "Generate UCP models. Usage: dev codegen <kotlin|swift>"
syntax: "<kotlin|swift>"
Expand Down Expand Up @@ -38,3 +56,67 @@ commands:
swift) shift; cd platforms/swift && ./Scripts/apollo_codegen "$@" ;;
*) echo "Usage: dev apollo codegen <android|swift> [accelerated|mobile-buy|all]"; exit 1 ;;
esac

# Android
android:
desc: "Android Checkout Kit commands"
subcommands:
build:
desc: Build the library
run: cd platforms/android && ./gradlew :lib:build
subcommands:
samples:
desc: Build all sample applications
run: cd platforms/android/samples/MobileBuyIntegration && ./gradlew build

test:
desc: Run all tests with clean build
run: cd platforms/android && ./gradlew clean test --console=plain
subcommands:
specific:
desc: Run specific test class
syntax: <TestClassName> (e.g. CheckoutBridgeTest)
run: cd platforms/android && ./gradlew :lib:testDebugUnitTest --tests "$1"

lint:
desc: Check code style and lint (detekt + Android lint)
aliases: [style]
run: cd platforms/android && ./gradlew detekt lintRelease

fix:
desc: Automatically fix format and lint issues where possible
run: cd platforms/android && ./gradlew detekt --auto-correct

api:
desc: Validate or update the public API baseline (lib/api/lib.api)
run: |
echo "Usage: dev android api {check|dump}"
echo ""
echo " check Verify public API matches the committed baseline"
echo " dump Regenerate the baseline after intentional public API changes"
subcommands:
check:
desc: Verify public API matches the committed baseline
run: cd platforms/android && ./gradlew :lib:apiCheck
dump:
desc: Regenerate the baseline after intentional public API changes
run: cd platforms/android && ./gradlew :lib:apiDump

check:
desc: Run all Android checks (license headers, detekt, android lint)
run: |
set -e
cd platforms/android
./scripts/check_license_headers.rb
./gradlew detekt
./gradlew lintRelease
subcommands:
license-headers:
desc: Check MIT license headers in source files
run: cd platforms/android && ./scripts/check_license_headers.rb
detekt:
desc: Run detekt static analysis
run: cd platforms/android && ./gradlew detekt
android-lint:
desc: Run Android lint
run: cd platforms/android && ./gradlew lintRelease
Comment thread
kyle-schellen marked this conversation as resolved.
10 changes: 5 additions & 5 deletions platforms/android/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ The library's public API is captured in `lib/api/lib.api` (managed by the [binar

If a change intentionally modifies public API (adding, removing, or changing any public class, method, field, or property):

1. Run `./gradlew :lib:apiDump` (or `dev api dump`) to regenerate the baseline.
1. Run `./gradlew :lib:apiDump` (or `dev android api dump`) to regenerate the baseline.
2. Review the diff in `lib/api/lib.api` — it's the single best indicator of consumer impact, and reviewers will focus on it.
3. Commit the updated `.api` file in the same PR as the code change.

If `apiCheck` fails and you did *not* intend to change public API, the diff tells you what inadvertently leaked out. Fix the leak rather than updating the baseline — you've accidentally shifted the consumer contract.

## Common commands

- Tests: `./gradlew :lib:test` (or `dev test`)
- API surface: `./gradlew :lib:apiCheck` / `./gradlew :lib:apiDump` (or `dev api check` / `dev api dump`)
- Lint: `./gradlew detekt lintRelease` (or `dev style`)
- Auto-fix lint: `./gradlew detekt --auto-correct` (or `dev fix`)
- Tests: `./gradlew :lib:test` (or `dev android test`)
- API surface: `./gradlew :lib:apiCheck` / `./gradlew :lib:apiDump` (or `dev android api check` / `dev android api dump`)
- Lint: `./gradlew detekt lintRelease` (or `dev android lint`)
- Auto-fix lint: `./gradlew detekt --auto-correct` (or `dev android fix`)
- Full local verification: `./gradlew :lib:clean :lib:test :lib:detekt :lib:lintRelease :lib:assembleRelease`
- Sample app build (from `samples/MobileBuyIntegration/`): `./gradlew assembleDebug`

Expand Down
60 changes: 0 additions & 60 deletions platforms/android/dev.yml

This file was deleted.

22 changes: 11 additions & 11 deletions platforms/android/samples/MobileBuyIntegration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ API_VERSION=2025-10

### 2. Download the new schema

The schema defines what types and fields are available in the API. Run from the **android module root** (`platforms/android/`):
The schema defines what types and fields are available in the API. Run from the **repo root** (`checkout-kit/`):

```bash
dev apollo download_schema
dev apollo download_schema android
```

This uses [`rover`](https://www.apollographql.com/docs/rover/) to introspect your store's Storefront API at the configured version and writes `schema.graphqls` into `app/src/main/graphql/`.
Expand Down Expand Up @@ -106,10 +106,10 @@ query FetchProducts(...) {
From the **repo root**:

```bash
dev apollo codegen
dev apollo codegen android
```

This reads the schema + your `.graphql` files and regenerates the Kotlin code in `app/build/generated/source/apollo/`. The command also runs `dev style` to check formatting.
This reads the schema + your `.graphql` files and regenerates the Kotlin code in `app/build/generated/source/apollo/`. The command also runs `dev android lint` to check formatting.

### 5. Build and fix any issues

Expand All @@ -121,16 +121,16 @@ If the new schema removed or renamed fields, you'll get compile errors pointing

## Dev commands reference

All commands are run from the **android module root** (`platforms/android/`):
All commands are run from the **repo root** (`checkout-kit/`):

| Command | Description |
|---------|-------------|
| `dev apollo download_schema` | Download the Storefront API schema for this sample app |
| `dev apollo codegen` | Regenerate Kotlin types from `.graphql` files |
| `dev style` | Run detekt + Android lint checks |
| `dev build` | Build the library |
| `dev build samples` | Build all sample applications |
| `dev test` | Run all tests |
| `dev apollo download_schema android` | Download the Storefront API schema for this sample app |
| `dev apollo codegen android` | Regenerate Kotlin types from `.graphql` files |
Comment thread
kyle-schellen marked this conversation as resolved.
| `dev android lint` | Run detekt + Android lint checks |
| `dev android build` | Build the library |
| `dev android build samples` | Build all sample applications |
| `dev android test` | Run all tests |

## Key files

Expand Down
2 changes: 1 addition & 1 deletion platforms/android/scripts/apollo_codegen
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ else
fi

cd ../..
/opt/dev/bin/dev style
/opt/dev/bin/dev android lint
Loading