Make pluginOptions.classpath a separate input in the Gradle tasks
(cherry picked from commit b03e758)
This commit is contained in:
+4
-1
@@ -44,6 +44,9 @@ open class KaptGenerateStubsTask : KotlinCompile() {
|
|||||||
@get:Classpath @get:InputFiles
|
@get:Classpath @get:InputFiles
|
||||||
lateinit var kaptClasspath: List<File>
|
lateinit var kaptClasspath: List<File>
|
||||||
|
|
||||||
|
@get:Classpath @get:InputFiles @Suppress("unused")
|
||||||
|
internal val kotlinTaskPluginClasspath get() = kotlinCompileTask.pluginClasspath
|
||||||
|
|
||||||
override fun source(vararg sources: Any?): SourceTask? {
|
override fun source(vararg sources: Any?): SourceTask? {
|
||||||
return super.source(sourceRootsContainer.add(sources))
|
return super.source(sourceRootsContainer.add(sources))
|
||||||
}
|
}
|
||||||
@@ -61,7 +64,7 @@ open class KaptGenerateStubsTask : KotlinCompile() {
|
|||||||
|
|
||||||
override fun setupCompilerArgs(args: K2JVMCompilerArguments, defaultsOnly: Boolean) {
|
override fun setupCompilerArgs(args: K2JVMCompilerArguments, defaultsOnly: Boolean) {
|
||||||
kotlinCompileTask.setupCompilerArgs(args)
|
kotlinCompileTask.setupCompilerArgs(args)
|
||||||
args.pluginClasspaths = (pluginOptions.classpath + args.pluginClasspaths!!).toSet().toTypedArray()
|
args.pluginClasspaths = (pluginClasspath + args.pluginClasspaths!!).toSet().toTypedArray()
|
||||||
args.pluginOptions = (pluginOptions.arguments + args.pluginOptions!!).toTypedArray()
|
args.pluginOptions = (pluginOptions.arguments + args.pluginOptions!!).toTypedArray()
|
||||||
args.verbose = project.hasProperty("kapt.verbose") && project.property("kapt.verbose").toString().toBoolean() == true
|
args.verbose = project.hasProperty("kapt.verbose") && project.property("kapt.verbose").toString().toBoolean() == true
|
||||||
args.classpathAsList = this.compileClasspath.toList()
|
args.classpathAsList = this.compileClasspath.toList()
|
||||||
|
|||||||
+7
-1
@@ -43,7 +43,7 @@ open class KaptTask : ConventionTask(), CompilerArgumentAware<K2JVMCompilerArgum
|
|||||||
override fun setupCompilerArgs(args: K2JVMCompilerArguments, defaultsOnly: Boolean) {
|
override fun setupCompilerArgs(args: K2JVMCompilerArguments, defaultsOnly: Boolean) {
|
||||||
kotlinCompileTask.setupCompilerArgs(args)
|
kotlinCompileTask.setupCompilerArgs(args)
|
||||||
|
|
||||||
args.pluginClasspaths = (pluginOptions.classpath + args.pluginClasspaths!!).toSet().toTypedArray()
|
args.pluginClasspaths = (pluginClasspath + args.pluginClasspaths!!).toSet().toTypedArray()
|
||||||
args.pluginOptions = (pluginOptions.arguments + args.pluginOptions!!).toTypedArray()
|
args.pluginOptions = (pluginOptions.arguments + args.pluginOptions!!).toTypedArray()
|
||||||
args.verbose = project.hasProperty("kapt.verbose") && project.property("kapt.verbose").toString().toBoolean() == true
|
args.verbose = project.hasProperty("kapt.verbose") && project.property("kapt.verbose").toString().toBoolean() == true
|
||||||
}
|
}
|
||||||
@@ -52,6 +52,12 @@ open class KaptTask : ConventionTask(), CompilerArgumentAware<K2JVMCompilerArgum
|
|||||||
val classpath: FileCollection
|
val classpath: FileCollection
|
||||||
get() = kotlinCompileTask.classpath
|
get() = kotlinCompileTask.classpath
|
||||||
|
|
||||||
|
@get:Classpath @get:InputFiles @Suppress("unused")
|
||||||
|
internal val kotlinTaskPluginClasspaths get() = kotlinCompileTask.pluginClasspath
|
||||||
|
|
||||||
|
@get:Classpath @get:InputFiles
|
||||||
|
internal val pluginClasspath get() = pluginOptions.classpath
|
||||||
|
|
||||||
val source: FileCollection
|
val source: FileCollection
|
||||||
@InputFiles get() {
|
@InputFiles get() {
|
||||||
val sourcesFromKotlinTask = kotlinCompileTask.source
|
val sourcesFromKotlinTask = kotlinCompileTask.source
|
||||||
|
|||||||
+5
-3
@@ -37,7 +37,6 @@ import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
|||||||
import org.jetbrains.kotlin.compilerRunner.*
|
import org.jetbrains.kotlin.compilerRunner.*
|
||||||
import org.jetbrains.kotlin.gradle.dsl.*
|
import org.jetbrains.kotlin.gradle.dsl.*
|
||||||
import org.jetbrains.kotlin.gradle.internal.CompilerArgumentAware
|
import org.jetbrains.kotlin.gradle.internal.CompilerArgumentAware
|
||||||
import org.jetbrains.kotlin.gradle.internal.CompilerArgumentAware
|
|
||||||
import org.jetbrains.kotlin.gradle.internal.prepareCompilerArguments
|
import org.jetbrains.kotlin.gradle.internal.prepareCompilerArguments
|
||||||
import org.jetbrains.kotlin.gradle.plugin.kotlinDebug
|
import org.jetbrains.kotlin.gradle.plugin.kotlinDebug
|
||||||
import org.jetbrains.kotlin.gradle.plugin.kotlinInfo
|
import org.jetbrains.kotlin.gradle.plugin.kotlinInfo
|
||||||
@@ -104,6 +103,9 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
|
|||||||
get() = (classpath + additionalClasspath)
|
get() = (classpath + additionalClasspath)
|
||||||
.filterTo(LinkedHashSet(), File::exists)
|
.filterTo(LinkedHashSet(), File::exists)
|
||||||
|
|
||||||
|
@get:Classpath @get:InputFiles
|
||||||
|
internal val pluginClasspath get() = pluginOptions.classpath
|
||||||
|
|
||||||
private val kotlinExt: KotlinProjectExtension
|
private val kotlinExt: KotlinProjectExtension
|
||||||
get() = project.extensions.findByType(KotlinProjectExtension::class.java)!!
|
get() = project.extensions.findByType(KotlinProjectExtension::class.java)!!
|
||||||
|
|
||||||
@@ -228,7 +230,7 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
|
|||||||
}
|
}
|
||||||
|
|
||||||
open fun setupPlugins(compilerArgs: T) {
|
open fun setupPlugins(compilerArgs: T) {
|
||||||
compilerArgs.pluginClasspaths = pluginOptions.classpath.toTypedArray()
|
compilerArgs.pluginClasspaths = pluginClasspath.toTypedArray()
|
||||||
compilerArgs.pluginOptions = pluginOptions.arguments.toTypedArray()
|
compilerArgs.pluginOptions = pluginOptions.arguments.toTypedArray()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -285,7 +287,7 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
|
|||||||
K2JVMCompilerArguments()
|
K2JVMCompilerArguments()
|
||||||
|
|
||||||
override fun setupPlugins(compilerArgs: K2JVMCompilerArguments) {
|
override fun setupPlugins(compilerArgs: K2JVMCompilerArguments) {
|
||||||
compilerArgs.pluginClasspaths = pluginOptions.classpath.toTypedArray()
|
compilerArgs.pluginClasspaths = pluginClasspath.toTypedArray()
|
||||||
|
|
||||||
val kaptPluginOptions = getKaptPluginOptions()
|
val kaptPluginOptions = getKaptPluginOptions()
|
||||||
compilerArgs.pluginOptions = (pluginOptions.arguments + kaptPluginOptions.arguments).toTypedArray()
|
compilerArgs.pluginOptions = (pluginOptions.arguments + kaptPluginOptions.arguments).toTypedArray()
|
||||||
|
|||||||
Reference in New Issue
Block a user