KT-32210: Handle long compiler plugin options

Some of the KAPT compiler plugin options were longer than 0xFFFF bytes in
UTF-8 encoding, causing UTFDataFormatException when serializing them. This
commit avoids that issue by encoding changed files and changed classpath types
one by one instead of joining them to a single string.
This commit is contained in:
Ivan Gavrilovic
2019-07-24 17:00:03 +01:00
committed by Yan Zhulanow
parent 4b9a852745
commit 1c63d3aa2f
2 changed files with 4 additions and 7 deletions
@@ -54,11 +54,8 @@ internal fun CompilerPluginOptions.withWrappedKaptOptions(
subpluginOptionsByPluginId.toMutableMap()
resultOptionsByPluginId.compute(Kapt3KotlinGradleSubplugin.KAPT_SUBPLUGIN_ID) { _, kaptOptions ->
val changedFilesOption = FilesSubpluginOption("changedFile", changedFiles).takeIf { changedFiles.isNotEmpty() }
val classpathChangesOption = SubpluginOption(
"classpathChange",
classpathChanges.joinToString(separator = File.pathSeparator)
).takeIf { classpathChanges.isNotEmpty() }
val changedFilesOption = changedFiles.map { SubpluginOption("changedFile", it.canonicalPath) }
val classpathChangesOption = classpathChanges.map { SubpluginOption("classpathChange", it) }
val processIncrementallyOption = SubpluginOption("processIncrementally", processIncrementally.toString())
val compiledSourcesOption =
FilesSubpluginOption("compiledSourcesDir", compiledSourcesDir).takeIf { compiledSourcesDir.isNotEmpty() }