Merge "Fix the releax_check flag format verb."
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/bp2build/conversion.go b/bp2build/conversion.go
index 081e082..1225f2b 100644
--- a/bp2build/conversion.go
+++ b/bp2build/conversion.go
@@ -93,6 +93,7 @@
"name": true, // redundant, since this is explicitly generated for every target
"from": true, // reserved keyword
"in": true, // reserved keyword
+ "size": true, // reserved for tests
"arch": true, // interface prop type is not supported yet.
"multilib": true, // interface prop type is not supported yet.
"target": true, // interface prop type is not supported yet.
diff --git a/cc/compiler.go b/cc/compiler.go
index e96295c..2e71922 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -442,7 +442,7 @@
fmt.Sprintf("${config.%sClangGlobalCflags}", hod))
if isThirdParty(modulePath) {
- flags.Global.CommonFlags = append([]string{"${config.ClangExternalCflags}"}, flags.Global.CommonFlags...)
+ flags.Global.CommonFlags = append(flags.Global.CommonFlags, "${config.ClangExternalCflags}")
}
if tc.Bionic() {
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,
}