Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the API to pass flags to KAPT. #123

Merged
merged 1 commit into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies {
// The Kotlin compiler should be near the end of the list because its .jar file includes
// an obsolete version of Guava
api(libs.kotlin.compilerEmbeddable)
implementation(libs.kotlin.annotationProcessingEmbeddable)
api(libs.kotlin.annotationProcessingEmbeddable)
testImplementation(libs.kotlin.junit)
testImplementation(libs.mockito)
testImplementation(libs.mockitoKotlin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() {
/** Arbitrary arguments to be passed to kapt */
var kaptArgs: MutableMap<OptionName, OptionValue> = mutableMapOf()

/** Arbitrary flags to be passed to kapt */
var kaptFlags: MutableSet<KaptFlag> = mutableSetOf()

/** Annotation processors to be passed to kapt */
var annotationProcessors: List<Processor> = emptyList()

Expand Down Expand Up @@ -389,8 +392,13 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() {

it.mode = AptMode.STUBS_AND_APT

if (verbose)
it.flags.addAll(KaptFlag.MAP_DIAGNOSTIC_LOCATIONS, KaptFlag.VERBOSE)
it.flags.apply {
addAll(kaptFlags)

if (verbose) {
addAll(KaptFlag.MAP_DIAGNOSTIC_LOCATIONS, KaptFlag.VERBOSE)
}
}
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh gosh, tabs vs spaces.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the original project has inconsistencies and I haven't enabled a formatted yet


val compilerMessageCollector = PrintingMessageCollector(
Expand Down