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: 2 additions & 0 deletions .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,5 @@ src/test/java/com/whop/api/helpers/
.fern/replay.lock
.fern/replay.yml
.gitattributes
# Remove when Fern emits and tests equivalent Android consumer rules.
src/main/resources/META-INF/proguard/whop-java.pro
13 changes: 13 additions & 0 deletions .github/package-smoke/src/main/java/PackageConsumer.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ public static void main(String[] args) throws Exception {
require(
version.equals(WhopApiClient.class.getPackage().getImplementationVersion()),
"installed jar manifest has an incorrect version");
try (java.io.InputStream rules =
WhopApiClient.class.getResourceAsStream("/META-INF/proguard/whop-java.pro")) {
require(rules != null, "installed jar is missing Android consumer rules");
String contents = new String(rules.readAllBytes(), java.nio.charset.StandardCharsets.UTF_8);
require(
contents.contains("-keep class com.whop.api.core.NullableNonemptyFilter { *; }"),
"installed jar does not preserve the reflective nullable filter");
require(
contents.contains("com.whop.api.types.**")
&& contents.contains("com.whop.api.resources.**.requests.**")
&& contents.contains("-keepattributes Signature,*Annotation*,InnerClasses,EnclosingMethod"),
"installed jar does not preserve Jackson models and annotations");
}
String apiVersion = java.util.Arrays.stream(ApiKeyApiVersionDate.class.getFields())
.filter(field ->
Modifier.isStatic(field.getModifiers()) && field.getType() == ApiKeyApiVersionDate.class)
Expand Down
6 changes: 6 additions & 0 deletions MIGRATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ Closing a client releases HTTP resources the SDK created. A supplied `OkHttpClie

The generated builder sends the API version matching its models. An explicit `apiVersionDate(...)` still overrides that pin; select an older API date only when your integration also expects its response shapes.

## Android release builds

The SDK JAR includes consumer rules in `META-INF/proguard/whop-java.pro`. Android builds consume these automatically when R8 is enabled. They preserve Jackson model annotations, generated request and response models, and the `NullableNonemptyFilter` constructor and methods used through reflection.

Without the filter rule, an optimized app can read API responses but fail while serializing a request with nullable fields. A debug build does not exercise that shrinker behavior. Validate a minified app when changing these rules.

## Installing and releasing the package

This change builds and tests the SDK without publishing it. `gradle.properties` keeps `version=0.0.0`, and the release workflow refuses to publish that placeholder. Generated metadata records the generator's input version; the release workflow stamps the artifact, source headers, and metadata from `gradle.properties` before building them.
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/META-INF/proguard/whop-java.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-keepattributes Signature,*Annotation*,InnerClasses,EnclosingMethod
-keep class com.whop.api.types.** { *; }
-keep class com.whop.api.resources.**.types.** { *; }
-keep class com.whop.api.resources.**.requests.** { *; }
-keep class com.whop.api.core.NullableNonemptyFilter { *; }
-keep class com.fasterxml.jackson.databind.annotation.JacksonStdImpl
-keep,allowobfuscation,allowshrinking @com.fasterxml.jackson.databind.annotation.JacksonStdImpl class *
Loading