[Analysis API Standalone] deduplicate binary roots for KtBinaryModuleBuilder

^KT-60884
This commit is contained in:
Ilya Kirillov
2023-08-30 14:28:42 +02:00
committed by Space Team
parent d459981974
commit 0416e0423f
3 changed files with 5 additions and 1 deletions
@@ -9,7 +9,7 @@ import java.nio.file.Path
@KtModuleBuilderDsl
public abstract class KtBinaryModuleBuilder : KtModuleBuilder() {
protected val binaryRoots: MutableList<Path> = mutableListOf()
private val binaryRoots: MutableList<Path> = mutableListOf()
public fun addBinaryRoot(root: Path) {
binaryRoots.add(root)
@@ -18,4 +18,6 @@ public abstract class KtBinaryModuleBuilder : KtModuleBuilder() {
public fun addBinaryRoots(roots: Collection<Path>) {
binaryRoots.addAll(roots)
}
protected fun getBinaryRoots(): List<Path> = binaryRoots.distinct()
}
@@ -22,6 +22,7 @@ public class KtLibraryModuleBuilder(
public var librarySources: KtLibrarySourceModule? = null
override fun build(): KtLibraryModule {
val binaryRoots = getBinaryRoots()
val contentScope = StandaloneProjectFactory.createSearchScopeByLibraryRoots(binaryRoots, kotlinCoreProjectEnvironment)
return KtLibraryModuleImpl(
directRegularDependencies,
@@ -27,6 +27,7 @@ public class KtSdkModuleBuilder(
}
override fun build(): KtSdkModule {
val binaryRoots = getBinaryRoots()
val contentScope = StandaloneProjectFactory.createSearchScopeByLibraryRoots(binaryRoots, kotlinCoreProjectEnvironment)
return KtSdkModuleImpl(