Locate build history when file is outside of root project dir

Support use-cases when the build dir is outside of root project dir.
Many projects set up output dir as <root_project>/../out/<project_name>/build
to be able to clean build dir more easily. This commit adds support
to build history file detection and it tries to find build history
files for artifacts that are:
- under root project dir (a default structure)
- under root project's build dir parent (to support typical custom setup)

Fixes https://youtrack.jetbrains.com/issue/KT-40875

Test: BaseIncrementalCompilationMultiProjectIT
This commit is contained in:
Ivan Gavrilovic
2021-02-01 15:40:29 +00:00
committed by nataliya.valtman
parent 5de34b052f
commit 2fce6a4af9
6 changed files with 48 additions and 7 deletions
@@ -32,7 +32,7 @@ abstract class AbstractIncrementalMultiModuleCompilerRunnerTest<Args : CommonCom
private val jarToModule = mutableMapOf<File, IncrementalModuleEntry>()
protected val incrementalModuleInfo: IncrementalModuleInfo by lazy {
IncrementalModuleInfo(workingDir, dirToModule, nameToModules, jarToClassListFile, jarToModule)
IncrementalModuleInfo(workingDir, workingDir, dirToModule, nameToModules, jarToClassListFile, jarToModule)
}
protected abstract val modulesApiHistory: ApiHistory
@@ -56,6 +56,7 @@ class ModulesApiHistoryAndroidTest {
val info = IncrementalModuleInfo(
projectRoot = projectRoot,
rootProjectBuildDir = projectRoot.resolve("build"),
dirToModule = mapOf(appKotlinDestination to appEntry, libKotlinDestination to libEntry),
nameToModules = mapOf("app" to setOf(appEntry), "lib" to setOf(libEntry)),
jarToClassListFile = mapOf(),