https://github.com/aherrmann/demo-bazel-detect-bzlmod-config-setting
https://github.com/aherrmann/demo-bazel-detect-bzlmod-config-setting
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/aherrmann/demo-bazel-detect-bzlmod-config-setting
- Owner: aherrmann
- Created: 2023-03-24T10:12:42.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-24T10:12:53.000Z (about 3 years ago)
- Last Synced: 2025-01-13T09:10:04.130Z (over 1 year ago)
- Language: Starlark
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A config setting to distinguish bzlmod and WORKSPACE mode.
```
$ bazel build demo && cat bazel-bin/demo.txt
...
workspace
```
```
$ bazel build demo --enable_bzlmod && cat bazel-bin/demo.txt
...
bzlmod
```
Where `demo` is defined as
```
write_file(
name = "demo",
out = "demo.txt",
content = select({
":bzlmod": ["bzlmod"],
":workspace": ["workspace"],
}),
)
```