From dfe52c80d8e9ea7d754ccddcbd2d1513a4052b38 Mon Sep 17 00:00:00 2001 From: Goooler Date: Mon, 9 Dec 2024 21:09:14 +0800 Subject: [PATCH] Convert MavenFileModule --- .../util/repo/maven/MavenFileModule.groovy | 46 ------------------- .../shadow/util/repo/maven/MavenFileModule.kt | 43 +++++++++++++++++ 2 files changed, 43 insertions(+), 46 deletions(-) delete mode 100644 src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/util/repo/maven/MavenFileModule.groovy create mode 100644 src/intiTest/kotlin/com/github/jengelman/gradle/plugins/shadow/util/repo/maven/MavenFileModule.kt diff --git a/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/util/repo/maven/MavenFileModule.groovy b/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/util/repo/maven/MavenFileModule.groovy deleted file mode 100644 index 80d482224..000000000 --- a/src/funcTest/groovy/com/github/jengelman/gradle/plugins/shadow/util/repo/maven/MavenFileModule.groovy +++ /dev/null @@ -1,46 +0,0 @@ -package com.github.jengelman.gradle.plugins.shadow.util.repo.maven - -import org.jetbrains.annotations.NotNull - -class MavenFileModule extends AbstractMavenModule { - private boolean uniqueSnapshots = true - - MavenFileModule(File moduleDir, String groupId, String artifactId, String version) { - super(moduleDir, groupId, artifactId, version) - } - - @Override - boolean getUniqueSnapshots() { - return uniqueSnapshots - } - - @Override - String getMetaDataFileContent() { - """ - - - $groupId - $artifactId - $version - - - ${timestampFormat.format(publishTimestamp)} - $publishCount - - ${updateFormat.format(publishTimestamp)} - - - """.stripIndent() - } - - @Override - protected void onPublish(@NotNull File file) { - sha1File(file) - md5File(file) - } - - @Override - protected boolean publishesMetaDataFile() { - uniqueSnapshots && version.endsWith("-SNAPSHOT") - } -} diff --git a/src/intiTest/kotlin/com/github/jengelman/gradle/plugins/shadow/util/repo/maven/MavenFileModule.kt b/src/intiTest/kotlin/com/github/jengelman/gradle/plugins/shadow/util/repo/maven/MavenFileModule.kt new file mode 100644 index 000000000..81b23ec0e --- /dev/null +++ b/src/intiTest/kotlin/com/github/jengelman/gradle/plugins/shadow/util/repo/maven/MavenFileModule.kt @@ -0,0 +1,43 @@ +package com.github.jengelman.gradle.plugins.shadow.util.repo.maven + +import java.io.File +import org.intellij.lang.annotations.Language +import org.jetbrains.annotations.NotNull + +class MavenFileModule( + moduleDir: File, + groupId: String, + artifactId: String, + version: String, +) : AbstractMavenModule(moduleDir, groupId, artifactId, version) { + + override fun getUniqueSnapshots(): Boolean = uniqueSnapshots + + @Language("XML") + override fun getMetaDataFileContent(): String { + return """ + + + $groupId + $artifactId + $version + + + ${timestampFormat.format(publishTimestamp)} + $publishCount + + ${updateFormat.format(publishTimestamp)} + + + """.trimIndent() + } + + override fun onPublish(@NotNull file: File) { + sha1File(file) + md5File(file) + } + + override fun publishesMetaDataFile(): Boolean { + return uniqueSnapshots && version.endsWith("-SNAPSHOT") + } +}