Skip to content

Commit b0d02d5

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 4c83f1f + 3c0f56a commit b0d02d5

237 files changed

Lines changed: 5442 additions & 624 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.

.github/workflows/pull-request.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: On pull request
22

33
on: [ pull_request ]
44

5+
concurrency: pull-request
6+
57
jobs:
68
build:
79

@@ -18,18 +20,8 @@ jobs:
1820
uses: actions/setup-java@v3
1921
with:
2022
java-version: '17'
21-
distribution: 'adopt'
22-
server-id: github
23-
settings-path: ${{ github.workspace }}
24-
25-
- name: Enqueue concurrent workflows runs
26-
uses: softprops/turnstyle@v1
27-
with:
28-
abort-after-seconds: 1800
29-
poll-interval-seconds: 30
30-
same-branch-only: false
31-
env:
32-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
distribution: 'corretto'
24+
cache: 'gradle'
3325

3426
- name: Build, run tests and upload dev snapshot to Maven Central with Gradle
3527
run: ./gradlew devSnapshot printDevSnapshotReleaseNote

.github/workflows/push-to-master.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches:
66
- master
77

8+
concurrency: push-to-master
9+
810
jobs:
911
build:
1012

@@ -21,20 +23,11 @@ jobs:
2123
uses: actions/setup-java@v3
2224
with:
2325
java-version: '17'
24-
distribution: 'adopt'
25-
server-id: github
26-
27-
- name: Enqueue concurrent workflows runs
28-
uses: softprops/turnstyle@v1
29-
with:
30-
abort-after-seconds: 1800
31-
poll-interval-seconds: 30
32-
same-branch-only: false
33-
env:
34-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
distribution: 'corretto'
27+
cache: 'gradle'
3528

3629
- name: Build, upload release version to Maven Central and create git release tag with Gradle
37-
run: ./gradlew detekt final closeRepository releaseRepository printFinalReleaseNote
30+
run: ./gradlew detekt final closeAndReleaseStagingRepository printFinalReleaseNote
3831
env:
3932
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
4033
GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
!.idea/codeStyles/codeStyleConfig.xml
44
build/
55
out/
6+
*.iml
67

78
src/test/resources/test.properties
89

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,26 @@ apiHost=app.local.ecwid.com
1515
apiPort=8443
1616
```
1717

18+
#### Adding the Library to a Maven Project
19+
20+
To add the current library to a Maven project, you need to add the following block of code to your project's `pom.xml` file inside the `<dependencies>` tag:
21+
22+
```xml
23+
<dependency>
24+
<groupId>com.ecwid.apiclient</groupId>
25+
<artifactId>api-client</artifactId>
26+
<version>0.326.0</version>
27+
</dependency>
28+
```
29+
30+
#### Adding the Library to a Gradle Project
31+
32+
To add the current library to a Gradle project using Kotlin DSL, you need to add the following line to your project's `build.gradle.kts` file inside the `dependencies` block:
33+
34+
```kotlin
35+
implementation("com.ecwid.apiclient:api-client:0.326.0")
36+
```
37+
1838
## Examples
1939

2040
#### Simple example:
@@ -25,7 +45,7 @@ val apiClient = ApiClient.create(
2545
storeId = 1003,
2646
apiToken = "secret_mysecuretoken"),
2747
httpTransport = ApacheCommonsHttpClientTransport(),
28-
jsonTransformerProvider = GsonTransformerProvider()
48+
jsonTransformerProvider = GsonTransformerProvider())
2949

3050
val customer = apiClient.getCustomerDetails(CustomerDetailsRequest(customerId = 1))
3151
println("api/v3 customer: $customer")
@@ -39,7 +59,7 @@ val apiClient = ApiClient.create(
3959
storeId = 1003,
4060
apiToken = "secret_mysecuretoken"),
4161
httpTransport = ApacheCommonsHttpClientTransport(),
42-
jsonTransformerProvider = GsonTransformerProvider()
62+
jsonTransformerProvider = GsonTransformerProvider())
4363

4464
val requestsForBatch = listOf(CustomerDetailsRequest(1), CustomerDetailsRequest(2))
4565
val batch = apiClient.createBatch(CreateBatchRequest(requestsForBatch, stopOnFirstFailure = true))
@@ -57,6 +77,6 @@ while (true) {
5777
.map { it.toTypedResponse(FetchedCustomer::class.java) }
5878
.mapNotNull { if (it !is TypedBatchResponse.Ok<FetchedCustomer>) it.toString() else null }
5979
println("api/v3 customers: ${customers.joinToString { it.id.toString() }}, errors: ${errors.joinToString()}")
60-
break;
80+
break
6181
}
6282
```

build.gradle.kts

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
77
plugins {
88
java
99
signing
10-
kotlin("jvm") version "1.8.10"
10+
kotlin("jvm") version "1.9.23"
1111
id("com.adarshr.test-logger") version "3.2.0"
12-
id("io.codearte.nexus-staging") version "0.30.0"
1312
id("nebula.release") version "17.1.0"
1413
id("maven-publish")
15-
id("io.gitlab.arturbosch.detekt") version "1.22.0"
16-
id("org.gradle.test-retry") version "1.4.1"
14+
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
15+
id("io.gitlab.arturbosch.detekt") version "1.23.4"
16+
id("org.gradle.test-retry") version "1.5.2"
1717
}
1818

