Merge changes from topic "afdo-in-cc-rules"
* changes:
Change out path to android_target-opt in bazel integration tests
Add check for handcrafted BUILD file in bp2build
Add bp2build conversion to reference to fdo_profile targets
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index fce8d7b..7134c7b 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -731,7 +731,7 @@
"platform_tools_properties", "build_tools_source_properties", // TODO(b/203369847): multiple genrules in the same package creating the same file
// aar support
- "prebuilt_car-ui-androidx-core-common", // TODO(b/224773339), genrule dependency creates an .aar, not a .jar
+ "prebuilt_car-ui-androidx-core-common", // TODO(b/224773339), genrule dependency creates an .aar, not a .jar
// ERROR: The dependencies for the following 1 jar(s) are not complete.
// 1.bazel-out/android_target-fastbuild/bin/prebuilts/tools/common/m2/_aar/robolectric-monitor-1.0.2-alpha1/classes_and_libs_merged.jar
"prebuilt_robolectric-monitor-1.0.2-alpha1",
@@ -1359,5 +1359,8 @@
// Staging-mode allowlist. Modules in this list are only built
// by Bazel with --bazel-mode-staging. This list should contain modules
// which will soon be added to the prod allowlist.
- StagingMixedBuildsEnabledList = []string{"com.android.tzdata"}
+ StagingMixedBuildsEnabledList = []string{
+ "com.android.adbd",
+ "com.android.tzdata",
+ }
)
diff --git a/apex/apex.go b/apex/apex.go
index 25de1ee..01e4f12 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -3087,31 +3087,7 @@
// Module separator
//
m["com.android.btservices"] = []string{
- "bluetooth-protos-lite",
- "internal_include_headers",
- "libaudio-a2dp-hw-utils",
- "libaudio-hearing-aid-hw-utils",
- "libbluetooth",
- "libbluetooth-types",
- "libbluetooth-types-header",
- "libbluetooth_gd",
- "libbluetooth_headers",
- "libbluetooth_jni",
- "libbt-audio-hal-interface",
- "libbt-bta",
- "libbt-common",
- "libbt-hci",
- "libbt-platform-protos-lite",
- "libbt-protos-lite",
- "libbt-sbc-decoder",
- "libbt-sbc-encoder",
- "libbt-stack",
- "libbt-utils",
- "libbtcore",
- "libbtdevice",
- "libbte",
- "libbtif",
- "libchrome",
+ // empty
}
//
// Module separator
diff --git a/apex/deapexer.go b/apex/deapexer.go
index 8c9030a..fed9cd1 100644
--- a/apex/deapexer.go
+++ b/apex/deapexer.go
@@ -140,6 +140,8 @@
Tool(android.PathForSource(ctx, "build/soong/scripts/unpack-prebuilt-apex.sh")).
BuiltTool("deapexer").
BuiltTool("debugfs").
+ BuiltTool("blkid").
+ BuiltTool("fsck.erofs").
Input(p.inputApex).
Text(deapexerOutput.String())
for _, p := range exportedPaths {
diff --git a/bazel/properties.go b/bazel/properties.go
index ee9609a..6921984 100644
--- a/bazel/properties.go
+++ b/bazel/properties.go
@@ -1207,6 +1207,11 @@
// The configured attribute label list Values. Optional
// a map of independent configurability axes
ConfigurableValues configurableStringLists
+
+ // If a property has struct tag "variant_prepend", this value should
+ // be set to True, so that when bp2build generates BUILD.bazel, variant
+ // properties(select ...) come before general properties.
+ Prepend bool
}
// IsEmpty returns true if the attribute has no values under any configuration.
@@ -1273,6 +1278,9 @@
// Append appends all values, including os and arch specific ones, from another
// StringListAttribute to this StringListAttribute
func (sla *StringListAttribute) Append(other StringListAttribute) *StringListAttribute {
+ if sla.Prepend != other.Prepend {
+ panic(fmt.Errorf("StringListAttribute could not be appended because it has different prepend value"))
+ }
sla.Value = append(sla.Value, other.Value...)
if sla.ConfigurableValues == nil {
sla.ConfigurableValues = make(configurableStringLists)
diff --git a/bp2build/cc_binary_conversion_test.go b/bp2build/cc_binary_conversion_test.go
index 68dc383..8aa2c3e 100644
--- a/bp2build/cc_binary_conversion_test.go
+++ b/bp2build/cc_binary_conversion_test.go
@@ -789,82 +789,3 @@
},
})
}
-
-func TestCcBinaryWithIntegerOverflowProperty(t *testing.T) {
- runCcBinaryTestCase(t, ccBinaryBp2buildTestCase{
- description: "cc_binary with integer overflow property specified",
- blueprint: `
-{rule_name} {
- name: "foo",
- sanitize: {
- integer_overflow: true,
- },
-}`,
- targets: []testBazelTarget{
- {"cc_binary", "foo", AttrNameToString{
- "local_includes": `["."]`,
- "features": `["ubsan_integer_overflow"]`,
- }},
- },
- })
-}
-
-func TestCcBinaryWithMiscUndefinedProperty(t *testing.T) {
- runCcBinaryTestCase(t, ccBinaryBp2buildTestCase{
- description: "cc_binary with miscellaneous properties specified",
- blueprint: `
-{rule_name} {
- name: "foo",
- sanitize: {
- misc_undefined: ["undefined", "nullability"],
- },
-}`,
- targets: []testBazelTarget{
- {"cc_binary", "foo", AttrNameToString{
- "local_includes": `["."]`,
- "features": `[
- "ubsan_undefined",
- "ubsan_nullability",
- ]`,
- }},
- },
- })
-}
-
-func TestCcBinaryWithUBSanPropertiesArchSpecific(t *testing.T) {
- runCcBinaryTestCase(t, ccBinaryBp2buildTestCase{
- description: "cc_binary has correct feature select when UBSan props are specified in arch specific blocks",
- blueprint: `
-{rule_name} {
- name: "foo",
- sanitize: {
- misc_undefined: ["undefined", "nullability"],
- },
- target: {
- android: {
- sanitize: {
- misc_undefined: ["alignment"],
- },
- },
- linux_glibc: {
- sanitize: {
- integer_overflow: true,
- },
- },
- },
-}`,
- targets: []testBazelTarget{
- {"cc_binary", "foo", AttrNameToString{
- "local_includes": `["."]`,
- "features": `[
- "ubsan_undefined",
- "ubsan_nullability",
- ] + select({
- "//build/bazel/platforms/os:android": ["ubsan_alignment"],
- "//build/bazel/platforms/os:linux": ["ubsan_integer_overflow"],
- "//conditions:default": [],
- })`,
- }},
- },
- })
-}
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 416e129..ee6e5b8 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -3774,113 +3774,3 @@
},
)
}
-
-func TestCcLibraryWithIntegerOverflowProperty(t *testing.T) {
- runCcLibraryTestCase(t, Bp2buildTestCase{
- Description: "cc_library has correct features when integer_overflow property is provided",
- ModuleTypeUnderTest: "cc_library",
- ModuleTypeUnderTestFactory: cc.LibraryFactory,
- Blueprint: `
-cc_library {
- name: "foo",
- sanitize: {
- integer_overflow: true,
- },
-}
-`,
- ExpectedBazelTargets: []string{
- MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
- "features": `["ubsan_integer_overflow"]`,
- "local_includes": `["."]`,
- }),
- MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
- "features": `["ubsan_integer_overflow"]`,
- "local_includes": `["."]`,
- }),
- },
- })
-}
-
-func TestCcLibraryWithMiscUndefinedProperty(t *testing.T) {
- runCcLibraryTestCase(t, Bp2buildTestCase{
- Description: "cc_library has correct features when misc_undefined property is provided",
- ModuleTypeUnderTest: "cc_library",
- ModuleTypeUnderTestFactory: cc.LibraryFactory,
- Blueprint: `
-cc_library {
- name: "foo",
- sanitize: {
- misc_undefined: ["undefined", "nullability"],
- },
-}
-`,
- ExpectedBazelTargets: []string{
- MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
- "features": `[
- "ubsan_undefined",
- "ubsan_nullability",
- ]`,
- "local_includes": `["."]`,
- }),
- MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
- "features": `[
- "ubsan_undefined",
- "ubsan_nullability",
- ]`,
- "local_includes": `["."]`,
- }),
- },
- })
-}
-
-func TestCcLibraryWithUBSanPropertiesArchSpecific(t *testing.T) {
- runCcLibraryTestCase(t, Bp2buildTestCase{
- Description: "cc_library has correct feature select when UBSan props are specified in arch specific blocks",
- ModuleTypeUnderTest: "cc_library",
- ModuleTypeUnderTestFactory: cc.LibraryFactory,
- Blueprint: `
-cc_library {
- name: "foo",
- sanitize: {
- misc_undefined: ["undefined", "nullability"],
- },
- target: {
- android: {
- sanitize: {
- misc_undefined: ["alignment"],
- },
- },
- linux_glibc: {
- sanitize: {
- integer_overflow: true,
- },
- },
- },
-}
-`,
- ExpectedBazelTargets: []string{
- MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
- "features": `[
- "ubsan_undefined",
- "ubsan_nullability",
- ] + select({
- "//build/bazel/platforms/os:android": ["ubsan_alignment"],
- "//build/bazel/platforms/os:linux": ["ubsan_integer_overflow"],
- "//conditions:default": [],
- })`,
- "local_includes": `["."]`,
- }),
- MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
- "features": `[
- "ubsan_undefined",
- "ubsan_nullability",
- ] + select({
- "//build/bazel/platforms/os:android": ["ubsan_alignment"],
- "//build/bazel/platforms/os:linux": ["ubsan_integer_overflow"],
- "//conditions:default": [],
- })`,
- "local_includes": `["."]`,
- }),
- },
- })
-}
diff --git a/bp2build/cc_library_headers_conversion_test.go b/bp2build/cc_library_headers_conversion_test.go
index 7d9db6f..686c9d5 100644
--- a/bp2build/cc_library_headers_conversion_test.go
+++ b/bp2build/cc_library_headers_conversion_test.go
@@ -107,15 +107,15 @@
}`,
ExpectedBazelTargets: []string{
MakeBazelTarget("cc_library_headers", "foo_headers", AttrNameToString{
- "export_includes": `[
- "dir-1",
- "dir-2",
- ] + select({
+ "export_includes": `select({
"//build/bazel/platforms/arch:arm64": ["arch_arm64_exported_include_dir"],
"//build/bazel/platforms/arch:x86": ["arch_x86_exported_include_dir"],
"//build/bazel/platforms/arch:x86_64": ["arch_x86_64_exported_include_dir"],
"//conditions:default": [],
- })`,
+ }) + [
+ "dir-1",
+ "dir-2",
+ ]`,
"sdk_version": `"current"`,
"min_sdk_version": `"29"`,
}),
@@ -340,16 +340,16 @@
}`,
ExpectedBazelTargets: []string{
MakeBazelTarget("cc_library_headers", "foo_headers", AttrNameToString{
- "export_system_includes": `["shared_include_dir"] + select({
- "//build/bazel/platforms/arch:arm": ["arm_include_dir"],
- "//build/bazel/platforms/arch:x86_64": ["x86_64_include_dir"],
- "//conditions:default": [],
- }) + select({
+ "export_system_includes": `select({
"//build/bazel/platforms/os:android": ["android_include_dir"],
"//build/bazel/platforms/os:darwin": ["darwin_include_dir"],
"//build/bazel/platforms/os:linux": ["linux_include_dir"],
"//conditions:default": [],
- })`,
+ }) + select({
+ "//build/bazel/platforms/arch:arm": ["arm_include_dir"],
+ "//build/bazel/platforms/arch:x86_64": ["x86_64_include_dir"],
+ "//conditions:default": [],
+ }) + ["shared_include_dir"]`,
}),
},
})
diff --git a/bp2build/cc_library_shared_conversion_test.go b/bp2build/cc_library_shared_conversion_test.go
index 9b01b6f..7e1d111 100644
--- a/bp2build/cc_library_shared_conversion_test.go
+++ b/bp2build/cc_library_shared_conversion_test.go
@@ -886,85 +886,3 @@
},
})
}
-
-func TestCcLibrarySharedWithIntegerOverflowProperty(t *testing.T) {
- runCcLibrarySharedTestCase(t, Bp2buildTestCase{
- Description: "cc_library_shared has correct features when integer_overflow property is provided",
- Blueprint: `
-cc_library_shared {
- name: "foo",
- sanitize: {
- integer_overflow: true,
- },
-}
-`,
- ExpectedBazelTargets: []string{
- MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
- "features": `["ubsan_integer_overflow"]`,
- "local_includes": `["."]`,
- }),
- },
- })
-}
-
-func TestCcLibrarySharedWithMiscUndefinedProperty(t *testing.T) {
- runCcLibrarySharedTestCase(t, Bp2buildTestCase{
- Description: "cc_library_shared has correct features when misc_undefined property is provided",
- Blueprint: `
-cc_library_shared {
- name: "foo",
- sanitize: {
- misc_undefined: ["undefined", "nullability"],
- },
-}
-`,
- ExpectedBazelTargets: []string{
- MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
- "features": `[
- "ubsan_undefined",
- "ubsan_nullability",
- ]`,
- "local_includes": `["."]`,
- }),
- },
- })
-}
-
-func TestCcLibrarySharedWithUBSanPropertiesArchSpecific(t *testing.T) {
- runCcLibrarySharedTestCase(t, Bp2buildTestCase{
- Description: "cc_library_shared has correct feature select when UBSan props are specified in arch specific blocks",
- Blueprint: `
-cc_library_shared {
- name: "foo",
- sanitize: {
- misc_undefined: ["undefined", "nullability"],
- },
- target: {
- android: {
- sanitize: {
- misc_undefined: ["alignment"],
- },
- },
- linux_glibc: {
- sanitize: {
- integer_overflow: true,
- },
- },
- },
-}
-`,
- ExpectedBazelTargets: []string{
- MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
- "features": `[
- "ubsan_undefined",
- "ubsan_nullability",
- ] + select({
- "//build/bazel/platforms/os:android": ["ubsan_alignment"],
- "//build/bazel/platforms/os:linux": ["ubsan_integer_overflow"],
- "//conditions:default": [],
- })`,
- "local_includes": `["."]`,
- }),
- },
- })
-}
diff --git a/bp2build/cc_library_static_conversion_test.go b/bp2build/cc_library_static_conversion_test.go
index cac7f9b..b47d1f1 100644
--- a/bp2build/cc_library_static_conversion_test.go
+++ b/bp2build/cc_library_static_conversion_test.go
@@ -1723,85 +1723,3 @@
},
})
}
-
-func TestCcLibraryStaticWithIntegerOverflowProperty(t *testing.T) {
- runCcLibraryStaticTestCase(t, Bp2buildTestCase{
- Description: "cc_library_static has correct features when integer_overflow property is provided",
- Blueprint: `
-cc_library_static {
- name: "foo",
- sanitize: {
- integer_overflow: true,
- },
-}
-`,
- ExpectedBazelTargets: []string{
- MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
- "features": `["ubsan_integer_overflow"]`,
- "local_includes": `["."]`,
- }),
- },
- })
-}
-
-func TestCcLibraryStaticWithMiscUndefinedProperty(t *testing.T) {
- runCcLibraryStaticTestCase(t, Bp2buildTestCase{
- Description: "cc_library_static has correct features when misc_undefined property is provided",
- Blueprint: `
-cc_library_static {
- name: "foo",
- sanitize: {
- misc_undefined: ["undefined", "nullability"],
- },
-}
-`,
- ExpectedBazelTargets: []string{
- MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
- "features": `[
- "ubsan_undefined",
- "ubsan_nullability",
- ]`,
- "local_includes": `["."]`,
- }),
- },
- })
-}
-
-func TestCcLibraryStaticWithUBSanPropertiesArchSpecific(t *testing.T) {
- runCcLibraryStaticTestCase(t, Bp2buildTestCase{
- Description: "cc_library_static has correct feature select when UBSan props are specified in arch specific blocks",
- Blueprint: `
-cc_library_static {
- name: "foo",
- sanitize: {
- misc_undefined: ["undefined", "nullability"],
- },
- target: {
- android: {
- sanitize: {
- misc_undefined: ["alignment"],
- },
- },
- linux_glibc: {
- sanitize: {
- integer_overflow: true,
- },
- },
- },
-}
-`,
- ExpectedBazelTargets: []string{
- MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
- "features": `[
- "ubsan_undefined",
- "ubsan_nullability",
- ] + select({
- "//build/bazel/platforms/os:android": ["ubsan_alignment"],
- "//build/bazel/platforms/os:linux": ["ubsan_integer_overflow"],
- "//conditions:default": [],
- })`,
- "local_includes": `["."]`,
- }),
- },
- })
-}
diff --git a/bp2build/configurability.go b/bp2build/configurability.go
index 9398d12..112755b 100644
--- a/bp2build/configurability.go
+++ b/bp2build/configurability.go
@@ -37,10 +37,11 @@
return value, []selects{ret}
}
-func getStringListValues(list bazel.StringListAttribute) (reflect.Value, []selects) {
+func getStringListValues(list bazel.StringListAttribute) (reflect.Value, []selects, bool) {
value := reflect.ValueOf(list.Value)
+ prepend := reflect.ValueOf(list.Prepend).Bool()
if !list.HasConfigurableValues() {
- return value, []selects{}
+ return value, []selects{}, prepend
}
var ret []selects
@@ -56,7 +57,7 @@
}
}
- return value, ret
+ return value, ret, prepend
}
func getLabelValue(label bazel.LabelAttribute) (reflect.Value, []selects) {
@@ -156,6 +157,7 @@
func prettyPrintAttribute(v bazel.Attribute, indent int) (string, error) {
var value reflect.Value
var configurableAttrs []selects
+ var prepend bool
var defaultSelectValue *string
var emitZeroValues bool
// If true, print the default attribute value, even if the attribute is zero.
@@ -168,7 +170,7 @@
value, configurableAttrs = getStringValue(list)
defaultSelectValue = &bazelNone
case bazel.StringListAttribute:
- value, configurableAttrs = getStringListValues(list)
+ value, configurableAttrs, prepend = getStringListValues(list)
defaultSelectValue = &emptyBazelList
case bazel.LabelListAttribute:
value, configurableAttrs = getLabelListValues(list)
@@ -203,22 +205,28 @@
ret += s
}
- // Convenience function to append selects components to an attribute value.
- appendSelects := func(selectsData selects, defaultValue *string, s string) (string, error) {
+ // Convenience function to prepend/append selects components to an attribute value.
+ concatenateSelects := func(selectsData selects, defaultValue *string, s string, prepend bool) (string, error) {
selectMap, err := prettyPrintSelectMap(selectsData, defaultValue, indent, emitZeroValues)
if err != nil {
return "", err
}
- if s != "" && selectMap != "" {
- s += " + "
+ var left, right string
+ if prepend {
+ left, right = selectMap, s
+ } else {
+ left, right = s, selectMap
}
- s += selectMap
+ if left != "" && right != "" {
+ left += " + "
+ }
+ left += right
- return s, nil
+ return left, nil
}
for _, configurableAttr := range configurableAttrs {
- ret, err = appendSelects(configurableAttr, defaultSelectValue, ret)
+ ret, err = concatenateSelects(configurableAttr, defaultSelectValue, ret, prepend)
if err != nil {
return "", err
}
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 3cd0b1a..16ab791 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -341,7 +341,7 @@
compilerAttributes
linkerAttributes
- // A combination of compilerAttributes.features and linkerAttributes.features, as well as sanitizer features
+ // A combination of compilerAttributes.features and linkerAttributes.features
features bazel.StringListAttribute
protoDependency *bazel.LabelAttribute
aidlDependency *bazel.LabelAttribute
@@ -790,7 +790,7 @@
(&linkerAttrs).wholeArchiveDeps.Add(bp2buildCcSysprop(ctx, module.Name(), module.Properties.Min_sdk_version, compilerAttrs.syspropSrcs))
}
- features := compilerAttrs.features.Clone().Append(linkerAttrs.features).Append(bp2buildSanitizerFeatures(ctx, module))
+ features := compilerAttrs.features.Clone().Append(linkerAttrs.features)
features.DeduplicateAxesFromBase()
return baseAttributes{
@@ -1301,6 +1301,13 @@
} else {
exported = BazelIncludes{}
}
+
+ // cc library Export_include_dirs and Export_system_include_dirs are marked
+ // "variant_prepend" in struct tag, set their prepend property to true to make
+ // sure bp2build generates correct result.
+ exported.Includes.Prepend = true
+ exported.SystemIncludes.Prepend = true
+
bp2BuildPropParseHelper(ctx, module, &FlagExporterProperties{}, func(axis bazel.ConfigurationAxis, config string, props interface{}) {
if flagExporterProperties, ok := props.(*FlagExporterProperties); ok {
if len(flagExporterProperties.Export_include_dirs) > 0 {
@@ -1408,20 +1415,3 @@
return attrs
}
-
-func bp2buildSanitizerFeatures(ctx android.BazelConversionPathContext, m *Module) bazel.StringListAttribute {
- sanitizerFeatures := bazel.StringListAttribute{}
- bp2BuildPropParseHelper(ctx, m, &SanitizeProperties{}, func(axis bazel.ConfigurationAxis, config string, props interface{}) {
- var features []string
- if sanitizerProps, ok := props.(*SanitizeProperties); ok {
- if sanitizerProps.Sanitize.Integer_overflow != nil && *sanitizerProps.Sanitize.Integer_overflow {
- features = append(features, "ubsan_integer_overflow")
- }
- for _, sanitizer := range sanitizerProps.Sanitize.Misc_undefined {
- features = append(features, "ubsan_"+sanitizer)
- }
- sanitizerFeatures.SetSelectValue(axis, config, features)
- }
- })
- return sanitizerFeatures
-}
diff --git a/cc/cc.go b/cc/cc.go
index e07edeb..2ff5bba 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1859,11 +1859,7 @@
}
func (c *Module) IsMixedBuildSupported(ctx android.BaseModuleContext) bool {
- // TODO(b/261058727): Remove this (enable mised builds for modules with UBSan)
- ubsanEnabled := c.sanitize != nil &&
- ((c.sanitize.Properties.Sanitize.Integer_overflow != nil && *c.sanitize.Properties.Sanitize.Integer_overflow) ||
- c.sanitize.Properties.Sanitize.Misc_undefined != nil)
- return c.bazelHandler != nil && !ubsanEnabled
+ return c.bazelHandler != nil
}
func (c *Module) ProcessBazelQueryResponse(ctx android.ModuleContext) {
diff --git a/cmd/soong_ui/main.go b/cmd/soong_ui/main.go
index 8adc86f..928ae17 100644
--- a/cmd/soong_ui/main.go
+++ b/cmd/soong_ui/main.go
@@ -117,6 +117,7 @@
// Command is the type of soong_ui execution. Only one type of
// execution is specified. The args are specific to the command.
func main() {
+ //TODO(juu): Add logic to soong_ui to delete a hardcoded list of metrics files
shared.ReexecWithDelveMaybe(os.Getenv("SOONG_UI_DELVE"), shared.ResolveDelveBinary())
buildStarted := time.Now()
@@ -184,6 +185,7 @@
rbeMetricsFile := filepath.Join(logsDir, c.logsPrefix+"rbe_metrics.pb")
soongMetricsFile := filepath.Join(logsDir, c.logsPrefix+"soong_metrics")
bp2buildMetricsFile := filepath.Join(logsDir, c.logsPrefix+"bp2build_metrics.pb")
+ soongBuildMetricsFile := filepath.Join(logsDir, c.logsPrefix+"soong_build_metrics.pb")
build.PrintOutDirWarning(buildCtx, config)
@@ -211,6 +213,7 @@
files := []string{
buildErrorFile, // build error strings
rbeMetricsFile, // high level metrics related to remote build execution.
+ soongBuildMetricsFile, // high level metrics related to soong build(except bp2build).
bp2buildMetricsFile, // high level metrics related to bp2build.
soongMetricsFile, // high level metrics related to this build system.
config.BazelMetricsDir(), // directory that contains a set of bazel metrics.
@@ -219,7 +222,6 @@
if !config.SkipMetricsUpload() {
defer build.UploadMetrics(buildCtx, config, c.simpleOutput, buildStarted, files...)
}
-
defer met.Dump(soongMetricsFile)
defer build.CheckProdCreds(buildCtx, config)
}
diff --git a/java/lint.go b/java/lint.go
index 7a6e5d9..07b9629 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -366,6 +366,9 @@
}
}
+ l.extraLintCheckJars = append(l.extraLintCheckJars, android.PathForSource(ctx,
+ "prebuilts/cmdline-tools/AndroidGlobalLintChecker.jar"))
+
rule := android.NewRuleBuilder(pctx, ctx).
Sbox(android.PathForModuleOut(ctx, "lint"),
android.PathForModuleOut(ctx, "lint.sbox.textproto")).
diff --git a/java/testing.go b/java/testing.go
index ccbb638..e6f76e1 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -56,6 +56,8 @@
"build/make/target/product/security": nil,
// Required to generate Java used-by API coverage
"build/soong/scripts/gen_java_usedby_apex.sh": nil,
+ // Needed for the global lint checks provided from frameworks/base
+ "prebuilts/cmdline-tools/AndroidGlobalLintChecker.jar": nil,
}.AddToFixture(),
)
diff --git a/scripts/unpack-prebuilt-apex.sh b/scripts/unpack-prebuilt-apex.sh
index f34a480..b244f79 100755
--- a/scripts/unpack-prebuilt-apex.sh
+++ b/scripts/unpack-prebuilt-apex.sh
@@ -17,23 +17,28 @@
# limitations under the License.
# Tool to unpack an apex file and verify that the required files were extracted.
-if [ $# -lt 5 ]; then
- echo "usage: $0 <deapaxer_path> <debugfs_path> <apex file> <output_dir> <required_files>+" >&2
+if [ $# -lt 7 ]; then
+ echo "usage: $0 <deapaxer_path> <debugfs_path> <blkid_path> <fsck.erofs_path> <apex file> <output_dir> <required_files>+" >&2
exit 1
fi
DEAPEXER_PATH=$1
DEBUGFS_PATH=$2
-APEX_FILE=$3
-OUTPUT_DIR=$4
-shift 4
+BLKID_PATH=$3
+FSCK_EROFS_PATH=$4
+APEX_FILE=$5
+OUTPUT_DIR=$6
+shift 6
REQUIRED_PATHS=$@
rm -fr $OUTPUT_DIR
mkdir -p $OUTPUT_DIR
# Unpack the apex file contents.
-$DEAPEXER_PATH --debugfs_path $DEBUGFS_PATH extract $APEX_FILE $OUTPUT_DIR
+$DEAPEXER_PATH --debugfs_path $DEBUGFS_PATH \
+ --blkid_path $BLKID_PATH \
+ --fsckerofs_path $FSCK_EROFS_PATH \
+ extract $APEX_FILE $OUTPUT_DIR
# Verify that the files that the build expects to be in the .apex file actually
# exist, and make sure they have a fresh mtime to not confuse ninja.
diff --git a/ui/build/soong.go b/ui/build/soong.go
index b89ca20..370b1bc 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -566,11 +566,12 @@
targets = append(targets, config.SoongNinjaFile())
}
+ // TODO(juu): Stop embedding soong_build_metrics in soong_metrics.
+ soongBuildMetricsFile := filepath.Join(config.LogsDir(), "soong_build_metrics.pb")
+ if err := os.Remove(soongBuildMetricsFile); err != nil && !os.IsNotExist(err) {
+ ctx.Verbosef("Failed to remove %s", soongBuildMetricsFile)
+ }
if shouldCollectBuildSoongMetrics(config) {
- soongBuildMetricsFile := filepath.Join(config.LogsDir(), "soong_build_metrics.pb")
- if err := os.Remove(soongBuildMetricsFile); err != nil && !os.IsNotExist(err) {
- ctx.Verbosef("Failed to remove %s", soongBuildMetricsFile)
- }
defer func() {
soongBuildMetrics := loadSoongBuildMetrics(ctx, soongBuildMetricsFile)
if soongBuildMetrics != nil {