1. Properly extract srcs from j2cl_library by adding a -src.jar output target to j2cl_library per cl/159032233.
2. Fixed web_library and xplat_fava_service_component_auto_modules to use that -src.jar.
3. Improved js extraction in xplat_fava_service_component_auto_modules, which surfaces some bugs (e.g. xplat_fava_service_component_auto_modules is not used in any binary yet).
@@ -92,6 +92,9 @@ def j2cl_library(name,
**kwargs):
"""Translates Java source into JS source in a js_library() target.
+ Implicit output targets:
+ lib<name>-src.jar: A java archive containing the sources (source jar).
+
Args:
srcs: Source files (.java or .srcjar) to compile.
native_srcs: Foo.native.js source files.
@@ -238,6 +241,10 @@ def j2cl_library(name,
_do_env_copy(js_sources_from_apt, apt_jszip_name, testonly)
src_zips += [":" + apt_jszip_name]
+ # Expose java sources similar to java_library
+ java_src_jar = "lib" + base_name + "-src.jar"
+ _do_env_copy("lib" + base_name + "_java_library-src.jar", java_src_jar, testonly)
+
if _js_srcs:
handrolled_js = base_name + "_handrolled.js.zip";
generate_zip(handrolled_js, _js_srcs, "RELATIVE")
