Fixed duplicated kapt options caused by multiple call to args setup
Separated kapt args from other plugin options. Issues: #KT-16965 Fixed Fix indentation
This commit is contained in:
+9
-6
@@ -196,9 +196,11 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
|
|||||||
super.setupCompilerArgs(args, defaultsOnly)
|
super.setupCompilerArgs(args, defaultsOnly)
|
||||||
args.apply { fillDefaultValues() }
|
args.apply { fillDefaultValues() }
|
||||||
|
|
||||||
handleKaptProperties()
|
|
||||||
args.pluginClasspaths = pluginOptions.classpath.toTypedArray()
|
args.pluginClasspaths = pluginOptions.classpath.toTypedArray()
|
||||||
args.pluginOptions = pluginOptions.arguments.toTypedArray()
|
|
||||||
|
val kaptPluginOptions = getKaptPluginOptions()
|
||||||
|
args.pluginOptions = (pluginOptions.arguments + kaptPluginOptions.arguments).toTypedArray()
|
||||||
|
|
||||||
args.moduleName = moduleName
|
args.moduleName = moduleName
|
||||||
args.addCompilerBuiltIns = true
|
args.addCompilerBuiltIns = true
|
||||||
|
|
||||||
@@ -284,21 +286,22 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
|
|||||||
throwGradleExceptionIfError(exitCode)
|
throwGradleExceptionIfError(exitCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleKaptProperties() {
|
private fun getKaptPluginOptions() =
|
||||||
|
CompilerPluginOptions().apply {
|
||||||
kaptOptions.annotationsFile?.let { kaptAnnotationsFile ->
|
kaptOptions.annotationsFile?.let { kaptAnnotationsFile ->
|
||||||
if (incremental) {
|
if (incremental) {
|
||||||
kaptAnnotationsFileUpdater = AnnotationFileUpdaterImpl(kaptAnnotationsFile)
|
kaptAnnotationsFileUpdater = AnnotationFileUpdaterImpl(kaptAnnotationsFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginOptions.addPluginArgument(ANNOTATIONS_PLUGIN_NAME, "output", kaptAnnotationsFile.canonicalPath)
|
addPluginArgument(ANNOTATIONS_PLUGIN_NAME, "output", kaptAnnotationsFile.canonicalPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kaptOptions.generateStubs) {
|
if (kaptOptions.generateStubs) {
|
||||||
pluginOptions.addPluginArgument(ANNOTATIONS_PLUGIN_NAME, "stubs", destinationDir.canonicalPath)
|
addPluginArgument(ANNOTATIONS_PLUGIN_NAME, "stubs", destinationDir.canonicalPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kaptOptions.supportInheritedAnnotations) {
|
if (kaptOptions.supportInheritedAnnotations) {
|
||||||
pluginOptions.addPluginArgument(ANNOTATIONS_PLUGIN_NAME, "inherited", true.toString())
|
addPluginArgument(ANNOTATIONS_PLUGIN_NAME, "inherited", true.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user