1919
repositories {
@@ -26,13 +26,14 @@ dependencies {
2626

2727
api("com.google.code.gson:gson:2.10")
2828
api("org.apache.httpcomponents:httpclient:4.5.13")
29-
api("io.prometheus:simpleclient:0.16.0")
29+
api("io.prometheus:prometheus-metrics-core:1.1.0")
3030

31+
testImplementation(kotlin("test"))
3132
testImplementation("org.junit.jupiter:junit-jupiter:5.9.1")
3233
testImplementation("org.reflections:reflections:0.10.2")
3334
testImplementation("uk.co.jemos.podam:podam:7.2.11.RELEASE")
3435

35-
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.22.0")
36+
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.4")
3637
}
3738

3839
configure<JavaPluginConvention> {
@@ -70,6 +71,7 @@ tasks.withType<Detekt>().configureEach {
7071

7172
val settingsProvider = SettingsProvider()
7273

74+
7375
tasks {
7476
// All checks were already made by workflow "On pull request" => no checks here
7577
if (gradle.startParameter.taskNames.contains("final")) {
@@ -78,16 +80,15 @@ tasks {
7880
}
7981
}
8082

81-
// Publish artifacts to Maven Central before pushing new git tag to repo
82-
named("release").get().apply {
83-
dependsOn(named("publish").get())
84-
}
83+
afterEvaluate {
84+
// Publish artifacts to Maven Central before pushing new git tag to repo
85+
named("release").get().apply {
86+
dependsOn(named("publishToSonatype").get())
87+
}
8588

86-
named("closeRepository").get().apply {
87-
dependsOn(named("final").get())
88-
}
89-
named("releaseRepository").get().apply {
90-
dependsOn(named("final").get())
89+
named("closeAndReleaseStagingRepository").get().apply {
90+
dependsOn(named("final").get())
91+
}
9192
}
9293
}
9394

@@ -186,30 +187,23 @@ publishing {
186187
}
187188
}
188189
}
189-
repositories {
190-
maven {
191-
credentials {
192-
username = settingsProvider.ossrhUsername
193-
password = settingsProvider.ossrhPassword
194-
}
195-
url = if (project.isSnapshotVersion()) {
196-
uri("https://oss.sonatype.org/content/repositories/snapshots/")
197-
} else {
198-
uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
199-
}
200-
}
201-
}
202190
}
203191

204192
signing {
205193
useInMemoryPgpKeys(settingsProvider.gpgSigningKey, settingsProvider.gpgSigningPassword)
206194
sign(publishing.publications["mavenJava"])
207195
}
208196

209-
nexusStaging {
210-
packageGroup = PublicationSettings.STAGING_PACKAGE_GROUP
211-
username = settingsProvider.ossrhUsername
212-
password = settingsProvider.ossrhPassword
197+
nexusPublishing {
198+
repositories {
199+
sonatype {
200+
useStaging.set(!project.isSnapshotVersion())
201+
packageGroup.set(PublicationSettings.STAGING_PACKAGE_GROUP)
202+
stagingProfileId.set(PublicationSettings.STAGING_PROFILE_ID)
203+
username.set(settingsProvider.ossrhUsername)
204+
password.set(settingsProvider.ossrhPassword)
205+
}
206+
}
213207
}
214208

215209
// We want to change SNAPSHOT versions format from:
@@ -298,12 +292,16 @@ class SettingsProvider {
298292

299293
fun validateGPGSecrets() = require(
300294
value = !gpgSigningKey.isNullOrBlank() && !gpgSigningPassword.isNullOrBlank(),
301-
lazyMessage = { "Both $GPG_SIGNING_KEY_PROPERTY and $GPG_SIGNING_PASSWORD_PROPERTY environment variables must not be empty" }
295+
lazyMessage = {
296+
"Both $GPG_SIGNING_KEY_PROPERTY and $GPG_SIGNING_PASSWORD_PROPERTY environment variables must not be empty"
297+
}
302298
)
303299

304300
fun validateOssrhCredentials() = require(
305301
value = !ossrhUsername.isNullOrBlank() && !ossrhPassword.isNullOrBlank(),
306-
lazyMessage = { "Both $OSSRH_USERNAME_PROPERTY and $OSSRH_PASSWORD_PROPERTY environment variables must not be empty" }
302+
lazyMessage = {
303+
"Both $OSSRH_USERNAME_PROPERTY and $OSSRH_PASSWORD_PROPERTY environment variables must not be empty"
304+
}
307305
)
308306

309307
companion object {
@@ -335,6 +333,7 @@ object PublicationSettings {
335333
const val SCM_URL = "https://github.com/Ecwid/ecwid-java-api-client.git"
336334

337335
const val STAGING_PACKAGE_GROUP = "com.ecwid"
336+
const val STAGING_PROFILE_ID = "42242535548c99"
338337
}
339338

340339
object Consts {

config/detekt.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ style:
2727
ThrowsCount:
2828
max: 5
2929
ReturnCount:
30-
max: 5
30+
max: 8
3131
UnnecessaryAbstractClass:
3232
excludes: [ '**/test/**' ]
3333
WildcardImport:

gradle/wrapper/gradle-wrapper.jar

-17.7 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

gradlew

Lines changed: 17 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)