Skip to content

Commit

Permalink
[bazel] Migrate to bzlmod
Browse files Browse the repository at this point in the history
  • Loading branch information
Yan-Tong Lin authored and alexkaratarakis committed Jul 14, 2024
1 parent a79f31e commit b4d6213
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ CTestTestfile.cmake
_deps

### Bazel ###
# Ignore the lock file
MODULE.bazel.lock
# Ignore backup files.
*~
# Ignore Vim swap files.
Expand Down
36 changes: 36 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module(
name = "fixed-containers",
)

bazel_dep(name = "magic_enum", repo_name = "com_github_neargye_magic_enum")
archive_override(
module_name = "magic_enum",
integrity = "sha256-mysXiN1lH+q4i8/7Cyrj3tTCcUKildbt6ILI/IoyejU=",
strip_prefix = "magic_enum-d63a9d63717640705c6c9654d68fa6575d39bab8",
urls = ["https://github.com/Neargye/magic_enum/archive/d63a9d63717640705c6c9654d68fa6575d39bab8.tar.gz"],
)

bazel_dep(name = "googletest", dev_dependency = True, repo_name = "com_google_googletest")
archive_override(
module_name = "googletest",
integrity = "sha256-WSQxGdI8Gbrxi7QGRkTliUsVaxW9AZHqMEbbnEp+4Ow=",
strip_prefix = "googletest-eff443c6ef5eb6ab598bfaae27f9427fdb4f6af7",
urls = ["https://github.com/google/googletest/archive/eff443c6ef5eb6ab598bfaae27f9427fdb4f6af7.tar.gz"],
)

bazel_dep(name = "google_benchmark", dev_dependency = True, repo_name = "com_google_benchmark")
archive_override(
module_name = "google_benchmark",
integrity = "sha256-3xI14ONyl+mQu4M8cjzT3sYfyVxJUfZL3Vxy0c6n9Pk=",
strip_prefix = "benchmark-447752540c71f34d5d71046e08192db181e9b02b",
urls = ["https://github.com/google/benchmark/archive/447752540c71f34d5d71046e08192db181e9b02b.tar.gz"],
)

bazel_dep(name = "range-v3", dev_dependency = True, repo_name = "com_github_ericniebler_range-v3")
archive_override(
module_name = "range-v3",
integrity = "sha256-Kj6VbMAXTqiD02xRre2FSa8QB4VYF36PbXbF4z3pUME=",
strip_prefix = "range-v3-53c40dd628450c977ee1558285ff43e0613fa7a9",
urls = ["https://github.com/ericniebler/range-v3/archive/53c40dd628450c977ee1558285ff43e0613fa7a9.tar.gz"],
patches = ["//:patches/range-v3_bzlmod.patch",],
)
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,17 @@ target_link_libraries(<your_binary> fixed_containers::fixed_containers)
```

### bazel
Use the following in your `WORKSPACE` file:
If you are managing dependencies with the newer bzlmod system, use the following in your `MODULE.bazel` file:
```
bazel_dep(name = "fixed_containers")
archive_override(
module_name = "fixed_containers",
strip_prefix = "fixed-containers-<commit>",
urls = ["https://github.com/teslamotors/fixed-containers/archive/<commit>.tar.gz"],
)
```

If you are managing dependencies with the older `WORKSPACE` system, use the following in your `WORKSPACE` file:
```
http_archive(
name = "fixed_containers",
Expand Down
25 changes: 0 additions & 25 deletions WORKSPACE

This file was deleted.

10 changes: 10 additions & 0 deletions patches/range-v3_bzlmod.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 0000000..2a3ae781c
--- /dev/null
+++ MODULE.bazel
@@ -0,0 +1,3 @@
+module(
+ name = "range-v3",
+)

0 comments on commit b4d6213

Please sign in to comment.