From 978368365090edd0c894c036ca799cbcd96445c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Tue, 10 Mar 2026 21:00:45 +0100 Subject: [PATCH] Fix version strings in standalone bazel build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 16ac05c87a 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 --- BUILD | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/BUILD b/BUILD index 8192d047..8df7f65f 100644 --- a/BUILD +++ b/BUILD @@ -178,14 +178,23 @@ genrule( name = "StaConfig", srcs = [], outs = ["include/sta/StaConfig.hh"], - cmd = """echo -e ' - #pragma once - #define STA_VERSION "2.7.0" - #define STA_GIT_SHA1 "f21d4a3878e2531e3af4930818d9b5968aad9416" - #define SSTA 0 - #define ZLIB_FOUND - #define HAVE_CXX_STD_FORMAT 1' > \"$@\" + cmd = """ + SHA1="" + if [ -f bazel-out/stable-status.txt ]; then + SHA1=$$(grep '^STABLE_STA_GIT_SHA1 ' bazel-out/stable-status.txt \ + | cut -d' ' -f2-) || true + fi + [ -z "$$SHA1" ] && SHA1="unknown" + printf '#pragma once\\n' > $@ + printf '#define STA_VERSION "3.1.0"\\n' >> $@ + printf '#define STA_GIT_SHA1 "%s"\\n' "$$SHA1" >> $@ + printf '#define SSTA 0\\n' >> $@ + printf '#define ZLIB_FOUND\\n' >> $@ + printf '#define HAVE_CXX_STD_FORMAT 1\\n' >> $@ """, + # stamp = -1: only stamps with --stamp (or --config=release). + # Without --stamp, STA_GIT_SHA1 will be "unknown". + stamp = -1, visibility = ["//:__subpackages__"], )