mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Incremental packaging.
This commit is contained in:
parent
c974330612
commit
b2390f34f8
1 changed files with 36 additions and 36 deletions
|
@ -61,19 +61,12 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
|
||||||
runTask = { taskInstall(project) })
|
runTask = { taskInstall(project) })
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* "assemble" is an incremental task but with a twist. Because it can be costly to determine if any
|
|
||||||
* of the class files generated in the previous phase is new or not, we just don't do that and always
|
|
||||||
* return "null" for both input and output checksums, which would cause that task to always be rerun.
|
|
||||||
* However, we are depending on Kobalt's cascading incremental management to skip us whenever appropriate:
|
|
||||||
* whenever a previous incremental task was a success, all following incremental tasks are automatically
|
|
||||||
* skipped.
|
|
||||||
*/
|
|
||||||
override fun assemble(project: Project, context: KobaltContext) : IncrementalTaskInfo {
|
override fun assemble(project: Project, context: KobaltContext) : IncrementalTaskInfo {
|
||||||
val allConfigs = packages.filter { it.project.name == project.name }
|
val allConfigs = packages.filter { it.project.name == project.name }
|
||||||
|
|
||||||
if (false) {
|
val start = System.currentTimeMillis()
|
||||||
// Work in progress
|
val checksums =
|
||||||
|
if (true) {
|
||||||
val allIncludedFiles = arrayListOf<IncludedFile>()
|
val allIncludedFiles = arrayListOf<IncludedFile>()
|
||||||
val zipToFiles = hashMapOf<String, List<IncludedFile>>()
|
val zipToFiles = hashMapOf<String, List<IncludedFile>>()
|
||||||
val outputArchives = arrayListOf<File>()
|
val outputArchives = arrayListOf<File>()
|
||||||
|
@ -99,14 +92,21 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
|
||||||
files
|
files
|
||||||
}
|
}
|
||||||
|
|
||||||
val md5 = Md5.toMd5Directories(allFiles)
|
val inMd5 = Md5.toMd5Directories(allFiles)
|
||||||
val outMd5 = Md5.toMd5Directories(outputArchives)
|
val outMd5 = Md5.toMd5Directories(outputArchives)
|
||||||
println("Input MD5: $md5 output MD5: $outMd5")
|
Pair(inMd5, outMd5)
|
||||||
|
} else {
|
||||||
|
Pair(null, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val inMd5 = checksums.first
|
||||||
|
val outMd5 = checksums.second
|
||||||
|
context.logger.log(project.name, 2,
|
||||||
|
" Time to calculate packaging checksum: " + (System.currentTimeMillis() - start) + " ms")
|
||||||
|
|
||||||
return IncrementalTaskInfo(
|
return IncrementalTaskInfo(
|
||||||
{ null },
|
{ -> inMd5 },
|
||||||
{ null },
|
{ -> outMd5 },
|
||||||
{ project ->
|
{ project ->
|
||||||
try {
|
try {
|
||||||
project.projectProperties.put(Archives.JAR_NAME,
|
project.projectProperties.put(Archives.JAR_NAME,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue