Merge "Remove dependency from vendor_snapshot to each module"
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/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.