From d18eb73b9949522eec5e6d86ad639878e88f60a0 Mon Sep 17 00:00:00 2001 From: Henrique Ferreiro Date: Tue, 14 Apr 2026 14:12:48 +0100 Subject: [PATCH] build: Reuse //base:build_date_internal for //copied_base/base:build_date https://crrev.com/c/6551784 and https://crrev.com/c/6546841 modified //base:build_date to simply copy the generated timestamp header file from the default toolchain and avoid having to redo the work in every toolchain. The changes also introduced an assertion to ensure that was the case. In AOSP builds, that assertion fails because it uses copied_base with the old code. This PR fixes this by reusing the same mechanism that is already in place at //base:build_date_internal. Bug: 495203133 --- copied_base/base/BUILD.gn | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/copied_base/base/BUILD.gn b/copied_base/base/BUILD.gn index 4b79af13d34e..ad916e67dca3 100644 --- a/copied_base/base/BUILD.gn +++ b/copied_base/base/BUILD.gn @@ -37,7 +37,6 @@ import("//build/config/sanitizers/sanitizers.gni") import("//build/config/sysroot.gni") import("//build/config/ui.gni") import("//build/nocompile.gni") -import("//build/timestamp.gni") import("//build_overrides/build.gni") import("//testing/libfuzzer/fuzzer_test.gni") import("//testing/test.gni") @@ -103,6 +102,8 @@ if (is_fuchsia) { import("//third_party/fuchsia-sdk/sdk/build/fidl_library.gni") } +_build_date_header = "$target_gen_dir/generated_build_date.h" + if (is_cobalt) { use_perfetto_client_library = true enable_log_error_not_reached = false @@ -943,6 +944,7 @@ component("base") { "version.h", "vlog.cc", "vlog.h", + _build_date_header, ] @@ -4181,15 +4183,11 @@ if (is_win && toolchain_has_rust) { } } -action("build_date") { - script = "write_build_date_header.py" - - outputs = [ "$target_gen_dir/generated_build_date.h" ] - - args = [ - rebase_path("$target_gen_dir/generated_build_date.h", root_build_dir), - build_timestamp, - ] +copy("build_date") { + # Reuse the file generated by //base:build_date_internal. + sources = [ "$root_build_dir/gen/base/generated_build_date_internal.h" ] + outputs = [ _build_date_header ] + deps = [ "//base:build_date_internal($default_toolchain)" ] } if (is_android || is_robolectric) {