Skip to content

Commit 821ee81

Browse files
jbylickiglatosinski
authored andcommitted
bazel/README: Add bazel/README
Signed-off-by: Jan Bylicki <[email protected]>
1 parent ac73caa commit 821ee81

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

bazel/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# OpenROAD-flow-scripts and Bazel integration
2+
3+
`bazel-orfs` is a Bazel package containing the definitions and logic governing the build process of ORFS designs.
4+
The module uses the `openroad/orfs` docker image to extract the flow scripts with dependencies, builds the Bazel environment around them and defines the methods of calling the ORFS Makefiles with selected designs.
5+
6+
## Run examples
7+
8+
`flow/BUILD.bazel` contains definitions for various flows to serve as examples.
9+
10+
It is recommended to run the utility [Bazelisk](https://github.com/bazelbuild/bazelisk) to manage the version of `bazel` installed on the system.
11+
Details on installation can be found in the `bazel-orfs` [README](https://github.com/The-OpenROAD-Project/bazel-orfs?tab=readme-ov-file#requirements)
12+
13+
The flow can be ran with the following call structure:
14+
15+
```bash
16+
bazel build <target_name>_<stage_name>
17+
```
18+
19+
For example, to run the stage `final`, along with all the dependent stages, call:
20+
```bash
21+
bazel build gcd_final
22+
```
23+
24+
Details on usage and defining of the flows are presented in the Usage section of the `bazel-orfs` [README](https://github.com/The-OpenROAD-Project/bazel-orfs?tab=readme-ov-file#usage)
25+
26+
## Dependency version management
27+
28+
In the flow scipts, the `bazel-orfs` version is defined as
29+
30+
```starlark
31+
bazel_dep(name = "bazel-orfs")
32+
git_override(
33+
module_name = "bazel-orfs",
34+
commit = "<Hash of the default bazel-orfs commit>",
35+
remote = "https://github.com/The-OpenROAD-Project/bazel-orfs.git",
36+
)
37+
```
38+
However, as the referenced documentation shows, the git-based dependency can be overridden with a local repository.
39+
First, remove the `git_override` call entirely and replace it with a `local_path_override` call following this convention:
40+
41+
```starlark
42+
local_path_override(
43+
module_name = "bazel-orfs",
44+
path = "/replace/with/path/to/local/orfs/repository"
45+
)
46+
```
47+
48+
`bazel-orfs` sets a default version of the docker image used to create the Bazel environment.
49+
This selection can be overridden by a following snippet inserted below the `bazel-orfs` declaration and override.
50+
51+
```starlark
52+
orfs = use_extension("@bazel-orfs//:extension.bzl", "orfs_repositories")
53+
orfs.default(
54+
image = "tag-name",
55+
sha256 = "the-hash",
56+
)
57+
```
58+
59+
Substitute `tag-name` with the tag of the version needed and `the-hash` with the digest corresponding to the selected tag (without the `sha256:` prefix).
60+

0 commit comments

Comments
 (0)