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:
committed by
Yan Zhulanow
parent
4b9a852745
commit
1c63d3aa2f
+2
-5
@@ -54,11 +54,8 @@ internal fun CompilerPluginOptions.withWrappedKaptOptions(
|
|||||||
subpluginOptionsByPluginId.toMutableMap()
|
subpluginOptionsByPluginId.toMutableMap()
|
||||||
|
|
||||||
resultOptionsByPluginId.compute(Kapt3KotlinGradleSubplugin.KAPT_SUBPLUGIN_ID) { _, kaptOptions ->
|
resultOptionsByPluginId.compute(Kapt3KotlinGradleSubplugin.KAPT_SUBPLUGIN_ID) { _, kaptOptions ->
|
||||||
val changedFilesOption = FilesSubpluginOption("changedFile", changedFiles).takeIf { changedFiles.isNotEmpty() }
|
val changedFilesOption = changedFiles.map { SubpluginOption("changedFile", it.canonicalPath) }
|
||||||
val classpathChangesOption = SubpluginOption(
|
val classpathChangesOption = classpathChanges.map { SubpluginOption("classpathChange", it) }
|
||||||
"classpathChange",
|
|
||||||
classpathChanges.joinToString(separator = File.pathSeparator)
|
|
||||||
).takeIf { classpathChanges.isNotEmpty() }
|
|
||||||
val processIncrementallyOption = SubpluginOption("processIncrementally", processIncrementally.toString())
|
val processIncrementallyOption = SubpluginOption("processIncrementally", processIncrementally.toString())
|
||||||
val compiledSourcesOption =
|
val compiledSourcesOption =
|
||||||
FilesSubpluginOption("compiledSourcesDir", compiledSourcesDir).takeIf { compiledSourcesDir.isNotEmpty() }
|
FilesSubpluginOption("compiledSourcesDir", compiledSourcesDir).takeIf { compiledSourcesDir.isNotEmpty() }
|
||||||
|
|||||||
@@ -96,10 +96,10 @@ class Kapt3CommandLineProcessor : CommandLineProcessor {
|
|||||||
STUBS_OUTPUT_DIR_OPTION -> stubsOutputDir = File(value)
|
STUBS_OUTPUT_DIR_OPTION -> stubsOutputDir = File(value)
|
||||||
INCREMENTAL_DATA_OUTPUT_DIR_OPTION -> incrementalDataOutputDir = File(value)
|
INCREMENTAL_DATA_OUTPUT_DIR_OPTION -> incrementalDataOutputDir = File(value)
|
||||||
|
|
||||||
CHANGED_FILES -> changedFiles.addAll(value.split(File.pathSeparator).map { File(it) })
|
CHANGED_FILES -> changedFiles.add(File(value))
|
||||||
COMPILED_SOURCES_DIR -> compiledSources.addAll(value.split(File.pathSeparator).map { File(it) })
|
COMPILED_SOURCES_DIR -> compiledSources.addAll(value.split(File.pathSeparator).map { File(it) })
|
||||||
INCREMENTAL_CACHE -> incrementalCache = File(value)
|
INCREMENTAL_CACHE -> incrementalCache = File(value)
|
||||||
CLASSPATH_CHANGES -> classpathChanges.addAll(value.split(File.pathSeparator).map { it })
|
CLASSPATH_CHANGES -> classpathChanges.add(value)
|
||||||
PROCESS_INCREMENTALLY -> setFlag(KaptFlag.INCREMENTAL_APT, value)
|
PROCESS_INCREMENTALLY -> setFlag(KaptFlag.INCREMENTAL_APT, value)
|
||||||
|
|
||||||
ANNOTATION_PROCESSOR_CLASSPATH_OPTION -> processingClasspath += File(value)
|
ANNOTATION_PROCESSOR_CLASSPATH_OPTION -> processingClasspath += File(value)
|
||||||
|
|||||||
Reference in New Issue
Block a user