Changed to prepending annotation processor path instead of appending it

to classpath and existing annotation processors.
This commit is contained in:
Sergey Igushkin
2017-04-13 17:47:40 +03:00
parent 91f7f19902
commit 2360d5f330
@@ -157,7 +157,7 @@ class AnnotationProcessingManager(
return kotlinGeneratedDir return kotlinGeneratedDir
} }
val kaptProcessorPath get() = javaTask.classpath + setOf(wrappersDirectory) + aptFiles val kaptProcessorPath get() = setOf(wrappersDirectory) + aptFiles + javaTask.classpath
fun setupKapt() { fun setupKapt() {
originalJavaCompilerArgs = javaTask.options.compilerArgs originalJavaCompilerArgs = javaTask.options.compilerArgs
@@ -281,7 +281,7 @@ class AnnotationProcessingManager(
javaTask.addCompilerArgument("-processorpath") { prevValue -> javaTask.addCompilerArgument("-processorpath") { prevValue ->
if (prevValue != null) if (prevValue != null)
javaTask.logger.warn("Processor path was modified by kapt. Previous value = $prevValue") javaTask.logger.warn("Processor path was modified by kapt. Previous value = $prevValue")
path.joinToString(prefix = prevValue?.let { it + File.pathSeparator }.orEmpty(), path.joinToString(postfix = prevValue?.let { File.pathSeparator + it }.orEmpty(),
separator = File.pathSeparator) separator = File.pathSeparator)
} }
} }
@@ -297,7 +297,7 @@ class AnnotationProcessingManager(
if (originalProcessorPath != null) if (originalProcessorPath != null)
javaTask.logger.warn("Processor path was modified by kapt. Previous value = $originalProcessorPath") javaTask.logger.warn("Processor path was modified by kapt. Previous value = $originalProcessorPath")
val newPath = javaTask.project.files(path + (originalProcessorPath ?: emptyList<File>())) val newPath = javaTask.project.files(path + (originalProcessorPath ?: emptyList()))
setPath(javaTask.options, newPath) setPath(javaTask.options, newPath)
true true
} catch (_: NoSuchMethodException) { } catch (_: NoSuchMethodException) {