Skip to content

Commit ddc5964

Browse files
authored
Bump Kotlin, OkHttp, xmlutil and a bunch of other dependencies (#228)
* Bump versions * update kotlin-js-store
1 parent 685c5c4 commit ddc5964

10 files changed

Lines changed: 56 additions & 84 deletions

File tree

.github/workflows/build-pull-request.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@ jobs:
88
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
99
- run: |
1010
./gradlew build
11-
./gradlew -p tests/jvm build
12-
./gradlew -p tests/kmp publishAggregationToCentralPortal --configuration-cache
13-
./gradlew -p tests/kmp build
11+
./scripts/integration-tests.sh

gradle/libs.versions.toml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
[versions]
2-
kgp = "2.2.20"
3-
ksp = "2.3.2"
4-
gratatouille-runtime = "0.2.0"
5-
gratatouille-plugin = "0.2.0"
2+
kgp = "2.3.0"
3+
ksp = "2.3.4"
4+
gratatouille-runtime = "0.2.1"
5+
gratatouille-plugin = "0.2.1"
66

77
[libraries]
8-
json = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.1"
9-
okio = "com.squareup.okio:okio:3.8.0"
10-
okhttp = "com.squareup.okhttp3:okhttp:4.12.0"
11-
mockwebserver = "com.squareup.okhttp3:mockwebserver:4.12.0"
8+
json = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0"
9+
okio = "com.squareup.okio:okio:3.16.4"
10+
okhttp = "com.squareup.okhttp3:okhttp:5.3.2"
11+
mockwebserver = "com.squareup.okhttp3:mockwebserver:5.3.2"
12+
#noinspection NewerVersionAvailable
1213
gradle-min = "dev.gradleplugins:gradle-api:8.8"
1314
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test" }
14-
xmlutil = "io.github.pdvrieze.xmlutil:serialization:0.91.1"
15+
xmlutil = "io.github.pdvrieze.xmlutil:serialization:1.0.0-rc1"
1516
kgp = { module = "org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin", version.ref = "kgp" }
1617
coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2"
1718
gratatouille-runtime = { module = "com.gradleup.gratatouille:gratatouille-runtime", version.ref = "gratatouille-runtime" }
@@ -24,4 +25,4 @@ ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
2425
gratatouille = { id = "com.gradleup.gratatouille", version.ref = "gratatouille-plugin" }
2526
librarian = { id = "com.gradleup.librarian", version = "0.2.2-SNAPSHOT-6898196f1f9759091ae6fa9bbe84154ec28a9331" }
2627
nmcp = { id = "com.gradleup.nmcp", version = "1.3.0" }
27-
compat = { id = "com.gradleup.compat.patrouille", version = "0.0.1-SNAPSHOT-9da44b3b93e36a196ae5afc9f7a79a46a82763cd" }
28+
compat = { id = "com.gradleup.tapmoc", version = "0.3.3-SNAPSHOT-a7d9d3fed6e48f1a88966d81e753259dadfa9a9a" }

nmcp-tasks/src/main/kotlin/nmcp/internal/task/metadata.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ package nmcp.internal.task
33
import kotlinx.serialization.Serializable
44
import kotlinx.serialization.StringFormat
55
import nl.adaptivity.xmlutil.serialization.XML
6+
import nl.adaptivity.xmlutil.serialization.XML1_0
67
import nl.adaptivity.xmlutil.serialization.XmlChildrenName
8+
import nl.adaptivity.xmlutil.serialization.XmlConfig
79
import nl.adaptivity.xmlutil.serialization.XmlElement
810
import nl.adaptivity.xmlutil.serialization.XmlSerialName
911

@@ -80,6 +82,6 @@ internal data class ArtifactMetadata(
8082
)
8183
}
8284

