Fixed incremental compilation, when removing all callables from file.
This commit is contained in:
+11
-6
@@ -94,13 +94,18 @@ public class PackagePartClassUtils {
|
||||
return ContainerUtil.filter(packageFiles, new Condition<JetFile>() {
|
||||
@Override
|
||||
public boolean value(JetFile packageFile) {
|
||||
for (JetDeclaration declaration : packageFile.getDeclarations()) {
|
||||
if (declaration instanceof JetProperty || declaration instanceof JetNamedFunction) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return fileHasCallables(packageFile);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean fileHasCallables(@NotNull JetFile file) {
|
||||
for (JetDeclaration declaration : file.getDeclarations()) {
|
||||
if (declaration instanceof JetProperty || declaration instanceof JetNamedFunction) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+7
-2
@@ -22,15 +22,20 @@ import org.jetbrains.jet.lang.resolve.name.FqName
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName
|
||||
import java.util.HashMap
|
||||
import java.io.File
|
||||
import org.jetbrains.jet.lang.resolve.kotlin.PackagePartClassUtils
|
||||
|
||||
public fun IncrementalCache.getPackagesWithRemovedFiles(sourceFilesToCompile: Collection<JetFile>): Collection<FqName> {
|
||||
return getRemovedPackageParts(sourceFilesToCompile).map { it.getPackageFqName() }
|
||||
}
|
||||
|
||||
public fun IncrementalCache.getRemovedPackageParts(sourceFilesToCompile: Collection<JetFile>): Collection<JvmClassName> {
|
||||
val sourceFilesToFqName = HashMap<File, String>()
|
||||
val sourceFilesToFqName = HashMap<File, String?>()
|
||||
for (sourceFile in sourceFilesToCompile) {
|
||||
sourceFilesToFqName[File(sourceFile.getVirtualFile()!!.getPath())] = sourceFile.getPackageFqName().asString()
|
||||
sourceFilesToFqName[File(sourceFile.getVirtualFile()!!.getPath())] =
|
||||
if (PackagePartClassUtils.fileHasCallables(sourceFile))
|
||||
sourceFile.getPackageFqName().asString()
|
||||
else
|
||||
null
|
||||
}
|
||||
|
||||
return getRemovedPackageParts(sourceFilesToFqName).map { JvmClassName.byInternalName(it) }
|
||||
|
||||
+4
-1
@@ -23,7 +23,10 @@ import java.util.HashMap
|
||||
import java.io.File
|
||||
|
||||
public trait IncrementalCache {
|
||||
public fun getRemovedPackageParts(sourceFilesToCompileAndFqNames: Map<File, String>): Collection<String>
|
||||
public fun getRemovedPackageParts(
|
||||
// null value means source file has no top-level callables (won't produce package part)
|
||||
sourceFilesToCompileAndFqNames: Map<File, String?>
|
||||
): Collection<String>
|
||||
|
||||
public fun getPackageData(fqName: String): ByteArray?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user