From e46fe9b2554ed317268742f61bcb44d5ed3347d2 Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Mon, 20 Nov 2017 22:29:34 +0900 Subject: [PATCH] Kapt: Do not add duplicating library entries in project importing --- .../kotlin/kapt/idea/KaptProjectResolverExtension.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt b/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt index 7f326a41dc1..0ce1c432c58 100644 --- a/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt +++ b/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt @@ -86,8 +86,7 @@ class KaptProjectResolverExtension : AbstractProjectResolverExtension() { fun addSourceSet(path: String, type: ExternalSystemSourceType) { val contentRootData = ContentRootData(GRADLE_SYSTEM_ID, path) contentRootData.storePath(type, path) - val child = sourceSetDataNode.createChild(ProjectKeys.CONTENT_ROOT, contentRootData) - sourceSetDataNode.addChild(child) + sourceSetDataNode.createChild(ProjectKeys.CONTENT_ROOT, contentRootData) } 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.generatedClassesDirFile?.let { generatedClassesDir -> - val libraryData = LibraryData(GRADLE_SYSTEM_ID, "Kapt generated classes") + val libraryData = LibraryData(GRADLE_SYSTEM_ID, "") libraryData.addPath(LibraryPathType.BINARY, generatedClassesDir.absolutePath) - val libraryDependencyData = LibraryDependencyData(ideModule.data, libraryData, LibraryLevel.MODULE) - val child = sourceSetDataNode.createChild(ProjectKeys.LIBRARY_DEPENDENCY, libraryDependencyData) - sourceSetDataNode.addChild(child) + val libraryDependencyData = LibraryDependencyData(sourceSetDataNode.data, libraryData, LibraryLevel.MODULE) + sourceSetDataNode.createChild(ProjectKeys.LIBRARY_DEPENDENCY, libraryDependencyData) } } }