-
Notifications
You must be signed in to change notification settings - Fork 211
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 support for generated Java code with KSP #1139
Conversation
f6371e2
to
efd7ad7
Compare
kotlin/internal/jvm/compile.bzl
Outdated
# the final ABI jar. Otherwise just use the KT ABI jar as final ABI jar. | ||
if srcs.java or generated_kapt_src_jars or srcs.src_jars: | ||
if srcs.java or generated_kapt_src_jars or srcs.src_jars or generated_ksp_src_jars: |
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.
Doesn't this essentially mean that all targets that execute KSP will be forced to run a Java compilation action even if the underlying KSP plugin only produces Kotlin or class file outputs?
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.
Great point, that's correct.
I'm thinking how we could avoid that and I'm not really sure how we could get the information if the plugin is generating java code or not, without getting this provided as one of kt_ksp_plugin
parameters.
Could be something like
kt_ksp_plugin = rule(
attrs = {
"generates_java": attr.bool(
doc = """Runs Java compilation action for plugin generating Java output"""",
default = False,
),
...
}
...
}
What do you think about this approach? Or maybe there is some detail information that I'm missing, that could be used to determine if we could enforce/avoid running Java compilation action for certain KSP plugins? 👀
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.
@Bencodes updated PR with the approach mentioned above
10e6c02
to
4ab5cb5
Compare
f5b40eb
to
2f7e08c
Compare
What has changed?
deshading
toreshading
to cover the case where plugins dependencies are clashing with kotlin compiler ones (proper solution would be: rules_kotlin should link the embeddable Kotlin compiler #624) and those need to be shaded.Why it was changed?
kt_ksp_plugin
Fixes