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 b934ade49..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.apache.maven.artifact.repository.metadata.Metadata -import org.apache.maven.artifact.repository.metadata.Snapshot -import org.apache.maven.artifact.repository.metadata.Versioning -import org.jetbrains.annotations.NotNull - -class MavenFileModule extends AbstractMavenModule { - MavenFileModule(File moduleDir, String groupId, String artifactId, String version) { - super(moduleDir, groupId, artifactId, version) - } - - @Override - boolean isUniqueSnapshots() { - return true - } - - @Override - Metadata getMetaData(List versions) { - Metadata metadata = new Metadata() - metadata.groupId = groupId - metadata.artifactId = artifactId - metadata.version = version - - Versioning versioning = new Versioning() - versioning.versions = versions - versioning.snapshot = new Snapshot() - versioning.snapshot.timestamp = timestampFormat.format(publishTimestamp) - versioning.snapshot.buildNumber = publishCount - versioning.lastUpdated = updateFormat.format(publishTimestamp) - metadata.versioning = versioning - - return metadata - } - - @Override - protected void onPublish(@NotNull File file) { - sha1File(file) - md5File(file) - } - - @Override - protected boolean isPublishesMetaDataFile() { - 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..172e7c137 --- /dev/null +++ b/src/intiTest/kotlin/com/github/jengelman/gradle/plugins/shadow/util/repo/maven/MavenFileModule.kt @@ -0,0 +1,40 @@ +package com.github.jengelman.gradle.plugins.shadow.util.repo.maven + +import java.io.File +import org.apache.maven.artifact.repository.metadata.Metadata +import org.apache.maven.artifact.repository.metadata.Snapshot +import org.apache.maven.artifact.repository.metadata.Versioning + +open class MavenFileModule( + moduleDir: File, + groupId: String, + artifactId: String, + version: String, +) : AbstractMavenModule(moduleDir, groupId, artifactId, version) { + + override val isUniqueSnapshots: Boolean = true + + override fun getMetaData(versions: List): Metadata { + return Metadata().also { + it.groupId = groupId + it.artifactId = artifactId + it.version = version + it.versioning = Versioning().also { versioning -> + versioning.versions = versions + versioning.snapshot = Snapshot().apply { + timestamp = timestampFormat.format(publishTimestamp) + buildNumber = publishCount + } + versioning.lastUpdated = updateFormat.format(publishTimestamp) + } + } + } + + override fun onPublish(file: File) { + sha1File(file) + md5File(file) + } + + override val isPublishesMetaDataFile: Boolean + get() = isUniqueSnapshots && version.endsWith("-SNAPSHOT") +}