Fix incremental packages

Original commit: f9fe01047d
This commit is contained in:
Alexey Tsvetkov
2015-08-12 16:41:33 +03:00
parent 46233cb721
commit 34fe09dac1
@@ -149,6 +149,7 @@ public class IncrementalCacheImpl(
private val cacheFormatVersion = CacheFormatVersion(targetDataRoot) private val cacheFormatVersion = CacheFormatVersion(targetDataRoot)
private val dependents = arrayListOf<IncrementalCacheImpl>() private val dependents = arrayListOf<IncrementalCacheImpl>()
private val outputDir = requireNotNull(target.outputDir) { "Target is expected to have output directory: $target" }
private val inlineRegistering = object : InlineRegistering { private val inlineRegistering = object : InlineRegistering {
override fun registerInline(fromPath: String, jvmSignature: String, toPath: String) { override fun registerInline(fromPath: String, jvmSignature: String, toPath: String) {
@@ -181,7 +182,6 @@ public class IncrementalCacheImpl(
public fun getFilesToReinline(): Collection<File> { public fun getFilesToReinline(): Collection<File> {
val result = THashSet(FileUtil.PATH_HASHING_STRATEGY) val result = THashSet(FileUtil.PATH_HASHING_STRATEGY)
val outPath = target?.outputDir!!
for ((className, functions) in dirtyInlineFunctionsMap.getEntries()) { for ((className, functions) in dirtyInlineFunctionsMap.getEntries()) {
val sourceFiles = classToSourcesMap[className] val sourceFiles = classToSourcesMap[className]
@@ -199,11 +199,10 @@ public class IncrementalCacheImpl(
internalName = packageJvmName.internalName internalName = packageJvmName.internalName
} }
val classFile = File(outPath, "$internalName.class") val classFilePath = getClassFilePath(internalName)
val classFileName = classFile.normalizedPath
for (dependent in dependents) { for (dependent in dependents) {
val targetFiles = functions.flatMap { dependent.hasInlineTo[classFileName, it] } val targetFiles = functions.flatMap { dependent.hasInlineTo[classFilePath, it] }
result.addAll(targetFiles) result.addAll(targetFiles)
} }
} }
@@ -212,6 +211,10 @@ public class IncrementalCacheImpl(
return result.map { File(it) } return result.map { File(it) }
} }
override fun getClassFilePath(internalClassName: String): String {
return File(outputDir, "$internalClassName.class").canonicalPath
}
private fun getRecompilationDecision(protoChanged: Boolean, constantsChanged: Boolean) = private fun getRecompilationDecision(protoChanged: Boolean, constantsChanged: Boolean) =
when { when {
constantsChanged -> RECOMPILE_OTHER_IN_CHUNK_AND_DEPENDANTS constantsChanged -> RECOMPILE_OTHER_IN_CHUNK_AND_DEPENDANTS