Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
load(":rules.bzl", "clojure_repl")
# Bazel 9 stubs the native java_* rules with a reduced attribute set
# (no main_class/runtime_deps/jvm_flags/resources); they must come from rules_java.
load("@rules_java//java:defs.bzl", "java_binary")

package(default_visibility = ["//visibility:public"])

Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module(
version = "0.5",
)

bazel_dep(name = "rules_java", version = "8.16.1")
bazel_dep(name = "rules_java", version = "9.7.1")
bazel_dep(name = "rules_jvm_external", version = "6.8")

bazel_dep(name = "buildifier_prebuilt", version = "8.5.1.2", dev_dependency = True)
Expand Down
42 changes: 28 additions & 14 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions examples/gen_srcs_bench/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
load("@rules_clojure//rules:tools_deps.bzl", "clojure_gen_srcs")
# Bazel 9 stubs the native java_* rules with a reduced attribute set
# (no main_class/runtime_deps/jvm_flags/resources); they must come from rules_java.
load("@rules_java//java:defs.bzl", "java_binary", "java_library")

package(default_visibility = ["//visibility:public"])

Expand Down
5 changes: 5 additions & 0 deletions examples/simple/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ module(name = "example-simple")

bazel_dep(name = "rules_clojure", version = "0.5")

# Bazel 9 stubs the native java_* rules, so the BUILD files here load them from
# rules_java. This module must declare that dependency itself — it is a
# separate module, so the root repo's bazel_dep is not visible to it.
bazel_dep(name = "rules_java", version = "9.7.1")

local_path_override(module_name = "rules_clojure",
path = "../..")

Expand Down
3 changes: 3 additions & 0 deletions examples/simple/src/example/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
load("@rules_clojure//:rules.bzl", "clojure_library", "clojure_binary")
# Bazel 9 stubs the native java_* rules with a reduced attribute set
# (no main_class/runtime_deps/jvm_flags/resources); they must come from rules_java.
load("@rules_java//java:defs.bzl", "java_binary", "java_library")

package(default_visibility = ["//visibility:public"])

Expand Down
3 changes: 3 additions & 0 deletions examples/simple/test/example/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
load("@rules_clojure//:rules.bzl", "clojure_library", "clojure_test")
# Bazel 9 stubs the native java_* rules with a reduced attribute set
# (no main_class/runtime_deps/jvm_flags/resources); they must come from rules_java.
load("@rules_java//java:defs.bzl", "java_library")

java_library(name="libcore_test",
resources=["core_test.clj"],
Expand Down
11 changes: 8 additions & 3 deletions rules.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
load("//rules:jar.bzl", _clojure_jar_impl = "clojure_jar_impl")
load("//rules:repl.bzl", _clojure_repl_impl = "clojure_repl_impl")
# Bazel 9 removed JavaInfo/java_common from the Starlark globals; they must
# now be loaded from rules_java. Without this the rules fail to load with
# "name 'JavaInfo' is not defined".
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
load("@rules_java//java:defs.bzl", "java_binary", "java_test")

clojure_library = rule(
doc = "Define a clojure library",
Expand Down Expand Up @@ -27,7 +32,7 @@ def clojure_binary(name, **kwargs):
deps = kwargs.pop("deps", [])
runtime_deps = kwargs.pop("runtime_deps", [])

native.java_binary(name=name,
java_binary(name=name,
runtime_deps = deps + runtime_deps,
**kwargs)

Expand All @@ -49,7 +54,7 @@ def clojure_test(name, *, test_ns, deps=[], runtime_deps=[], main_class="rules_c
# ideally the library name and the bin name would be the same. They can't be.
# clojure src files would like to depend on `foo_test`, so mangle the test binary, not the src jar name

native.java_test(name=name,
java_test(name=name,
runtime_deps = deps + runtime_deps + ["@rules_clojure//src/rules_clojure:testrunner"],
use_testrunner = False,
main_class=main_class,
Expand Down Expand Up @@ -100,7 +105,7 @@ _cljs_library = rule(

def cljs_library(name, deps=[],**kwargs):
clj_binary="%s_clj_binary" % name
native.java_binary(name=clj_binary,
java_binary(name=clj_binary,
main_class = "clojure.main",
jvm_flags=["-Dclojure.main.report=stderr"],
runtime_deps=deps,
Expand Down
5 changes: 5 additions & 0 deletions rules/jar.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Bazel 9 removed JavaInfo/java_common from the Starlark globals; they must
# now be loaded from rules_java. Without this the rules fail to load with
# "name 'JavaInfo' is not defined".
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
load("@rules_java//java/common:java_common.bzl", "java_common")
def contains(lst, item):
for x in lst:
if x == item:
Expand Down
4 changes: 4 additions & 0 deletions rules/namespace.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
load("//rules:common.bzl", "CljInfo")
# Bazel 9 removed JavaInfo/java_common from the Starlark globals; they must
# now be loaded from rules_java. Without this the rules fail to load with
# "name 'JavaInfo' is not defined".
load("@rules_java//java/common:java_info.bzl", "JavaInfo")

def clojure_ns_impl(ctx):
runfiles = ctx.runfiles()
Expand Down
4 changes: 4 additions & 0 deletions rules/repl.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Bazel 9 removed JavaInfo/java_common from the Starlark globals; they must
# now be loaded from rules_java. Without this the rules fail to load with
# "name 'JavaInfo' is not defined".
load("@rules_java//java/common:java_info.bzl", "JavaInfo")
### rule to start a clojure repl. We don't use `java_binary` because
### we want to support adding directories to the classpath (and in the
### future, possibly running from the source tree rather than `bazel-bin`), both in support of
Expand Down
3 changes: 3 additions & 0 deletions src/rules_clojure/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
load("//:rules.bzl", "clojure_library", "clojure_binary")
# Bazel 9 stubs the native java_* rules with a reduced attribute set
# (no main_class/runtime_deps/jvm_flags/resources); they must come from rules_java.
load("@rules_java//java:defs.bzl", "java_binary", "java_import", "java_library")

package(default_visibility = ["//visibility:public"])
exports_files(glob(["**/*.clj"]))
Expand Down
3 changes: 3 additions & 0 deletions test/rules_clojure/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
load("//:rules.bzl", "clojure_library", "clojure_test")
# Bazel 9 stubs the native java_* rules with a reduced attribute set
# (no main_class/runtime_deps/jvm_flags/resources); they must come from rules_java.
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])

Expand Down