Skip to content

Commit

Permalink
Add consumer proguard rules to prevent minification
Browse files Browse the repository at this point in the history
  • Loading branch information
markmur committed Nov 4, 2024
1 parent f0cc289 commit b9da393
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 3.1.2 - November 4, 2024

- Add `consumerProguardRules` build.gradle option to prevent minification of
classes in release builds.

## 3.1.1 - November 1, 2024

- Logs invalid JSON for lifecycle events
Expand Down
9 changes: 8 additions & 1 deletion modules/@shopify/checkout-sheet-kit/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,16 @@ android {
}

buildTypes {
release {
debug {
minifyEnabled false
}

release {
minifyEnabled true

// Rules in consumerProguardFiles are automatically included in the ProGuard configuration of any application that uses the library
consumerProguardFiles 'proguard-rules.pro'
}
}

lintOptions {
Expand Down
12 changes: 12 additions & 0 deletions modules/@shopify/checkout-sheet-kit/android/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Keep the ObjectMapper and its methods
-keep class com.fasterxml.jackson.databind.ObjectMapper { *; }

# Keep Checkout Sheet Kit classes
-keep class com.shopify.checkoutsheetkit.lifecycleevents.CheckoutCompletedEvent { *; }
-keep class com.shopify.checkoutsheetkit.pixelevents.PixelEvent { *; }
-keep class com.shopify.checkoutsheetkit.CheckoutException { *; }
-keep class com.shopify.checkoutsheetkit.CheckoutExpiredException { *; }
-keep class com.shopify.checkoutsheetkit.ClientException { *; }
-keep class com.shopify.checkoutsheetkit.HttpException { *; }
-keep class com.shopify.checkoutsheetkit.ConfigurationException { *; }
-keep class com.shopify.checkoutsheetkit.CheckoutSheetKitException { *; }
2 changes: 1 addition & 1 deletion modules/@shopify/checkout-sheet-kit/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@shopify/checkout-sheet-kit",
"license": "MIT",
"version": "3.1.1",
"version": "3.1.2",
"main": "lib/commonjs/index.js",
"types": "src/index.ts",
"source": "src/index.ts",
Expand Down
9 changes: 2 additions & 7 deletions sample/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ react {
hermesFlags = ["-O", "-output-source-map"]
}

/**
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
*/
def enableProguardInReleaseBuilds = false

/**
* The preferred build flavor of JavaScriptCore (JSC)
*
Expand Down Expand Up @@ -115,8 +110,8 @@ android {
}
release {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
minifyEnabled true
proguardFiles "proguard-rules.pro"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions sample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNShopifyCheckoutSheetKit (3.1.0):
- RNShopifyCheckoutSheetKit (3.1.1):
- React-Core
- ShopifyCheckoutSheetKit (~> 3.1.1)
- RNVectorIcons (10.0.3):
Expand Down Expand Up @@ -1524,7 +1524,7 @@ SPEC CHECKSUMS:
RNGestureHandler: 9b113eb9b7a4cbe66e1dbf4d9914281863ee0703
RNReanimated: d534e0114e2c3e7011550a78ecf2d0b431435a60
RNScreens: 23dad53fc9db1da2c93e647ae33fd7ce2bd49d60
RNShopifyCheckoutSheetKit: 3d854ed7fe1bc96eab4718819ee79d33488066bc
RNShopifyCheckoutSheetKit: 0fb6aa9fe539a331f313d8e009ecb1917fc6c103
RNVectorIcons: 50ea777efffdd991a22e968aa312d75da7ff46c3
ShopifyCheckoutSheetKit: fe309799b18b8d554f28c3f075d6d57d4811c9ab
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Expand Down

0 comments on commit b9da393

Please sign in to comment.