Skip to content

Commit 106e9c3

Browse files
authored
Merge pull request #237 from Ecwid/upgrade-deps
Upgrade dependencies
2 parents d7ad545 + 464f960 commit 106e9c3

30 files changed

+216
-182
lines changed

.github/workflows/pull-request.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ jobs:
1010
steps:
1111

1212
- name: Checkout full repository history
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1414
with:
1515
fetch-depth: 0
1616

1717
- name: Set up JDK 17
18-
uses: actions/setup-java@v2
18+
uses: actions/setup-java@v3
1919
with:
2020
java-version: '17'
2121
distribution: 'adopt'
@@ -32,7 +32,7 @@ jobs:
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3333

3434
- name: Build, run tests and upload dev snapshot to Maven Central with Gradle
35-
run: ./gradlew devSnapshot printDevSnapshotReleaseNode
35+
run: ./gradlew devSnapshot printDevSnapshotReleaseNote
3636
env:
3737
STORE_ID: ${{ secrets.STORE_ID }}
3838
API_TOKEN: ${{ secrets.API_TOKEN }}
@@ -44,7 +44,7 @@ jobs:
4444
GITHUB_HEAD_REF: ${{ github.head_ref }}
4545

4646
- name: Upload artifacts with checks results
47-
uses: actions/upload-artifact@v2
47+
uses: actions/upload-artifact@v3
4848
if: failure()
4949
with:
5050
name: check-results
@@ -53,7 +53,7 @@ jobs:
5353
${{ github.workspace }}/build/reports/detekt/detekt.html
5454
5555
- name: Upload static analysis results
56-
uses: github/codeql-action/upload-sarif@v1
56+
uses: github/codeql-action/upload-sarif@v2
5757
if: always()
5858
with:
5959
sarif_file: ${{ github.workspace }}/build/reports/detekt/detekt.sarif

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
steps:
1414

1515
- name: Checkout full repository history
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
1717
with:
1818
fetch-depth: 0
1919

2020
- name: Set up JDK 17
21-
uses: actions/setup-java@v2
21+
uses: actions/setup-java@v3
2222
with:
2323
java-version: '17'
2424
distribution: 'adopt'
@@ -34,7 +34,7 @@ jobs:
3434
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3535

3636
- name: Build, upload release version to Maven Central and create git release tag with Gradle
37-
run: ./gradlew detekt final closeAndReleaseRepository printFinalReleaseNode
37+
run: ./gradlew detekt final closeAndReleaseRepository printFinalReleaseNote
3838
env:
3939
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
4040
GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }}
@@ -44,7 +44,7 @@ jobs:
4444
GRGIT_PASS: ${{ secrets.GRGIT_PASS }}
4545

4646
- name: Upload static analysis results
47-
uses: github/codeql-action/upload-sarif@v1
47+
uses: github/codeql-action/upload-sarif@v2
4848
if: always()
4949
with:
5050
sarif_file: ${{ github.workspace }}/build/reports/detekt/detekt.sarif

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ src/test/resources/test.properties
88

99
# Files created by github actions before workflow job run
1010
# Task `gradle release` requires that git reposoitary to be clean
11-
settings.xml
11+
settings.xml
12+
toolchains.xml

build.gradle.kts

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
77
plugins {
88
java
99
signing
10-
kotlin("jvm") version "1.5.32"
11-
id("com.adarshr.test-logger") version "2.1.1"
12-
id("io.codearte.nexus-staging") version "0.22.0"
10+
kotlin("jvm") version "1.7.21"
11+
id("com.adarshr.test-logger") version "3.2.0"
12+
id("io.codearte.nexus-staging") version "0.30.0"
1313
id("nebula.release") version "17.1.0"
1414
id("maven-publish")
15-
id("io.gitlab.arturbosch.detekt") version "1.17.1"
15+
id("io.gitlab.arturbosch.detekt") version "1.22.0"
1616
id("org.gradle.test-retry") version "1.4.1"
1717
}
1818

@@ -24,14 +24,14 @@ dependencies {
2424
implementation(kotlin("stdlib-jdk8"))
2525
implementation(kotlin("reflect"))
2626

27-
api("com.google.code.gson:gson:2.8.6")
27+
api("com.google.code.gson:gson:2.10")
2828
api("org.apache.httpcomponents:httpclient:4.5.13")
2929

30-
testImplementation("org.junit.jupiter:junit-jupiter:5.7.0")
31-
testImplementation("org.reflections:reflections:0.9.11")
32-
testImplementation("uk.co.jemos.podam:podam:7.2.6.RELEASE")
30+
testImplementation("org.junit.jupiter:junit-jupiter:5.9.1")
31+
testImplementation("org.reflections:reflections:0.10.2")
32+
testImplementation("uk.co.jemos.podam:podam:7.2.11.RELEASE")
3333

34-
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.17.1")
34+
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.22.0")
3535
}
3636

