-
Notifications
You must be signed in to change notification settings - Fork 213
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
Set the compile jar to be the same as the output jar #479
Conversation
@jongerrish -- have a look? This would have changed during the large refactoring. |
@@ -609,7 +609,7 @@ def kt_jvm_produce_jar_actions(ctx, rule_kind): | |||
|
|||
java_info = JavaInfo( | |||
output_jar = output_jar, | |||
compile_jar = compile_jar, |
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.
This is going to make the compile jar the same as the output jar which will break the whole header / ABI jars for compile avoidance optimization.
Are you expecting any auxiliary files to be included in the compile jars? Note that the final binary (e.g: {java,android}_binary) will link in the output jar for each target, not the compile jar. That is intended only for compilation and why we do this optimization.
A test case showing what is broken would be helpful.
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.
Yes, I'm expecting auxiliary files in the output_jar to be available for use by follow-on targets.
A specific example is doing a wire_proto compile which generates the jar containing the generated .class files as well as the .proto files.
A follow-on target uses takes as input this jar and requires both the .proto and .class files as input.
Without this PR, the .proto files get removed when the ijar / hjar file is generated prior to compiling the follow-on target.
An alternate solution would be to include the srcjar as an input to the follow-on target, but the output jar is really the proper generated target.
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.
Is there a way to force the output.jar to be used as a dep in a follow-on target build?
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.
Is wire_proto
a Skylark rule?
I'm guessing that wire_proto
invokes some tool to compile its local proto source into either Kotlin/Java source code or direct to JVM bytecode?
If the compiler needs access to transitive proto source, i.e: local proto source references protos in other libraries then you can make these protos available via a provider e.g: WireProtoInfo that your rule can then collect transitive instances of.
I was able to fix my wire proto bzl file to reference full_compile_jars rather than compile_jars. No need for this PR. |
When kt_jvm_library is used to create a library that contains auxiliary files (lie .proto files) it does so correctly. However, when referred to via deps in the build of another module, bazel creates the -hjar file that strips these needed components from the .jar file used to link against.
This PR sets the compile / ijar resource to be the same as the created .jar file, thus eliminating this intermediate hjar creation. This is the same as a previous PR (#341)