From 554f5f062658e3cf3a090f6c57d72bc512d70d35 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 21:04:51 +0000 Subject: [PATCH 1/2] fix(client): r8 support --- .../META-INF/proguard/increase-java-core.pro | 16 ++++---- increase-java-proguard-test/build.gradle.kts | 40 ++++++++++++++++--- .../api/proguard/ProGuardCompatibilityTest.kt | 17 ++++++-- increase-java-proguard-test/test.pro | 5 ++- 4 files changed, 61 insertions(+), 17 deletions(-) diff --git a/increase-java-core/src/main/resources/META-INF/proguard/increase-java-core.pro b/increase-java-core/src/main/resources/META-INF/proguard/increase-java-core.pro index 9a2cf7910..d24c82dc2 100644 --- a/increase-java-core/src/main/resources/META-INF/proguard/increase-java-core.pro +++ b/increase-java-core/src/main/resources/META-INF/proguard/increase-java-core.pro @@ -1,5 +1,5 @@ # Jackson uses reflection and depends heavily on runtime attributes. --keepattributes +-keepattributes Exceptions,InnerClasses,Signature,Deprecated,*Annotation* # Jackson uses Kotlin reflection utilities, which themselves use reflection to access things. -keep class kotlin.reflect.** { *; } @@ -17,13 +17,13 @@ *; } -# Jackson uses reflection to access the default constructors of serializers and deserializers. --keepclassmembers class * extends com.increase.api.core.BaseSerializer { - (); -} --keepclassmembers class * extends com.increase.api.core.BaseDeserializer { - (); -} +# Jackson uses reified type information to serialize and deserialize our classes (via `TypeReference`). +-keep class com.fasterxml.jackson.core.type.TypeReference { *; } +-keep class * extends com.fasterxml.jackson.core.type.TypeReference { *; } + +# Jackson uses reflection to access our class serializers and deserializers. +-keep @com.fasterxml.jackson.databind.annotation.JsonSerialize class com.increase.api.** { *; } +-keep @com.fasterxml.jackson.databind.annotation.JsonDeserialize class com.increase.api.** { *; } # Jackson uses reflection to serialize and deserialize our classes based on their constructors and annotated members. -keepclassmembers class com.increase.api.** { diff --git a/increase-java-proguard-test/build.gradle.kts b/increase-java-proguard-test/build.gradle.kts index d1f45fa62..56bcbbda8 100644 --- a/increase-java-proguard-test/build.gradle.kts +++ b/increase-java-proguard-test/build.gradle.kts @@ -4,8 +4,13 @@ plugins { } buildscript { + repositories { + google() + } + dependencies { classpath("com.guardsquare:proguard-gradle:7.4.2") + classpath("com.android.tools:r8:8.3.37") } } @@ -15,7 +20,6 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3") testImplementation("org.assertj:assertj-core:3.25.3") testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.4") - testImplementation("org.junit.platform:junit-platform-console:1.10.1") } tasks.shadowJar { @@ -58,17 +62,43 @@ val testProGuard by tasks.registering(JavaExec::class) { dependsOn(proguardJar) notCompatibleWithConfigurationCache("ProGuard") - mainClass.set("org.junit.platform.console.ConsoleLauncher") + mainClass.set("com.increase.api.proguard.ProGuardCompatibilityTest") classpath = files(proguardJarPath) +} + +val r8JarPath = "${layout.buildDirectory.get()}/libs/${project.name}-${project.version}-r8.jar" +val r8Jar by tasks.registering(JavaExec::class) { + group = "verification" + dependsOn(tasks.shadowJar) + notCompatibleWithConfigurationCache("R8") + + mainClass.set("com.android.tools.r8.R8") + classpath = buildscript.configurations["classpath"] + args = listOf( - "--classpath", proguardJarPath, - "--scan-classpath", - "--details", "verbose", + "--release", + "--classfile", + "--output", r8JarPath, + "--lib", System.getProperty("java.home"), + "--pg-conf", "./test.pro", + "--pg-conf", "../increase-java-core/src/main/resources/META-INF/proguard/increase-java-core.pro", + "--pg-map-output", "${layout.buildDirectory.get()}/r8-mapping.txt", + tasks.shadowJar.get().archiveFile.get().asFile.absolutePath, ) } +val testR8 by tasks.registering(JavaExec::class) { + group = "verification" + dependsOn(r8Jar) + notCompatibleWithConfigurationCache("R8") + + mainClass.set("com.increase.api.proguard.ProGuardCompatibilityTest") + classpath = files(r8JarPath) +} + tasks.test { dependsOn(testProGuard) + dependsOn(testR8) // We defer to the tests run via the ProGuard JAR. enabled = false } diff --git a/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt b/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt index ed80c450e..0d0eb29c2 100644 --- a/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt +++ b/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt @@ -8,20 +8,31 @@ import com.increase.api.core.jsonMapper import com.increase.api.models.accounts.Account import java.time.LocalDate import java.time.OffsetDateTime +import kotlin.reflect.full.memberFunctions +import kotlin.reflect.jvm.javaMethod import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.Test internal class ProGuardCompatibilityTest { companion object { - @BeforeAll @JvmStatic - fun setUp() { + fun main(args: Array) { // To debug that we're using the right JAR. val jarPath = this::class.java.getProtectionDomain().codeSource.location println("JAR being used: $jarPath") + + // We have to manually run the test methods instead of using the JUnit runner because it + // seems impossible to get working with R8. + val test = ProGuardCompatibilityTest() + test::class + .memberFunctions + .asSequence() + .filter { function -> + function.javaMethod?.isAnnotationPresent(Test::class.java) == true + } + .forEach { it.call(test) } } } diff --git a/increase-java-proguard-test/test.pro b/increase-java-proguard-test/test.pro index c7a0ba6cc..00aadf0fd 100644 --- a/increase-java-proguard-test/test.pro +++ b/increase-java-proguard-test/test.pro @@ -2,4 +2,7 @@ -keep class com.increase.api.proguard.** { *; } # For the testing framework. --keep class org.junit.** { *; } \ No newline at end of file +-keep class org.junit.** { *; } + +# Many warnings don't apply for our testing purposes. +-dontwarn \ No newline at end of file From a7e14e382a9be4b4ed69b7242432160212e5a741 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 21:05:20 +0000 Subject: [PATCH 2/2] release: 0.269.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index fa440d4de..ccad57edc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.269.0" + ".": "0.269.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b91a3b5b..8df1a4056 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.269.1 (2025-07-31) + +Full Changelog: [v0.269.0...v0.269.1](https://github.com/Increase/increase-java/compare/v0.269.0...v0.269.1) + +### Bug Fixes + +* **client:** r8 support ([554f5f0](https://github.com/Increase/increase-java/commit/554f5f062658e3cf3a090f6c57d72bc512d70d35)) + ## 0.269.0 (2025-07-29) Full Changelog: [v0.268.0...v0.269.0](https://github.com/Increase/increase-java/compare/v0.268.0...v0.269.0) diff --git a/README.md b/README.md index 1dec19a2e..456c01a2c 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.269.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.269.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.269.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.269.1) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.269.1/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.269.1) @@ -13,7 +13,7 @@ The Increase Java SDK is similar to the Increase Kotlin SDK but with minor diffe -The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.269.0). +The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.269.1). @@ -24,7 +24,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d ### Gradle ```kotlin -implementation("com.increase.api:increase-java:0.269.0") +implementation("com.increase.api:increase-java:0.269.1") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.269.0") com.increase.api increase-java - 0.269.0 + 0.269.1 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 5edf29fc2..01a31048c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.269.0" // x-release-please-version + version = "0.269.1" // x-release-please-version } subprojects {