Incremental annotation processing with KAPT
Add support for incremental annotation processors in KAPT. These processors conform to https://docs.gradle.org/current/userguide/java_plugin.html#sec:incremental_annotation_processing specification. Support is provided by using javac compiler APIs and recording the source file structure. At runtime, processors are instrumented with custom Filer that is used to keep track of generated files. In order to support classpath changes, stub generation task is used to generated a list of changed FQCNs, and this is simply used by KAPT. Both worker and non-worker mode are supported. #KT-23880
This commit is contained in:
committed by
Alexey Tsvetkov
parent
600a955a51
commit
9f14daa682
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.kapt.cli
|
||||
|
||||
import org.jetbrains.kotlin.compiler.plugin.AbstractCliOption
|
||||
import org.jetbrains.kotlin.kapt.cli.CliToolOption.Format.*
|
||||
import java.io.File
|
||||
|
||||
class CliToolOption(val name: String, val format: Format) {
|
||||
enum class Format {
|
||||
@@ -69,6 +70,32 @@ enum class KaptCliOption(
|
||||
|
||||
INCREMENTAL_DATA_OUTPUT_DIR_OPTION("incrementalData", "<path>", "Output path for incremental data"),
|
||||
|
||||
CHANGED_FILES(
|
||||
"changedFile",
|
||||
"<path>",
|
||||
"Use only in apt mode. Changed java source file that should be processed when using incremental annotation processing.",
|
||||
true
|
||||
),
|
||||
|
||||
COMPILED_SOURCES_DIR(
|
||||
"compiledSourcesDir",
|
||||
"<path>",
|
||||
"Use only in apt mode. Compiled sources (.class files) from previous compilation. This is typically a kotlinc or javac output.",
|
||||
true
|
||||
),
|
||||
|
||||
INCREMENTAL_CACHE(
|
||||
"incrementalCache",
|
||||
"<path>",
|
||||
"Use only in apt mode. Output directory for cache necessary to support incremental annotation processing."
|
||||
),
|
||||
|
||||
CLASSPATH_FQ_NAMES_HISTORY(
|
||||
"classpathFqNamesHistory",
|
||||
"<path>",
|
||||
"Use only in apt mode. Directory containing history of classpath fq name changes."
|
||||
),
|
||||
|
||||
ANNOTATION_PROCESSOR_CLASSPATH_OPTION(
|
||||
"apclasspath",
|
||||
"<classpath>",
|
||||
|
||||
Reference in New Issue
Block a user