3737
configure<JavaPluginConvention> {
@@ -87,6 +87,7 @@ tasks.withType<Sign> {
8787
doFirst {
8888
settingsProvider.validateGPGSecrets()
8989
}
90+
dependsOn(tasks.getByName("build"))
9091
}
9192

9293
tasks.withType<PublishToMavenRepository> {
@@ -95,24 +96,26 @@ tasks.withType<PublishToMavenRepository> {
9596
}
9697
}
9798

98-
tasks.register("printFinalReleaseNode") {
99+
tasks.register(Tasks.PRINT_FINAL_RELEASE_NOTE_TASK_NAME) {
99100
doLast {
100-
printFinalReleaseNode(
101+
printFinalReleaseNote(
101102
groupId = PublicationSettings.GROUP_ID,
102103
artifactId = PublicationSettings.ARTIFACT_ID,
103104
sanitizedVersion = project.sanitizeVersion()
104105
)
105106
}
107+
dependsOn(tasks.getByName("final"))
106108
}
107109

108-
tasks.register("printDevSnapshotReleaseNode") {
110+
tasks.register(Tasks.PRINT_DEV_SNAPSHOT_RELEASE_NOTE_TASK_NAME) {
109111
doLast {
110-
printDevSnapshotReleaseNode(
112+
printDevSnapshotReleaseNote(
111113
groupId = PublicationSettings.GROUP_ID,
112114
artifactId = PublicationSettings.ARTIFACT_ID,
113115
sanitizedVersion = project.sanitizeVersion()
114116
)
115117
}
118+
dependsOn(tasks.getByName("devSnapshot"))
116119
}
117120

118121
detekt {
@@ -227,7 +230,7 @@ fun Project.sanitizeVersion(): String {
227230

228231
fun Project.isSnapshotVersion() = version.toString().contains("-dev.")
229232

230-
fun printFinalReleaseNode(groupId: String, artifactId: String, sanitizedVersion: String) {
233+
fun printFinalReleaseNote(groupId: String, artifactId: String, sanitizedVersion: String) {
231234
println()
232235
println("========================================================")
233236
println()
@@ -249,7 +252,7 @@ fun printFinalReleaseNode(groupId: String, artifactId: String, sanitizedVersion:
249252
println()
250253
}
251254

252-
fun printDevSnapshotReleaseNode(groupId: String, artifactId: String, sanitizedVersion: String) {
255+
fun printDevSnapshotReleaseNote(groupId: String, artifactId: String, sanitizedVersion: String) {
253256
println()
254257
println("========================================================")
255258
println()
@@ -330,3 +333,8 @@ object Consts {
330333
const val SLOW_TESTS_LOGGING_THRESHOLD_MS = 30_000L
331334
const val MAX_TEST_RETRIES_COUNT = 3
332335
}
336+
337+
object Tasks {
338+
const val PRINT_FINAL_RELEASE_NOTE_TASK_NAME = "printFinalReleaseNote"
339+
const val PRINT_DEV_SNAPSHOT_RELEASE_NOTE_TASK_NAME = "printDevSnapshotReleaseNote"
340+
}

config/detekt.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
complexity:
2-
ComplexMethod:
2+
CyclomaticComplexMethod:
33
threshold: 40
44
LargeClass:
5-
excludes: ['**/test/**']
5+
excludes: [ '**/test/**' ]
66
LongMethod:
77
threshold: 100
8-
excludes: ['**/test/**']
8+
excludes: [ '**/test/**' ]
99
LongParameterList:
1010
functionThreshold: 10
1111
constructorThreshold: 15
12-
excludes: ['**/com/ecwid/apiclient/v3/ApiClient.kt']
12+
excludes: [ '**/com/ecwid/apiclient/v3/ApiClient.kt' ]
1313
NestedBlockDepth:
14-
excludes: ['**/test/**']
14+
excludes: [ '**/test/**' ]
1515
TooManyFunctions:
1616
thresholdInFiles: 50
1717
thresholdInClasses: 50
@@ -29,14 +29,16 @@ style:
2929
ReturnCount:
3030
max: 5
3131
UnnecessaryAbstractClass:
32-
excludes: ['**/test/**']
32+
excludes: [ '**/test/**' ]
3333
WildcardImport:
3434
active: false
3535

3636
# ktlint rules
3737
formatting:
3838
MaximumLineLength:
3939
maxLineLength: 180
40+
EnumEntryNameCase:
41+
active: false # We need to fix all enums before enabling this inspection
4042
# Initially enabled
4143
NoBlankLineBeforeRbrace:
4244
active: false
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/kotlin/com/ecwid/apiclient/v3/ApiClient.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,14 @@ interface StoreProfileApiClient {
116116
fun getStoreProfile(request: StoreProfileRequest): FetchedStoreProfile
117117
fun updateStoreProfile(request: StoreProfileUpdateRequest): StoreProfileUpdateResult
118118
fun getLatestStats(request: LatestStatsRequest): FetchedLatestStats
119-
fun getShippingOptions(request: ShippingOptionsRequest): ShippingOptionsResult
120-
// fun addShippingOption()
121-
// fun updateShippingOption()
122-
fun getPaymentOptions(request: PaymentOptionsRequest): PaymentOptionsResult
123-
// fun addPaymentOption()
124-
// fun updatePaymentOption()
119+
fun getShippingOptions(request: ShippingOptionsRequest): ShippingOptionsResult
120+
121+
// fun addShippingOption()
122+
// fun updateShippingOption()
123+
fun getPaymentOptions(request: PaymentOptionsRequest): PaymentOptionsResult
124+
125+
// fun addPaymentOption()
126+
// fun updatePaymentOption()
125127
fun uploadStoreLogo(request: StoreLogoUploadRequest): StoreLogoUploadResult
126128
fun removeStoreLogo(request: StoreLogoRemoveRequest): StoreLogoRemoveResult
127129
fun uploadInvoiceLogo(request: InvoiceLogoUploadRequest): InvoiceLogoUploadResult

src/main/kotlin/com/ecwid/apiclient/v3/ApiClientHelper.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,16 @@ class ApiClientHelper private constructor(
129129
)
130130
}
131131
}
132+
132133
is HttpResponse.Error -> {
133134
try {
134135
val responseBody = responseBytes.asString()
135136
logErrorResponseIfNeeded(requestId, requestTime, httpResponse.statusCode, responseBody)
136137
val ecwidError = if (responseBody.isNotBlank()) {
137138
jsonTransformer.deserialize(responseBody, EcwidApiError::class.java)
138-
} else null
139+
} else {
140+
null
141+
}
139142
throw EcwidApiException(
140143
statusCode = httpResponse.statusCode,
141144
reasonPhrase = httpResponse.reasonPhrase,
@@ -151,6 +154,7 @@ class ApiClientHelper private constructor(
151154
)
152155
}
153156
}
157+
154158
is HttpResponse.TransportError -> {
155159
logTransportErrorResponseIfNeeded(
156160
requestId,
@@ -196,16 +200,19 @@ class ApiClientHelper private constructor(
196200
uri = createApiEndpointUri(pathSegments),
197201
params = params.withCredentialsParams(credentials)
198202
)
203+
199204
HttpMethod.POST -> HttpRequest.HttpPostRequest(
200205
uri = createApiEndpointUri(pathSegments),
201206
params = params.withCredentialsParams(credentials),
202207
transportHttpBody = httpBody.prepare(jsonTransformer)
203208
)
209+
204210
HttpMethod.PUT -> HttpRequest.HttpPutRequest(
205211
uri = createApiEndpointUri(pathSegments),
206212
params = params.withCredentialsParams(credentials),
207213
transportHttpBody = httpBody.prepare(jsonTransformer)
208214
)
215+
209216
HttpMethod.DELETE -> HttpRequest.HttpDeleteRequest(
210217
uri = createApiEndpointUri(pathSegments),
211218
params = params.withCredentialsParams(credentials)
@@ -393,12 +400,15 @@ internal fun HttpBody.prepare(jsonTransformer: JsonTransformer): TransportHttpBo
393400
val bodyAsBytes = jsonTransformer.serialize(obj, objExt).toByteArray()
394401
TransportHttpBody.ByteArrayBody(bodyAsBytes, MIME_TYPE_APPLICATION_JSON)
395402
}
403+
396404
is HttpBody.ByteArrayBody -> {
397405
TransportHttpBody.ByteArrayBody(bytes, mimeType)
398406
}
407+
399408
is HttpBody.InputStreamBody -> {
400409
TransportHttpBody.InputStreamBody(stream, mimeType)
401410
}
411+
402412
is HttpBody.LocalFileBody -> {
403413
TransportHttpBody.LocalFileBody(file, mimeType)
404414
}

src/main/kotlin/com/ecwid/apiclient/v3/dto/batch/request/CreateBatchRequest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,15 @@ private data class SingleBatchRequest(
7272
is HttpBody.EmptyBody -> {
7373
null
7474
}
75+
7576
is HttpBody.JsonBody -> {
7677
requestInfo.httpBody.obj
7778
}
79+
7880
is HttpBody.ByteArrayBody,
7981
is HttpBody.InputStreamBody,
8082
is HttpBody.LocalFileBody -> {
81-
throw IllegalStateException("Request type ${requestInfo.httpBody.javaClass.simpleName} is not allowed in batch requests")
83+
error("Request type ${requestInfo.httpBody.javaClass.simpleName} is not allowed in batch requests")
8284
}
8385
}
8486
)

src/main/kotlin/com/ecwid/apiclient/v3/dto/category/result/FetchedCategory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ data class FetchedCategory(
2020

2121
val hdThumbnailUrl: String? = null,
2222
val thumbnailUrl: String? = null,
23-
val imageUrl: String? = null, // TODO Cannot test due to bug https://track.ecwid.com/youtrack/issue/ECWID-53222
23+
val imageUrl: String? = null, // TODO Cannot test due to bug https://track.ecwid.com/youtrack/issue/ECWID-53222
2424
val originalImageUrl: String? = null,
2525
val originalImage: PictureInfo? = null,
2626
val url: String? = null,

0 commit comments

Comments
 (0)