Skip to content
Draft
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
12 changes: 12 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ To check for lint issues without auto-correcting:
./gradlew detekt
```

## Public API surface

The library's public API is tracked via a committed baseline at `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 public API (adds, removes, or changes any public class, method, or field):

1. Run `dev api dump` (or `./gradlew :lib:apiDump`) to regenerate the baseline.
2. Review the diff in `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.

## Releasing a new version

Open a pull request with the following changes:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
- name: Run Tests
run: ./gradlew clean test --console=plain

- name: Check API Surface
run: ./gradlew :lib:apiCheck --console=plain

build:
runs-on: ubuntu-latest

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
## Requirements

- JDK 17+
- Android SDK 23+
- Android minSdk 23+
- Android compileSdk 35+
- Chrome >= 80

## Getting Started
Expand All @@ -54,7 +55,7 @@ your project:
### Gradle

```groovy
implementation "com.shopify:checkout-sheet-kit:3.5.4"
implementation "com.shopify:checkout-sheet-kit:3.6.0"
```

### Maven
Expand All @@ -64,7 +65,7 @@ implementation "com.shopify:checkout-sheet-kit:3.5.4"
<dependency>
<groupId>com.shopify</groupId>
<artifactId>checkout-sheet-kit</artifactId>
<version>3.5.4</version>
<version>3.6.0</version>
</dependency>
```

Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.library' version '8.12.2' apply false
id 'com.android.library' version '9.1.1' apply false
id 'org.jetbrains.kotlin.android' version '1.9.23' apply false
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.23' apply false
id 'io.gitlab.arturbosch.detekt' version '1.23.8' apply false
id 'org.jetbrains.kotlinx.binary-compatibility-validator' version '0.18.1'
}
10 changes: 10 additions & 0 deletions dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ commands:
desc: Automatically fix format and lint issues where possible
run: ./gradlew detekt --auto-correct

api:
desc: Validate or update the public API baseline (lib/api/lib.api)
subcommands:
check:
desc: Verify public API matches the committed baseline
run: ./gradlew :lib:apiCheck
dump:
desc: Regenerate the baseline after intentional public API changes
run: ./gradlew :lib:apiDump

apollo:
subcommands:
download_schema:
Expand Down
16 changes: 16 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,19 @@ kotlin.code.style=official
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonFinalResIds=false
# -----------------------------------------------------------------------------
# Temporary AGP 9 opt-outs that keep the library compilable with Kotlin 1.9.23.
#
# The library is deliberately held at Kotlin 1.9.23 to maximise consumer
# compatibility: consumers on older Kotlin toolchains can still build against
# our AAR without metadata-version warnings or language/API-level breakage.
#
# Both opt-outs will be removed in AGP 10 (~mid-2026). Before then, plan to
# migrate to Kotlin 2.x as part of the next major library release, with
# `apiVersion`/`languageVersion` pinned to 1.9 in lib/build.gradle to preserve
# the same consumer contract. Revisit this block at that time.
# -----------------------------------------------------------------------------
# Keep the explicit org.jetbrains.kotlin.android plugin at 1.9.23.
android.builtInKotlin=false
# KGP 1.9.23 uses the old DSL types (BaseExtension) that AGP 9 removed.
android.newDsl=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2,186 changes: 2,186 additions & 0 deletions lib/api/lib.api

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions lib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

