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
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,31 @@ jobs:

- name: Run lints
run: ./scripts/lint

build:
timeout-minutes: 15
name: build
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

steps:
- uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: |
8
21
cache: gradle

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build SDK
run: ./scripts/build

test:
timeout-minutes: 15
name: test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-sonatype.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
export -- GPG_SIGNING_KEY_ID
printenv -- GPG_SIGNING_KEY | gpg --batch --passphrase-fd 3 --import 3<<< "$GPG_SIGNING_PASSWORD"
GPG_SIGNING_KEY_ID="$(gpg --with-colons --list-keys | awk -F : -- '/^pub:/ { getline; print "0x" substr($10, length($10) - 7) }')"
./gradlew publishAndReleaseToMavenCentral -Dorg.gradle.jvmargs="-Xmx8g" --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" --no-configuration-cache
./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" --no-configuration-cache
env:
SONATYPE_USERNAME: ${{ secrets.ONEBUSAWAY_SDK_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.ONEBUSAWAY_SDK_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
.gradle
.idea
.kotlin
build
build/
codegen.log
kls_database.db
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.36"
".": "0.1.0-alpha.37"
}
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## 0.1.0-alpha.37 (2025-08-31)

Full Changelog: [v0.1.0-alpha.36...v0.1.0-alpha.37](https://github.com/OneBusAway/java-sdk/compare/v0.1.0-alpha.36...v0.1.0-alpha.37)

### Performance Improvements

* **internal:** make formatting faster ([99fbd78](https://github.com/OneBusAway/java-sdk/commit/99fbd78f052b7bd28679a4e4ca63e5486909b40c))


### Chores

* **ci:** add build job ([e9a4334](https://github.com/OneBusAway/java-sdk/commit/e9a4334ed4def5ff07ef7ad9fc959d86531423d4))
* **ci:** reduce log noise ([a44cd60](https://github.com/OneBusAway/java-sdk/commit/a44cd60b985c90043721fdd5e59913bbee7001ef))
* **client:** refactor closing / shutdown ([1a3f6c5](https://github.com/OneBusAway/java-sdk/commit/1a3f6c59f0a6215188bbce3d1117f1008b7e4008))
* increase max gradle JVM heap to 8GB ([09fe22c](https://github.com/OneBusAway/java-sdk/commit/09fe22c50fd3025c2f1da7a37218d6cbfc8a04d9))
* **internal:** codegen related update ([fcda4f9](https://github.com/OneBusAway/java-sdk/commit/fcda4f9e3cadf6574f110689ddb80fda9fe3e87b))
* **internal:** dynamically determine included projects ([87d4c56](https://github.com/OneBusAway/java-sdk/commit/87d4c56d8a6f24de52544ade996e83dd65bedbe0))
* **internal:** support passing arguments to test script ([7bad9c0](https://github.com/OneBusAway/java-sdk/commit/7bad9c0a8741e9ffd6432856434a48a9d76af7af))
* **internal:** support running formatters directly ([bd33d83](https://github.com/OneBusAway/java-sdk/commit/bd33d83283a843365951f3b6f7de65367ae7bcd7))
* **internal:** update comment in script ([d037c17](https://github.com/OneBusAway/java-sdk/commit/d037c17a5b778fc55c8e30534bfd50f23f4d0984))
* remove memory upper bound from publishing step ([9710ffe](https://github.com/OneBusAway/java-sdk/commit/9710ffe8cbce1fbc8870aa4de279524e40ea4153))
* update @stainless-api/prism-cli to v5.15.0 ([3f2a043](https://github.com/OneBusAway/java-sdk/commit/3f2a043a8a41078b57b5d2afa8052824b60d6a43))

## 0.1.0-alpha.36 (2025-08-06)

Full Changelog: [v0.1.0-alpha.35...v0.1.0-alpha.36](https://github.com/OneBusAway/java-sdk/compare/v0.1.0-alpha.35...v0.1.0-alpha.36)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

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

[![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.36)
[![javadoc](https://javadoc.io/badge2/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.36/javadoc.svg)](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.36)
[![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.37)
[![javadoc](https://javadoc.io/badge2/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.37/javadoc.svg)](https://javadoc.io/doc/org.onebusaway/onebusaway-sdk-java/0.1.0-alpha.37)

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

Expand All @@ -15,7 +15,7 @@ It is generated with [Stainless](https://www.stainless.com/).

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

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.36).
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.37).

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

Expand All @@ -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.36")
implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.37")
```

### Maven
Expand All @@ -35,7 +35,7 @@ implementation("org.onebusaway:onebusaway-sdk-java:0.1.0-alpha.36")
<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-sdk-java</artifactId>
<version>0.1.0-alpha.36</version>
<version>0.1.0-alpha.37</version>
</dependency>
```

Expand Down
15 changes: 14 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ repositories {

allprojects {
group = "org.onebusaway"
version = "0.1.0-alpha.36" // x-release-please-version
version = "0.1.0-alpha.37" // x-release-please-version
}

subprojects {
// These are populated with dependencies by `buildSrc` scripts.
tasks.register("format") {
group = "Verification"
description = "Formats all source files."
}
tasks.register("lint") {
group = "Verification"
description = "Verifies all source files are formatted."
}
apply(plugin = "org.jetbrains.dokka")
}

subprojects {
Expand Down
1 change: 0 additions & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ repositories {
}

dependencies {
implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20")
implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0")
}
94 changes: 83 additions & 11 deletions buildSrc/src/main/kotlin/onebusaway-sdk.java.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import org.gradle.api.tasks.testing.logging.TestExceptionFormat

plugins {
`java-library`
id("com.diffplug.spotless")
}

repositories {
mavenCentral()
}

configure<SpotlessExtension> {
java {
importOrder()
removeUnusedImports()
palantirJavaFormat()
toggleOffOn()
}
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
Expand Down Expand Up @@ -53,3 +42,86 @@ tasks.withType<Test>().configureEach {
exceptionFormat = TestExceptionFormat.FULL
}
}

val palantir by configurations.creating
dependencies {
palantir("com.palantir.javaformat:palantir-java-format:2.73.0")
}

fun registerPalantir(
name: String,
description: String,
) {
val javaName = "${name}Java"
tasks.register<JavaExec>(javaName) {
group = "Verification"
this.description = description

classpath = palantir
mainClass = "com.palantir.javaformat.java.Main"

// Avoid an `IllegalAccessError` on Java 9+.
jvmArgs(
"--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
)

// Use paths relative to the current module.
val argumentFile =
project.layout.buildDirectory.file("palantir-$name-args.txt").get().asFile
val lastRunTimeFile =
project.layout.buildDirectory.file("palantir-$name-last-run.txt").get().asFile

// Read the time when this task was last executed for this module (if ever).
val lastRunTime = lastRunTimeFile.takeIf { it.exists() }?.readText()?.toLongOrNull() ?: 0L

// Use a `fileTree` relative to the module's source directory.
val javaFiles = project.fileTree("src") { include("**/*.java") }

// Determine if any files need to be formatted or linted and continue only if there is at least
// one file.
onlyIf { javaFiles.any { it.lastModified() > lastRunTime } }

inputs.files(javaFiles)

doFirst {
// Create the argument file and set the preferred formatting style.
argumentFile.parentFile.mkdirs()
argumentFile.writeText("--palantir\n")

if (name == "lint") {
// For lint, do a dry run, so no files are modified. Set the exit code to 1 (instead of
// the default 0) if any files need to be formatted, indicating that linting has failed.
argumentFile.appendText("--dry-run\n")
argumentFile.appendText("--set-exit-if-changed\n")
} else {
// `--dry-run` and `--replace` (for in-place formatting) are mutually exclusive.
argumentFile.appendText("--replace\n")
}

// Write the modified files to the argument file.
javaFiles.filter { it.lastModified() > lastRunTime }
.forEach { argumentFile.appendText("${it.absolutePath}\n") }
}

doLast {
// Record the last execution time for later up-to-date checking.
lastRunTimeFile.writeText(System.currentTimeMillis().toString())
}

// Pass the argument file using the @ symbol
args = listOf("@${argumentFile.absolutePath}")

outputs.upToDateWhen { javaFiles.none { it.lastModified() > lastRunTime } }
}

tasks.named(name) {
dependsOn(tasks.named(javaName))
}
}

registerPalantir(name = "format", description = "Formats all Java source files.")
registerPalantir(name = "lint", description = "Verifies all Java source files are formatted.")
82 changes: 74 additions & 8 deletions buildSrc/src/main/kotlin/onebusaway-sdk.kotlin.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

Expand All @@ -7,6 +6,10 @@ plugins {
kotlin("jvm")
}

repositories {
mavenCentral()
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(21))
Expand All @@ -27,14 +30,77 @@ kotlin {
}
}

configure<SpotlessExtension> {
kotlin {
ktfmt().kotlinlangStyle()
toggleOffOn()
}
}

tasks.withType<Test>().configureEach {
systemProperty("junit.jupiter.execution.parallel.enabled", true)
systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent")
}

val ktfmt by configurations.creating
dependencies {
ktfmt("com.facebook:ktfmt:0.56")
}

fun registerKtfmt(
name: String,
description: String,
) {
val kotlinName = "${name}Kotlin"
tasks.register<JavaExec>(kotlinName) {
group = "Verification"
this.description = description

classpath = ktfmt
mainClass = "com.facebook.ktfmt.cli.Main"

// Use paths relative to the current module.
val argumentFile = project.layout.buildDirectory.file("ktfmt-$name-args.txt").get().asFile
val lastRunTimeFile =
project.layout.buildDirectory.file("ktfmt-$name-last-run.txt").get().asFile

// Read the time when this task was last executed for this module (if ever).
val lastRunTime = lastRunTimeFile.takeIf { it.exists() }?.readText()?.toLongOrNull() ?: 0L

// Use a `fileTree` relative to the module's source directory.
val kotlinFiles = project.fileTree("src") { include("**/*.kt") }

// Determine if any files need to be formatted or linted and continue only if there is at least
// one file (otherwise Ktfmt will fail).
onlyIf { kotlinFiles.any { it.lastModified() > lastRunTime } }

inputs.files(kotlinFiles)

doFirst {
// Create the argument file and set the preferred formatting style.
argumentFile.parentFile.mkdirs()
argumentFile.writeText("--kotlinlang-style\n")

if (name == "lint") {
// For lint, do a dry run, so no files are modified. Set the exit code to 1 (instead of
// the default 0) if any files need to be formatted, indicating that linting has failed.
argumentFile.appendText("--dry-run\n")
argumentFile.appendText("--set-exit-if-changed\n")
}

// Write the modified files to the argument file.
kotlinFiles.filter { it.lastModified() > lastRunTime }
.forEach { argumentFile.appendText("${it.absolutePath}\n") }
}

doLast {
// Record the last execution time for later up-to-date checking.
lastRunTimeFile.writeText(System.currentTimeMillis().toString())
}

// Pass the argument file using the @ symbol
args = listOf("@${argumentFile.absolutePath}")

outputs.upToDateWhen { kotlinFiles.none { it.lastModified() > lastRunTime } }
}

tasks.named(name) {
dependsOn(tasks.named(kotlinName))
}
}

registerKtfmt(name = "format", description = "Formats all Kotlin source files.")
registerKtfmt(name = "lint", description = "Verifies all Kotlin source files are formatted.")
7 changes: 4 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ org.gradle.parallel=true
org.gradle.daemon=false
# These options improve our compilation and test performance. They are inherited by the Kotlin daemon.
org.gradle.jvmargs=\
-Xms1g \
-Xmx4g \
-Xms2g \
-Xmx8g \
-XX:+UseParallelGC \
-XX:InitialCodeCacheSize=256m \
-XX:ReservedCodeCacheSize=1G \
-XX:MetaspaceSize=256m \
-XX:MetaspaceSize=512m \
-XX:MaxMetaspaceSize=2G \
-XX:TieredStopAtLevel=1 \
-XX:GCTimeRatio=4 \
-XX:CICompilerCount=4 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class OnebusawaySdkClientAsyncImpl(private val clientOptions: ClientOptions) :

override fun shape(): ShapeServiceAsync = shape

override fun close() = clientOptions.httpClient.close()
override fun close() = clientOptions.close()

class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
OnebusawaySdkClientAsync.WithRawResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class OnebusawaySdkClientImpl(private val clientOptions: ClientOptions) : Onebus

override fun shape(): ShapeService = shape

override fun close() = clientOptions.httpClient.close()
override fun close() = clientOptions.close()

class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
OnebusawaySdkClient.WithRawResponse {
Expand Down
Loading
Loading