KT-45777: Keep only package facades whose members are looked up

to reduce the size of the shrunk classpath snapshot further.
This commit is contained in:
Hung Nguyen
2021-12-20 09:37:23 +00:00
committed by nataliya.valtman
parent a6b5339980
commit 78f10d9142
10 changed files with 193 additions and 89 deletions
@@ -118,7 +118,6 @@ class KotlinOnlyClasspathChangesComputerTest : ClasspathChangesComputerTest() {
LookupSymbol(name = "addedTopLevelFunction", scope = "com.example"),
LookupSymbol(name = "removedTopLevelFunction", scope = "com.example"),
LookupSymbol(name = "movedTopLevelFunction", scope = "com.example"),
LookupSymbol(name = SAM_LOOKUP_NAME.asString(), scope = "com.example")
),
fqNames = setOf("com.example")
).assertEquals(changes)
@@ -154,7 +153,6 @@ class KotlinOnlyClasspathChangesComputerTest : ClasspathChangesComputerTest() {
LookupSymbol(name = SAM_LOOKUP_NAME.asString(), scope = "com.example.NormalClass"),
LookupSymbol(name = SAM_LOOKUP_NAME.asString(), scope = "com.example.NormalClass.CompanionObject"),
LookupSymbol(name = SAM_LOOKUP_NAME.asString(), scope = "com.example.NormalClass.NestedClass"),
LookupSymbol(name = SAM_LOOKUP_NAME.asString(), scope = "com.example"),
),
fqNames = setOf(
"com.example.NormalClass",
@@ -267,6 +265,9 @@ class JavaOnlyClasspathChangesComputerTest(private val protoBased: Boolean) : Cl
class KotlinAndJavaClasspathChangesComputerTest : ClasspathSnapshotTestCommon() {
// TODO Add more test cases:
// - Java class converted to Kotlin class
@Test
fun testImpactAnalysis() {
val changes =
@@ -25,8 +25,10 @@ abstract class ClasspathSnapshotterTest : ClasspathSnapshotTestCommon() {
protected abstract val sourceFileWithNonAbiChange: TestSourceFile
private val expectedSnapshotFile: File
get() = sourceFile.asFile().path.let {
File(it.substringBeforeLast("src") + "expected-snapshot" + it.substringAfterLast("src").substringBeforeLast('.') + ".json")
get() = sourceFile.asFile().let {
val srcDir = File(it.path.substringBeforeLast("src") + "src")
val relativePath = it.relativeTo(srcDir)
testDataDir.resolve("expected-snapshot").resolve(relativePath.parent).resolve(relativePath.nameWithoutExtension + ".json")
}
@Test