No public description
PiperOrigin-RevId: 725431780
Change-Id: I99a3abc52c4c3c654a698b8ca68ad3365d5b504d
diff --git a/.bazelrc b/.bazelrc
index a85e2a1..d04f768 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -1 +1,2 @@
+common --enable_bzlmod
build --cxxopt=-std=c++17 --cxxopt=-fexceptions --cxxopt=-Wno-nonnull --cxxopt=-Wno-sign-compare --cxxopt=-Wno-parentheses --cxxopt=-Wno-deprecated-declarations
diff --git a/BUILD.bazel b/BUILD.bazel
index 5231327..eca5745 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -26,7 +26,7 @@
"ModuleBaseListener.h",
],
cmd = " ".join([
- "$(locations @antlr4_deps_antlr4_tools//:rules_python_wheel_entry_point_antlr4) -v ",
+ "$(locations //entry_points:antlr4) -v ",
ANTLR4_VERSION,
" -o $(RULEDIR) -Dlanguage=Cpp -package fuzzyc_cc_module $(SRCS);",
"find $(RULEDIR) \\( -name *.cpp -o -name *.h \\) -exec cp -n {} $(RULEDIR) \\;",
@@ -34,7 +34,7 @@
local = True,
tools = [
requirement("antlr4-tools"),
- "@antlr4_deps_antlr4_tools//:rules_python_wheel_entry_point_antlr4",
+ "//entry_points:antlr4",
],
)
@@ -57,7 +57,7 @@
"FunctionBaseListener.h",
],
cmd = " ".join([
- "$(locations @antlr4_deps_antlr4_tools//:rules_python_wheel_entry_point_antlr4) -v ",
+ "$(locations //entry_points:antlr4) -v ",
ANTLR4_VERSION,
" -o $(RULEDIR) -Dlanguage=Cpp -package fuzzyc_cc_function $(SRCS);",
"find $(RULEDIR) \\( -name *.cpp -o -name *.h \\) -exec cp -n {} $(RULEDIR) \\;",
@@ -65,7 +65,7 @@
local = True,
tools = [
requirement("antlr4-tools"),
- "@antlr4_deps_antlr4_tools//:rules_python_wheel_entry_point_antlr4",
+ "//entry_points:antlr4",
],
)
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 0000000..91b1f3c
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,24 @@
+"""Fuzzyc build and test dependencies."""
+
+module(name = "fuzzyc")
+
+bazel_dep(name = "rules_python", version = "1.1.0")
+bazel_dep(name = "abseil-cpp", version = "20230125.1", repo_name = "com_google_absl")
+bazel_dep(name = "googletest", version = "1.15.2", repo_name = "com_google_googletest")
+
+python = use_extension("@rules_python//python/extensions:python.bzl", "python")
+python.toolchain(
+ is_default = True,
+ python_version = "3.9"
+)
+
+pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
+pip.parse(
+ hub_name = "antlr4_deps",
+ python_version = "3.9",
+ requirements_lock = "//:requirements_lock.txt",
+)
+use_repo(pip, "antlr4_deps")
+
+antlr4_runtimes_extension = use_extension("//:extensions.bzl", "antlr4_runtimes_extension")
+use_repo(antlr4_runtimes_extension, "antlr4_runtimes")
\ No newline at end of file
diff --git a/entry_points/BUILD.bazel b/entry_points/BUILD.bazel
new file mode 100644
index 0000000..f38e596
--- /dev/null
+++ b/entry_points/BUILD.bazel
@@ -0,0 +1,9 @@
+# Bazel build rules for antlr4 entry points.
+load("@rules_python//python/entry_points:py_console_script_binary.bzl", "py_console_script_binary")
+
+py_console_script_binary(
+ name = "antlr4",
+ pkg = "@antlr4_deps//antlr4_tools",
+ script = "antlr4",
+ visibility = ["//visibility:public"],
+)
\ No newline at end of file
diff --git a/extensions.bzl b/extensions.bzl
new file mode 100644
index 0000000..01cac96
--- /dev/null
+++ b/extensions.bzl
@@ -0,0 +1,8 @@
+"""Extensions for Fuzzyc."""
+
+load("//:repositories.bzl", "antlr4_runtimes_repo")
+
+def _antlr4_runtimes_impl(_ctx):
+ antlr4_runtimes_repo()
+
+antlr4_runtimes_extension = module_extension(implementation = _antlr4_runtimes_impl)
diff --git a/repositories.bzl b/repositories.bzl
new file mode 100644
index 0000000..c9a78d6
--- /dev/null
+++ b/repositories.bzl
@@ -0,0 +1,20 @@
+"""External repositories required by fuzzyc."""
+
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+def antlr4_runtimes_repo():
+ http_archive(
+ name = "antlr4_runtimes",
+ build_file_content = """
+package(default_visibility = ["//visibility:public"])
+cc_library(
+ name = "cpp",
+ srcs = glob(["runtime/Cpp/runtime/src/**/*.cpp"]),
+ hdrs = glob(["runtime/Cpp/runtime/src/**/*.h"]),
+ includes = ["runtime/Cpp/runtime/src"],
+)
+ """,
+ sha256 = "50e87636a61daabd424d884c60f804387430920072f585a9fee2b90e2043fdcc",
+ strip_prefix = "antlr4-4.11.1",
+ urls = ["https://github.com/antlr/antlr4/archive/v4.11.1.tar.gz"],
+ )