Merge "Enable bloaty artifact for checkbuild"
diff --git a/android/arch.go b/android/arch.go
index 6fb70c9..f719ddc 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -616,16 +616,8 @@
 		osTargets = []Target{osTargets[0]}
 	}
 
-	// Some modules want compile_multilib: "first" to mean 32-bit, not 64-bit.
-	// This is used for HOST_PREFER_32_BIT=true support for Art modules.
-	prefer32 := false
-	if base.prefer32 != nil {
-		prefer32 = base.prefer32(mctx, base, os)
-	}
-	if os == Windows {
-		// Windows builds always prefer 32-bit
-		prefer32 = true
-	}
+	// Windows builds always prefer 32-bit
+	prefer32 := os == Windows
 
 	// Determine the multilib selection for this module.
 	multilib, extraMultilib := decodeMultilib(base, os.Class)
diff --git a/android/module.go b/android/module.go
index 58675d4..5342246 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1168,8 +1168,6 @@
 
 	initRcPaths         Paths
 	vintfFragmentsPaths Paths
-
-	prefer32 func(ctx BaseModuleContext, base *ModuleBase, os OsType) bool
 }
 
 func (m *ModuleBase) ComponentDepsMutator(BottomUpMutatorContext) {}
@@ -1196,10 +1194,6 @@
 	return m.variables
 }
 
-func (m *ModuleBase) Prefer32(prefer32 func(ctx BaseModuleContext, base *ModuleBase, os OsType) bool) {
-	m.prefer32 = prefer32
-}
-
 // Name returns the name of the module.  It may be overridden by individual module types, for
 // example prebuilts will prepend prebuilt_ to the name.
 func (m *ModuleBase) Name() string {
diff --git a/bp2build/cc_object_conversion_test.go b/bp2build/cc_object_conversion_test.go
index f094102..f655842 100644
--- a/bp2build/cc_object_conversion_test.go
+++ b/bp2build/cc_object_conversion_test.go
@@ -38,9 +38,10 @@
 			moduleTypeUnderTestFactory:         cc.ObjectFactory,
 			moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
 			filesystem: map[string]string{
-				"a/b/foo.h": "",
-				"a/b/bar.h": "",
-				"a/b/c.c":   "",
+				"a/b/foo.h":     "",
+				"a/b/bar.h":     "",
+				"a/b/exclude.c": "",
+				"a/b/c.c":       "",
 			},
 			blueprint: `cc_object {
     name: "foo",
@@ -52,8 +53,9 @@
     ],
     srcs: [
         "a/b/*.h",
-        "a/b/c.c"
+        "a/b/*.c"
     ],
+    exclude_srcs: ["a/b/exclude.c"],
 
     bazel_module: { bp2build_available: true },
 }
@@ -134,6 +136,52 @@
 )`,
 			},
 		},
+		{
+			description:                        "cc_object with cc_object deps in objs props",
+			moduleTypeUnderTest:                "cc_object",
+			moduleTypeUnderTestFactory:         cc.ObjectFactory,
+			moduleTypeUnderTestBp2BuildMutator: cc.ObjectBp2Build,
+			filesystem: map[string]string{
+				"a/b/c.c": "",
+				"x/y/z.c": "",
+			},
+			blueprint: `cc_object {
+    name: "foo",
+    srcs: ["a/b/c.c"],
+    objs: ["bar"],
+
+    bazel_module: { bp2build_available: true },
+}
+
+cc_object {
+    name: "bar",
+    srcs: ["x/y/z.c"],
+
+    bazel_module: { bp2build_available: true },
+}
+`,
+			expectedBazelTargets: []string{`cc_object(
+    name = "bar",
+    copts = [
+        "-fno-addrsig",
+    ],
+    srcs = [
+        "x/y/z.c",
+    ],
+)`, `cc_object(
+    name = "foo",
+    copts = [
+        "-fno-addrsig",
+    ],
+    deps = [
+        ":bar",
+    ],
+    srcs = [
+        "a/b/c.c",
+    ],
+)`,
+			},
+		},
 	}
 
 	dir := "."
