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
This commit is contained in:
Jeremy Meyer
2021-11-01 21:06:20 +00:00
parent 684a3c8fd8
commit 7f592a8a35

View File

@@ -22,9 +22,9 @@
#include <vector>
#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());
}