Merge "Remove `use_apex_name_macro`"
diff --git a/android/arch.go b/android/arch.go
index 54242e5..5e3e920 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -1587,10 +1587,12 @@
return PrefixInList(arch.Abi, "arm")
}
-// hasArmArch returns true if targets has at least non-native_bridge arm Android arch
+// hasArmAndroidArch returns true if targets has at least
+// one arm Android arch (possibly native bridged)
func hasArmAndroidArch(targets []Target) bool {
for _, target := range targets {
- if target.Os == Android && target.Arch.ArchType == Arm {
+ if target.Os == Android &&
+ (target.Arch.ArchType == Arm || target.Arch.ArchType == Arm64) {
return true
}
}
@@ -2006,17 +2008,10 @@
osToProp := ArchVariantProperties{}
archOsToProp := ArchVariantProperties{}
- var linuxStructs, bionicStructs []reflect.Value
- var ok bool
-
- linuxStructs, ok = getTargetStructs(ctx, archProperties, "Linux")
- if !ok {
- linuxStructs = make([]reflect.Value, 0)
- }
- bionicStructs, ok = getTargetStructs(ctx, archProperties, "Bionic")
- if !ok {
- bionicStructs = make([]reflect.Value, 0)
- }
+ linuxStructs := getTargetStructs(ctx, archProperties, "Linux")
+ bionicStructs := getTargetStructs(ctx, archProperties, "Bionic")
+ hostStructs := getTargetStructs(ctx, archProperties, "Host")
+ hostNotWindowsStructs := getTargetStructs(ctx, archProperties, "Not_windows")
// For android, linux, ...
for _, os := range osTypeList {
@@ -2025,9 +2020,10 @@
continue
}
osStructs := make([]reflect.Value, 0)
- osSpecificStructs, ok := getTargetStructs(ctx, archProperties, os.Field)
- if ok {
- osStructs = append(osStructs, osSpecificStructs...)
+
+ osSpecificStructs := getTargetStructs(ctx, archProperties, os.Field)
+ if os.Class == Host {
+ osStructs = append(osStructs, hostStructs...)
}
if os.Linux() {
osStructs = append(osStructs, linuxStructs...)
@@ -2035,37 +2031,44 @@
if os.Bionic() {
osStructs = append(osStructs, bionicStructs...)
}
+
+ if os == LinuxMusl {
+ osStructs = append(osStructs, getTargetStructs(ctx, archProperties, "Musl")...)
+ }
+ if os == Linux {
+ osStructs = append(osStructs, getTargetStructs(ctx, archProperties, "Glibc")...)
+ }
+
+ osStructs = append(osStructs, osSpecificStructs...)
+
+ if os.Class == Host && os != Windows {
+ osStructs = append(osStructs, hostNotWindowsStructs...)
+ }
osToProp[os.Name] = mergeStructs(ctx, osStructs, propertySet)
// For arm, x86, ...
for _, arch := range osArchTypeMap[os] {
osArchStructs := make([]reflect.Value, 0)
- targetField := GetCompoundTargetField(os, arch)
- targetName := fmt.Sprintf("%s_%s", os.Name, arch.Name)
- targetStructs, ok := getTargetStructs(ctx, archProperties, targetField)
- if ok {
- osArchStructs = append(osArchStructs, targetStructs...)
- }
-
// Auto-combine with Linux_ and Bionic_ targets. This potentially results in
// repetition and select() bloat, but use of Linux_* and Bionic_* targets is rare.
// TODO(b/201423152): Look into cleanup.
if os.Linux() {
targetField := "Linux_" + arch.Name
- targetStructs, ok := getTargetStructs(ctx, archProperties, targetField)
- if ok {
- osArchStructs = append(osArchStructs, targetStructs...)
- }
+ targetStructs := getTargetStructs(ctx, archProperties, targetField)
+ osArchStructs = append(osArchStructs, targetStructs...)
}
if os.Bionic() {
targetField := "Bionic_" + arch.Name
- targetStructs, ok := getTargetStructs(ctx, archProperties, targetField)
- if ok {
- osArchStructs = append(osArchStructs, targetStructs...)
- }
+ targetStructs := getTargetStructs(ctx, archProperties, targetField)
+ osArchStructs = append(osArchStructs, targetStructs...)
}
+ targetField := GetCompoundTargetField(os, arch)
+ targetName := fmt.Sprintf("%s_%s", os.Name, arch.Name)
+ targetStructs := getTargetStructs(ctx, archProperties, targetField)
+ osArchStructs = append(osArchStructs, targetStructs...)
+
archOsToProp[targetName] = mergeStructs(ctx, osArchStructs, propertySet)
}
}
@@ -2089,8 +2092,8 @@
// }
// }
// This would return a BaseCompilerProperties with BaseCompilerProperties.Srcs = ["foo.c"]
-func getTargetStructs(ctx ArchVariantContext, archProperties []interface{}, targetName string) ([]reflect.Value, bool) {
- propertyStructs := make([]reflect.Value, 0)
+func getTargetStructs(ctx ArchVariantContext, archProperties []interface{}, targetName string) []reflect.Value {
+ var propertyStructs []reflect.Value
for _, archProperty := range archProperties {
archPropValues := reflect.ValueOf(archProperty).Elem()
targetProp := archPropValues.FieldByName("Target").Elem()
@@ -2098,11 +2101,11 @@
if ok {
propertyStructs = append(propertyStructs, targetStruct)
} else {
- return propertyStructs, false
+ return []reflect.Value{}
}
}
- return propertyStructs, true
+ return propertyStructs
}
func mergeStructs(ctx ArchVariantContext, propertyStructs []reflect.Value, propertySet interface{}) interface{} {
diff --git a/androidmk/androidmk/android.go b/androidmk/androidmk/android.go
index 963e905..f3ad152 100644
--- a/androidmk/androidmk/android.go
+++ b/androidmk/androidmk/android.go
@@ -639,6 +639,12 @@
if len(val.Variables) == 1 && varLiteralName(val.Variables[0]) != "" && len(val.Strings) == 2 && val.Strings[0] == "" {
fixed = val.Strings[1]
varname = val.Variables[0].Name.Strings[0]
+ // TARGET_OUT_OPTIONAL_EXECUTABLES puts the artifact in xbin, which is
+ // deprecated. TARGET_OUT_DATA_APPS install location will be handled
+ // automatically by Soong
+ if varname == "TARGET_OUT_OPTIONAL_EXECUTABLES" || varname == "TARGET_OUT_DATA_APPS" {
+ return nil
+ }
} else if len(val.Variables) == 2 && varLiteralName(val.Variables[0]) == "PRODUCT_OUT" && varLiteralName(val.Variables[1]) == "TARGET_COPY_OUT_VENDOR" &&
len(val.Strings) == 3 && val.Strings[0] == "" && val.Strings[1] == "/" {
fixed = val.Strings[2]
diff --git a/androidmk/androidmk/androidmk_test.go b/androidmk/androidmk/androidmk_test.go
index 9fd4ff9..775a9a8 100644
--- a/androidmk/androidmk/androidmk_test.go
+++ b/androidmk/androidmk/androidmk_test.go
@@ -1516,7 +1516,23 @@
],
}
`,
- },
+ }, {
+ desc: "Obsolete LOCAL_MODULE_PATH",
+ in: `
+include $(CLEAR_VARS)
+LOCAL_MODULE := foo
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
+LOCAL_CTS_TEST_PACKAGE := bar
+LOCAL_USE_AAPT2 := blah
+include $(BUILD_PACKAGE)
+`,
+ expected: `
+android_app {
+ name: "foo",
+
+}
+`},
}
func TestEndToEnd(t *testing.T) {
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 49a83c3..78a6bb8 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -8259,6 +8259,75 @@
`)
}
+func TestAndroidMk_DexpreoptBuiltInstalledForApex(t *testing.T) {
+ ctx := testApex(t, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ updatable: false,
+ java_libs: ["foo"],
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+
+ java_library {
+ name: "foo",
+ srcs: ["foo.java"],
+ apex_available: ["myapex"],
+ installable: true,
+ }
+ `,
+ dexpreopt.FixtureSetApexSystemServerJars("myapex:foo"),
+ )
+
+ apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle)
+ data := android.AndroidMkDataForTest(t, ctx, apexBundle)
+ var builder strings.Builder
+ data.Custom(&builder, apexBundle.BaseModuleName(), "TARGET_", "", data)
+ androidMk := builder.String()
+ ensureContains(t, androidMk, "LOCAL_REQUIRED_MODULES += foo-dexpreopt-arm64-apex@myapex@javalib@foo.jar@classes.odex foo-dexpreopt-arm64-apex@myapex@javalib@foo.jar@classes.vdex")
+}
+
+func TestAndroidMk_DexpreoptBuiltInstalledForApex_Prebuilt(t *testing.T) {
+ ctx := testApex(t, `
+ prebuilt_apex {
+ name: "myapex",
+ arch: {
+ arm64: {
+ src: "myapex-arm64.apex",
+ },
+ arm: {
+ src: "myapex-arm.apex",
+ },
+ },
+ exported_java_libs: ["foo"],
+ }
+
+ java_import {
+ name: "foo",
+ jars: ["foo.jar"],
+ installable: true,
+ }
+ `,
+ dexpreopt.FixtureSetApexSystemServerJars("myapex:foo"),
+ )
+
+ prebuilt := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*Prebuilt)
+ entriesList := android.AndroidMkEntriesForTest(t, ctx, prebuilt)
+ mainModuleEntries := entriesList[0]
+ android.AssertArrayString(t,
+ "LOCAL_REQUIRED_MODULES",
+ mainModuleEntries.EntryMap["LOCAL_REQUIRED_MODULES"],
+ []string{
+ "foo-dexpreopt-arm64-apex@myapex@javalib@foo.jar@classes.odex",
+ "foo-dexpreopt-arm64-apex@myapex@javalib@foo.jar@classes.vdex",
+ })
+}
+
func TestMain(m *testing.M) {
os.Exit(m.Run())
}
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index 53ef4d7..61e7a0b 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -264,17 +264,6 @@
// we need to remove the suffix from LOCAL_MODULE_STEM, otherwise
// we will have foo.jar.jar
entries.SetString("LOCAL_MODULE_STEM", strings.TrimSuffix(fi.stem(), ".jar"))
- var classesJar android.Path
- var headerJar android.Path
- if javaModule, ok := fi.module.(java.ApexDependency); ok {
- classesJar = javaModule.ImplementationAndResourcesJars()[0]
- headerJar = javaModule.HeaderJars()[0]
- } else {
- classesJar = fi.builtFile
- headerJar = fi.builtFile
- }
- entries.SetString("LOCAL_SOONG_CLASSES_JAR", classesJar.String())
- entries.SetString("LOCAL_SOONG_HEADER_JAR", headerJar.String())
entries.SetString("LOCAL_SOONG_DEX_JAR", fi.builtFile.String())
entries.SetString("LOCAL_DEX_PREOPT", "false")
},
diff --git a/bazel/properties.go b/bazel/properties.go
index ee32e73..6a06c1b 100644
--- a/bazel/properties.go
+++ b/bazel/properties.go
@@ -164,48 +164,36 @@
// Subtract needle from haystack
func SubtractStrings(haystack []string, needle []string) []string {
// This is really a set
- remainder := make(map[string]bool)
-
- for _, s := range haystack {
- remainder[s] = true
- }
+ needleMap := make(map[string]bool)
for _, s := range needle {
- delete(remainder, s)
+ needleMap[s] = true
}
var strings []string
- for s, _ := range remainder {
- strings = append(strings, s)
+ for _, s := range haystack {
+ if exclude := needleMap[s]; !exclude {
+ strings = append(strings, s)
+ }
}
- sort.SliceStable(strings, func(i, j int) bool {
- return strings[i] < strings[j]
- })
-
return strings
}
// Subtract needle from haystack
func SubtractBazelLabels(haystack []Label, needle []Label) []Label {
// This is really a set
- remainder := make(map[Label]bool)
-
- for _, label := range haystack {
- remainder[label] = true
- }
- for _, label := range needle {
- delete(remainder, label)
+ needleMap := make(map[Label]bool)
+ for _, s := range needle {
+ needleMap[s] = true
}
var labels []Label
- for label, _ := range remainder {
- labels = append(labels, label)
+ for _, label := range haystack {
+ if exclude := needleMap[label]; !exclude {
+ labels = append(labels, label)
+ }
}
- sort.SliceStable(labels, func(i, j int) bool {
- return labels[i].Label < labels[j].Label
- })
-
return labels
}
diff --git a/bp2build/build_conversion_test.go b/bp2build/build_conversion_test.go
index f14574c..ee1d862 100644
--- a/bp2build/build_conversion_test.go
+++ b/bp2build/build_conversion_test.go
@@ -223,6 +223,7 @@
func TestGenerateBazelTargetModules(t *testing.T) {
testCases := []bp2buildTestCase{
{
+ description: "string props",
blueprint: `custom {
name: "foo",
string_list_prop: ["a", "b"],
@@ -240,6 +241,7 @@
},
},
{
+ description: "control characters",
blueprint: `custom {
name: "control_characters",
string_list_prop: ["\t", "\n"],
@@ -257,6 +259,7 @@
},
},
{
+ description: "handles dep",
blueprint: `custom {
name: "has_dep",
arch_paths: [":dep"],
@@ -279,25 +282,98 @@
},
},
{
+ description: "arch-variant srcs",
blueprint: `custom {
name: "arch_paths",
arch: {
- x86: {
- arch_paths: ["abc"],
- },
+ x86: { arch_paths: ["x86.txt"] },
+ x86_64: { arch_paths: ["x86_64.txt"] },
+ arm: { arch_paths: ["arm.txt"] },
+ arm64: { arch_paths: ["arm64.txt"] },
+ },
+ target: {
+ linux: { arch_paths: ["linux.txt"] },
+ bionic: { arch_paths: ["bionic.txt"] },
+ host: { arch_paths: ["host.txt"] },
+ not_windows: { arch_paths: ["not_windows.txt"] },
+ android: { arch_paths: ["android.txt"] },
+ linux_musl: { arch_paths: ["linux_musl.txt"] },
+ musl: { arch_paths: ["musl.txt"] },
+ linux_glibc: { arch_paths: ["linux_glibc.txt"] },
+ glibc: { arch_paths: ["glibc.txt"] },
+ linux_bionic: { arch_paths: ["linux_bionic.txt"] },
+ darwin: { arch_paths: ["darwin.txt"] },
+ windows: { arch_paths: ["windows.txt"] },
+ },
+ multilib: {
+ lib32: { arch_paths: ["lib32.txt"] },
+ lib64: { arch_paths: ["lib64.txt"] },
},
bazel_module: { bp2build_available: true },
}`,
expectedBazelTargets: []string{`custom(
name = "arch_paths",
arch_paths = select({
- "//build/bazel/platforms/arch:x86": ["abc"],
+ "//build/bazel/platforms/arch:arm": [
+ "arm.txt",
+ "lib32.txt",
+ ],
+ "//build/bazel/platforms/arch:arm64": [
+ "arm64.txt",
+ "lib64.txt",
+ ],
+ "//build/bazel/platforms/arch:x86": [
+ "x86.txt",
+ "lib32.txt",
+ ],
+ "//build/bazel/platforms/arch:x86_64": [
+ "x86_64.txt",
+ "lib64.txt",
+ ],
+ "//conditions:default": [],
+ }) + select({
+ "//build/bazel/platforms/os:android": [
+ "linux.txt",
+ "bionic.txt",
+ "android.txt",
+ ],
+ "//build/bazel/platforms/os:darwin": [
+ "host.txt",
+ "darwin.txt",
+ "not_windows.txt",
+ ],
+ "//build/bazel/platforms/os:linux": [
+ "host.txt",
+ "linux.txt",
+ "glibc.txt",
+ "linux_glibc.txt",
+ "not_windows.txt",
+ ],
+ "//build/bazel/platforms/os:linux_bionic": [
+ "host.txt",
+ "linux.txt",
+ "bionic.txt",
+ "linux_bionic.txt",
+ "not_windows.txt",
+ ],
+ "//build/bazel/platforms/os:linux_musl": [
+ "host.txt",
+ "linux.txt",
+ "musl.txt",
+ "linux_musl.txt",
+ "not_windows.txt",
+ ],
+ "//build/bazel/platforms/os:windows": [
+ "host.txt",
+ "windows.txt",
+ ],
"//conditions:default": [],
}),
)`,
},
},
{
+ description: "arch-variant deps",
blueprint: `custom {
name: "has_dep",
arch: {
@@ -327,6 +403,7 @@
},
},
{
+ description: "embedded props",
blueprint: `custom {
name: "embedded_props",
embedded_prop: "abc",
@@ -339,6 +416,7 @@
},
},
{
+ description: "ptr to embedded props",
blueprint: `custom {
name: "ptr_to_embedded_props",
other_embedded_prop: "abc",
@@ -354,38 +432,40 @@
dir := "."
for _, testCase := range testCases {
- config := android.TestConfig(buildDir, nil, testCase.blueprint, nil)
- ctx := android.NewTestContext(config)
+ t.Run(testCase.description, func(t *testing.T) {
+ config := android.TestConfig(buildDir, nil, testCase.blueprint, nil)
+ ctx := android.NewTestContext(config)
- registerCustomModuleForBp2buildConversion(ctx)
+ registerCustomModuleForBp2buildConversion(ctx)
- _, errs := ctx.ParseFileList(dir, []string{"Android.bp"})
- if errored(t, testCase, errs) {
- continue
- }
- _, errs = ctx.ResolveDependencies(config)
- if errored(t, testCase, errs) {
- continue
- }
+ _, errs := ctx.ParseFileList(dir, []string{"Android.bp"})
+ if errored(t, testCase, errs) {
+ return
+ }
+ _, errs = ctx.ResolveDependencies(config)
+ if errored(t, testCase, errs) {
+ return
+ }
- codegenCtx := NewCodegenContext(config, *ctx.Context, Bp2Build)
- bazelTargets, err := generateBazelTargetsForDir(codegenCtx, dir)
- android.FailIfErrored(t, err)
+ codegenCtx := NewCodegenContext(config, *ctx.Context, Bp2Build)
+ bazelTargets, err := generateBazelTargetsForDir(codegenCtx, dir)
+ android.FailIfErrored(t, err)
- if actualCount, expectedCount := len(bazelTargets), len(testCase.expectedBazelTargets); actualCount != expectedCount {
- t.Errorf("Expected %d bazel target, got %d", expectedCount, actualCount)
- } else {
- for i, expectedBazelTarget := range testCase.expectedBazelTargets {
- actualBazelTarget := bazelTargets[i]
- if actualBazelTarget.content != expectedBazelTarget {
- t.Errorf(
- "Expected generated Bazel target to be '%s', got '%s'",
- expectedBazelTarget,
- actualBazelTarget.content,
- )
+ if actualCount, expectedCount := len(bazelTargets), len(testCase.expectedBazelTargets); actualCount != expectedCount {
+ t.Errorf("Expected %d bazel target, got %d", expectedCount, actualCount)
+ } else {
+ for i, expectedBazelTarget := range testCase.expectedBazelTargets {
+ actualBazelTarget := bazelTargets[i]
+ if actualBazelTarget.content != expectedBazelTarget {
+ t.Errorf(
+ "Expected generated Bazel target to be '%s', got '%s'",
+ expectedBazelTarget,
+ actualBazelTarget.content,
+ )
+ }
}
}
- }
+ })
}
}
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 76f83e7..653e8c7 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -133,8 +133,8 @@
"//conditions:default": [],
}) + select({
"//build/bazel/platforms/os:android": [
- "android.cpp",
"bionic.cpp",
+ "android.cpp",
],
"//build/bazel/platforms/os:darwin": ["darwin.cpp"],
"//build/bazel/platforms/os:linux": ["linux.cpp"],
@@ -1668,9 +1668,9 @@
name = "foo-lib",
srcs = ["base.cpp"] + select({
"//build/bazel/platforms/os:android": [
- "android.cpp",
- "bionic.cpp",
"linux.cpp",
+ "bionic.cpp",
+ "android.cpp",
],
"//build/bazel/platforms/os:darwin": ["darwin.cpp"],
"//build/bazel/platforms/os:linux": [
@@ -1678,8 +1678,8 @@
"linux_glibc.cpp",
],
"//build/bazel/platforms/os:linux_bionic": [
- "bionic.cpp",
"linux.cpp",
+ "bionic.cpp",
],
"//build/bazel/platforms/os:linux_musl": [
"linux.cpp",
@@ -1692,7 +1692,7 @@
}
-func TestCcLibraryCppStdWithGnuExtensions_ConvertstoCopt(t *testing.T) {
+func TestCcLibraryCppStdWithGnuExtensions_ConvertsToFeatureAttr(t *testing.T) {
type testCase struct {
cpp_std string
gnu_extensions string
@@ -1751,7 +1751,7 @@
}
bazelCppStdAttr := ""
if tc.bazel_cpp_std != "" {
- bazelCppStdAttr = fmt.Sprintf("\n copts = [\"-std=%s\"],", tc.bazel_cpp_std)
+ bazelCppStdAttr = fmt.Sprintf("\n cpp_std = \"%s\",", tc.bazel_cpp_std)
}
runCcLibraryTestCase(t, bp2buildTestCase{
@@ -1772,5 +1772,43 @@
name = "a",%s
)`, bazelCppStdAttr)},
})
+
+ runCcLibraryStaticTestCase(t, bp2buildTestCase{
+ description: fmt.Sprintf(
+ "cc_library_static with cpp_std: %s and gnu_extensions: %s", tc.cpp_std, tc.gnu_extensions),
+ moduleTypeUnderTest: "cc_library_static",
+ moduleTypeUnderTestFactory: cc.LibraryStaticFactory,
+ moduleTypeUnderTestBp2BuildMutator: cc.CcLibraryStaticBp2Build,
+ blueprint: soongCcLibraryPreamble + fmt.Sprintf(`
+cc_library_static {
+ name: "a",
+%s // cpp_std: *string
+%s // gnu_extensions: *bool
+ include_build_directory: false,
+}
+`, cppStdAttr, gnuExtensionsAttr),
+ expectedBazelTargets: []string{fmt.Sprintf(`cc_library_static(
+ name = "a",%s
+)`, bazelCppStdAttr)},
+ })
+
+ runCcLibrarySharedTestCase(t, bp2buildTestCase{
+ description: fmt.Sprintf(
+ "cc_library_shared with cpp_std: %s and gnu_extensions: %s", tc.cpp_std, tc.gnu_extensions),
+ moduleTypeUnderTest: "cc_library_shared",
+ moduleTypeUnderTestFactory: cc.LibrarySharedFactory,
+ moduleTypeUnderTestBp2BuildMutator: cc.CcLibrarySharedBp2Build,
+ blueprint: soongCcLibraryPreamble + fmt.Sprintf(`
+cc_library_shared {
+ name: "a",
+%s // cpp_std: *string
+%s // gnu_extensions: *bool
+ include_build_directory: false,
+}
+`, cppStdAttr, gnuExtensionsAttr),
+ expectedBazelTargets: []string{fmt.Sprintf(`cc_library_shared(
+ name = "a",%s
+)`, bazelCppStdAttr)},
+ })
}
}
diff --git a/bp2build/cc_library_static_conversion_test.go b/bp2build/cc_library_static_conversion_test.go
index f02ce4d..9f6f450 100644
--- a/bp2build/cc_library_static_conversion_test.go
+++ b/bp2build/cc_library_static_conversion_test.go
@@ -641,12 +641,12 @@
name = "foo_static",
srcs_c = ["common.c"] + select({
"//build/bazel/platforms/arch:arm": [
- "for-arm.c",
"not-for-x86.c",
+ "for-arm.c",
],
"//build/bazel/platforms/arch:x86": [
- "for-x86.c",
"not-for-arm.c",
+ "for-x86.c",
],
"//conditions:default": [
"not-for-arm.c",
@@ -691,28 +691,28 @@
name = "foo_static",
srcs_c = ["common.c"] + select({
"//build/bazel/platforms/arch:arm": [
- "for-arm.c",
"not-for-arm64.c",
"not-for-x86.c",
"not-for-x86_64.c",
+ "for-arm.c",
],
"//build/bazel/platforms/arch:arm64": [
- "for-arm64.c",
"not-for-arm.c",
"not-for-x86.c",
"not-for-x86_64.c",
+ "for-arm64.c",
],
"//build/bazel/platforms/arch:x86": [
- "for-x86.c",
"not-for-arm.c",
"not-for-arm64.c",
"not-for-x86_64.c",
+ "for-x86.c",
],
"//build/bazel/platforms/arch:x86_64": [
- "for-x86_64.c",
"not-for-arm.c",
"not-for-arm64.c",
"not-for-x86.c",
+ "for-x86_64.c",
],
"//conditions:default": [
"not-for-arm.c",
@@ -875,20 +875,20 @@
name = "foo_static2",
srcs_c = ["common.c"] + select({
"//build/bazel/platforms/arch:arm": [
- "for-lib32.c",
"not-for-lib64.c",
+ "for-lib32.c",
],
"//build/bazel/platforms/arch:arm64": [
- "for-lib64.c",
"not-for-lib32.c",
+ "for-lib64.c",
],
"//build/bazel/platforms/arch:x86": [
- "for-lib32.c",
"not-for-lib64.c",
+ "for-lib32.c",
],
"//build/bazel/platforms/arch:x86_64": [
- "for-lib64.c",
"not-for-lib32.c",
+ "for-lib64.c",
],
"//conditions:default": [
"not-for-lib32.c",
@@ -942,36 +942,36 @@
name = "foo_static3",
srcs_c = ["common.c"] + select({
"//build/bazel/platforms/arch:arm": [
+ "not-for-arm64.c",
+ "not-for-lib64.c",
+ "not-for-x86.c",
+ "not-for-x86_64.c",
"for-arm.c",
"for-lib32.c",
- "not-for-arm64.c",
- "not-for-lib64.c",
- "not-for-x86.c",
- "not-for-x86_64.c",
],
"//build/bazel/platforms/arch:arm64": [
- "for-arm64.c",
- "for-lib64.c",
"not-for-arm.c",
"not-for-lib32.c",
"not-for-x86.c",
"not-for-x86_64.c",
+ "for-arm64.c",
+ "for-lib64.c",
],
"//build/bazel/platforms/arch:x86": [
- "for-lib32.c",
- "for-x86.c",
"not-for-arm.c",
"not-for-arm64.c",
"not-for-lib64.c",
"not-for-x86_64.c",
+ "for-x86.c",
+ "for-lib32.c",
],
"//build/bazel/platforms/arch:x86_64": [
- "for-lib64.c",
- "for-x86_64.c",
"not-for-arm.c",
"not-for-arm64.c",
"not-for-lib32.c",
"not-for-x86.c",
+ "for-x86_64.c",
+ "for-lib64.c",
],
"//conditions:default": [
"not-for-arm.c",
@@ -1000,73 +1000,92 @@
"dep/Android.bp": `
genrule {
name: "generated_src_other_pkg",
- out: ["generated_src_other_pkg.cpp"],
cmd: "nothing to see here",
}
genrule {
name: "generated_hdr_other_pkg",
- out: ["generated_hdr_other_pkg.cpp"],
cmd: "nothing to see here",
}
genrule {
name: "generated_hdr_other_pkg_x86",
- out: ["generated_hdr_other_pkg_x86.cpp"],
+ cmd: "nothing to see here",
+}
+
+genrule {
+ name: "generated_hdr_other_pkg_android",
cmd: "nothing to see here",
}`,
},
blueprint: soongCcLibraryStaticPreamble + `
genrule {
name: "generated_src",
- out: ["generated_src.cpp"],
cmd: "nothing to see here",
}
genrule {
- name: "generated_src_x86",
- out: ["generated_src_x86.cpp"],
+ name: "generated_src_not_x86",
+ cmd: "nothing to see here",
+}
+
+genrule {
+ name: "generated_src_android",
cmd: "nothing to see here",
}
genrule {
name: "generated_hdr",
- out: ["generated_hdr.h"],
cmd: "nothing to see here",
}
cc_library_static {
- name: "foo_static3",
- srcs: ["common.cpp", "not-for-*.cpp"],
- exclude_srcs: ["not-for-everything.cpp"],
- generated_sources: ["generated_src", "generated_src_other_pkg"],
- generated_headers: ["generated_hdr", "generated_hdr_other_pkg"],
- arch: {
- x86: {
- srcs: ["for-x86.cpp"],
- exclude_srcs: ["not-for-x86.cpp"],
- generated_sources: ["generated_src_x86"],
- generated_headers: ["generated_hdr_other_pkg_x86"],
- },
- },
+ name: "foo_static3",
+ srcs: ["common.cpp", "not-for-*.cpp"],
+ exclude_srcs: ["not-for-everything.cpp"],
+ generated_sources: ["generated_src", "generated_src_other_pkg", "generated_src_not_x86"],
+ generated_headers: ["generated_hdr", "generated_hdr_other_pkg"],
+ arch: {
+ x86: {
+ srcs: ["for-x86.cpp"],
+ exclude_srcs: ["not-for-x86.cpp"],
+ generated_headers: ["generated_hdr_other_pkg_x86"],
+ exclude_generated_sources: ["generated_src_not_x86"],
+ },
+ },
+ target: {
+ android: {
+ generated_sources: ["generated_src_android"],
+ generated_headers: ["generated_hdr_other_pkg_android"],
+ },
+ },
+
include_build_directory: false,
}
`,
expectedBazelTargets: []string{`cc_library_static(
name = "foo_static3",
srcs = [
- "//dep:generated_hdr_other_pkg",
- "//dep:generated_src_other_pkg",
- ":generated_hdr",
- ":generated_src",
"common.cpp",
+ ":generated_hdr",
+ "//dep:generated_hdr_other_pkg",
+ ":generated_src",
+ "//dep:generated_src_other_pkg",
] + select({
"//build/bazel/platforms/arch:x86": [
- "//dep:generated_hdr_other_pkg_x86",
- ":generated_src_x86",
"for-x86.cpp",
+ "//dep:generated_hdr_other_pkg_x86",
],
- "//conditions:default": ["not-for-x86.cpp"],
+ "//conditions:default": [
+ "not-for-x86.cpp",
+ ":generated_src_not_x86",
+ ],
+ }) + select({
+ "//build/bazel/platforms/os:android": [
+ "//dep:generated_hdr_other_pkg_android",
+ ":generated_src_android",
+ ],
+ "//conditions:default": [],
}),
)`},
})
diff --git a/bp2build/cc_object_conversion_test.go b/bp2build/cc_object_conversion_test.go
index 63a0b8a..c4b276a 100644
--- a/bp2build/cc_object_conversion_test.go
+++ b/bp2build/cc_object_conversion_test.go
@@ -439,13 +439,13 @@
copts = ["-fno-addrsig"],
srcs = ["base.cpp"] + select({
"//build/bazel/platforms/os_arch:android_arm64": [
- "bionic_arm64.cpp",
"linux_arm64.cpp",
+ "bionic_arm64.cpp",
],
"//build/bazel/platforms/os_arch:android_x86": ["linux_x86.cpp"],
"//build/bazel/platforms/os_arch:linux_bionic_arm64": [
- "bionic_arm64.cpp",
"linux_arm64.cpp",
+ "bionic_arm64.cpp",
],
"//build/bazel/platforms/os_arch:linux_glibc_x86": ["linux_x86.cpp"],
"//build/bazel/platforms/os_arch:linux_musl_x86": ["linux_x86.cpp"],
diff --git a/bp2build/testing.go b/bp2build/testing.go
index 6c322ee..7c2f43a 100644
--- a/bp2build/testing.go
+++ b/bp2build/testing.go
@@ -283,7 +283,7 @@
return
}
- paths := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrcExcludes(ctx, m.props.Arch_paths, m.props.Arch_paths_exclude))
+ paths := bazel.LabelListAttribute{}
for axis, configToProps := range m.GetArchVariantProperties(ctx, &customProps{}) {
for config, props := range configToProps {
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 0b2c133..543394d 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -226,7 +226,10 @@
srcs bazel.LabelListAttribute
rtti bazel.BoolAttribute
- stl *string
+
+ // Not affected by arch variants
+ stl *string
+ cppStd *string
localIncludes bazel.StringListAttribute
absoluteIncludes bazel.StringListAttribute
@@ -242,6 +245,8 @@
var rtti bazel.BoolAttribute
var localIncludes bazel.StringListAttribute
var absoluteIncludes bazel.StringListAttribute
+ var stl *string = nil
+ var cppStd *string = nil
parseCommandLineFlags := func(soongFlags []string) []string {
var result []string
@@ -255,15 +260,22 @@
}
// Parse srcs from an arch or OS's props value.
- parseSrcs := func(baseCompilerProps *BaseCompilerProperties) bazel.LabelList {
+ parseSrcs := func(props *BaseCompilerProperties) (bazel.LabelList, bool) {
+ anySrcs := false
// Add srcs-like dependencies such as generated files.
// First create a LabelList containing these dependencies, then merge the values with srcs.
- generatedHdrsAndSrcs := baseCompilerProps.Generated_headers
- generatedHdrsAndSrcs = append(generatedHdrsAndSrcs, baseCompilerProps.Generated_sources...)
- generatedHdrsAndSrcsLabelList := android.BazelLabelForModuleDeps(ctx, generatedHdrsAndSrcs)
+ generatedHdrsAndSrcs := props.Generated_headers
+ generatedHdrsAndSrcs = append(generatedHdrsAndSrcs, props.Generated_sources...)
+ generatedHdrsAndSrcsLabelList := android.BazelLabelForModuleDepsExcludes(ctx, generatedHdrsAndSrcs, props.Exclude_generated_sources)
+ if len(generatedHdrsAndSrcs) > 0 || len(props.Exclude_generated_sources) > 0 {
+ anySrcs = true
+ }
- allSrcsLabelList := android.BazelLabelForModuleSrcExcludes(ctx, baseCompilerProps.Srcs, baseCompilerProps.Exclude_srcs)
- return bazel.AppendBazelLabelLists(allSrcsLabelList, generatedHdrsAndSrcsLabelList)
+ allSrcsLabelList := android.BazelLabelForModuleSrcExcludes(ctx, props.Srcs, props.Exclude_srcs)
+ if len(props.Srcs) > 0 || len(props.Exclude_srcs) > 0 {
+ anySrcs = true
+ }
+ return bazel.AppendBazelLabelLists(allSrcsLabelList, generatedHdrsAndSrcsLabelList), anySrcs
}
archVariantCompilerProps := module.GetArchVariantProperties(ctx, &BaseCompilerProperties{})
@@ -272,12 +284,10 @@
if baseCompilerProps, ok := props.(*BaseCompilerProperties); ok {
// If there's arch specific srcs or exclude_srcs, generate a select entry for it.
// TODO(b/186153868): do this for OS specific srcs and exclude_srcs too.
- if len(baseCompilerProps.Srcs) > 0 || len(baseCompilerProps.Exclude_srcs) > 0 {
- srcsList := parseSrcs(baseCompilerProps)
+ if srcsList, ok := parseSrcs(baseCompilerProps); ok {
srcs.SetSelectValue(axis, config, srcsList)
}
- var archVariantCopts []string
if axis == bazel.NoConfigAxis {
// If cpp_std is not specified, don't generate it in the
// BUILD file. For readability purposes, cpp_std and gnu_extensions are
@@ -289,11 +299,14 @@
// These transformations are shared with compiler.go.
cppStdVal := parseCppStd(baseCompilerProps.Cpp_std)
_, cppStdVal = maybeReplaceGnuToC(baseCompilerProps.Gnu_extensions, "", cppStdVal)
- archVariantCopts = append(archVariantCopts, "-std="+cppStdVal)
+ cppStd = &cppStdVal
} else if baseCompilerProps.Gnu_extensions != nil && !*baseCompilerProps.Gnu_extensions {
- archVariantCopts = append(archVariantCopts, "-std=c++17")
+ cppStdVal := "c++17"
+ cppStd = &cppStdVal
}
}
+
+ var archVariantCopts []string
archVariantCopts = append(archVariantCopts, parseCommandLineFlags(baseCompilerProps.Cflags)...)
archVariantAsflags := parseCommandLineFlags(baseCompilerProps.Asflags)
@@ -339,7 +352,6 @@
srcs, cSrcs, asSrcs := groupSrcsByExtension(ctx, srcs)
- var stl *string = nil
stlPropsByArch := module.GetArchVariantProperties(ctx, &StlProperties{})
for _, configToProps := range stlPropsByArch {
for _, props := range configToProps {
@@ -367,6 +379,7 @@
cppFlags: cppFlags,
rtti: rtti,
stl: stl,
+ cppStd: cppStd,
localIncludes: localIncludes,
absoluteIncludes: absoluteIncludes,
}
diff --git a/cc/config/global.go b/cc/config/global.go
index 5f41f9e..ba10491 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -77,10 +77,6 @@
// TODO: can we remove this now?
"-Wno-reserved-id-macro",
- // Workaround for ccache with clang.
- // See http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html.
- "-Wno-unused-command-line-argument",
-
// Force clang to always output color diagnostics. Ninja will strip the ANSI
// color codes if it is not running in a terminal.
"-fcolor-diagnostics",
@@ -329,6 +325,12 @@
// Default to zero initialization.
flags = append(flags, "-ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang")
}
+
+ // Workaround for ccache with clang.
+ // See http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html.
+ if ctx.Config().IsEnvTrue("USE_CCACHE") {
+ flags = append(flags, "-Wno-unused-command-line-argument")
+ }
return strings.Join(flags, " ")
})
diff --git a/cc/library.go b/cc/library.go
index 0cffd56..00e215b 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -248,7 +248,9 @@
Linkopts bazel.StringListAttribute
Use_libcrt bazel.BoolAttribute
Rtti bazel.BoolAttribute
- Stl *string
+
+ Stl *string
+ Cpp_std *string
// This is shared only.
Version_script bazel.LabelAttribute
@@ -328,6 +330,7 @@
Use_libcrt: linkerAttrs.useLibcrt,
Rtti: compilerAttrs.rtti,
Stl: compilerAttrs.stl,
+ Cpp_std: compilerAttrs.cppStd,
Version_script: linkerAttrs.versionScript,
@@ -2403,6 +2406,7 @@
Use_libcrt: linkerAttrs.useLibcrt,
Rtti: compilerAttrs.rtti,
Stl: compilerAttrs.stl,
+ Cpp_std: compilerAttrs.cppStd,
Export_includes: exportedIncludes.Includes,
Export_system_includes: exportedIncludes.SystemIncludes,
Local_includes: compilerAttrs.localIncludes,
@@ -2427,6 +2431,7 @@
Use_libcrt: linkerAttrs.useLibcrt,
Rtti: compilerAttrs.rtti,
Stl: compilerAttrs.stl,
+ Cpp_std: compilerAttrs.cppStd,
Export_includes: exportedIncludes.Includes,
Export_system_includes: exportedIncludes.SystemIncludes,
@@ -2462,6 +2467,7 @@
Use_libcrt bazel.BoolAttribute
Rtti bazel.BoolAttribute
Stl *string
+ Cpp_std *string
Export_includes bazel.StringListAttribute
Export_system_includes bazel.StringListAttribute
@@ -2489,6 +2495,7 @@
Use_libcrt bazel.BoolAttribute
Rtti bazel.BoolAttribute
Stl *string
+ Cpp_std *string
Export_includes bazel.StringListAttribute
Export_system_includes bazel.StringListAttribute
diff --git a/scripts/get_clang_version.py b/scripts/get_clang_version.py
index 64d922a..691c45d 100755
--- a/scripts/get_clang_version.py
+++ b/scripts/get_clang_version.py
@@ -34,7 +34,7 @@
with open(global_go) as infile:
contents = infile.read()
- regex_rev = r'\tClangDefaultVersion\s+= "(?P<rev>clang-r\d+[a-z]?\d?)"'
+ regex_rev = r'\tClangDefaultVersion\s+= "(?P<rev>clang-.*)"'
match_rev = re.search(regex_rev, contents)
if match_rev is None:
raise RuntimeError('Parsing clang info failed')
diff --git a/ui/build/config.go b/ui/build/config.go
index 5cd5c65..7837cc4 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -83,6 +83,8 @@
// Set by multiproduct_kati
emptyNinjaFile bool
+
+ metricsUploader string
}
const srcDirFileCheck = "build/soong/root.bp"
@@ -237,7 +239,8 @@
// Precondition: the current directory is the top of the source tree
checkTopDir(ctx)
- if srcDir := absPath(ctx, "."); strings.ContainsRune(srcDir, ' ') {
+ srcDir := absPath(ctx, ".")
+ if strings.ContainsRune(srcDir, ' ') {
ctx.Println("You are building in a directory whose absolute path contains a space character:")
ctx.Println()
ctx.Printf("%q\n", srcDir)
@@ -245,6 +248,8 @@
ctx.Fatalln("Directory names containing spaces are not supported")
}
+ ret.metricsUploader = GetMetricsUploader(srcDir, ret.environ)
+
if outDir := ret.OutDir(); strings.ContainsRune(outDir, ' ') {
ctx.Println("The absolute path of your output directory ($OUT_DIR) contains a space character:")
ctx.Println()
@@ -1246,10 +1251,7 @@
}
func (c *configImpl) MetricsUploaderApp() string {
- if p, ok := c.environ.Get("ANDROID_ENABLE_METRICS_UPLOAD"); ok {
- return p
- }
- return ""
+ return c.metricsUploader
}
// LogsDir returns the logs directory where build log and metrics
@@ -1277,3 +1279,14 @@
func (c *configImpl) EmptyNinjaFile() bool {
return c.emptyNinjaFile
}
+
+func GetMetricsUploader(topDir string, env *Environment) string {
+ if p, ok := env.Get("METRICS_UPLOADER"); ok {
+ metricsUploader := filepath.Join(topDir, p)
+ if _, err := os.Stat(metricsUploader); err == nil {
+ return metricsUploader
+ }
+ }
+
+ return ""
+}
diff --git a/ui/build/config_test.go b/ui/build/config_test.go
index 03d304e..e293275 100644
--- a/ui/build/config_test.go
+++ b/ui/build/config_test.go
@@ -1122,3 +1122,65 @@
})
}
}
+
+func TestGetMetricsUploaderApp(t *testing.T) {
+
+ metricsUploaderDir := "metrics_uploader_dir"
+ metricsUploaderBinary := "metrics_uploader_binary"
+ metricsUploaderPath := filepath.Join(metricsUploaderDir, metricsUploaderBinary)
+ tests := []struct {
+ description string
+ environ Environment
+ createFiles bool
+ expected string
+ }{{
+ description: "Uploader binary exist",
+ environ: Environment{"METRICS_UPLOADER=" + metricsUploaderPath},
+ createFiles: true,
+ expected: metricsUploaderPath,
+ }, {
+ description: "Uploader binary not exist",
+ environ: Environment{"METRICS_UPLOADER=" + metricsUploaderPath},
+ createFiles: false,
+ expected: "",
+ }, {
+ description: "Uploader binary variable not set",
+ createFiles: true,
+ expected: "",
+ }}
+
+ for _, tt := range tests {
+ t.Run(tt.description, func(t *testing.T) {
+ defer logger.Recover(func(err error) {
+ t.Fatalf("got unexpected error: %v", err)
+ })
+
+ // Create the root source tree.
+ topDir, err := ioutil.TempDir("", "")
+ if err != nil {
+ t.Fatalf("failed to create temp dir: %v", err)
+ }
+ defer os.RemoveAll(topDir)
+
+ expected := tt.expected
+ if len(expected) > 0 {
+ expected = filepath.Join(topDir, expected)
+ }
+
+ if tt.createFiles {
+ if err := os.MkdirAll(filepath.Join(topDir, metricsUploaderDir), 0755); err != nil {
+ t.Errorf("failed to create %s directory: %v", metricsUploaderDir, err)
+ }
+ if err := ioutil.WriteFile(filepath.Join(topDir, metricsUploaderPath), []byte{}, 0644); err != nil {
+ t.Errorf("failed to create file %s: %v", expected, err)
+ }
+ }
+
+ actual := GetMetricsUploader(topDir, &tt.environ)
+
+ if actual != expected {
+ t.Errorf("expecting: %s, actual: %s", expected, actual)
+ }
+ })
+ }
+}
diff --git a/ui/build/upload.go b/ui/build/upload.go
index 55ada33..687f519 100644
--- a/ui/build/upload.go
+++ b/ui/build/upload.go
@@ -70,12 +70,11 @@
return metricsFiles
}
-// UploadMetrics uploads a set of metrics files to a server for analysis. An
-// uploader full path is specified in ANDROID_ENABLE_METRICS_UPLOAD environment
-// variable in order to upload the set of metrics files. The metrics files are
-// first copied to a temporary directory and the uploader is then executed in
-// the background to allow the user/system to continue working. Soong communicates
-// to the uploader through the upload_proto raw protobuf file.
+// UploadMetrics uploads a set of metrics files to a server for analysis.
+// The metrics files are first copied to a temporary directory
+// and the uploader is then executed in the background to allow the user/system
+// to continue working. Soong communicates to the uploader through the
+// upload_proto raw protobuf file.
func UploadMetrics(ctx Context, config Config, simpleOutput bool, buildStarted time.Time, paths ...string) {
ctx.BeginTrace(metrics.RunSetupTool, "upload_metrics")
defer ctx.EndTrace()
diff --git a/ui/build/upload_test.go b/ui/build/upload_test.go
index b740c11..764a1e1 100644
--- a/ui/build/upload_test.go
+++ b/ui/build/upload_test.go
@@ -80,13 +80,10 @@
createFiles bool
files []string
}{{
- description: "ANDROID_ENABLE_METRICS_UPLOAD not set",
- }, {
- description: "no metrics files to upload",
- uploader: "fake",
+ description: "no metrics uploader",
}, {
description: "non-existent metrics files no upload",
- uploader: "fake",
+ uploader: "echo",
files: []string{"metrics_file_1", "metrics_file_2", "metrics_file_3"},
}, {
description: "trigger upload",
@@ -137,9 +134,9 @@
config := Config{&configImpl{
environ: &Environment{
"OUT_DIR=" + outDir,
- "ANDROID_ENABLE_METRICS_UPLOAD=" + tt.uploader,
},
- buildDateTime: strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10),
+ buildDateTime: strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10),
+ metricsUploader: tt.uploader,
}}
UploadMetrics(ctx, config, false, time.Now(), metricsFiles...)
@@ -192,9 +189,10 @@
config := Config{&configImpl{
environ: &Environment{
- "ANDROID_ENABLE_METRICS_UPLOAD=fake",
"OUT_DIR=/bad",
- }}}
+ },
+ metricsUploader: "echo",
+ }}
UploadMetrics(ctx, config, true, time.Now(), metricsFile)
t.Errorf("got nil, expecting %q as a failure", tt.expectedErr)
diff --git a/ui/metrics/metrics.go b/ui/metrics/metrics.go
index ccf9bd8..f1bb862 100644
--- a/ui/metrics/metrics.go
+++ b/ui/metrics/metrics.go
@@ -25,16 +25,11 @@
// that captures the metrics and is them added as a perfInfo into the set
// of the collected metrics. Finally, when soong_ui has finished the build,
// the defer Dump function is invoked to store the collected metrics to the
-// raw protobuf file in the $OUT directory.
-//
-// There is one additional step that occurs after the raw protobuf file is written.
-// If the configuration environment variable ANDROID_ENABLE_METRICS_UPLOAD is
-// set with the path, the raw protobuf file is uploaded to the destination. See
-// ui/build/upload.go for more details. The filename of the raw protobuf file
-// and the list of files to be uploaded is defined in cmd/soong_ui/main.go.
-//
-// See ui/metrics/event.go for the explanation of what an event is and how
-// the metrics system is a stack based system.
+// raw protobuf file in the $OUT directory and this raw protobuf file will be
+// uploaded to the destination. See ui/build/upload.go for more details. The
+// filename of the raw protobuf file and the list of files to be uploaded is
+// defined in cmd/soong_ui/main.go. See ui/metrics/event.go for the explanation
+// of what an event is and how the metrics system is a stack based system.
import (
"io/ioutil"