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:
+21
-18
@@ -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,24 +286,25 @@ open class KotlinCompile : AbstractKotlinCompile<K2JVMCompilerArguments>(), Kotl
|
|||||||
throwGradleExceptionIfError(exitCode)
|
throwGradleExceptionIfError(exitCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleKaptProperties() {
|
private fun getKaptPluginOptions() =
|
||||||
kaptOptions.annotationsFile?.let { kaptAnnotationsFile ->
|
CompilerPluginOptions().apply {
|
||||||
if (incremental) {
|
kaptOptions.annotationsFile?.let { kaptAnnotationsFile ->
|
||||||
kaptAnnotationsFileUpdater = AnnotationFileUpdaterImpl(kaptAnnotationsFile)
|
if (incremental) {
|
||||||
|
kaptAnnotationsFileUpdater = AnnotationFileUpdaterImpl(kaptAnnotationsFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
addPluginArgument(ANNOTATIONS_PLUGIN_NAME, "output", kaptAnnotationsFile.canonicalPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kaptOptions.generateStubs) {
|
||||||
|
addPluginArgument(ANNOTATIONS_PLUGIN_NAME, "stubs", destinationDir.canonicalPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kaptOptions.supportInheritedAnnotations) {
|
||||||
|
addPluginArgument(ANNOTATIONS_PLUGIN_NAME, "inherited", true.toString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginOptions.addPluginArgument(ANNOTATIONS_PLUGIN_NAME, "output", kaptAnnotationsFile.canonicalPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (kaptOptions.generateStubs) {
|
|
||||||
pluginOptions.addPluginArgument(ANNOTATIONS_PLUGIN_NAME, "stubs", destinationDir.canonicalPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (kaptOptions.supportInheritedAnnotations) {
|
|
||||||
pluginOptions.addPluginArgument(ANNOTATIONS_PLUGIN_NAME, "inherited", true.toString())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// override setSource to track source directory sets and files (for generated android folders)
|
// override setSource to track source directory sets and files (for generated android folders)
|
||||||
override fun setSource(sources: Any?) {
|
override fun setSource(sources: Any?) {
|
||||||
sourceRootsContainer.set(sources)
|
sourceRootsContainer.set(sources)
|
||||||
|
|||||||
Reference in New Issue
Block a user