Skip to content

Commit 9783683

Browse files
committed
Fix version strings in standalone bazel build
Replace the hard-coded hash with a value fetched through the same mechanism used for openroad. Also bump the tool version. This requires changes to the workspace_status.sh script on the OR end. When the hash is available (with --stamp): $ bazel-bin/src/sta/opensta OpenSTA 3.0.0 16ac05c Copyright (c) 2025, Parallax Software, Inc. When it's not: $ bazel-bin/src/sta/opensta OpenSTA 3.0.0 unknown Copyright (c) 2025, Parallax Software, Inc. Signed-off-by: Martin Povišer <povik@cutebit.org>
1 parent 4527254 commit 9783683

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

BUILD

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,23 @@ genrule(
178178
name = "StaConfig",
179179
srcs = [],
180180
outs = ["include/sta/StaConfig.hh"],
181-
cmd = """echo -e '
182-
#pragma once
183-
#define STA_VERSION "2.7.0"
184-
#define STA_GIT_SHA1 "f21d4a3878e2531e3af4930818d9b5968aad9416"
185-
#define SSTA 0
186-
#define ZLIB_FOUND
187-
#define HAVE_CXX_STD_FORMAT 1' > \"$@\"
181+
cmd = """
182+
SHA1=""
183+
if [ -f bazel-out/stable-status.txt ]; then
184+
SHA1=$$(grep '^STABLE_STA_GIT_SHA1 ' bazel-out/stable-status.txt \
185+
| cut -d' ' -f2-) || true
186+
fi
187+
[ -z "$$SHA1" ] && SHA1="unknown"
188+
printf '#pragma once\\n' > $@
189+
printf '#define STA_VERSION "3.1.0"\\n' >> $@
190+
printf '#define STA_GIT_SHA1 "%s"\\n' "$$SHA1" >> $@
191+
printf '#define SSTA 0\\n' >> $@
192+
printf '#define ZLIB_FOUND\\n' >> $@
193+
printf '#define HAVE_CXX_STD_FORMAT 1\\n' >> $@
188194
""",
195+
# stamp = -1: only stamps with --stamp (or --config=release).
196+
# Without --stamp, STA_GIT_SHA1 will be "unknown".
197+
stamp = -1,
189198
visibility = ["//:__subpackages__"],
190199
)
191200

0 commit comments

Comments
 (0)