java_library: output JNI headers generated by javac#2525
java_library: output JNI headers generated by javac#2525chrisnovakovic wants to merge 1 commit intothought-machine:masterfrom
java_library: output JNI headers generated by javac#2525Conversation
rules/java_rules.build_defs
Outdated
| javac_flags = CONFIG.JAVAC_TEST_FLAGS if test_only else CONFIG.JAVAC_FLAGS | ||
|
|
||
| javac_flags = '-g -encoding utf8 ' + javac_flags | ||
| javac_flags = '-h _jni -g -encoding utf8 ' + javac_flags |
There was a problem hiding this comment.
There doesn't seem to be any significant overhead in invoking the compiler with -h even when the JNI headers aren't needed (at least not compared with the time it takes to generate the class files).
rules/java_rules.build_defs
Outdated
| javac_cmd, | ||
| "find _jni -type f -name '*.h' | sort", |
There was a problem hiding this comment.
This should be safe because javac only ever outputs on stderr by default, so it shouldn't mess up the post-build output collection.
|
Thanks! Would you mind please opening this against https://github.com/please-build/java-rules instead? Those plugin repos are where future development of language-specific rules will happen. I have a couple of comments too but let's pick the conversation up there :) |
4377be5 to
e44cd56
Compare
Will do - I noticed a couple of CI failures in here that I didn't see over there, so I'll fix those, then force-push equivalent changes to please-build/java-rules#13. |
e44cd56 to
bc14739
Compare
The Java compiler outputs header files for Java sources that use the Java Native Interface (JNI), but there's currently no way for them to be consumed by the native-code components that depend on them, preventing them from being built. Provide the JNI headers as outputs of `java_library` when `cc_hdrs` is required. This allows native-code JNI components written in C/C++ to be built by including the `java_library` target as a dependency.
b2a6703 to
4d0a354
Compare
|
This issue has been automatically marked as stale because it has not had any recent activity in the past 90 days. It will be closed if no further activity occurs. If you require additional support, please reply to this message. Thank you for your contributions. |
The Java compiler outputs header files for Java sources that use the Java Native Interface (JNI), but there's currently no way for them to be consumed by the native-code components that depend on them, preventing them from being built.
Provide the JNI headers as outputs of
java_librarywhencc_hdrsis required. This allows native-code JNI components written in C/C++ to be built by including thejava_librarytarget as a dependency.