Skip to content

Commit

Permalink
IncrementalGlobalSearchScope: include source roots
Browse files Browse the repository at this point in the history
in addition to source files in them. This helps AA in computing package
scopes.
  • Loading branch information
ting-yuan committed Aug 26, 2024
1 parent 1490e06 commit 57f54c8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class KspModuleBuilder(
return buildSet {
for (root in sourceRoots) {
val files = when {
root.isDirectory() -> collectSourceFilePaths(root)
root.isDirectory() -> listOf(root) + collectSourceFilePaths(root)
root.hasSuitableExtensionToAnalyse() -> listOf(root)
else -> emptyList()
}
Expand Down
12 changes: 12 additions & 0 deletions kotlin-analysis-api/testData/getPackage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
// main.test.L JAVA
// main.test.C JAVA
// symbols from package non.exist
// symbols from package test
// test.TestJava JAVA
// symbols from package testlib
// testlib.TestJavaLib JAVA_LIB
// END

// MODULE: lib1
Expand Down Expand Up @@ -64,6 +68,10 @@ val a = 0

class Bar {}

// FILE: testlib/Test.java
package testlib;
class TestJavaLib {}

// MODULE: main(lib1, lib2)
// FILE: a.kt
package lib1
Expand Down Expand Up @@ -102,3 +110,7 @@ package main.test;
public class L {

}

// FILE: test/Test.java
package test;
class TestJava {}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class GetPackageProcessor : AbstractTestProcessor() {
addPackage("lib2", resolver)
addPackage("main.test", resolver)
addPackage("non.exist", resolver)
addPackage("test", resolver)
addPackage("testlib", resolver)
return emptyList()
}

Expand Down
12 changes: 12 additions & 0 deletions test-utils/testData/api/getPackage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
// main.test.C JAVA
// main.test.D JAVA
// symbols from package non.exist
// symbols from package test
// test.TestJava JAVA
// symbols from package testlib
// testlib.TestJavaLib JAVA_LIB
// END

// MODULE: lib1
Expand Down Expand Up @@ -63,6 +67,10 @@ val a = 0

class Bar {}

// FILE: testlib/Test.java
package testlib;
class TestJavaLib {}

// MODULE: main(lib1, lib2)
// FILE: a.kt
package lib1
Expand Down Expand Up @@ -101,3 +109,7 @@ package main.test;
public class L {

}

// FILE: test/Test.java
package test;
class TestJava {}

0 comments on commit 57f54c8

Please sign in to comment.