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
add KAPT arguments to define_kt_toolchain #858
base: master
Are you sure you want to change the base?
add KAPT arguments to define_kt_toolchain #858
Conversation
kotlin/internal/defs.bzl
Outdated
@@ -36,6 +36,12 @@ KtJvmInfo = provider( | |||
}, | |||
) | |||
|
|||
KaptInfo = provider( | |||
fields = { | |||
"correctErrorTypes": "correct Error Types https://kotlinlang.org/docs/kapt.html#non-existent-type-correction", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we follow snake case i.e correct_error_types
here to stay consistent with rest of the args?
43daefc
to
d2f4434
Compare
Notes: All available options: https://kotlinlang.org/docs/kapt.html#using-in-cli Kapt is in maintenance mode at the moment hence we could consider adding options statically as it is not expected to change much between versions. The structure outlined in this PR is similar to what is already done in Kotlin Gradle Plugin for example, the
If this structure is accepted we could look into adding support for |
Sounds reasonable to me. Also we might want to bring in all the other defaults from Gradle as that the source of truth we should follow at this point. |
kotlin/internal/jvm/compile.bzl
Outdated
@@ -395,6 +396,7 @@ def _run_kt_builder_action( | |||
args.add_all("--deps_artifacts", deps_artifacts, omit_if_empty = True) | |||
args.add_all("--kotlin_friend_paths", associates.jars, map_each = _associate_utils.flatten_jars) | |||
args.add("--instrument_coverage", ctx.coverage_instrumented()) | |||
args.add("--kapt_correct_error_types", toolchains.kt.kaptInfo[_KaptInfo].correct_error_types) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should just pass all the options in here like we do for Kotlinc/Javac/Ksp, otherwise we'd end up having to create new proto entries for every single kapt option that we want to support.
2c28d70
to
01608ea
Compare
01608ea
to
767c879
Compare
I'm against adding these to the toolchain -- we want to move away from specific plugin arguments being embedded in the core infrastructure. KSP has shown that the plugin ecosystem is robust enough to foster an entire new ecosystem of plugins on top of the old one. It would be better to move KAPT (and KSP) into an extendable subsystem, as we've previously discussed. |
@restingbull I'm not aware of the discussion care to elaborate more? |
@restingbull can you elaborate on the preferred direction? Would having something like |
Adding KAPT arguments to define_kt_toolchain
By this, we can configure KAPT.
Build.bazel