From dbca2b6f65b33feb5dac137c43976ee53adf1586 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 05:37:40 +0000 Subject: [PATCH 1/4] fix(client): r8 support --- .../proguard/onebusaway-sdk-java-core.pro | 16 ++++---- .../build.gradle.kts | 40 ++++++++++++++++--- .../proguard/ProGuardCompatibilityTest.kt | 17 ++++++-- onebusaway-sdk-java-proguard-test/test.pro | 5 ++- 4 files changed, 61 insertions(+), 17 deletions(-) diff --git a/onebusaway-sdk-java-core/src/main/resources/META-INF/proguard/onebusaway-sdk-java-core.pro b/onebusaway-sdk-java-core/src/main/resources/META-INF/proguard/onebusaway-sdk-java-core.pro index b6d53ae..8c798f7 100644 --- a/onebusaway-sdk-java-core/src/main/resources/META-INF/proguard/onebusaway-sdk-java-core.pro +++ b/onebusaway-sdk-java-core/src/main/resources/META-INF/proguard/onebusaway-sdk-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 org.onebusaway.core.BaseSerializer { - (); -} --keepclassmembers class * extends org.onebusaway.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 org.onebusaway.** { *; } +-keep @com.fasterxml.jackson.databind.annotation.JsonDeserialize class org.onebusaway.** { *; } # Jackson uses reflection to serialize and deserialize our classes based on their constructors and annotated members. -keepclassmembers class org.onebusaway.** { diff --git a/onebusaway-sdk-java-proguard-test/build.gradle.kts b/onebusaway-sdk-java-proguard-test/build.gradle.kts index 0561174..cb73454 100644 --- a/onebusaway-sdk-java-proguard-test/build.gradle.kts +++ b/onebusaway-sdk-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("org.onebusaway.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", "../onebusaway-sdk-java-core/src/main/resources/META-INF/proguard/onebusaway-sdk-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("org.onebusaway.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/onebusaway-sdk-java-proguard-test/src/test/kotlin/org/onebusaway/proguard/ProGuardCompatibilityTest.kt b/onebusaway-sdk-java-proguard-test/src/test/kotlin/org/onebusaway/proguard/ProGuardCompatibilityTest.kt index fe0e0a4..385085c 100644 --- a/onebusaway-sdk-java-proguard-test/src/test/kotlin/org/onebusaway/proguard/ProGuardCompatibilityTest.kt +++ b/onebusaway-sdk-java-proguard-test/src/test/kotlin/org/onebusaway/proguard/ProGuardCompatibilityTest.kt @@ -3,8 +3,9 @@ package org.onebusaway.proguard import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +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 import org.onebusaway.client.okhttp.OnebusawaySdkOkHttpClient import org.onebusaway.core.jsonMapper @@ -14,12 +15,22 @@ 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/onebusaway-sdk-java-proguard-test/test.pro b/onebusaway-sdk-java-proguard-test/test.pro index 1c472dd..ba9a988 100644 --- a/onebusaway-sdk-java-proguard-test/test.pro +++ b/onebusaway-sdk-java-proguard-test/test.pro @@ -2,4 +2,7 @@ -keep class org.onebusaway.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 09535340857380e8bb7ec1112aafd2b84efb55dc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 05:46:14 +0000 Subject: [PATCH 2/4] chore(internal): reduce proguard ci logging --- onebusaway-sdk-java-proguard-test/build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/onebusaway-sdk-java-proguard-test/build.gradle.kts b/onebusaway-sdk-java-proguard-test/build.gradle.kts index cb73454..7611c8e 100644 --- a/onebusaway-sdk-java-proguard-test/build.gradle.kts +++ b/onebusaway-sdk-java-proguard-test/build.gradle.kts @@ -37,7 +37,6 @@ val proguardJar by tasks.registering(proguard.gradle.ProGuardTask::class) { outjars(proguardJarPath) printmapping("${layout.buildDirectory.get()}/proguard-mapping.txt") - verbose() dontwarn() val javaHome = System.getProperty("java.home") From 6139a454dea5b2df944e1ff9e51ee68102048eb1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 05:49:05 +0000 Subject: [PATCH 3/4] chore(internal): bump ci test timeout --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d05e3b..30a531a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ on: jobs: lint: - timeout-minutes: 10 + timeout-minutes: 15 name: lint runs-on: ${{ github.repository == 'stainless-sdks/open-transit-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork @@ -37,7 +37,7 @@ jobs: - name: Run lints run: ./scripts/lint test: - timeout-minutes: 10 + timeout-minutes: 15 name: test runs-on: ${{ github.repository == 'stainless-sdks/open-transit-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork From 5b9d5e2a79464a1bd9f3e8e17a583dc31554c773 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 05:49:22 +0000 Subject: [PATCH 4/4] release: 0.1.0-alpha.34 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ff4f9a5..36b2aff 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.33" + ".": "0.1.0-alpha.34" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 717404d..b33ef97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.1.0-alpha.34 (2025-08-01) + +Full Changelog: [v0.1.0-alpha.33...v0.1.0-alpha.34](https://github.com/OneBusAway/java-sdk/compare/v0.1.0-alpha.33...v0.1.0-alpha.34) + +### Bug Fixes + +* **client:** r8 support ([dbca2b6](https://github.com/OneBusAway/java-sdk/commit/dbca2b6f65b33feb5dac137c43976ee53adf1586)) + + +### Chores + +* **internal:** bump ci test timeout ([6139a45](https://github.com/OneBusAway/java-sdk/commit/6139a454dea5b2df944e1ff9e51ee68102048eb1)) +* **internal:** reduce proguard ci logging ([0953534](https://github.com/OneBusAway/java-sdk/commit/09535340857380e8bb7ec1112aafd2b84efb55dc)) + ## 0.1.0-alpha.33 (2025-07-30) Full Changelog: [v0.1.0-alpha.32...v0.1.0-alpha.33](https://github.com/OneBusAway/java-sdk/compare/v0.1.0-alpha.32...v0.1.0-alpha.33) diff --git a/README.md b/README.md index e069e22..c3e4fa8 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/org.onebusaway/onebusaway-sdk-java)](https://central.sonatype.com/artifact/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.33) -[![javadoc](https://javadoc.io/badge2/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.33/javadoc.svg)](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.33) +[![Maven Central](https://img.shields.io/maven-central/v/org.onebusaway/onebusaway-sdk-java)](https://central.sonatype.com/artifact/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.34) +[![javadoc](https://javadoc.io/badge2/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.34/javadoc.svg)](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.34) @@ -15,7 +15,7 @@ It is generated with [Stainless](https://www.stainless.com/). -The REST API documentation can be found on [developer.onebusaway.org](https://developer.onebusaway.org). Javadocs are available on [javadoc.io](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.33). +The REST API documentation can be found on [developer.onebusaway.org](https://developer.onebusaway.org). Javadocs are available on [javadoc.io](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.34). @@ -26,7 +26,7 @@ The REST API documentation can be found on [developer.onebusaway.org](https://de ### Gradle ```kotlin -implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.33") +implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.34") ``` ### Maven @@ -35,7 +35,7 @@ implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.33") org.onebusaway onebusaway-sdk-java - 0.1.0-alpha.33 + 0.1.0-alpha.34 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 987b183..7e6d4d0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "org.onebusaway" - version = "0.1.0-alpha.33" // x-release-please-version + version = "0.1.0-alpha.34" // x-release-please-version } subprojects {