Skip to content

Commit 4b9a485

Browse files
chore(internal): update formatter (#484)
chore(internal): optimize build and test perf
1 parent effb362 commit 4b9a485

423 files changed

Lines changed: 1733 additions & 3670 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

buildSrc/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
`kotlin-dsl`
3-
kotlin("jvm") version "2.1.0"
3+
kotlin("jvm") version "2.1.10"
44
id("com.vanniktech.maven.publish") version "0.28.0"
55
}
66

@@ -10,7 +10,7 @@ repositories {
1010
}
1111

1212
dependencies {
13-
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.25.0")
14-
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
13+
implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2")
14+
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.10")
1515
implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0")
1616
}

buildSrc/src/main/kotlin/lithic.java.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@ tasks.named<Jar>("jar") {
3939
}
4040
}
4141

42-
tasks.named<Test>("test") {
42+
tasks.withType<Test>().configureEach {
4343
useJUnitPlatform()
4444

45+
// Run tests in parallel to some degree.
46+
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
47+
forkEvery = 100
48+
4549
testLogging {
4650
exceptionFormat = TestExceptionFormat.FULL
4751
}

buildSrc/src/main/kotlin/lithic.kotlin.gradle.kts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import com.diffplug.gradle.spotless.SpotlessExtension
2+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
23
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
34

45
plugins {
@@ -20,13 +21,19 @@ configure<SpotlessExtension> {
2021
}
2122

2223
tasks.withType<KotlinCompile>().configureEach {
23-
kotlinOptions {
24+
compilerOptions {
2425
freeCompilerArgs = listOf(
2526
"-Xjvm-default=all",
2627
"-Xjdk-release=1.8",
2728
// Suppress deprecation warnings because we may still reference and test deprecated members.
2829
"-Xsuppress-warning=DEPRECATION"
2930
)
30-
jvmTarget = "1.8"
31+
jvmTarget.set(JvmTarget.JVM_1_8)
3132
}
3233
}
34+
35+
// Run tests in parallel to some degree.
36+
tasks.withType<Test>().configureEach {
37+
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
38+
forkEvery = 100
39+
}

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
org.gradle.configuration-cache=true
12
org.gradle.caching=true
2-
org.gradle.jvmargs=-Xmx4g
33
org.gradle.parallel=true
4+
org.gradle.daemon=false
5+
org.gradle.jvmargs=-Xmx4g
46
kotlin.daemon.jvmargs=-Xmx4g

lithic-java-client-okhttp/src/main/kotlin/com/lithic/api/client/okhttp/OkHttpClient.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ class OkHttpClient
3131
private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val baseUrl: HttpUrl) :
3232
HttpClient {
3333

34-
override fun execute(
35-
request: HttpRequest,
36-
requestOptions: RequestOptions,
37-
): HttpResponse {
34+
override fun execute(request: HttpRequest, requestOptions: RequestOptions): HttpResponse {
3835
val call = newCall(request, requestOptions)
3936

4037
return try {
@@ -120,13 +117,13 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
120117
) {
121118
builder.header(
122119
"X-Stainless-Read-Timeout",
123-
Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString()
120+
Duration.ofMillis(client.readTimeoutMillis.toLong()).seconds.toString(),
124121
)
125122
}
126123
if (!headers.names().contains("X-Stainless-Timeout") && client.callTimeoutMillis != 0) {
127124
builder.header(
128125
"X-Stainless-Timeout",
129-
Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString()
126+
Duration.ofMillis(client.callTimeoutMillis.toLong()).seconds.toString(),
130127
)
131128
}
132129

lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ interface LithicClient {
114114
@JvmOverloads
115115
fun apiStatus(
116116
params: ClientApiStatusParams,
117-
requestOptions: RequestOptions = RequestOptions.none()
117+
requestOptions: RequestOptions = RequestOptions.none(),
118118
): ApiStatus
119119

120120
/**

lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ interface LithicClientAsync {
115115
@JvmOverloads
116116
fun apiStatus(
117117
params: ClientApiStatusParams,
118-
requestOptions: RequestOptions = RequestOptions.none()
118+
requestOptions: RequestOptions = RequestOptions.none(),
119119
): CompletableFuture<ApiStatus>
120120

121121
/**

lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ import com.lithic.api.services.async.WebhookServiceAsync
6969
import com.lithic.api.services.async.WebhookServiceAsyncImpl
7070
import java.util.concurrent.CompletableFuture
7171

72-
class LithicClientAsyncImpl(
73-
private val clientOptions: ClientOptions,
74-
) : LithicClientAsync {
72+
class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicClientAsync {
7573

7674
private val clientOptionsWithUserAgent =
7775
if (clientOptions.headers.names().contains("User-Agent")) clientOptions
@@ -247,7 +245,7 @@ class LithicClientAsyncImpl(
247245
/** Status of api */
248246
override fun apiStatus(
249247
params: ClientApiStatusParams,
250-
requestOptions: RequestOptions
248+
requestOptions: RequestOptions,
251249
): CompletableFuture<ApiStatus> {
252250
val request =
253251
HttpRequest.builder()

lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ import com.lithic.api.services.blocking.TransferServiceImpl
6868
import com.lithic.api.services.blocking.WebhookService
6969
import com.lithic.api.services.blocking.WebhookServiceImpl
7070

71-
class LithicClientImpl(
72-
private val clientOptions: ClientOptions,
73-
) : LithicClient {
71+
class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient {
7472

7573
private val clientOptionsWithUserAgent =
7674
if (clientOptions.headers.names().contains("User-Agent")) clientOptions
@@ -231,7 +229,7 @@ class LithicClientImpl(
231229
/** Status of api */
232230
override fun apiStatus(
233231
params: ClientApiStatusParams,
234-
requestOptions: RequestOptions
232+
requestOptions: RequestOptions,
235233
): ApiStatus {
236234
val request =
237235
HttpRequest.builder()

lithic-java-core/src/main/kotlin/com/lithic/api/core/BaseDeserializer.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ abstract class BaseDeserializer<T : Any>(type: KClass<T>) :
1818

1919
override fun createContextual(
2020
context: DeserializationContext,
21-
property: BeanProperty?
21+
property: BeanProperty?,
2222
): JsonDeserializer<T> {
2323
return this
2424
}
@@ -32,7 +32,7 @@ abstract class BaseDeserializer<T : Any>(type: KClass<T>) :
3232
protected fun <T> ObjectCodec.tryDeserialize(
3333
node: JsonNode,
3434
type: TypeReference<T>,
35-
validate: (T) -> Unit = {}
35+
validate: (T) -> Unit = {},
3636
): T? {
3737
return try {
3838
readValue(treeAsTokens(node), type).apply(validate)
@@ -46,7 +46,7 @@ abstract class BaseDeserializer<T : Any>(type: KClass<T>) :
4646
protected fun <T> ObjectCodec.tryDeserialize(
4747
node: JsonNode,
4848
type: JavaType,
49-
validate: (T) -> Unit = {}
49+
validate: (T) -> Unit = {},
5050
): T? {
5151
return try {
5252
readValue<T>(treeAsTokens(node), type).apply(validate)

0 commit comments

Comments
 (0)