diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/kapt/Kapt3KotlinGradleSubplugin.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/kapt/Kapt3KotlinGradleSubplugin.kt index cc96d3acaad..503c84aada8 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/kapt/Kapt3KotlinGradleSubplugin.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/kapt/Kapt3KotlinGradleSubplugin.kt @@ -700,7 +700,9 @@ class Kapt3GradleSubplugin @Inject internal constructor(private val registry: To val newCompilerArgs = oldCompilerArgs.filterTo(mutableListOf()) { it !is CharSequence || !it.toString().startsWith("-proc:") } - newCompilerArgs.add("-proc:none") + if (!kaptExtension.keepJavacAnnotationProcessors) { + newCompilerArgs.add("-proc:none") + } @Suppress("UNCHECKED_CAST") options.compilerArgs = newCompilerArgs as List diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KaptExtension.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KaptExtension.kt index 1f409de535c..b472344244d 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KaptExtension.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KaptExtension.kt @@ -46,6 +46,11 @@ open class KaptExtension { @Deprecated("Use `annotationProcessor()` and `annotationProcessors()` instead") open var processors: String = "" + /** + * If true keeps annotation processors added via `annotationProcessor(..)` configuration for javac java-files compilation + */ + open var keepJavacAnnotationProcessors: Boolean = false + /** Opt-out switch for Kapt caching. Should be used when annotation processors used by this project are suspected of * using anything aside from the task inputs in their logic and are not guaranteed to produce the same * output on subsequent runs without input changes. */ @@ -146,4 +151,4 @@ private fun Any?.executeClosure(closure: Closure<*>) { closure.resolveStrategy = Closure.DELEGATE_FIRST closure.delegate = this closure.call() -} \ No newline at end of file +} diff --git a/libraries/tools/kotlin-lombok/build.gradle.kts b/libraries/tools/kotlin-lombok/build.gradle.kts index 962c0894ee7..d98df06a5e3 100644 --- a/libraries/tools/kotlin-lombok/build.gradle.kts +++ b/libraries/tools/kotlin-lombok/build.gradle.kts @@ -1,5 +1,4 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import plugins.configureDefaultPublishing description = "Kotlin lombok compiler plugin" diff --git a/libraries/tools/kotlin-lombok/src/main/kotlin/org/jetbrains/kotlin/lombok/gradle/LombokSubplugin.kt b/libraries/tools/kotlin-lombok/src/main/kotlin/org/jetbrains/kotlin/lombok/gradle/LombokSubplugin.kt index 0c14c90fc14..8090da367f3 100644 --- a/libraries/tools/kotlin-lombok/src/main/kotlin/org/jetbrains/kotlin/lombok/gradle/LombokSubplugin.kt +++ b/libraries/tools/kotlin-lombok/src/main/kotlin/org/jetbrains/kotlin/lombok/gradle/LombokSubplugin.kt @@ -7,19 +7,15 @@ package org.jetbrains.kotlin.lombok.gradle import org.gradle.api.Project import org.gradle.api.provider.Provider -import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry import org.jetbrains.kotlin.gradle.plugin.* -import javax.inject.Inject -class LombokSubplugin @Inject internal constructor(private val registry: ToolingModelBuilderRegistry) : - KotlinCompilerPluginSupportPlugin { +class LombokSubplugin : KotlinCompilerPluginSupportPlugin { override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean = (kotlinCompilation.platformType == KotlinPlatformType.jvm || kotlinCompilation.platformType == KotlinPlatformType.androidJvm) override fun apply(target: Project) { target.extensions.create("kotlinLombok", LombokExtension::class.java) -// registry.register(AllOpenModelBuilder()) } override fun applyToCompilation(kotlinCompilation: KotlinCompilation<*>): Provider> { @@ -32,9 +28,6 @@ class LombokSubplugin @Inject internal constructor(private val registry: Tooling extension.configurationFile?.let { configFile -> options += SubpluginOption("config", configFile.absolutePath) } - - - options } } diff --git a/plugins/lombok/lombok-compiler-plugin/README.md b/plugins/lombok/lombok-compiler-plugin/README.md index b19500d9bcb..64821ae3ea9 100644 --- a/plugins/lombok/lombok-compiler-plugin/README.md +++ b/plugins/lombok/lombok-compiler-plugin/README.md @@ -13,7 +13,7 @@ Features support: - [x] Basic support - [x] Class-level - [x] @Accessors config support: chain and fluent - - [ ] Config support (_lombok.getter.noIsPrefix_ only supported) + - [ ] Config support (_lombok.getter.noIsPrefix_ only supported atm) - [ ] Copy annotations - [ ] Strip defined prefixes - in config and @Accessors - [ ] Skip generation with AccessLevel.NONE @@ -40,7 +40,7 @@ Other todos: - [x] Generic classes - [x] Actually run compiled code - [x] Don't generate members that already exist (if having a duplicate is a problem) - - [ ] Gradle integration (as subplugin or just a way to enable lombok support) + - [x] Gradle integration (as subplugin or just a way to enable lombok support) - [ ] Maven integration (as subplugin or just a way to enable lombok support) - [ ] Nullability from annotations. Check if it is inherited from variable definition