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

Fix for #104: if depended-on project changes dependent project's jar should be updated.

This commit is contained in:
Cedric Beust 2016-01-30 00:43:59 +04:00
parent 66c4f9a1e0
commit c90fbb6a41
2 changed files with 18 additions and 3 deletions

View file

@ -82,7 +82,8 @@ class IncrementalManager(val fileName: String = IncrementalManager.BUILD_INFO_FI
var upToDate = false
var taskOutputChecksum : String? = null
inputChecksumFor(taskName)?.let { inputChecksum ->
if (inputChecksum == iit.inputChecksum) {
val dependsOnDirtyProjects = project.projectInfo.dependsOnDirtyProjects(project)
if (inputChecksum == iit.inputChecksum && ! dependsOnDirtyProjects) {
outputChecksumFor(taskName)?.let { outputChecksum ->
taskOutputChecksum = iit.outputChecksum()
if (outputChecksum == taskOutputChecksum) {
@ -92,8 +93,13 @@ class IncrementalManager(val fileName: String = IncrementalManager.BUILD_INFO_FI
}
}
} else {
logIncremental(2, "Incremental task $taskName input is out of date, running it"
+ " old: $inputChecksum new: ${iit.inputChecksum}")
if (dependsOnDirtyProjects) {
logIncremental(2, "Project ${project.name} depends on dirty project, running $taskName")
} else {
logIncremental(2, "Incremental task $taskName input is out of date, running it"
+ " old: $inputChecksum new: ${iit.inputChecksum}")
}
project.projectInfo.isDirty = true
}
}
if (! upToDate) {

View file

@ -28,6 +28,13 @@ interface IProjectInfo {
* The list of projects that this project depends on
*/
val dependsOn: ArrayList<Project>
var isDirty: Boolean
/**
* @return true if any of the projects we depend on is dirty.
*/
fun dependsOnDirtyProjects(project: Project) = project.projectInfo.dependsOn.any { it.projectInfo.isDirty }
}
abstract class BaseProjectInfo : IProjectInfo {
@ -43,4 +50,6 @@ abstract class BaseProjectInfo : IProjectInfo {
}
override val dependsOn = arrayListOf<Project>()
override var isDirty = false
}