Fixing local_jar stuff to work with runtime.
Change-Id: I3209167bc9660c6cd2e80521e3edd96b479bba71
Note: There's still a small cosmetic glitch in that the jars still get included under the original version; internally they are the new version though and OSGi recognizes them as such.
diff --git a/tools/build/bazel/local_jar.bzl b/tools/build/bazel/local_jar.bzl
index 31da241..14d9f7b 100644
--- a/tools/build/bazel/local_jar.bzl
+++ b/tools/build/bazel/local_jar.bzl
@@ -13,14 +13,29 @@
# limitations under the License.
def _local_jar_impl(repository_ctx):
- repository_ctx.symlink(repository_ctx.attr.path, "jar/%s.jar" % repository_ctx.attr.name)
- repository_ctx.file("jar/BUILD", content = """
+ file = repository_ctx.attr.path.split("/")[-1]
+ repository_ctx.symlink(repository_ctx.attr.path, "%s" % file)
+ repository_ctx.file("BUILD", content = """
# DO NOT EDIT: automatically generated BUILD file for local_jar rule
java_import(
- name = "jar",
- jars = ["%s.jar"],
+ name = "%s",
+ jars = ["%s"],
visibility = ['//visibility:public']
)
+ """ % (repository_ctx.attr.name, file))
+ repository_ctx.file("WORKSPACE", content = """
+# DO NOT EDIT: automatically generated BUILD file for local_jar rule
+workspace(name = "%s")
+ """ % repository_ctx.attr.name)
+ repository_ctx.file("jar/BUILD", content = """
+# DO NOT EDIT: automatically generated BUILD file for local_jar rule
+
+package(default_visibility = ["//visibility:public"])
+
+alias(
+ name = "jar",
+ actual = "@%s",
+)
""" % repository_ctx.attr.name)
# Workspace rule to allow override of a single locally built 3rd party jar