From 8c9bb043a28979685506491ecb089aa71e25514a Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov Date: Tue, 6 Sep 2016 15:55:03 +0300 Subject: [PATCH] Remove source annotations when copy class with kapt2 Writing source annotations enables incremental compilation for kapt2. However they are not needed in bytecode, so we remove them when copying classes. # Conflicts: # compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt # compiler/frontend.java/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java Original commit: 6ebb50751cf256f4a18e3da4958c070d8a337570 --- .../kotlin/jps/build/KotlinBuilder.kt | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt index 55f18273a40..6a57f769cb3 100644 --- a/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt +++ b/jps/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt @@ -414,16 +414,20 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { sourceRetentionAnnotationHandler: SourceRetentionAnnotationHandler?, context: CompileContext ): CompilerEnvironment { - val compilerServices = Services.Builder() - .register(IncrementalCompilationComponents::class.java, - IncrementalCompilationComponentsImpl(incrementalCaches.mapKeys { TargetId(it.key) }, - lookupTracker, sourceRetentionAnnotationHandler)) - .register(CompilationCanceledStatus::class.java, object : CompilationCanceledStatus { - override fun checkCanceled() { - if (context.cancelStatus.isCanceled) throw CompilationCanceledException() - } - }) - .build() + val compilerServices = with(Services.Builder()) { + register(IncrementalCompilationComponents::class.java, + IncrementalCompilationComponentsImpl(incrementalCaches.mapKeys { TargetId(it.key) }, + lookupTracker)) + register(CompilationCanceledStatus::class.java, object : CompilationCanceledStatus { + override fun checkCanceled() { + if (context.cancelStatus.isCanceled) throw CompilationCanceledException() + } + }) + sourceRetentionAnnotationHandler?.let { + register(SourceRetentionAnnotationHandler::class.java, it) + } + build() + } return CompilerEnvironment.getEnvironmentFor( PathUtil.getKotlinPathsForJpsPluginOrJpsTests(),