diff --git a/cc/object.go b/cc/object.go
index b108c1c..140a066 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -92,6 +92,7 @@
 // For bp2build conversion.
 type bazelObjectAttributes struct {
 	Srcs               bazel.LabelList
+	Deps               bazel.LabelList
 	Copts              []string
 	Local_include_dirs []string
 }
@@ -134,18 +135,28 @@
 
 	var copts []string
 	var srcs []string
+	var excludeSrcs []string
 	var localIncludeDirs []string
 	for _, props := range m.compiler.compilerProps() {
 		if baseCompilerProps, ok := props.(*BaseCompilerProperties); ok {
 			copts = baseCompilerProps.Cflags
 			srcs = baseCompilerProps.Srcs
+			excludeSrcs = baseCompilerProps.Exclude_srcs
 			localIncludeDirs = baseCompilerProps.Local_include_dirs
 			break
 		}
 	}
 
+	var deps bazel.LabelList
+	for _, props := range m.linker.linkerProps() {
+		if objectLinkerProps, ok := props.(*ObjectLinkerProperties); ok {
+			deps = android.BazelLabelForModuleDeps(ctx, objectLinkerProps.Objs)
+		}
+	}
+
 	attrs := &bazelObjectAttributes{
-		Srcs:               android.BazelLabelForModuleSrc(ctx, srcs),
+		Srcs:               android.BazelLabelForModuleSrcExcludes(ctx, srcs, excludeSrcs),
+		Deps:               deps,
 		Copts:              copts,
 		Local_include_dirs: localIncludeDirs,
 	}
diff --git a/cc/snapshot_prebuilt.go b/cc/snapshot_prebuilt.go
index 62daafd..f9aea0c 100644
--- a/cc/snapshot_prebuilt.go
+++ b/cc/snapshot_prebuilt.go
@@ -280,50 +280,36 @@
 	// Nothing, the snapshot module is only used to forward dependency information in DepsMutator.
 }
 
