Skip to content

Commit

Permalink
fix(abg): provide a checksum for maven metadata or consumers are unhappy
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed Sep 4, 2024
1 parent e8c1cd5 commit 907580d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ suspend fun ActionCoords.buildPackageArtifacts(githubToken: String): Map<String,
val mavenMetadata = buildMavenMetadataFile(githubToken = githubToken)
return mapOf(
"maven-metadata.xml" to mavenMetadata,
"maven-metadata.xml.md5" to mavenMetadata.md5Checksum(),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ fun ActionCoords.buildVersionArtifacts(types: String? = null): Map<String, Artif
)
}

private fun ByteArray.md5Checksum(): String {
internal fun ByteArray.md5Checksum(): String {
val md5 = MessageDigest.getInstance("MD5")
val hashBytes = md5.digest(this)
return hashBytes.joinToString("") { "%02x".format(it) }
}

private fun String.md5Checksum(): String = this.toByteArray(charset = Charsets.UTF_8).md5Checksum()
internal fun String.md5Checksum(): String = this.toByteArray(charset = Charsets.UTF_8).md5Checksum()

0 comments on commit 907580d

Please sign in to comment.