Merge "Add stl property support for bp2build" am: 0bb4ac55d6

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1834858

Change-Id: I9c45eab96c5e62667bd78d0fa48601ab140357a0
This commit is contained in:
Christopher Parsons 2021-09-24 20:08:41 +00:00 committed by Automerger Merge Worker
commit a64586fb74
3 changed files with 28 additions and 6 deletions

View file

@ -223,13 +223,9 @@ var (
"libbase_ndk", // http://b/186826477, cc_library, no such target '//build/bazel/platforms/os:darwin' when --platforms //build/bazel/platforms:android_x86 is added "libbase_ndk", // http://b/186826477, cc_library, no such target '//build/bazel/platforms/os:darwin' when --platforms //build/bazel/platforms:android_x86 is added
// libcxx // libcxx
"libBionicBenchmarksUtils", // cc_library_static, fatal error: 'map' file not found, from libcxx "libBionicBenchmarksUtils", // cc_library_static, fatal error: 'map' file not found, from libcxx
"fmtlib", // cc_library_static, fatal error: 'cassert' file not found, from libcxx "libbase", // Depends on fmtlib via static_libs and also whole_static_libs, which results in bazel errors.
"fmtlib_ndk", // cc_library_static, fatal error: 'cassert' file not found
"liblog", // http://b/186822772: cc_library, 'sys/cdefs.h' file not found
"libbase", // Requires liblog. http://b/186826479, cc_library, fatal error: 'memory' file not found, from libcxx.
// Also depends on fmtlib.
"libfdtrack", // depends on STL "libfdtrack", // depends on liblzma and libbase
"libseccomp_policy", // depends on libbase "libseccomp_policy", // depends on libbase

View file

@ -226,6 +226,7 @@ type compilerAttributes struct {
srcs bazel.LabelListAttribute srcs bazel.LabelListAttribute
rtti bazel.BoolAttribute rtti bazel.BoolAttribute
stl *string
localIncludes bazel.StringListAttribute localIncludes bazel.StringListAttribute
absoluteIncludes bazel.StringListAttribute absoluteIncludes bazel.StringListAttribute
@ -321,6 +322,24 @@ func bp2BuildParseCompilerProps(ctx android.TopDownMutatorContext, module *Modul
srcs, cSrcs, asSrcs := groupSrcsByExtension(ctx, srcs) srcs, cSrcs, asSrcs := groupSrcsByExtension(ctx, srcs)
var stl *string = nil
stlPropsByArch := module.GetArchVariantProperties(ctx, &StlProperties{})
for _, configToProps := range stlPropsByArch {
for _, props := range configToProps {
if stlProps, ok := props.(*StlProperties); ok {
if stlProps.Stl != nil {
if stl == nil {
stl = stlProps.Stl
} else {
if stl != stlProps.Stl {
ctx.ModuleErrorf("Unsupported conversion: module with different stl for different variants: %s and %s", *stl, stlProps.Stl)
}
}
}
}
}
}
return compilerAttributes{ return compilerAttributes{
copts: copts, copts: copts,
srcs: srcs, srcs: srcs,
@ -330,6 +349,7 @@ func bp2BuildParseCompilerProps(ctx android.TopDownMutatorContext, module *Modul
conlyFlags: conlyFlags, conlyFlags: conlyFlags,
cppFlags: cppFlags, cppFlags: cppFlags,
rtti: rtti, rtti: rtti,
stl: stl,
localIncludes: localIncludes, localIncludes: localIncludes,
absoluteIncludes: absoluteIncludes, absoluteIncludes: absoluteIncludes,
} }

View file

@ -248,6 +248,7 @@ type bazelCcLibraryAttributes struct {
Linkopts bazel.StringListAttribute Linkopts bazel.StringListAttribute
Use_libcrt bazel.BoolAttribute Use_libcrt bazel.BoolAttribute
Rtti bazel.BoolAttribute Rtti bazel.BoolAttribute
Stl *string
// This is shared only. // This is shared only.
Version_script bazel.LabelAttribute Version_script bazel.LabelAttribute
@ -322,6 +323,7 @@ func CcLibraryBp2Build(ctx android.TopDownMutatorContext) {
Linkopts: linkerAttrs.linkopts, Linkopts: linkerAttrs.linkopts,
Use_libcrt: linkerAttrs.useLibcrt, Use_libcrt: linkerAttrs.useLibcrt,
Rtti: compilerAttrs.rtti, Rtti: compilerAttrs.rtti,
Stl: compilerAttrs.stl,
Version_script: linkerAttrs.versionScript, Version_script: linkerAttrs.versionScript,
@ -2388,6 +2390,7 @@ func ccSharedOrStaticBp2BuildMutatorInternal(ctx android.TopDownMutatorContext,
Linkopts: linkerAttrs.linkopts, Linkopts: linkerAttrs.linkopts,
Use_libcrt: linkerAttrs.useLibcrt, Use_libcrt: linkerAttrs.useLibcrt,
Rtti: compilerAttrs.rtti, Rtti: compilerAttrs.rtti,
Stl: compilerAttrs.stl,
Export_includes: exportedIncludes.Includes, Export_includes: exportedIncludes.Includes,
Export_system_includes: exportedIncludes.SystemIncludes, Export_system_includes: exportedIncludes.SystemIncludes,
Local_includes: compilerAttrs.localIncludes, Local_includes: compilerAttrs.localIncludes,
@ -2408,6 +2411,7 @@ func ccSharedOrStaticBp2BuildMutatorInternal(ctx android.TopDownMutatorContext,
Use_libcrt: linkerAttrs.useLibcrt, Use_libcrt: linkerAttrs.useLibcrt,
Rtti: compilerAttrs.rtti, Rtti: compilerAttrs.rtti,
Stl: compilerAttrs.stl,
Export_includes: exportedIncludes.Includes, Export_includes: exportedIncludes.Includes,
Export_system_includes: exportedIncludes.SystemIncludes, Export_system_includes: exportedIncludes.SystemIncludes,
@ -2440,6 +2444,7 @@ type bazelCcLibraryStaticAttributes struct {
Linkopts bazel.StringListAttribute Linkopts bazel.StringListAttribute
Use_libcrt bazel.BoolAttribute Use_libcrt bazel.BoolAttribute
Rtti bazel.BoolAttribute Rtti bazel.BoolAttribute
Stl *string
Export_includes bazel.StringListAttribute Export_includes bazel.StringListAttribute
Export_system_includes bazel.StringListAttribute Export_system_includes bazel.StringListAttribute
@ -2463,6 +2468,7 @@ type bazelCcLibrarySharedAttributes struct {
Linkopts bazel.StringListAttribute Linkopts bazel.StringListAttribute
Use_libcrt bazel.BoolAttribute Use_libcrt bazel.BoolAttribute
Rtti bazel.BoolAttribute Rtti bazel.BoolAttribute
Stl *string
Export_includes bazel.StringListAttribute Export_includes bazel.StringListAttribute
Export_system_includes bazel.StringListAttribute Export_system_includes bazel.StringListAttribute