+func getSnapshotNameSuffix(moduleSuffix, version, arch string) string {
+	versionSuffix := version
+	if arch != "" {
+		versionSuffix += "." + arch
+	}
+	return moduleSuffix + versionSuffix
+}
+
 func (s *snapshot) DepsMutator(ctx android.BottomUpMutatorContext) {
-	collectSnapshotMap := func(variations []blueprint.Variation, depTag blueprint.DependencyTag,
-		names []string, snapshotSuffix, moduleSuffix string) map[string]string {
-
-		decoratedNames := make([]string, 0, len(names))
-		for _, name := range names {
-			decoratedNames = append(decoratedNames, name+
-				snapshotSuffix+moduleSuffix+
-				s.baseSnapshot.version()+
-				"."+ctx.Arch().ArchType.Name)
-		}
-
-		deps := ctx.AddVariationDependencies(variations, depTag, decoratedNames...)
+	collectSnapshotMap := func(names []string, snapshotSuffix, moduleSuffix string) map[string]string {
 		snapshotMap := make(map[string]string)
-		for _, dep := range deps {
-			if dep == nil {
-				continue
-			}
-
-			snapshotMap[dep.(*Module).BaseModuleName()] = ctx.OtherModuleName(dep)
+		for _, name := range names {
+			snapshotMap[name] = name +
+				getSnapshotNameSuffix(snapshotSuffix+moduleSuffix,
+					s.baseSnapshot.version(), ctx.Arch().ArchType.Name)
 		}
 		return snapshotMap
 	}
 
 	snapshotSuffix := s.image.moduleNameSuffix()
-	headers := collectSnapshotMap(nil, HeaderDepTag(), s.properties.Header_libs, snapshotSuffix, snapshotHeaderSuffix)
-	binaries := collectSnapshotMap(nil, nil, s.properties.Binaries, snapshotSuffix, snapshotBinarySuffix)
-	objects := collectSnapshotMap(nil, nil, s.properties.Objects, snapshotSuffix, snapshotObjectSuffix)
-
-	staticLibs := collectSnapshotMap([]blueprint.Variation{
-		{Mutator: "link", Variation: "static"},
-	}, StaticDepTag(), s.properties.Static_libs, snapshotSuffix, snapshotStaticSuffix)
-
-	sharedLibs := collectSnapshotMap([]blueprint.Variation{
-		{Mutator: "link", Variation: "shared"},
-	}, SharedDepTag(), s.properties.Shared_libs, snapshotSuffix, snapshotSharedSuffix)
-
-	vndkLibs := collectSnapshotMap([]blueprint.Variation{
-		{Mutator: "link", Variation: "shared"},
-	}, SharedDepTag(), s.properties.Vndk_libs, "", vndkSuffix)
-
+	headers := collectSnapshotMap(s.properties.Header_libs, snapshotSuffix, snapshotHeaderSuffix)
+	binaries := collectSnapshotMap(s.properties.Binaries, snapshotSuffix, snapshotBinarySuffix)
+	objects := collectSnapshotMap(s.properties.Objects, snapshotSuffix, snapshotObjectSuffix)
+	staticLibs := collectSnapshotMap(s.properties.Static_libs, snapshotSuffix, snapshotStaticSuffix)
+	sharedLibs := collectSnapshotMap(s.properties.Shared_libs, snapshotSuffix, snapshotSharedSuffix)
+	vndkLibs := collectSnapshotMap(s.properties.Vndk_libs, "", vndkSuffix)
 	for k, v := range vndkLibs {
 		sharedLibs[k] = v
 	}
+
 	ctx.SetProvider(SnapshotInfoProvider, SnapshotInfo{
 		HeaderLibs: headers,
 		Binaries:   binaries,
@@ -395,12 +381,7 @@
 }
 
 func (p *baseSnapshotDecorator) NameSuffix() string {
-	versionSuffix := p.version()
-	if p.arch() != "" {
-		versionSuffix += "." + p.arch()
-	}
-
-	return p.baseProperties.ModuleSuffix + versionSuffix
+	return getSnapshotNameSuffix(p.moduleSuffix(), p.version(), p.arch())
 }
 
 func (p *baseSnapshotDecorator) version() string {
diff --git a/cc/vendor_snapshot_test.go b/cc/vendor_snapshot_test.go
index 7e283fb..0833277 100644
--- a/cc/vendor_snapshot_test.go
+++ b/cc/vendor_snapshot_test.go
@@ -416,7 +416,13 @@
 		name: "libvendor",
 		version: "BOARD",
 		target_arch: "arm64",
+		compile_multilib: "64",
 		vendor: true,
+		shared_libs: [
+			"libvendor_without_snapshot",
+			"libvendor_available",
+			"libvndk",
+		],
 		arch: {
 			arm64: {
 				src: "libvendor.so",
diff --git a/java/app.go b/java/app.go
index 5181207..8287533 100755
--- a/java/app.go
+++ b/java/app.go
@@ -1298,7 +1298,7 @@
 		Textf("aapt_binary=%s", aapt.String()).Implicit(aapt).
 		Textf(`uses_library_names="%s"`, strings.Join(u.usesLibraryProperties.Uses_libs, " ")).
 		Textf(`optional_uses_library_names="%s"`, strings.Join(u.usesLibraryProperties.Optional_uses_libs, " ")).
-		Textf(`relax_check="%b"`, dexpreopt.GetGlobalConfig(ctx).RelaxUsesLibraryCheck).
+		Textf(`relax_check="%t"`, dexpreopt.GetGlobalConfig(ctx).RelaxUsesLibraryCheck).
 		Tool(android.PathForSource(ctx, "build/make/core/verify_uses_libraries.sh")).Input(apk).Output(statusFile)
 	rule.Command().Text("cp -f").Input(apk).Output(outputFile)
 
diff --git a/rust/config/lints.go b/rust/config/lints.go
index ac8165b..7c05e4f 100644
--- a/rust/config/lints.go
+++ b/rust/config/lints.go
@@ -53,6 +53,7 @@
 	defaultClippyLints = []string{
 		"-A clippy::type-complexity",
 		"-A clippy::unnecessary-wraps",
+		"-A clippy::unusual-byte-groupings",
 	}
 
 	// Rust lints for vendor code.