From 06903f803bb9ef9c2f8f625e428e8dcedf4cd3f9 Mon Sep 17 00:00:00 2001 From: Sergey Igushkin Date: Tue, 2 Jan 2018 14:14:53 +0300 Subject: [PATCH] (minor) Separate the Gradle annotations from `CompilerArgumentAware` --- .../gradle/internal/CompilerArgumentAware.kt | 19 +++++++++++++++---- .../kotlin/gradle/internal/KaptTask.kt | 2 +- .../jetbrains/kotlin/gradle/tasks/Tasks.kt | 4 ++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/CompilerArgumentAware.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/CompilerArgumentAware.kt index d998349c3d8..2c269214df2 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/CompilerArgumentAware.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/CompilerArgumentAware.kt @@ -22,17 +22,14 @@ import org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments import org.jetbrains.kotlin.compilerRunner.ArgumentUtils interface CompilerArgumentAware { - @get:Internal val serializedCompilerArguments: List get() = ArgumentUtils.convertArgumentsToStringList(prepareCompilerArguments()) - @get:Internal val defaultSerializedCompilerArguments: List get() = createCompilerArgs() .also { setupCompilerArgs(it, defaultsOnly = true) } .let(ArgumentUtils::convertArgumentsToStringList) - @get:Input val filteredArgumentsMap: Map get() = CompilerArgumentsGradleInput.createInputsMap(prepareCompilerArguments()) @@ -41,4 +38,18 @@ interface CompilerArgumentAware { } internal fun CompilerArgumentAware.prepareCompilerArguments() = - createCompilerArgs().also { setupCompilerArgs(it) } \ No newline at end of file + createCompilerArgs().also { setupCompilerArgs(it) } + +interface CompilerArgumentAwareWithInput : CompilerArgumentAware { + @get:Internal + override val serializedCompilerArguments: List + get() = super.serializedCompilerArguments + + @get:Internal + override val defaultSerializedCompilerArguments: List + get() = super.defaultSerializedCompilerArguments + + @get:Input + override val filteredArgumentsMap: Map + get() = super.filteredArgumentsMap +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/KaptTask.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/KaptTask.kt index 7bd2e6c4994..cff75932ddb 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/KaptTask.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/internal/KaptTask.kt @@ -14,7 +14,7 @@ import org.jetbrains.kotlin.gradle.tasks.* import java.io.File @CacheableTask -open class KaptTask : ConventionTask(), CompilerArgumentAware { +open class KaptTask : ConventionTask(), CompilerArgumentAwareWithInput { init { cacheOnlyIfEnabledForKotlin() diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt index 1a40b593a0c..60a2ecac5ec 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/tasks/Tasks.kt @@ -36,7 +36,7 @@ import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.compilerRunner.* import org.jetbrains.kotlin.gradle.dsl.* -import org.jetbrains.kotlin.gradle.internal.CompilerArgumentAware +import org.jetbrains.kotlin.gradle.internal.CompilerArgumentAwareWithInput import org.jetbrains.kotlin.gradle.internal.prepareCompilerArguments import org.jetbrains.kotlin.gradle.plugin.* import org.jetbrains.kotlin.gradle.utils.ParsedGradleVersion @@ -54,7 +54,7 @@ const val KOTLIN_BUILD_DIR_NAME = "kotlin" const val USING_INCREMENTAL_COMPILATION_MESSAGE = "Using Kotlin incremental compilation" const val USING_EXPERIMENTAL_JS_INCREMENTAL_COMPILATION_MESSAGE = "Using experimental Kotlin/JS incremental compilation" -abstract class AbstractKotlinCompileTool() : AbstractCompile(), CompilerArgumentAware { +abstract class AbstractKotlinCompileTool() : AbstractCompile(), CompilerArgumentAwareWithInput { // TODO: deprecate and remove @get:Internal var compilerJarFile: File? = null