Move conditional task caching setup into the task constructors;

Add 'kotlin.caching.enabled' flag to switch the caching for all tasks;
Rename and change semantics of cache support checks: make two instead
    of one, `isBuildCacheSupported` and `isBuildCacheEnabledForKotlin`;
Remove FileOptionKind entries that are redundant at the moment;
Improvements in BuildCacheIT.kt and other refactoring  suggestions from
    the review
    https://upsource.jetbrains.com/kotlin/review/KOTLIN-CR-1647
This commit is contained in:
Sergey Igushkin
2017-12-29 18:59:34 +03:00
parent fd066ea4d5
commit 1be9e04797
16 changed files with 121 additions and 106 deletions
@@ -21,22 +21,29 @@ import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.compile.AbstractCompile
import java.io.File
open class SubpluginOption(val key: String, open val value: String)
open class SubpluginOption(val key: String, val value: String)
class FilesSubpluginOption(
key: String,
val kind: FileOptionKind,
val files: List<File>,
val kind: FilesOptionKind = FilesOptionKind.INTERNAL,
value: String = files.joinToString(File.pathSeparator) { it.canonicalPath })
: SubpluginOption(key, value)
class WrapperSubpluginOption(
class CompositeSubpluginOption(
key: String,
value: String,
val originalOptions: List<SubpluginOption>)
: SubpluginOption(key, value)
enum class FileOptionKind { INPUT_FILES, CLASSPATH_INPUT, OUTPUT_FILES, OUTPUT_DIRS, INTERNAL }
/** Defines how the files option should be handled with regard to Gradle model */
enum class FilesOptionKind {
/** The files option is an implementation detail and should not be treated as an input or an output. */
INTERNAL
// More options might be added when use cases appear for them,
// such as output directories, inputs or classpath options.
}
interface KotlinGradleSubplugin<in KotlinCompile : AbstractCompile> {
fun isApplicable(project: Project, task: AbstractCompile): Boolean