83-
internal val xml: StringFormat = XML {
84-
indent = 2
85+
internal val xml: StringFormat = XML1_0.recommended {
86+
indentString = " "
8587
}

nmcp-tasks/src/main/kotlin/nmcp/internal/task/nmcpPublishWithPublisherApi.kt

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
package nmcp.internal.task
22

33
import gratatouille.tasks.GInputFile
4-
import gratatouille.tasks.GInputFiles
54
import gratatouille.tasks.GLogger
65
import gratatouille.tasks.GTask
76
import java.net.SocketTimeoutException
8-
import java.util.zip.ZipEntry
9-
import java.util.zip.ZipOutputStream
107
import kotlin.time.Duration
118
import kotlin.time.Duration.Companion.minutes
129
import kotlin.time.Duration.Companion.seconds
@@ -15,15 +12,12 @@ import kotlinx.serialization.json.Json
1512
import kotlinx.serialization.json.JsonObject
1613
import kotlinx.serialization.json.JsonPrimitive
1714
import nmcp.transport.nmcpClient
18-
import okhttp3.MediaType
1915
import okhttp3.MediaType.Companion.toMediaType
2016
import okhttp3.MultipartBody
2117
import okhttp3.Request
22-
import okhttp3.RequestBody
2318
import okhttp3.RequestBody.Companion.asRequestBody
2419
import okhttp3.RequestBody.Companion.toRequestBody
2520
import okio.Buffer
26-
import okio.BufferedSink
2721
import okio.ByteString
2822
import okio.use
2923

@@ -58,8 +52,10 @@ internal fun nmcpPublishWithPublisherApi(
5852
)
5953
.build()
6054

55+
@Suppress("NAME_SHADOWING")
6156
val publishingType = publishingType ?: "AUTOMATIC"
6257

58+
@Suppress("NAME_SHADOWING")
6359
val baseUrl = baseUrl ?: "https://central.sonatype.com/"
6460
val url = baseUrl + "api/v1/publisher/upload?publishingType=$publishingType"
6561

@@ -73,10 +69,10 @@ internal fun nmcpPublishWithPublisherApi(
7369
nmcpClient.newCall(it).execute()
7470
}.use {
7571
if (!it.isSuccessful) {
76-
error("Cannot deploy to maven central (status='${it.code}'): ${it.body?.string()}")
72+
error("Cannot deploy to maven central (status='${it.code}'): ${it.body.string()}")
7773
}
7874

79-
it.body!!.string()
75+
it.body.string()
8076
}
8177

8278
logger.lifecycle("Nmcp: deployment bundle '$deploymentId' uploaded.")
@@ -180,10 +176,10 @@ private fun verifyStatus(
180176
}
181177
}.use {
182178
if (!it.isSuccessful) {
183-
error("Cannot verify deployment $deploymentId status (HTTP status='${it.code}'): ${it.body?.string()}")
179+
error("Cannot verify deployment $deploymentId status (HTTP status='${it.code}'): ${it.body.string()}")
184180
}
185181

186-
val str = it.body!!.string()
182+
val str = it.body.string()
187183
val element = Json.parseToJsonElement(str)
188184
check(element is JsonObject) {
189185
"Nmcp: unexpected status response for deployment $deploymentId: $str"
@@ -207,32 +203,3 @@ private fun verifyStatus(
207203
}
208204
}
209205
}
210-
211-
internal class ZipBody(val files: GInputFiles, private val logger: GLogger) : RequestBody() {
212-
override fun contentType(): MediaType {
213-
return "application/octet-stream".toMediaType()
214-
}
215-
216-
override fun writeTo(sink: BufferedSink) {
217-
val stream = ZipOutputStream(sink.outputStream())
218-
files.forEach {
219-
if (it.file.isDirectory) {
220-
return@forEach
221-
}
222-
// Exclude maven-metadata files or the bundle is not recognized
223-
// See https://slack-chats.kotlinlang.org/t/16407246/anyone-tried-the-https-central-sonatype-org-publish-publish-#c8738fe5-8051-4f64-809f-ca67a645216e
224-
if (it.file.name.startsWith("maven-metadata")) {
225-
return@forEach
226-
}
227-
logger.info("Nmcp: zip ${it.normalizedPath}")
228-
stream.putNextEntry(ZipEntry(it.normalizedPath))
229-
it.file.inputStream().use {
230-
it.copyTo(stream)
231-
}
232-
stream.closeEntry()
233-
}
234-
stream.finish()
235-
stream.flush()
236-
sink.flush()
237-
}
238-
}

