From 7f592a8a35fa1079c3100da489348d3cdfb28e9d Mon Sep 17 00:00:00 2001 From: Jeremy Meyer Date: Mon, 1 Nov 2021 21:06:20 +0000 Subject: [PATCH] Dont include day/time or ldap for eng aapt2 builds Previously, eng builds included a fingerprint that was a combination of the developers ldap, the date, and the time. This meant that the build system (including RBE) couldn't cache the ouput of aapt. This removes the ldap, day, and time part of that so that caching will work. Fixes: 200741997 Test: ran `aapt2 version` to verify the updated format Change-Id: Id0d1ff99c8fbbf18261d3fc06f21b2969ed2e247 --- tools/aapt2/util/Util.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/aapt2/util/Util.cpp b/tools/aapt2/util/Util.cpp index 44b4ec13b2f1a..efbbf8ebe013f 100644 --- a/tools/aapt2/util/Util.cpp +++ b/tools/aapt2/util/Util.cpp @@ -22,9 +22,9 @@ #include #include "android-base/stringprintf.h" +#include "android-base/strings.h" #include "androidfw/StringPiece.h" #include "build/version.h" - #include "text/Unicode.h" #include "text/Utf8Iterator.h" #include "util/BigBuffer.h" @@ -231,7 +231,14 @@ std::string GetToolFingerprint() { static const char* const sMinorVersion = "19"; // The build id of aapt2 binary. - static const std::string sBuildId = android::build::GetBuildNumber(); + static std::string sBuildId = android::build::GetBuildNumber(); + + if (android::base::StartsWith(sBuildId, "eng.")) { + time_t now = time(0); + tm* ltm = localtime(&now); + + sBuildId = android::base::StringPrintf("eng.%d%d", 1900 + ltm->tm_year, 1 + ltm->tm_mon); + } return android::base::StringPrintf("%s.%s-%s", sMajorVersion, sMinorVersion, sBuildId.c_str()); }