Subplugin options refactoring & Gradle input improvements

Introduce FilesSubpluginOption Special kind of SubpluginOption that
holds a list of files together with the kind of these files with respect
to the task.

Add a logic for handling such options and converting them into
task inputs.

Refactor CompilerPluginOptions: make it store subplugin options to be
able to add options from KotlinCompile to the kapt tasks.

Introduce WrapperSubpluginOption for encoded and complex options.

Remove pluginOptions from the Gradle inputs built from the
compiler args.

Do not cache Kotlin compilation with kapt1 enabled: since we are going
to drop kapt1 it anyway, there's no point in implementing
proper cache for it, so just disable the caching of the task in case
kapt1 is used.
This commit is contained in:
Sergey Igushkin
2017-12-05 20:38:04 +03:00
parent 93097014a0
commit c852d0b6cb
8 changed files with 509 additions and 420 deletions
@@ -19,8 +19,24 @@ package org.jetbrains.kotlin.gradle.plugin
import org.gradle.api.Project
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.compile.AbstractCompile
import java.io.File
class SubpluginOption(val key: String, val value: String)
open class SubpluginOption(val key: String, open val value: String)
class FilesSubpluginOption(
key: String,
val kind: FileOptionKind,
val files: List<File>,
value: String = files.joinToString(File.pathSeparator) { it.canonicalPath })
: SubpluginOption(key, value)
class WrapperSubpluginOption(
key: String,
value: String,
val originalOptions: List<SubpluginOption>)
: SubpluginOption(key, value)
enum class FileOptionKind { INPUT_FILES, CLASSPATH_INPUT, OUTPUT_FILES, OUTPUT_DIRS, INTERNAL }
interface KotlinGradleSubplugin<in KotlinCompile : AbstractCompile> {
fun isApplicable(project: Project, task: AbstractCompile): Boolean