https://github.com/keith/bazel-stamp-example
An example of bazel's stamp feature to embed git shas and other info into produced binaries
https://github.com/keith/bazel-stamp-example
Last synced: 4 days ago
JSON representation
An example of bazel's stamp feature to embed git shas and other info into produced binaries
- Host: GitHub
- URL: https://github.com/keith/bazel-stamp-example
- Owner: keith
- License: mit
- Created: 2022-07-21T23:28:23.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-22T17:54:52.000Z (over 1 year ago)
- Last Synced: 2025-01-22T02:56:17.009Z (over 1 year ago)
- Language: Starlark
- Size: 9.77 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bazel-stamp-example
This is an example repo using bazel's under-documented "stamp" feature
to embed information into your final binary in a relatively safe way.
## Example
The `binary_example` target in the root [root `BUILD` file](BUILD) is
the standard example of linkstamps where you have a `cc_library` with
the `linkstamp` attribute, and depend on that from a binary that sets
`stamp = 1`.
The `genrule_example` target in the [root `BUILD` file](BUILD) is an
example for when you don't have a top level binary you can set `stamp =
1` on (even though in this example we still use a `cc_binary` to
demonstrate it working). This is useful for the case you want to embed
this specific information into a static library that you vendor.