Merge "Always run AndroidGlobalLintChecker.jar with lint invocations"
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 5feb02e..a1e83d8 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -3691,113 +3691,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_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/cc/bp2build.go b/cc/bp2build.go
index d41aa00..6caa854 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
@@ -781,7 +781,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{
@@ -1364,20 +1364,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/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 {