mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Output checksums.
This commit is contained in:
parent
383128d96b
commit
a0ce7498e3
2 changed files with 18 additions and 5 deletions
|
@ -4,8 +4,15 @@ import com.beust.kobalt.api.KobaltContext
|
||||||
import com.beust.kobalt.api.Project
|
import com.beust.kobalt.api.Project
|
||||||
import com.beust.kobalt.archive.Zip
|
import com.beust.kobalt.archive.Zip
|
||||||
import com.beust.kobalt.misc.IncludedFile
|
import com.beust.kobalt.misc.IncludedFile
|
||||||
|
import com.beust.kobalt.misc.KFiles
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
interface ArchiveFileFinder {
|
interface ArchiveFileFinder {
|
||||||
fun findIncludedFiles(project: Project, context: KobaltContext, zip: Zip) : List<IncludedFile>
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,16 +70,21 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
|
||||||
* skipped.
|
* skipped.
|
||||||
*/
|
*/
|
||||||
override fun assemble(project: Project, context: KobaltContext) : IncrementalTaskInfo {
|
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) {
|
if (false) {
|
||||||
// Work in progress
|
// Work in progress
|
||||||
val allIncludedFiles = arrayListOf<IncludedFile>()
|
val allIncludedFiles = arrayListOf<IncludedFile>()
|
||||||
val zipToFiles = hashMapOf<String, List<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 ->
|
listOf(packageConfig.jars, packageConfig.wars, packageConfig.zips).forEach { archives ->
|
||||||
archives.forEach {
|
archives.forEach {
|
||||||
val files = jarGenerator.findIncludedFiles(packageConfig.project, context, it)
|
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)
|
allIncludedFiles.addAll(files)
|
||||||
zipToFiles[it.name] = files
|
zipToFiles[it.name] = files
|
||||||
}
|
}
|
||||||
|
@ -95,7 +100,8 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
|
||||||
}
|
}
|
||||||
|
|
||||||
val md5 = Md5.toMd5Directories(allFiles)
|
val md5 = Md5.toMd5Directories(allFiles)
|
||||||
println("MD5 is: " + md5)
|
val outMd5 = Md5.toMd5Directories(outputArchives)
|
||||||
|
println("Input MD5: $md5 output MD5: $outMd5")
|
||||||
}
|
}
|
||||||
|
|
||||||
return IncrementalTaskInfo(
|
return IncrementalTaskInfo(
|
||||||
|
@ -105,7 +111,7 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
|
||||||
try {
|
try {
|
||||||
project.projectProperties.put(Archives.JAR_NAME,
|
project.projectProperties.put(Archives.JAR_NAME,
|
||||||
context.variant.archiveName(project, null, ".jar"))
|
context.variant.archiveName(project, null, ".jar"))
|
||||||
allArchivers.forEach { packageConfig ->
|
allConfigs.forEach { packageConfig ->
|
||||||
packageConfig.jars.forEach { jarGenerator.generateJar(packageConfig.project, context, it) }
|
packageConfig.jars.forEach { jarGenerator.generateJar(packageConfig.project, context, it) }
|
||||||
packageConfig.wars.forEach { warGenerator.generateWar(packageConfig.project, context, it) }
|
packageConfig.wars.forEach { warGenerator.generateWar(packageConfig.project, context, it) }
|
||||||
packageConfig.zips.forEach { zipGenerator.generateZip(packageConfig.project, context, it) }
|
packageConfig.zips.forEach { zipGenerator.generateZip(packageConfig.project, context, it) }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue