AA: use partition to group directory/jar library roots
This commit is contained in:
committed by
Ilya Kirillov
parent
a2da690afd
commit
9ba6cf47ea
+28
-32
@@ -98,39 +98,35 @@ internal fun buildKtModuleProviderByCompilerConfiguration(
|
|||||||
val moduleName = compilerConfig.get(CommonConfigurationKeys.MODULE_NAME) ?: "<no module name provided>"
|
val moduleName = compilerConfig.get(CommonConfigurationKeys.MODULE_NAME) ?: "<no module name provided>"
|
||||||
|
|
||||||
val libraryRoots = compilerConfig.jvmModularRoots + compilerConfig.jvmClasspathRoots
|
val libraryRoots = compilerConfig.jvmModularRoots + compilerConfig.jvmClasspathRoots
|
||||||
val libraryRootsByType = libraryRoots.groupBy { it.isDirectory }
|
val (directories, jars) = libraryRoots.partition { it.isDirectory }
|
||||||
libraryRootsByType[true]?.let { directories ->
|
directories.forEach {
|
||||||
directories.forEach {
|
// E.g., project/app/build/intermediates/javac/debug/classes
|
||||||
// E.g., project/app/build/intermediates/javac/debug/classes
|
val root = it.toPath()
|
||||||
val root = it.toPath()
|
addRegularDependency(
|
||||||
addRegularDependency(
|
buildKtLibraryModule {
|
||||||
buildKtLibraryModule {
|
contentScope = ProjectScope.getLibrariesScope(project)
|
||||||
contentScope = ProjectScope.getLibrariesScope(project)
|
this.platform = platform
|
||||||
this.platform = platform
|
this.project = project
|
||||||
this.project = project
|
binaryRoots = listOf(root)
|
||||||
binaryRoots = listOf(root)
|
libraryName = "$moduleName-${root.toString().replace("/", "-")}"
|
||||||
libraryName = "$moduleName-${root.toString().replace("/", "-")}"
|
}
|
||||||
}
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
libraryRootsByType[false]?.let { jars ->
|
jars.forEach {
|
||||||
jars.forEach {
|
// E.g., project/libs/libA/a.jar
|
||||||
// E.g., project/libs/libA/a.jar
|
val root = it.toPath()
|
||||||
val root = it.toPath()
|
addRegularDependency(
|
||||||
addRegularDependency(
|
buildKtLibraryModule {
|
||||||
buildKtLibraryModule {
|
contentScope = ProjectScope.getLibrariesScope(project)
|
||||||
contentScope = ProjectScope.getLibrariesScope(project)
|
this.platform = platform
|
||||||
this.platform = platform
|
this.project = project
|
||||||
this.project = project
|
binaryRoots = listOf(root)
|
||||||
binaryRoots = listOf(root)
|
libraryName = getNameWithoutExtension(root.toString())
|
||||||
libraryName = getNameWithoutExtension(root.toString())
|
isBuiltinsContainingStdlib =
|
||||||
isBuiltinsContainingStdlib =
|
libraryName.startsWith("kotlin-stdlib") &&
|
||||||
libraryName.startsWith("kotlin-stdlib") &&
|
!libraryName.contains("common") && !libraryName.contains("jdk")
|
||||||
!libraryName.contains("common") && !libraryName.contains("jdk")
|
}
|
||||||
}
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
compilerConfig.get(JVMConfigurationKeys.JDK_HOME)?.let { jdkHome ->
|
compilerConfig.get(JVMConfigurationKeys.JDK_HOME)?.let { jdkHome ->
|
||||||
val vfm = VirtualFileManager.getInstance()
|
val vfm = VirtualFileManager.getInstance()
|
||||||
|
|||||||
Reference in New Issue
Block a user