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
2 changes: 1 addition & 1 deletion bzlmod/01-depend_on_bazel_module/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.3.1
8.5.0
2 changes: 1 addition & 1 deletion bzlmod/01-depend_on_bazel_module/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
cc_binary(
name = "main",
srcs = ["main.cc"],
deps = ["@com_github_google_glog//:glog"],
deps = ["@com_github_nglog_nglog//:ng-log"],
)
9 changes: 5 additions & 4 deletions bzlmod/01-depend_on_bazel_module/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ module(
version = "0.0.1",
)

bazel_dep(name = "rules_cc", version = "0.0.17")
bazel_dep(name = "rules_cc", version = "0.1.1")

# 1. The metadata of ng-log is fetched from the BCR, including its dependencies (gflags).
# 2. The `repo_name` attribute allows users to reference this dependency via the `com_github_nglog_nglog` repo name.
bazel_dep(name = "ng-log", version = "0.8.0-rc1", repo_name = "com_github_nglog_nglog")

# 1. The metadata of glog is fetched from the BCR, including its dependencies (gflags).
# 2. The `repo_name` attribute allows users to reference this dependency via the `com_github_google_glog` repo name.
bazel_dep(name = "glog", version = "0.5.0", repo_name = "com_github_google_glog")
2 changes: 1 addition & 1 deletion bzlmod/01-depend_on_bazel_module/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ This is an example on how to introduce dependencies on Bazel modules in the MODU
To test it out, `cd` into this directory and run the following:

```bash
GLOG_logtostderr=1 bazel run main
NGLOG_logtostderr=1 bazel run main
```
4 changes: 2 additions & 2 deletions bzlmod/01-depend_on_bazel_module/main.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <glog/logging.h>
#include <ng-log/logging.h>

int main(int argc, char* argv[]) {
// Initialize Google’s logging library.
google::InitGoogleLogging(argv[0]);
nglog::InitializeLogging(argv[0]);

int num_cookies = 42;
LOG(INFO) << "Found " << num_cookies << " cookies";
Expand Down