Kapt: Add flag to keep KDoc comments in stubs

Currently, KaptGenerateStubsTask may not generate KDoc comments
correctly. See KT-43593 for more details.

This commit provides a Kapt flag called
`kapt.keep.kdoc.comments.in.stubs`
to control whether KDoc comments will be included in the generated
stubs.

This flag is currently enabled by default to keep the existing behavior
and avoid breaking existing users.

Users who don't need KDoc comments in stubs but are hitting KT-43593 can
disable the flag.

Whether this flag will be disabled by default later is to be determined.

Bug: https://youtrack.jetbrains.com/issue/KT-43593
     (Note that this commit only provides a workaround, it doesn't
     actually fix the bug.)
Test: (Ir)ClassFileToSourceStubConverterTestGenerated#testCommentsRemoved
This commit is contained in:
Hung Nguyen
2021-01-21 11:07:23 +00:00
committed by nataliya.valtman
parent dcda47b502
commit e2521718dd
12 changed files with 307 additions and 38 deletions
@@ -195,6 +195,12 @@ enum class KaptCliOption(
cliToolOption = CliToolOption("-Kapt-strip-metadata", FLAG)
),
KEEP_KDOC_COMMENTS_IN_STUBS(
"keepKdocCommentsInStubs",
"true | false",
"Keep KDoc comments in stubs"
),
DETECT_MEMORY_LEAKS_OPTION("detectMemoryLeaks", "true | false", "Detect memory leaks in annotation processors"),
INCLUDE_COMPILE_CLASSPATH(
"includeCompileClasspath",