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
4 changes: 2 additions & 2 deletions build-plugins/build-support/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ dependencies {

implementation(libs.nexusPublishPlugin)
compileOnly(gradleApi())
implementation("aws.sdk.kotlin:s3:1.1.+")
implementation("aws.sdk.kotlin:cloudwatch:1.1.+")
implementation("aws.sdk.kotlin:s3:1.4.+")
implementation("aws.sdk.kotlin:cloudwatch:1.4.+")
testImplementation(libs.junit.jupiter)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,18 @@ internal abstract class CollectDelegatedArtifactSizeMetrics : DefaultTask() {
private fun getFiles(keys: List<String>): List<String> = runBlocking {
S3Client.fromEnvironment().use { s3 ->
keys.map { key ->
async { s3.getObjectAsText(key) }
async {
s3.getObject(
GetObjectRequest {
bucket = S3_ARTIFACT_SIZE_METRICS_BUCKET
this.key = key
},
) { it.body?.decodeToString() ?: throw AwsSdkGradleException("Metrics file $key is missing a body") }
}
}.awaitAll()
}
}

private suspend fun S3Client.getObjectAsText(objectKey: String) = getObject(
GetObjectRequest {
bucket = S3_ARTIFACT_SIZE_METRICS_BUCKET
key = objectKey
},
) { it.body?.decodeToString() ?: throw AwsSdkGradleException("Metrics file $objectKey is missing a body") }

private fun combine(metricsFiles: List<String>) = buildString {
appendLine("Artifact, Size")
metricsFiles.forEach { metricsFile ->
Expand Down