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: 6ebb50751c
This commit is contained in:
@@ -414,16 +414,20 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
sourceRetentionAnnotationHandler: SourceRetentionAnnotationHandler?,
|
sourceRetentionAnnotationHandler: SourceRetentionAnnotationHandler?,
|
||||||
context: CompileContext
|
context: CompileContext
|
||||||
): CompilerEnvironment {
|
): CompilerEnvironment {
|
||||||
val compilerServices = Services.Builder()
|
val compilerServices = with(Services.Builder()) {
|
||||||
.register(IncrementalCompilationComponents::class.java,
|
register(IncrementalCompilationComponents::class.java,
|
||||||
IncrementalCompilationComponentsImpl(incrementalCaches.mapKeys { TargetId(it.key) },
|
IncrementalCompilationComponentsImpl(incrementalCaches.mapKeys { TargetId(it.key) },
|
||||||
lookupTracker, sourceRetentionAnnotationHandler))
|
lookupTracker))
|
||||||
.register(CompilationCanceledStatus::class.java, object : CompilationCanceledStatus {
|
register(CompilationCanceledStatus::class.java, object : CompilationCanceledStatus {
|
||||||
override fun checkCanceled() {
|
override fun checkCanceled() {
|
||||||
if (context.cancelStatus.isCanceled) throw CompilationCanceledException()
|
if (context.cancelStatus.isCanceled) throw CompilationCanceledException()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.build()
|
sourceRetentionAnnotationHandler?.let {
|
||||||
|
register(SourceRetentionAnnotationHandler::class.java, it)
|
||||||
|
}
|
||||||
|
build()
|
||||||
|
}
|
||||||
|
|
||||||
return CompilerEnvironment.getEnvironmentFor(
|
return CompilerEnvironment.getEnvironmentFor(
|
||||||
PathUtil.getKotlinPathsForJpsPluginOrJpsTests(),
|
PathUtil.getKotlinPathsForJpsPluginOrJpsTests(),
|
||||||
|
|||||||
Reference in New Issue
Block a user