Skip to content

Commit 984e85d

Browse files
release: 2.20.1 (#567)
* fix(client): r8 support * chore(internal): reduce proguard ci logging * chore(internal): bump ci test timeout * release: 2.20.1 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 4f4ce3d commit 984e85d

File tree

9 files changed

+86
-29
lines changed

9 files changed

+86
-29
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414

1515
jobs:
1616
lint:
17-
timeout-minutes: 10
17+
timeout-minutes: 15
1818
name: lint
1919
runs-on: ${{ github.repository == 'stainless-sdks/openai-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
2020
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
@@ -37,7 +37,7 @@ jobs:
3737
- name: Run lints
3838
run: ./scripts/lint
3939
test:
40-
timeout-minutes: 10
40+
timeout-minutes: 15
4141
name: test
4242
runs-on: ${{ github.repository == 'stainless-sdks/openai-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
4343
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "2.20.0"
2+
".": "2.20.1"
33
}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## 2.20.1 (2025-07-31)
4+
5+
Full Changelog: [v2.20.0...v2.20.1](https://github.com/openai/openai-java/compare/v2.20.0...v2.20.1)
6+
7+
### Bug Fixes
8+
9+
* **client:** r8 support ([aa76f63](https://github.com/openai/openai-java/commit/aa76f638ca761ef63b336ee3e960f7302b4ec9dc))
10+
11+
12+
### Chores
13+
14+
* **internal:** bump ci test timeout ([0ea80f0](https://github.com/openai/openai-java/commit/0ea80f0f4e914919e95c6914e907617bfadea369))
15+
* **internal:** reduce proguard ci logging ([876aa8f](https://github.com/openai/openai-java/commit/876aa8fa7b801ff0ed62ff933088bead3f7d5d66))
16+
317
## 2.20.0 (2025-07-30)
418

519
Full Changelog: [v2.19.2...v2.20.0](https://github.com/openai/openai-java/compare/v2.19.2...v2.20.0)

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
<!-- x-release-please-start-version -->
44

5-
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/2.20.0)
6-
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/2.20.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/2.20.0)
5+
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/2.20.1)
6+
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/2.20.1/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/2.20.1)
77

88
<!-- x-release-please-end -->
99

1010
The OpenAI Java SDK provides convenient access to the [OpenAI REST API](https://platform.openai.com/docs) from applications written in Java.
1111

1212
<!-- x-release-please-start-version -->
1313

14-
The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/2.20.0).
14+
The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/2.20.1).
1515

1616
<!-- x-release-please-end -->
1717

@@ -24,7 +24,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfor
2424
### Gradle
2525

2626
```kotlin
27-
implementation("com.openai:openai-java:2.20.0")
27+
implementation("com.openai:openai-java:2.20.1")
2828
```
2929

3030
### Maven
@@ -33,7 +33,7 @@ implementation("com.openai:openai-java:2.20.0")
3333
<dependency>
3434
<groupId>com.openai</groupId>
3535
<artifactId>openai-java</artifactId>
36-
<version>2.20.0</version>
36+
<version>2.20.1</version>
3737
</dependency>
3838
```
3939

@@ -1329,7 +1329,7 @@ If you're using Spring Boot, then you can use the SDK's [Spring Boot starter](ht
13291329
#### Gradle
13301330

13311331
```kotlin
1332-
implementation("com.openai:openai-java-spring-boot-starter:2.20.0")
1332+
implementation("com.openai:openai-java-spring-boot-starter:2.20.1")
13331333
```
13341334

13351335
#### Maven
@@ -1338,7 +1338,7 @@ implementation("com.openai:openai-java-spring-boot-starter:2.20.0")
13381338
<dependency>
13391339
<groupId>com.openai</groupId>
13401340
<artifactId>openai-java-spring-boot-starter</artifactId>
1341-
<version>2.20.0</version>
1341+
<version>2.20.1</version>
13421342
</dependency>
13431343
```
13441344

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repositories {
88

99
allprojects {
1010
group = "com.openai"
11-
version = "2.20.0" // x-release-please-version
11+
version = "2.20.1" // x-release-please-version
1212
}
1313

1414
subprojects {

openai-java-core/src/main/resources/META-INF/proguard/openai-java-core.pro

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Jackson uses reflection and depends heavily on runtime attributes.
2-
-keepattributes
2+
-keepattributes Exceptions,InnerClasses,Signature,Deprecated,*Annotation*
33

44
# Jackson uses Kotlin reflection utilities, which themselves use reflection to access things.
55
-keep class kotlin.reflect.** { *; }
@@ -17,13 +17,13 @@
1717
*;
1818
}
1919

20-
# Jackson uses reflection to access the default constructors of serializers and deserializers.
21-
-keepclassmembers class * extends com.openai.core.BaseSerializer {
22-
<init>();
23-
}
24-
-keepclassmembers class * extends com.openai.core.BaseDeserializer {
25-
<init>();
26-
}
20+
# Jackson uses reified type information to serialize and deserialize our classes (via `TypeReference`).
21+
-keep class com.fasterxml.jackson.core.type.TypeReference { *; }
22+
-keep class * extends com.fasterxml.jackson.core.type.TypeReference { *; }
23+
24+
# Jackson uses reflection to access our class serializers and deserializers.
25+
-keep @com.fasterxml.jackson.databind.annotation.JsonSerialize class com.openai.** { *; }
26+
-keep @com.fasterxml.jackson.databind.annotation.JsonDeserialize class com.openai.** { *; }
2727

2828
# Jackson uses reflection to serialize and deserialize our classes based on their constructors and annotated members.
2929
-keepclassmembers class com.openai.** {

openai-java-proguard-test/build.gradle.kts

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ plugins {
44
}
55

66
buildscript {
7+
repositories {
8+
google()
9+
}
10+
711
dependencies {
812
classpath("com.guardsquare:proguard-gradle:7.4.2")
13+
classpath("com.android.tools:r8:8.3.37")
914
}
1015
}
1116

@@ -15,7 +20,6 @@ dependencies {
1520
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3")
1621
testImplementation("org.assertj:assertj-core:3.25.3")
1722
testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.4")
18-
testImplementation("org.junit.platform:junit-platform-console:1.10.1")
1923
}
2024

2125
tasks.shadowJar {
@@ -33,7 +37,6 @@ val proguardJar by tasks.registering(proguard.gradle.ProGuardTask::class) {
3337
outjars(proguardJarPath)
3438
printmapping("${layout.buildDirectory.get()}/proguard-mapping.txt")
3539

36-
verbose()
3740
dontwarn()
3841

3942
val javaHome = System.getProperty("java.home")
@@ -58,17 +61,43 @@ val testProGuard by tasks.registering(JavaExec::class) {
5861
dependsOn(proguardJar)
5962
notCompatibleWithConfigurationCache("ProGuard")
6063

61-
mainClass.set("org.junit.platform.console.ConsoleLauncher")
64+
mainClass.set("com.openai.proguard.ProGuardCompatibilityTest")
6265
classpath = files(proguardJarPath)
66+
}
67+
68+
val r8JarPath = "${layout.buildDirectory.get()}/libs/${project.name}-${project.version}-r8.jar"
69+
val r8Jar by tasks.registering(JavaExec::class) {
70+
group = "verification"
71+
dependsOn(tasks.shadowJar)
72+
notCompatibleWithConfigurationCache("R8")
73+
74+
mainClass.set("com.android.tools.r8.R8")
75+
classpath = buildscript.configurations["classpath"]
76+
6377
args = listOf(
64-
"--classpath", proguardJarPath,
65-
"--scan-classpath",
66-
"--details", "verbose",
78+
"--release",
79+
"--classfile",
80+
"--output", r8JarPath,
81+
"--lib", System.getProperty("java.home"),
82+
"--pg-conf", "./test.pro",
83+
"--pg-conf", "../openai-java-core/src/main/resources/META-INF/proguard/openai-java-core.pro",
84+
"--pg-map-output", "${layout.buildDirectory.get()}/r8-mapping.txt",
85+
tasks.shadowJar.get().archiveFile.get().asFile.absolutePath,
6786
)
6887
}
6988

89+
val testR8 by tasks.registering(JavaExec::class) {
90+
group = "verification"
91+
dependsOn(r8Jar)
92+
notCompatibleWithConfigurationCache("R8")
93+
94+
mainClass.set("com.openai.proguard.ProGuardCompatibilityTest")
95+
classpath = files(r8JarPath)
96+
}
97+
7098
tasks.test {
7199
dependsOn(testProGuard)
100+
dependsOn(testR8)
72101
// We defer to the tests run via the ProGuard JAR.
73102
enabled = false
74103
}

openai-java-proguard-test/src/test/kotlin/com/openai/proguard/ProGuardCompatibilityTest.kt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,31 @@ import com.openai.models.chat.completions.ChatCompletionMessageToolCall
1414
import com.openai.models.chat.completions.ChatCompletionModality
1515
import com.openai.models.chat.completions.ChatCompletionTokenLogprob
1616
import com.openai.models.completions.CompletionUsage
17+
import kotlin.reflect.full.memberFunctions
18+
import kotlin.reflect.jvm.javaMethod
1719
import org.assertj.core.api.Assertions.assertThat
18-
import org.junit.jupiter.api.BeforeAll
1920
import org.junit.jupiter.api.Test
2021

2122
internal class ProGuardCompatibilityTest {
2223

2324
companion object {
2425

25-
@BeforeAll
2626
@JvmStatic
27-
fun setUp() {
27+
fun main(args: Array<String>) {
2828
// To debug that we're using the right JAR.
2929
val jarPath = this::class.java.getProtectionDomain().codeSource.location
3030
println("JAR being used: $jarPath")
31+
32+
// We have to manually run the test methods instead of using the JUnit runner because it
33+
// seems impossible to get working with R8.
34+
val test = ProGuardCompatibilityTest()
35+
test::class
36+
.memberFunctions
37+
.asSequence()
38+
.filter { function ->
39+
function.javaMethod?.isAnnotationPresent(Test::class.java) == true
40+
}
41+
.forEach { it.call(test) }
3142
}
3243
}
3344

openai-java-proguard-test/test.pro

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
-keep class com.openai.proguard.** { *; }
33

44
# For the testing framework.
5-
-keep class org.junit.** { *; }
5+
-keep class org.junit.** { *; }
6+
7+
# Many warnings don't apply for our testing purposes.
8+
-dontwarn

0 commit comments

Comments
 (0)