Skip to content

Commit

Permalink
Fully qualify labels (#6)
Browse files Browse the repository at this point in the history
This should allow these rules to be imported into a user workspace. See #4 for background.
  • Loading branch information
marplesoft authored Mar 23, 2020
1 parent 8e15d2a commit a4a6fab
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
2 changes: 1 addition & 1 deletion macros.bzl
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 6 additions & 6 deletions rules.bzl
Original file line number Diff line number Diff line change
@@ -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.",
Expand All @@ -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
)

Expand All @@ -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
)

Expand All @@ -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
)
2 changes: 1 addition & 1 deletion rules/BUILD
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion rules/library.bzl
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion rules/repl.bzl
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion rules/test.bzl
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion runtime.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ def clojure_runtime():
)

native.register_toolchains(
"//rules:clojure_toolchain",
"@rules_clojure//rules:clojure_toolchain",
)
2 changes: 1 addition & 1 deletion tests/BUILD
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit a4a6fab

Please sign in to comment.