Kapt: Do not add duplicating library entries in project importing
This commit is contained in:
+4
-6
@@ -86,8 +86,7 @@ class KaptProjectResolverExtension : AbstractProjectResolverExtension() {
|
|||||||
fun addSourceSet(path: String, type: ExternalSystemSourceType) {
|
fun addSourceSet(path: String, type: ExternalSystemSourceType) {
|
||||||
val contentRootData = ContentRootData(GRADLE_SYSTEM_ID, path)
|
val contentRootData = ContentRootData(GRADLE_SYSTEM_ID, path)
|
||||||
contentRootData.storePath(type, path)
|
contentRootData.storePath(type, path)
|
||||||
val child = sourceSetDataNode.createChild(ProjectKeys.CONTENT_ROOT, contentRootData)
|
sourceSetDataNode.createChild(ProjectKeys.CONTENT_ROOT, contentRootData)
|
||||||
sourceSetDataNode.addChild(child)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val sourceType = if (sourceSet.isTest) ExternalSystemSourceType.TEST_GENERATED else ExternalSystemSourceType.SOURCE_GENERATED
|
val sourceType = if (sourceSet.isTest) ExternalSystemSourceType.TEST_GENERATED else ExternalSystemSourceType.SOURCE_GENERATED
|
||||||
@@ -95,11 +94,10 @@ class KaptProjectResolverExtension : AbstractProjectResolverExtension() {
|
|||||||
sourceSet.generatedKotlinSourcesDirFile?.let { addSourceSet(it.absolutePath, sourceType) }
|
sourceSet.generatedKotlinSourcesDirFile?.let { addSourceSet(it.absolutePath, sourceType) }
|
||||||
|
|
||||||
sourceSet.generatedClassesDirFile?.let { generatedClassesDir ->
|
sourceSet.generatedClassesDirFile?.let { generatedClassesDir ->
|
||||||
val libraryData = LibraryData(GRADLE_SYSTEM_ID, "Kapt generated classes")
|
val libraryData = LibraryData(GRADLE_SYSTEM_ID, "")
|
||||||
libraryData.addPath(LibraryPathType.BINARY, generatedClassesDir.absolutePath)
|
libraryData.addPath(LibraryPathType.BINARY, generatedClassesDir.absolutePath)
|
||||||
val libraryDependencyData = LibraryDependencyData(ideModule.data, libraryData, LibraryLevel.MODULE)
|
val libraryDependencyData = LibraryDependencyData(sourceSetDataNode.data, libraryData, LibraryLevel.MODULE)
|
||||||
val child = sourceSetDataNode.createChild(ProjectKeys.LIBRARY_DEPENDENCY, libraryDependencyData)
|
sourceSetDataNode.createChild(ProjectKeys.LIBRARY_DEPENDENCY, libraryDependencyData)
|
||||||
sourceSetDataNode.addChild(child)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user