From a4a6faba288d68273c97cc1c9c8b574937503ce8 Mon Sep 17 00:00:00 2001 From: marplesoft Date: Sun, 22 Mar 2020 22:46:49 -0700 Subject: [PATCH] Fully qualify labels (#6) This should allow these rules to be imported into a user workspace. See #4 for background. --- WORKSPACE | 2 +- macros.bzl | 2 +- rules.bzl | 12 ++++++------ rules/BUILD | 2 +- rules/library.bzl | 2 +- rules/repl.bzl | 2 +- rules/test.bzl | 2 +- runtime.bzl | 2 +- tests/BUILD | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 70e316d..bb7ddd2 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,6 +1,6 @@ workspace(name = "rules_clojure") -load("//:runtime.bzl", "clojure_runtime") +load("@rules_clojure//:runtime.bzl", "clojure_runtime") clojure_runtime() load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") diff --git a/macros.bzl b/macros.bzl index 7d3ab9d..ec40c61 100644 --- a/macros.bzl +++ b/macros.bzl @@ -1,4 +1,4 @@ -load("//:rules.bzl", _library = "clojure_library", _repl = "clojure_repl") +load("@rules_clojure//:rules.bzl", _library = "clojure_library", _repl = "clojure_repl") def clojure_binary(name, srcs, aots, main_class, deps = []): lib = "_lib_%" % name diff --git a/rules.bzl b/rules.bzl index 8319e4e..3f9cd22 100644 --- a/rules.bzl +++ b/rules.bzl @@ -1,6 +1,6 @@ -load("//rules:library.bzl", _clojure_library_impl = "clojure_library_impl") -load("//rules:repl.bzl", _clojure_repl_impl = "clojure_repl_impl") -load("//rules:test.bzl", _clojure_test_impl = "clojure_test_impl") +load("@rules_clojure//rules:library.bzl", _clojure_library_impl = "clojure_library_impl") +load("@rules_clojure//rules:repl.bzl", _clojure_repl_impl = "clojure_repl_impl") +load("@rules_clojure//rules:test.bzl", _clojure_test_impl = "clojure_test_impl") clojure_library = rule( doc = "Builds a jar for given sources with ahead-of-time compilation.", @@ -13,7 +13,7 @@ clojure_library = rule( "jar": "%{name}.jar", }, provides = [JavaInfo], - toolchains = ["//rules:toolchain_type"], + toolchains = ["@rules_clojure//rules:toolchain_type"], implementation = _clojure_library_impl ) @@ -24,7 +24,7 @@ clojure_repl = rule( "ns": attr.string(mandatory = False, doc = "Namespace to start REPL in."), }, executable = True, - toolchains = ["//rules:toolchain_type"], + toolchains = ["@rules_clojure//rules:toolchain_type"], implementation = _clojure_repl_impl ) @@ -35,6 +35,6 @@ clojure_test = rule( "deps": attr.label_list(default = [], providers = [JavaInfo], doc = "Libraries to link into this library."), }, test = True, - toolchains = ["//rules:toolchain_type"], + toolchains = ["@rules_clojure//rules:toolchain_type"], implementation = _clojure_test_impl ) diff --git a/rules/BUILD b/rules/BUILD index 28c0105..ed64e84 100644 --- a/rules/BUILD +++ b/rules/BUILD @@ -1,6 +1,6 @@ toolchain_type(name = "toolchain_type") -load("//:toolchain.bzl", "clojure_toolchain") +load("@rules_clojure//:toolchain.bzl", "clojure_toolchain") clojure_toolchain( name = "clojure_10_toolchain", diff --git a/rules/library.bzl b/rules/library.bzl index cc3af1a..61c2f76 100644 --- a/rules/library.bzl +++ b/rules/library.bzl @@ -1,5 +1,5 @@ def clojure_library_impl(ctx): - toolchain = ctx.toolchains["//rules:toolchain_type"] + toolchain = ctx.toolchains["@rules_clojure//rules:toolchain_type"] output = ctx.actions.declare_directory("%s.library" % ctx.label.name) diff --git a/rules/repl.bzl b/rules/repl.bzl index ecd1fa2..4068d93 100644 --- a/rules/repl.bzl +++ b/rules/repl.bzl @@ -1,5 +1,5 @@ def clojure_repl_impl(ctx): - toolchain = ctx.toolchains["//rules:toolchain_type"] + toolchain = ctx.toolchains["@rules_clojure//rules:toolchain_type"] ctx.actions.write( output = ctx.outputs.executable, diff --git a/rules/test.bzl b/rules/test.bzl index 69cb68e..eda5cc6 100644 --- a/rules/test.bzl +++ b/rules/test.bzl @@ -1,5 +1,5 @@ def clojure_test_impl(ctx): - toolchain = ctx.toolchains["//rules:toolchain_type"] + toolchain = ctx.toolchains["@rules_clojure//rules:toolchain_type"] ctx.actions.write( output = ctx.outputs.executable, diff --git a/runtime.bzl b/runtime.bzl index 09f1164..8e47134 100644 --- a/runtime.bzl +++ b/runtime.bzl @@ -23,5 +23,5 @@ def clojure_runtime(): ) native.register_toolchains( - "//rules:clojure_toolchain", + "@rules_clojure//rules:clojure_toolchain", ) diff --git a/tests/BUILD b/tests/BUILD index 6989b57..7144391 100644 --- a/tests/BUILD +++ b/tests/BUILD @@ -1,4 +1,4 @@ -load("//:rules.bzl", "clojure_library", "clojure_test", "clojure_repl") +load("@rules_clojure//:rules.bzl", "clojure_library", "clojure_test", "clojure_repl") clojure_library( name = "library",