Add dist support to Soong

When dist'ing a library or binary that has use_version_lib set, always
distribute the stamped version, even for the device.

Test: m test_build_version_test dist
Change-Id: I2995ec516b1d182ce18f099aeaa4d186ffbcf01f
This commit is contained in:
Dan Willemsen
2018-11-19 09:33:29 -08:00
parent bba551c1fa
commit 569edc5f66
7 changed files with 187 additions and 16 deletions

View File

@@ -23,9 +23,19 @@
namespace android {
namespace build {
#define PLACEHOLDER "SOONG BUILD NUMBER PLACEHOLDER"
extern "C" {
char soong_build_number[128] = PLACEHOLDER;
}
#ifdef __ANDROID__
std::string GetBuildNumber() {
if (strcmp(PLACEHOLDER, soong_build_number) != 0) {
return soong_build_number;
}
const prop_info* pi = __system_property_find("ro.build.version.incremental");
if (pi == nullptr) return "";
@@ -42,10 +52,6 @@ std::string GetBuildNumber() {
#else
extern "C" {
char soong_build_number[128] = "SOONG BUILD NUMBER PLACEHOLDER";
}
std::string GetBuildNumber() {
return soong_build_number;
}