Merge "denylist logcat to pass bp2build-incremental"
diff --git a/android/filegroup.go b/android/filegroup.go
index c042ff1..3522f80 100644
--- a/android/filegroup.go
+++ b/android/filegroup.go
@@ -82,7 +82,6 @@
type bazelAidlLibraryAttributes struct {
Srcs bazel.LabelListAttribute
Strip_import_prefix *string
- Deps bazel.LabelListAttribute
}
// api srcs can be contained in filegroups.
@@ -121,12 +120,9 @@
// and then convert
if fg.ShouldConvertToAidlLibrary(ctx) {
tags := []string{"apex_available=//apex_available:anyapex"}
- deps := bazel.MakeLabelListAttribute(BazelLabelForModuleDeps(ctx, fg.properties.Aidl.Deps))
-
attrs := &bazelAidlLibraryAttributes{
Srcs: srcs,
Strip_import_prefix: fg.properties.Path,
- Deps: deps,
}
props := bazel.BazelTargetModuleProperties{
@@ -203,14 +199,6 @@
// Create a make variable with the specified name that contains the list of files in the
// filegroup, relative to the root of the source tree.
Export_to_make_var *string
-
- // aidl is explicitly provided for implicit aidl dependencies
- // TODO(b/278298615): aidl prop is a no-op in Soong and is an escape hatch
- // to include implicit aidl dependencies for bazel migration compatibility
- Aidl struct {
- // List of aidl files or filegroup depended on by srcs
- Deps []string `android:"path"`
- }
}
type fileGroup struct {
diff --git a/bp2build/cc_binary_conversion_test.go b/bp2build/cc_binary_conversion_test.go
index d37722b..f89d42c 100644
--- a/bp2build/cc_binary_conversion_test.go
+++ b/bp2build/cc_binary_conversion_test.go
@@ -868,6 +868,25 @@
})
}
+func TestCcBinaryWithSanitizerBlocklist(t *testing.T) {
+ runCcBinaryTestCase(t, ccBinaryBp2buildTestCase{
+ description: "cc_binary has the correct feature when sanitize.blocklist is provided",
+ blueprint: `
+{rule_name} {
+ name: "foo",
+ sanitize: {
+ blocklist: "foo_blocklist.txt",
+ },
+}`,
+ targets: []testBazelTarget{
+ {"cc_binary", "foo", AttrNameToString{
+ "local_includes": `["."]`,
+ "features": `["ubsan_blocklist_foo_blocklist_txt"]`,
+ }},
+ },
+ })
+}
+
func TestCcBinaryWithThinLto(t *testing.T) {
runCcBinaryTestCase(t, ccBinaryBp2buildTestCase{
description: "cc_binary has correct features when thin LTO is enabled",
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 20f3bf6..24e91f5 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -4179,6 +4179,32 @@
})
}
+func TestCcLibraryWithSanitizerBlocklist(t *testing.T) {
+ runCcLibraryTestCase(t, Bp2buildTestCase{
+ Description: "cc_library has correct feature when sanitize.blocklist is provided",
+ ModuleTypeUnderTest: "cc_library",
+ ModuleTypeUnderTestFactory: cc.LibraryFactory,
+ Blueprint: `
+cc_library {
+ name: "foo",
+ sanitize: {
+ blocklist: "foo_blocklist.txt",
+ },
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
+ "features": `["ubsan_blocklist_foo_blocklist_txt"]`,
+ "local_includes": `["."]`,
+ }),
+ MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
+ "features": `["ubsan_blocklist_foo_blocklist_txt"]`,
+ "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",
diff --git a/bp2build/cc_library_shared_conversion_test.go b/bp2build/cc_library_shared_conversion_test.go
index 7f0ba44..a828855 100644
--- a/bp2build/cc_library_shared_conversion_test.go
+++ b/bp2build/cc_library_shared_conversion_test.go
@@ -1212,6 +1212,26 @@
})
}
+func TestCcLibrarySharedWithSanitizerBlocklist(t *testing.T) {
+ runCcLibrarySharedTestCase(t, Bp2buildTestCase{
+ Description: "cc_library_shared has correct features when sanitize.blocklist is provided",
+ Blueprint: `
+cc_library_shared {
+ name: "foo",
+ sanitize: {
+ blocklist: "foo_blocklist.txt",
+ },
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
+ "features": `["ubsan_blocklist_foo_blocklist_txt"]`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
+
func TestCcLibrarySharedWithThinLto(t *testing.T) {
runCcLibrarySharedTestCase(t, Bp2buildTestCase{
Description: "cc_library_shared has correct features when thin lto is enabled",
diff --git a/bp2build/cc_library_static_conversion_test.go b/bp2build/cc_library_static_conversion_test.go
index f537871..afe76e5 100644
--- a/bp2build/cc_library_static_conversion_test.go
+++ b/bp2build/cc_library_static_conversion_test.go
@@ -1905,6 +1905,26 @@
})
}
+func TestCcLibraryStaticWithSanitizerBlocklist(t *testing.T) {
+ runCcLibraryStaticTestCase(t, Bp2buildTestCase{
+ Description: "cc_library_static has correct features when sanitize.blocklist is provided",
+ Blueprint: `
+cc_library_static {
+ name: "foo",
+ sanitize: {
+ blocklist: "foo_blocklist.txt",
+ },
+}
+`,
+ ExpectedBazelTargets: []string{
+ MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
+ "features": `["ubsan_blocklist_foo_blocklist_txt"]`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
+
func TestCcLibraryStaticWithThinLto(t *testing.T) {
runCcLibraryStaticTestCase(t, Bp2buildTestCase{
Description: "cc_library_static has correct features when thin lto is enabled",
diff --git a/bp2build/filegroup_conversion_test.go b/bp2build/filegroup_conversion_test.go
index 273d556..7ce559d 100644
--- a/bp2build/filegroup_conversion_test.go
+++ b/bp2build/filegroup_conversion_test.go
@@ -105,42 +105,6 @@
}
}
-func TestFilegroupWithAidlDeps(t *testing.T) {
- bp := `
- filegroup {
- name: "bar",
- srcs: ["bar.aidl"],
- }
- filegroup {
- name: "foo",
- srcs: ["aidl/foo.aidl"],
- path: "aidl",
- aidl: {
- deps: [":bar"],
- }
- }`
-
- t.Run("filegroup with aidl deps", func(t *testing.T) {
- expectedBazelTargets := []string{
- MakeBazelTargetNoRestrictions("aidl_library", "bar", AttrNameToString{
- "srcs": `["bar.aidl"]`,
- "tags": `["apex_available=//apex_available:anyapex"]`,
- }),
- MakeBazelTargetNoRestrictions("aidl_library", "foo", AttrNameToString{
- "srcs": `["aidl/foo.aidl"]`,
- "strip_import_prefix": `"aidl"`,
- "deps": `[":bar"]`,
- "tags": `["apex_available=//apex_available:anyapex"]`,
- }),
- }
- runFilegroupTestCase(t, Bp2buildTestCase{
- Description: "filegroup with aidl deps",
- Blueprint: bp,
- ExpectedBazelTargets: expectedBazelTargets,
- })
- })
-}
-
func TestFilegroupWithAidlAndNonAidlSrcs(t *testing.T) {
runFilegroupTestCase(t, Bp2buildTestCase{
Description: "filegroup with aidl and non-aidl srcs",
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 1e83ca3..eb91898 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -1781,6 +1781,12 @@
for _, sanitizer := range sanitizerProps.Sanitize.Misc_undefined {
features = append(features, "ubsan_"+sanitizer)
}
+ blocklist := sanitizerProps.Sanitize.Blocklist
+ if blocklist != nil {
+ // Format the blocklist name to be used in a feature name
+ blocklistFeatureSuffix := strings.Replace(strings.ToLower(*blocklist), ".", "_", -1)
+ features = append(features, "ubsan_blocklist_"+blocklistFeatureSuffix)
+ }
if proptools.Bool(sanitizerProps.Sanitize.Cfi) {
features = append(features, "android_cfi")
if proptools.Bool(sanitizerProps.Sanitize.Config.Cfi_assembly_support) {
diff --git a/cc/cc.go b/cc/cc.go
index a7d6ff5..3484000 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1934,7 +1934,6 @@
sanitizeProps.Safestack,
sanitizeProps.Scudo,
BoolPtr(len(c.sanitize.Properties.Sanitize.Recover) > 0),
- BoolPtr(c.sanitize.Properties.Sanitize.Blocklist != nil),
}
for _, san := range unsupportedSanitizers {
if Bool(san) {
diff --git a/cc/sanitize.go b/cc/sanitize.go
index a5691ee..d391cf5 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -62,12 +62,14 @@
"-fast-isel=false",
}
+ sanitizeIgnorelistPrefix = "-fsanitize-ignorelist="
+
cfiBlocklistPath = "external/compiler-rt/lib/cfi"
cfiBlocklistFilename = "cfi_blocklist.txt"
cfiEnableFlag = "-fsanitize=cfi"
cfiCrossDsoFlag = "-fsanitize-cfi-cross-dso"
cfiCflags = []string{"-flto", cfiCrossDsoFlag,
- "-fsanitize-ignorelist=" + cfiBlocklistPath + "/" + cfiBlocklistFilename}
+ sanitizeIgnorelistPrefix + cfiBlocklistPath + "/" + cfiBlocklistFilename}
// -flto and -fvisibility are required by clang when -fsanitize=cfi is
// used, but have no effect on assembly files
cfiAsflags = []string{"-flto", "-fvisibility=default"}
@@ -401,6 +403,7 @@
exportedVars.ExportStringList("CfiLdFlags", cfiLdflags[2:])
exportedVars.ExportStringList("CfiAsFlags", cfiAsflags[1:])
+ exportedVars.ExportString("SanitizeIgnorelistPrefix", sanitizeIgnorelistPrefix)
exportedVars.ExportString("CfiCrossDsoFlag", cfiCrossDsoFlag)
exportedVars.ExportString("CfiBlocklistPath", cfiBlocklistPath)
exportedVars.ExportString("CfiBlocklistFilename", cfiBlocklistFilename)
@@ -965,7 +968,7 @@
blocklist := android.OptionalPathForModuleSrc(ctx, s.Properties.Sanitize.Blocklist)
if blocklist.Valid() {
- flags.Local.CFlags = append(flags.Local.CFlags, "-fsanitize-ignorelist="+blocklist.String())
+ flags.Local.CFlags = append(flags.Local.CFlags, sanitizeIgnorelistPrefix+blocklist.String())
flags.CFlagsDeps = append(flags.CFlagsDeps, blocklist.Path())
}
diff --git a/genrule/allowlists.go b/genrule/allowlists.go
index 46e3fb0..1fe30db 100644
--- a/genrule/allowlists.go
+++ b/genrule/allowlists.go
@@ -121,7 +121,6 @@
"nos_app_weaver_service_genc++_headers",
"nos_app_weaver_service_genc++_mock",
"nos_generator_test_service_genc++",
- "pandora-python-gen-src",
}
SandboxingDenyPathList = []string{
diff --git a/rust/builder.go b/rust/builder.go
index 0dfaef4..bf009a5 100644
--- a/rust/builder.go
+++ b/rust/builder.go
@@ -324,6 +324,7 @@
envVars = append(envVars, "CARGO_BIN_NAME="+strings.TrimSuffix(outputFile.Base(), outputFile.Ext()))
}
envVars = append(envVars, "CARGO_CRATE_NAME="+ctx.RustModule().CrateName())
+ envVars = append(envVars, "CARGO_PKG_NAME="+ctx.RustModule().CrateName())
pkgVersion := ctx.RustModule().compiler.CargoPkgVersion()
if pkgVersion != "" {
envVars = append(envVars, "CARGO_PKG_VERSION="+pkgVersion)
diff --git a/tests/lib.sh b/tests/lib.sh
index 7f3970e..b5dea99 100644
--- a/tests/lib.sh
+++ b/tests/lib.sh
@@ -101,6 +101,19 @@
symlink_directory external/spdx-tools
symlink_directory libcore
+ # TODO: b/286872909 - Remove these when the blocking bug is completed
+ symlink_directory external/libavc
+ symlink_directory external/libaom
+ symlink_directory external/libvpx
+ symlink_directory frameworks/base/libs/androidfw
+ symlink_directory external/libhevc
+ symlink_directory external/libexif
+ symlink_directory external/libopus
+ symlink_directory external/libmpeg2
+ symlink_directory external/expat
+ symlink_directory external/flac
+ symlink_directory system/extras/toolchain-extras
+
touch "$MOCK_TOP/Android.bp"
}
diff --git a/tests/run_integration_tests.sh b/tests/run_integration_tests.sh
index c77b903..43a9f0f 100755
--- a/tests/run_integration_tests.sh
+++ b/tests/run_integration_tests.sh
@@ -9,6 +9,7 @@
"$TOP/build/soong/tests/bp2build_bazel_test.sh"
"$TOP/build/soong/tests/persistent_bazel_test.sh"
"$TOP/build/soong/tests/soong_test.sh"
+"$TOP/build/soong/tests/stale_metrics_files_test.sh"
"$TOP/build/bazel/ci/rbc_regression_test.sh" aosp_arm64-userdebug
# The following tests build against the full source tree and don't rely on the
diff --git a/tests/stale_metrics_files_test.sh b/tests/stale_metrics_files_test.sh
new file mode 100755
index 0000000..0da89c3
--- /dev/null
+++ b/tests/stale_metrics_files_test.sh
@@ -0,0 +1,47 @@
+#!/bin/bash -e
+
+# This test ensures that stale metrics files are deleted after each run
+
+# Run bazel
+# Note - bp2build metrics are present after clean runs, only
+build/soong/soong_ui.bash --make-mode clean
+build/bazel/bin/b build libcore:all
+soong_build_metrics_files=("out/soong_build_metrics.pb" "out/build_progress.pb" "out/soong_metrics" "out/bp2build_metrics.pb")
+bazel_build_metrics_files=("out/bazel_metrics.pb" "out/build_progress.pb" "out/soong_metrics" "out/bp2build_metrics.pb")
+
+# Ensure bazel metrics files are present
+for i in ${!bazel_build_metrics_files[@]};
+do
+ file=${bazel_build_metrics_files[$i]}
+ if [[ ! -f $file ]]; then
+ echo "Missing metrics file for Bazel build " $file
+ exit 1
+ fi
+done
+
+
+# Run a soong build
+build/soong/soong_ui.bash --make-mode nothing
+
+for i in ${!soong_build_metrics_files[@]};
+do
+ file=${soong_build_metrics_files[$i]}
+ if [[ ! -f $file ]]; then
+ echo "Missing metrics file for Soong build " $file
+ exit 1
+ fi
+done
+
+# Ensure that bazel_metrics.pb is deleted
+if [[ -f out/bazel_metrics.pb ]]; then
+ echo "Stale out/bazel_metrics.pb file detected"
+ exit 1
+fi
+
+# Run bazel again - to make sure that soong_build_metrics.pb gets deleted
+build/bazel/bin/b build libcore:all
+
+if [[ -f out/soong_build_metrics.pb ]]; then
+ echo "Stale out/soong_build_metrics.pb file detected"
+ exit 1
+fi
diff --git a/ui/metrics/bazel_metrics_proto/bazel_metrics.pb.go b/ui/metrics/bazel_metrics_proto/bazel_metrics.pb.go
index bf5e80b..17a6b91 100644
--- a/ui/metrics/bazel_metrics_proto/bazel_metrics.pb.go
+++ b/ui/metrics/bazel_metrics_proto/bazel_metrics.pb.go
@@ -42,6 +42,7 @@
PhaseTimings []*PhaseTiming `protobuf:"bytes,1,rep,name=phase_timings,json=phaseTimings,proto3" json:"phase_timings,omitempty"`
Total *int64 `protobuf:"varint,2,opt,name=total,proto3,oneof" json:"total,omitempty"`
ExitCode *int32 `protobuf:"varint,3,opt,name=exit_code,json=exitCode,proto3,oneof" json:"exit_code,omitempty"`
+ SpongeId *string `protobuf:"bytes,4,opt,name=sponge_id,json=spongeId,proto3,oneof" json:"sponge_id,omitempty"`
}
func (x *BazelMetrics) Reset() {
@@ -97,6 +98,13 @@
return 0
}
+func (x *BazelMetrics) GetSpongeId() string {
+ if x != nil && x.SpongeId != nil {
+ return *x.SpongeId
+ }
+ return ""
+}
+
type PhaseTiming struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -169,7 +177,7 @@
0x0a, 0x13, 0x62, 0x61, 0x7a, 0x65, 0x6c, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69,
0x6c, 0x64, 0x5f, 0x62, 0x61, 0x7a, 0x65, 0x6c, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73,
- 0x22, 0xb0, 0x01, 0x0a, 0x0c, 0x42, 0x61, 0x7a, 0x65, 0x6c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63,
+ 0x22, 0xe0, 0x01, 0x0a, 0x0c, 0x42, 0x61, 0x7a, 0x65, 0x6c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63,
0x73, 0x12, 0x4b, 0x0a, 0x0d, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x69, 0x6e,
0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67,
0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x61, 0x7a, 0x65, 0x6c, 0x5f, 0x6d, 0x65, 0x74,
@@ -178,9 +186,12 @@
0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52,
0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a, 0x09, 0x65, 0x78, 0x69,
0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x08,
- 0x65, 0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f,
- 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x63,
- 0x6f, 0x64, 0x65, 0x22, 0xd1, 0x01, 0x0a, 0x0b, 0x50, 0x68, 0x61, 0x73, 0x65, 0x54, 0x69, 0x6d,
+ 0x65, 0x78, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a, 0x09, 0x73,
+ 0x70, 0x6f, 0x6e, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02,
+ 0x52, 0x08, 0x73, 0x70, 0x6f, 0x6e, 0x67, 0x65, 0x49, 0x64, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a,
+ 0x06, 0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x65, 0x78, 0x69, 0x74,
+ 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x73, 0x70, 0x6f, 0x6e, 0x67, 0x65,
+ 0x5f, 0x69, 0x64, 0x22, 0xd1, 0x01, 0x0a, 0x0b, 0x50, 0x68, 0x61, 0x73, 0x65, 0x54, 0x69, 0x6d,
0x69, 0x6e, 0x67, 0x12, 0x22, 0x0a, 0x0a, 0x70, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x70, 0x68, 0x61, 0x73, 0x65,
0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x2a, 0x0a, 0x0e, 0x64, 0x75, 0x72, 0x61, 0x74,
diff --git a/ui/metrics/bazel_metrics_proto/bazel_metrics.proto b/ui/metrics/bazel_metrics_proto/bazel_metrics.proto
index 9073080..e7e1015 100644
--- a/ui/metrics/bazel_metrics_proto/bazel_metrics.proto
+++ b/ui/metrics/bazel_metrics_proto/bazel_metrics.proto
@@ -21,6 +21,7 @@
repeated PhaseTiming phase_timings = 1;
optional int64 total = 2;
optional int32 exit_code = 3;
+ optional string sponge_id = 4;
}
message PhaseTiming {