1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Output checksums.

This commit is contained in:
Cedric Beust 2017-03-14 16:06:13 -07:00
parent 383128d96b
commit a0ce7498e3
2 changed files with 18 additions and 5 deletions

View file

@ -4,8 +4,15 @@ import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.Project
import com.beust.kobalt.archive.Zip
import com.beust.kobalt.misc.IncludedFile
import com.beust.kobalt.misc.KFiles
import java.io.File
interface ArchiveFileFinder {
fun findIncludedFiles(project: Project, context: KobaltContext, zip: Zip) : List<IncludedFile>
fun fullArchiveName(project: Project, context: KobaltContext, archiveName: String?, suffix: String) : File {
val fullArchiveName = context.variant.archiveName(project, archiveName, suffix)
val archiveDir = File(KFiles.libsDir(project))
val result = File(archiveDir.path, fullArchiveName)
return result
}
}

View file

@ -70,16 +70,21 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
* skipped.
*/
override fun assemble(project: Project, context: KobaltContext) : IncrementalTaskInfo {
val allArchivers = packages.filter { it.project.name == project.name }
val allConfigs = packages.filter { it.project.name == project.name }
if (false) {
// Work in progress
val allIncludedFiles = arrayListOf<IncludedFile>()
val zipToFiles = hashMapOf<String, List<IncludedFile>>()
allArchivers.forEach { packageConfig ->
val outputArchives = arrayListOf<File>()
allConfigs.forEach { packageConfig ->
listOf(packageConfig.jars, packageConfig.wars, packageConfig.zips).forEach { archives ->
archives.forEach {
val files = jarGenerator.findIncludedFiles(packageConfig.project, context, it)
val suffixIndex = it.name.lastIndexOf(".")
val suffix = it.name.substring(suffixIndex)
val outputFile = jarGenerator.fullArchiveName(project, context, it.name, suffix)
outputArchives.add(outputFile)
allIncludedFiles.addAll(files)
zipToFiles[it.name] = files
}
@ -95,7 +100,8 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
}
val md5 = Md5.toMd5Directories(allFiles)
println("MD5 is: " + md5)
val outMd5 = Md5.toMd5Directories(outputArchives)
println("Input MD5: $md5 output MD5: $outMd5")
}
return IncrementalTaskInfo(
@ -105,7 +111,7 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
try {
project.projectProperties.put(Archives.JAR_NAME,
context.variant.archiveName(project, null, ".jar"))
allArchivers.forEach { packageConfig ->
allConfigs.forEach { packageConfig ->
packageConfig.jars.forEach { jarGenerator.generateJar(packageConfig.project, context, it) }
packageConfig.wars.forEach { warGenerator.generateWar(packageConfig.project, context, it) }
packageConfig.zips.forEach { zipGenerator.generateZip(packageConfig.project, context, it) }