plugins {
Expand All @@ -15,7 +16,7 @@ def resolveEnvVarValue(name, defaultValue) {
return rawValue ? rawValue : defaultValue
}

def versionName = resolveEnvVarValue("CHECKOUT_SHEET_KIT_VERSION", "3.5.4")
def versionName = resolveEnvVarValue("CHECKOUT_SHEET_KIT_VERSION", "3.6.0")

ext {
app_compat_version = '1.7.1'
Expand All @@ -40,15 +41,18 @@ android {

defaultConfig {
minSdk = 23
targetSdk = 35
versionCode = 1
versionName

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "String", "SDK_VERSION", "\"$versionName\""

aarMetadata {
minCompileSdk = 35
}
}

lintOptions {
lint {
checkDependencies = true
warningsAsErrors = true
warning 'LintBaseline'
Expand Down Expand Up @@ -89,6 +93,10 @@ android {
tasks.withType(KotlinJvmCompile).configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
// Pin language/API version so bytecode stays consumable by Kotlin 1.9.20+ consumers
// even when the compiler later moves to 2.x.
apiVersion.set(KotlinVersion.KOTLIN_1_9)
languageVersion.set(KotlinVersion.KOTLIN_1_9)
if (!name.contains("Test")) {
freeCompilerArgs.add("-Xexplicit-api=strict")
}
Expand Down
5 changes: 1 addition & 4 deletions samples/MobileBuyIntegration/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ android {
compose = true
buildConfig = true
}
composeOptions {
kotlinCompilerExtensionVersion '1.5.8'
}
packagingOptions {
packaging {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.apollographql.apollo.api.Optional
import com.shopify.checkout_sdk_mobile_buy_integration_sample.common.ID
import com.shopify.checkout_sdk_mobile_buy_integration_sample.common.client.StorefrontApiClient
import com.shopify.checkout_sdk_mobile_buy_integration_sample.graphql.type.CartBuyerIdentityInput
import com.shopify.checkout_sdk_mobile_buy_integration_sample.graphql.type.CartDeliveryInput
import com.shopify.checkout_sdk_mobile_buy_integration_sample.graphql.type.CartInput
import com.shopify.checkout_sdk_mobile_buy_integration_sample.graphql.type.CartLineInput
import com.shopify.checkout_sdk_mobile_buy_integration_sample.graphql.type.CartLineUpdateInput
Expand All @@ -52,6 +53,11 @@ class CartRepository(
)
),
buyerIdentity = Optional.present(buyerIdentity(demoBuyerIdentityEnabled, customerAccessToken)),
delivery = if (demoBuyerIdentityEnabled && customerAccessToken == null) {
Optional.present(CartDeliveryInput(addresses = Optional.present(DemoBuyerIdentity.deliveryAddresses)))
} else {
Optional.Absent
},
)

val data = storefrontApiClient.createCart(input)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
package com.shopify.checkout_sdk_mobile_buy_integration_sample.cart.data

import com.apollographql.apollo.api.Optional
import com.shopify.checkout_sdk_mobile_buy_integration_sample.graphql.type.CartAddressInput
import com.shopify.checkout_sdk_mobile_buy_integration_sample.graphql.type.CartBuyerIdentityInput
import com.shopify.checkout_sdk_mobile_buy_integration_sample.graphql.type.CartDeliveryAddressInput
import com.shopify.checkout_sdk_mobile_buy_integration_sample.graphql.type.CartSelectableAddressInput
import com.shopify.checkout_sdk_mobile_buy_integration_sample.graphql.type.CountryCode

object DemoBuyerIdentity {
Expand All @@ -32,4 +35,40 @@ object DemoBuyerIdentity {
countryCode = Optional.present(CountryCode.CA),
phone = Optional.present("+441792123456"),
)

internal val deliveryAddresses = listOf(
CartSelectableAddressInput(
address = CartAddressInput(
deliveryAddress = Optional.present(
CartDeliveryAddressInput(
address1 = Optional.present("The Cloak & Dagger"),
address2 = Optional.present("1st Street Southeast"),
city = Optional.present("Calgary"),
countryCode = Optional.present(CountryCode.CA),
firstName = Optional.present("Ada"),
lastName = Optional.present("Lovelace"),
provinceCode = Optional.present("AB"),
phone = Optional.present("+441792123456"),
zip = Optional.present("T1X 0L3"),
)
)
)
),
CartSelectableAddressInput(
address = CartAddressInput(
deliveryAddress = Optional.present(
CartDeliveryAddressInput(
address1 = Optional.present("8 Lon Heddwch"),
address2 = Optional.present("Llansamlet"),
city = Optional.present("Swansea"),
countryCode = Optional.present(CountryCode.GB),
firstName = Optional.present("Ada"),
lastName = Optional.present("Lovelace"),
phone = Optional.present("+441792123456"),
zip = Optional.present("SA7 9UY"),
)
)
)
),
)
}
2 changes: 1 addition & 1 deletion samples/MobileBuyIntegration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ buildscript {
}
}
plugins {
id 'com.android.application' version '8.12.2' apply false
id 'com.android.application' version '9.1.1' apply false
id 'org.jetbrains.kotlin.android' version '2.2.20' apply false
id 'org.jetbrains.kotlin.plugin.serialization' version '2.2.20' apply false
id 'io.gitlab.arturbosch.detekt' version '1.23.8' apply false
Expand Down
7 changes: 7 additions & 0 deletions samples/MobileBuyIntegration/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ android.enableJettifier=true
kotlin.code.style=official
android.nonTransitiveRClass=true
android.nonFinalResIds=false
# The sample composite includes the :lib project, which is pinned to Kotlin 1.9.23
# for consumer compatibility. That pin requires matching the library's AGP 9
# opt-outs so the shared build can apply the Kotlin plugin cleanly. Both
# opt-outs will be removed in AGP 10 — see /gradle.properties for full context.
# Revisit alongside the next major library release.
android.builtInKotlin=false
android.newDsl=false
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading