Reland "Add version consistently in all build configs and UI"
This is a partial reland of r.android.com/1499116 and
r.android.com/1497878, % the changes that depend on .git
on Android. Turns out that was a bad idea because some bots
can build without it.
Change:
The script that generates the build version can already gracefully
deal with the absence of git. However I forgot the dependency on
.git/HEAD, which makes the build system fail.
For now, in order to avoid problems, this avoids any git
invocation on Android in-tree builds. A follow up CL will
try extending with libbuildversion as suggedted in the bug.
This reverts commit 9d15a2309a4f03d000bcf6d4d4dcba36a3df2916.
This reverts commit bb4bfb0665d16525868e94f941d87ae89c858eb3.
The first patchset is a plain re-revert (i.e. a plain reland).
The patchset on top show the delta from the original cl (for ease
of re-review)
Bug: 173245796
Change-Id: Icd2f7f2727313b9cdc11c6bfa93b67478ae77974
diff --git a/BUILD b/BUILD
index cd7447d..90af4ba 100644
--- a/BUILD
+++ b/BUILD
@@ -313,6 +313,7 @@
"include/perfetto/ext/base/unix_task_runner.h",
"include/perfetto/ext/base/utils.h",
"include/perfetto/ext/base/uuid.h",
+ "include/perfetto/ext/base/version.h",
"include/perfetto/ext/base/waitable_event.h",
"include/perfetto/ext/base/watchdog.h",
"include/perfetto/ext/base/watchdog_noop.h",
@@ -561,6 +562,7 @@
"src/base/unix_task_runner.cc",
"src/base/utils.cc",
"src/base/uuid.cc",
+ "src/base/version.cc",
"src/base/virtual_destructors.cc",
"src/base/waitable_event.cc",
"src/base/watchdog_posix.cc",
@@ -569,6 +571,8 @@
":include_perfetto_base_base",
":include_perfetto_ext_base_base",
],
+ deps = [
+ ] + PERFETTO_CONFIG.deps.version_header,
linkstatic = True,
)
@@ -585,6 +589,20 @@
linkstatic = True,
)
+genrule(
+ name = "src_base_version_gen_h",
+ srcs = [
+ "CHANGELOG",
+ ],
+ outs = [
+ "perfetto_version.gen.h",
+ ],
+ cmd = "$(location gen_version_header_py) --cpp_out=$@",
+ exec_tools = [
+ ":gen_version_header_py",
+ ],
+)
+
# GN target: //src/ipc:client
filegroup(
name = "src_ipc_client",
@@ -3451,6 +3469,21 @@
],
)
+# This is overridden in google internal builds via
+# PERFETTO_CONFIG.deps.version_header (see perfetto_cfg.bzl).
+perfetto_cc_library(
+ name = "cc_perfetto_version_header",
+ hdrs = ["perfetto_version.gen.h"],
+)
+
+perfetto_py_binary(
+ name = "gen_version_header_py",
+ srcs = ["tools/write_version_header.py"],
+ data = ["CHANGELOG"],
+ main = "tools/write_version_header.py",
+ python_version = "PY3",
+)
+
# Noop targets used to represent targets of the protobuf library.
# These will be rewritten in Google3 to be dependencies on the real targets.