Skip to content

Commit

Permalink
Merge pull request #2121 from lromor/bzlmod_bazel_7
Browse files Browse the repository at this point in the history
bazel: migrate to bazelmod and bazel 7
  • Loading branch information
hzeller authored Mar 6, 2024
2 parents f95f52a + 975d2f9 commit dac26f2
Show file tree
Hide file tree
Showing 5 changed files with 644 additions and 4 deletions.
82 changes: 82 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
module(
name = "verible",
)

bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "bazel_skylib", version = "1.5.0")

bazel_dep(name = "rules_license", version = "0.0.8")
bazel_dep(name = "rules_proto", version = "6.0.0-rc2")
bazel_dep(name = "rules_cc", version = "0.0.9")

# Register m4 rules and toolchain.
bazel_dep(name = "rules_m4", version = "0.2.3")
m4 = use_extension(
"@rules_m4//m4/extensions:m4_repository_ext.bzl",
"m4_repository_ext",
)
m4.repository(
name = "m4",
version = "1.4.18",
extra_copts = ["-O3"],
)
use_repo(m4, "m4")
register_toolchains("@m4//:toolchain")

# Register bison rules and toolchain.
bazel_dep(name = "rules_bison", version = "0.2.2")
bison = use_extension(
"@rules_bison//bison/extensions:bison_repository_ext.bzl",
"bison_repository_ext",
)
bison.repository(
name = "bison",
version = "3.3.2",
extra_copts = ["-O3"],
)
use_repo(bison, "bison")
register_toolchains("@bison//:toolchain")

# Register flex rules and toolchain.
bazel_dep(name = "rules_flex", version = "0.2.1")
flex = use_extension(
"@rules_flex//flex/extensions:flex_repository_ext.bzl",
"flex_repository_ext",
)
flex.repository(
name = "flex",
version = "2.6.4",
extra_copts = ["-O3"],
)
use_repo(flex, "flex")
register_toolchains("@flex//:toolchain")

bazel_dep(name = "abseil-cpp", version = "20240116.1", repo_name="com_google_absl")
single_version_override(
module_name = "abseil-cpp",
patch_strip = 1,
version = "20240116.1",
patches = ["//bazel:absl.patch"],
)

bazel_dep(name = "re2", version = "2023-09-01", repo_name="com_googlesource_code_re2")
bazel_dep(name = "googletest", version = "1.14.0.bcr.1", repo_name="com_google_googletest")

bazel_dep(name = "protobuf", version = "25.2", repo_name="com_google_protobuf")
# This override can be removed once https://registry.bazel.build/modules/protobuf
# supports a compatible protobuf version for abseil.
archive_override(
module_name = "protobuf",
urls = [
"https://github.com/protocolbuffers/protobuf/releases/download/v25.2/protobuf-25.2.tar.gz",
],
strip_prefix="protobuf-25.2",
integrity = "sha256-j/URpk/EbueS0/5JpaG8rW99xQ37uloosOW5ecF/mHE=",
patches = [
"//bazel:proto-add-module-bazel.patch",
],
patch_strip = 1,
)

bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name="jsonhpp")
bazel_dep(name = "zlib", version = "1.3.1")
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,8 @@ the nix package manager simply run `nix-shell` to get a build environment.

```bash
# Build all tools and libraries
# bazel 5/6
# bazel 5/6/7
bazel build -c opt //...
# bazel 7
bazel build --noenable_bzlmod -c opt //...
```

You can access the generated artifacts under `bazel-bin/`. For instance the
Expand Down
41 changes: 41 additions & 0 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
workspace(name = "com_google_verible")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

#
# External tools needed
#

# 'make install' equivalent rule 2023-02-21
http_archive(
name = "com_github_google_rules_install",
# The installer uses an option -T that is not available on MacOS, but
# it is benign to leave out.
# Upstream bug https://github.com/google/bazel_rules_install/issues/31
patch_args = ["-p1"],
patches = ["//bazel:installer.patch"],
sha256 = "aba3c1ae179beb92c1fc4502d66d7d7c648f90eb51897aa4b0ae4a76ce225eec",
strip_prefix = "bazel_rules_install-6001facc1a96bafed0e414a529b11c1819f0cdbe",
urls = ["https://github.com/google/bazel_rules_install/archive/6001facc1a96bafed0e414a529b11c1819f0cdbe.zip"],
)

load("@com_github_google_rules_install//:deps.bzl", "install_rules_dependencies")

install_rules_dependencies()

load("@com_github_google_rules_install//:setup.bzl", "install_rules_setup")

install_rules_setup()

# 2024-02-06
http_archive(
name = "rules_compdb",
sha256 = "70232adda61e89a4192be43b4719d35316ed7159466d0ab4f3da0ecb1fbf00b2",
strip_prefix = "bazel-compilation-database-fa872dd80742b3dccd79a711f52f286cbde33676",
urls = ["https://github.com/grailbio/bazel-compilation-database/archive/fa872dd80742b3dccd79a711f52f286cbde33676.tar.gz"],
)

load("@rules_compdb//:deps.bzl", "rules_compdb_deps")

rules_compdb_deps()
Loading

0 comments on commit dac26f2

Please sign in to comment.