nmcp-tasks/src/main/kotlin/nmcp/transport/publishFileByFile.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,8 @@ internal fun Instant.asTimestamp(withDot: Boolean): String {
249249

250250
internal val checksums = setOf("md5", "sha1", "sha256", "sha512")
251251

252-
/**
253-
* Helper function to add the `<?xml...` preamble as I haven't found how to do it with xmlutils
254-
*/
255252
internal inline fun <reified T> encodeToXml(t: T): String {
256-
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml.encodeToString(t)
253+
return xml.encodeToString(t)
257254
}
258255

259256
private fun ByteArray.digest(name: String): String {

nmcp-tasks/src/main/kotlin/nmcp/transport/transport.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ internal class HttpTransport(
103103
}
104104
if(!response.isSuccessful) {
105105
response.close()
106-
error("Nmcp: cannot GET '$url' (statusCode=${response.code}):\n${response.body!!.string()}")
106+
error("Nmcp: cannot GET '$url' (statusCode=${response.code}):\n${response.body.string()}")
107107
}
108108

109-
return response.body!!.source()
109+
return response.body.source()
110110
}
111111

112112
override fun put(path: String, body: Content) {
@@ -127,7 +127,7 @@ internal class HttpTransport(
127127
check(response.isSuccessful) {
128128
buildString {
129129
appendLine("Nmcp: cannot PUT '$url' (statusCode=${response.code}).")
130-
appendLine("Response body: ${response.body!!.string()}")
130+
appendLine("Response body: ${response.body.string()}")
131131
appendLine("Things to double check:")
132132
/**
133133
* I have seen 401 for this

nmcp-tasks/src/test/kotlin/MetadataTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ class MetadataTest {
4545
*/
4646
// language=xml
4747
val xmlData = """
48-
<?xml version="1.0" encoding="UTF-8"?>
48+
<?xml version='1.1' ?>
4949
<metadata modelVersion="1.1.0">
5050
<groupId>com.apollographql.apollo</groupId>
5151
<artifactId>apollo-api-jvm</artifactId>
5252
<versioning>
5353
<latest>5.0.0-SNAPSHOT</latest>
54-
<release></release>
54+
<release />
5555
<versions>
5656
<version>4.1.2-SNAPSHOT</version>
5757
<version>5.0.0-SNAPSHOT</version>
@@ -111,7 +111,7 @@ class MetadataTest {
111111
fun versionMetadataIsEncodedSuccessfully() {
112112
// language=xml
113113
val xmlData = """
114-
<?xml version="1.0" encoding="UTF-8"?>
114+
<?xml version='1.1' ?>
115115
<metadata modelVersion="1.1.0">
116116
<groupId>com.apollographql.apollo</groupId>
117117
<artifactId>apollo-api-jvm</artifactId>

scripts/integration-tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env sh
2+
set -e
3+
set -x
4+
./gradlew -p tests/jvm build
5+
./gradlew -p tests/kmp publishAggregationToCentralPortal --configuration-cache
6+
./gradlew -p tests/kmp build

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pluginManagement {
99
content {
1010
// gratatouille-processor is only used at build time and is safe to fetch as a snapshot
1111
includeModule("com.gradleup.gratatouille", "gratatouille-processor")
12+
includeModule("com.gradleup.tapmoc", "tapmoc-tasks")
1213
}
1314
}
1415
}

tests/kmp/kotlin-js-store/yarn.lock

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ balanced-match@^1.0.0:
5252
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
5353

5454
brace-expansion@^2.0.1:
55-
version "2.0.1"
56-
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"
57-
integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
55+
version "2.0.2"
56+
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.2.tgz#54fc53237a613d854c7bd37463aad17df87214e7"
57+
integrity sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==
5858
dependencies:
5959
balanced-match "^1.0.0"
6060

@@ -119,9 +119,9 @@ cross-spawn@^7.0.6:
119119
which "^2.0.1"
120120

121121
debug@^4.3.5:
122-
version "4.4.0"
123-
resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a"
124-
integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==
122+
version "4.4.3"
123+
resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a"
124+
integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==
125125
dependencies:
126126
ms "^2.1.3"
127127

@@ -192,9 +192,9 @@ get-caller-file@^2.0.5:
192192
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
193193

194194
glob@^10.4.5:
195-
version "10.4.5"
196-
resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956"
197-
integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==
195+
version "10.5.0"
196+
resolved "https://registry.yarnpkg.com/glob/-/glob-10.5.0.tgz#8ec0355919cd3338c28428a23d4f24ecc5fe738c"
197+
integrity sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==
198198
dependencies:
199199
foreground-child "^3.1.0"
200200
jackspeak "^3.1.2"
@@ -243,16 +243,16 @@ jackspeak@^3.1.2:
243243
"@pkgjs/parseargs" "^0.11.0"
244244

245245
js-yaml@^4.1.0:
246-
version "4.1.0"
247-
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
248-
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
246+
version "4.1.1"
247+
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.1.tgz#854c292467705b699476e1a2decc0c8a3458806b"
248+
integrity sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==
249249
dependencies:
250250
argparse "^2.0.1"
251251

252-
kotlin-web-helpers@2.1.0:
253-
version "2.1.0"
254-
resolved "https://registry.yarnpkg.com/kotlin-web-helpers/-/kotlin-web-helpers-2.1.0.tgz#6cd4b0f0dc3baea163929c8638155b8d19c55a74"
255-
integrity sha512-NAJhiNB84tnvJ5EQx7iER3GWw7rsTZkX9HVHZpe7E3dDBD/dhTzqgSwNU3MfQjniy2rB04bP24WM9Z32ntUWRg==
252+
kotlin-web-helpers@3.0.0:
253+
version "3.0.0"
254+
resolved "https://registry.yarnpkg.com/kotlin-web-helpers/-/kotlin-web-helpers-3.0.0.tgz#3ed6b48f694f74bb60a737a9d7e2c0e3b29abdb9"
255+
integrity sha512-kdQO4AJQkUPvpLh9aglkXDRyN+CfXO7pKq+GESEnxooBFkQpytLrqZis3ABvmFN1cGw/ZQ/K38u5sRGW+NfBnw==
256256
dependencies:
257257
format-util "^1.0.5"
258258

@@ -288,10 +288,10 @@ minimatch@^9.0.4, minimatch@^9.0.5:
288288
resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707"
289289
integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==
290290

291-
mocha@11.7.1:
292-
version "11.7.1"
293-
resolved "https://registry.yarnpkg.com/mocha/-/mocha-11.7.1.tgz#91948fecd624fb4bd154ed260b7e1ad3910d7c7a"
294-
integrity sha512-5EK+Cty6KheMS/YLPPMJC64g5V61gIR25KsRItHw6x4hEKT6Njp1n9LOlH4gpevuwMVS66SXaBBpg+RWZkza4A==
291+
mocha@11.7.2:
292+
version "11.7.2"
293+
resolved "https://registry.yarnpkg.com/mocha/-/mocha-11.7.2.tgz#3c0079fe5cc2f8ea86d99124debcc42bb1ab22b5"
294+
integrity sha512-lkqVJPmqqG/w5jmmFtiRvtA2jkDyNVUcefFJKb2uyX4dekk8Okgqop3cgbFiaIvj8uCRJVTP5x9dfxGyXm2jvQ==
295295
dependencies:
296296
browser-stdout "^1.3.1"
297297
chokidar "^4.0.1"

0 commit comments

Comments
 (0)