From 4ae6404d6f9328350a22c21d8865ce6821be3d59 Mon Sep 17 00:00:00 2001 From: Chad Reynolds Date: Thu, 30 Jan 2025 17:15:40 -0800 Subject: [PATCH] Update the return type of the version helper Also update the callsite, so there are no problems with scope of objects. Bug: 393455992 --- base/cvd/build_version.h.in | 7 +++---- .../cuttlefish/host/commands/cvd/cli/commands/version.cpp | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/base/cvd/build_version.h.in b/base/cvd/build_version.h.in index 7360dec34a..7ab6b967de 100644 --- a/base/cvd/build_version.h.in +++ b/base/cvd/build_version.h.in @@ -17,14 +17,13 @@ #ifndef BUILD_VERSION_H #define BUILD_VERSION_H -#include +#include namespace android { namespace build { -inline std::string_view GetBuildNumber() { - static constexpr char kBuildNumber[] = "@VCS_TAG@"; - return kBuildNumber; +std::string GetBuildNumber() { + return "@VCS_TAG@"; } } // namespace build diff --git a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/version.cpp b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/version.cpp index a2111122db..3e70c82715 100644 --- a/base/cvd/cuttlefish/host/commands/cvd/cli/commands/version.cpp +++ b/base/cvd/cuttlefish/host/commands/cvd/cli/commands/version.cpp @@ -48,7 +48,7 @@ class CvdVersionHandler : public CvdCommandHandler { fmt::print(std::cout, "major: {}\n", cvd::kVersionMajor); fmt::print(std::cout, "minor: {}\n", cvd::kVersionMinor); - std::string_view build = android::build::GetBuildNumber(); + const std::string build = android::build::GetBuildNumber(); if (!build.empty()) { fmt::print(std::cout, "build: {}\n", build); }