Restricts usage of j2cl_import to jar importing only.
Ideally we should just kill this in favor of regular j2cl_library but that's a much bigger work so for now the CL just restricts its usages.
Takes nonstandard input and repackages it with names that will allow the
j2cl_import() target to be directly depended upon from j2cl_library() targets.
-The nonstandard input can be a source jar, a jar, or both a jar and js.
+
+Should only be used for importing annotation byte code, otherwise may result
+in hard to debug errors!
Example use:
-# creates properly named forwarding rules
-# java_library(name="Qux_java_library")
-# js_library(name="Qux")
j2cl_import(
name = "Qux",
- jar = "//java/com/qux:qux_java", # nonconforming name
- js = "//java/com/qux:qux_js-lib", # nonconforming name
+ jar = "//java/com/qux:qux_java",
)
-# creates js_library(name="Bar") containing the results.
j2cl_library(
name = "Bar",
srcs = glob(["Bar.java"]),
@@ -30,14 +27,12 @@ load("//build_def:j2cl_java_library.bzl", "j2cl_java_library")
def j2cl_import(
name,
jar,
- js = None,
licenses = None,
visibility = None):
"""Translates nonstandard inputs into a dep'able j2cl_library.
Args:
jar: Jar file to appropriately rename.
- js: JS file to appropriately rename.
"""
# exit early to avoid parse errors when running under bazel
@@ -54,16 +49,6 @@ def j2cl_import(
tags = ["avoid_dep"],
)
- if js:
- native.js_library(
- name = name,
- exports = [js],
- licenses = licenses,
- visibility = visibility,
- # Direct automated dep picking tools away from this target.
- tags = ["avoid_dep"],
- )
- else:
# Empty target to satisfy references from j2cl_library()s
native.js_library(
name = name,
