Seperate asflags and cflags
This fixes a bug which was a misunderstanding of soong properties: Soong's cflags pertain only to C and C++ language, whereas bazel's copts pertain to all three languages. This change ensures that asflags are added as specifically asflags, and the 'copts' for the static library macro pertains only to C and C++ languages. This requires a somewhat hacky workaround for asflags, however: Since assembly sources also need includepath-related flags, this duplicates these flags between copts and asflags. To reduce verbosity of bp2build-generated targets, this also ensures that asflags are omitted in cases where there are no assembly sources. Test: Mixed build droid CI Change-Id: Ic0babed1f90d6dc82e5788638681ce5b995043f8
This commit is contained in:
@@ -180,7 +180,6 @@ var (
|
|||||||
// also depends on //system/logging/liblog:liblog (http://b/186822772)
|
// also depends on //system/logging/liblog:liblog (http://b/186822772)
|
||||||
"libc_ndk", // http://b/187013218, cc_library_static, depends on //bionic/libm:libm (http://b/183064661)
|
"libc_ndk", // http://b/187013218, cc_library_static, depends on //bionic/libm:libm (http://b/183064661)
|
||||||
"libc_malloc_hooks", // http://b/187016307, cc_library, ld.lld: error: undefined symbol: __malloc_hook
|
"libc_malloc_hooks", // http://b/187016307, cc_library, ld.lld: error: undefined symbol: __malloc_hook
|
||||||
"libm", // http://b/183064661, cc_library, math.h:25:16: error: unexpected token in argument list
|
|
||||||
|
|
||||||
// http://b/186823769: Needs C++ STL support, includes from unconverted standard libraries in //external/libcxx
|
// http://b/186823769: Needs C++ STL support, includes from unconverted standard libraries in //external/libcxx
|
||||||
// c++_static
|
// c++_static
|
||||||
@@ -189,7 +188,7 @@ var (
|
|||||||
"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
|
"fmtlib", // cc_library_static, fatal error: 'cassert' file not found, from libcxx
|
||||||
"fmtlib_ndk", // cc_library_static, fatal error: 'cassert' file not found
|
"fmtlib_ndk", // cc_library_static, fatal error: 'cassert' file not found
|
||||||
"libbase", // http://b/186826479, cc_library, fatal error: 'memory' file not found, from libcxx
|
"libbase", // Requires liblog. http://b/186826479, cc_library, fatal error: 'memory' file not found, from libcxx.
|
||||||
|
|
||||||
// http://b/186024507: Includes errors because of the system_shared_libs default value.
|
// http://b/186024507: Includes errors because of the system_shared_libs default value.
|
||||||
// Missing -isystem bionic/libc/include through the libc/libm/libdl
|
// Missing -isystem bionic/libc/include through the libc/libm/libdl
|
||||||
|
@@ -558,6 +558,19 @@ func (lla LabelListAttribute) HasConfigurableValues() bool {
|
|||||||
return len(lla.ConfigurableValues) > 0
|
return len(lla.ConfigurableValues) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsEmpty returns true if the attribute has no values under any configuration.
|
||||||
|
func (lla LabelListAttribute) IsEmpty() bool {
|
||||||
|
if len(lla.Value.Includes) > 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for axis, _ := range lla.ConfigurableValues {
|
||||||
|
if lla.ConfigurableValues[axis].HasConfigurableValues() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// ResolveExcludes handles excludes across the various axes, ensuring that items are removed from
|
// ResolveExcludes handles excludes across the various axes, ensuring that items are removed from
|
||||||
// the base value and included in default values as appropriate.
|
// the base value and included in default values as appropriate.
|
||||||
func (lla *LabelListAttribute) ResolveExcludes() {
|
func (lla *LabelListAttribute) ResolveExcludes() {
|
||||||
|
@@ -674,6 +674,10 @@ filegroup {
|
|||||||
blueprint: soongCcLibraryPreamble,
|
blueprint: soongCcLibraryPreamble,
|
||||||
expectedBazelTargets: []string{`cc_library(
|
expectedBazelTargets: []string{`cc_library(
|
||||||
name = "a",
|
name = "a",
|
||||||
|
asflags = [
|
||||||
|
"-Ifoo/bar",
|
||||||
|
"-I$(BINDIR)/foo/bar",
|
||||||
|
],
|
||||||
copts = [
|
copts = [
|
||||||
"-Ifoo/bar",
|
"-Ifoo/bar",
|
||||||
"-I$(BINDIR)/foo/bar",
|
"-I$(BINDIR)/foo/bar",
|
||||||
|
@@ -1413,7 +1413,7 @@ cc_library_static {
|
|||||||
|
|
||||||
func TestCcLibraryStaticProductVariableStringReplacement(t *testing.T) {
|
func TestCcLibraryStaticProductVariableStringReplacement(t *testing.T) {
|
||||||
runCcLibraryStaticTestCase(t, bp2buildTestCase{
|
runCcLibraryStaticTestCase(t, bp2buildTestCase{
|
||||||
description: "cc_library_static product variable selects",
|
description: "cc_library_static product variable string replacement",
|
||||||
moduleTypeUnderTest: "cc_library_static",
|
moduleTypeUnderTest: "cc_library_static",
|
||||||
moduleTypeUnderTestFactory: cc.LibraryStaticFactory,
|
moduleTypeUnderTestFactory: cc.LibraryStaticFactory,
|
||||||
moduleTypeUnderTestBp2BuildMutator: cc.CcLibraryStaticBp2Build,
|
moduleTypeUnderTestBp2BuildMutator: cc.CcLibraryStaticBp2Build,
|
||||||
@@ -1422,7 +1422,7 @@ func TestCcLibraryStaticProductVariableStringReplacement(t *testing.T) {
|
|||||||
blueprint: soongCcLibraryStaticPreamble + `
|
blueprint: soongCcLibraryStaticPreamble + `
|
||||||
cc_library_static {
|
cc_library_static {
|
||||||
name: "foo_static",
|
name: "foo_static",
|
||||||
srcs: ["common.c"],
|
srcs: ["common.S"],
|
||||||
product_variables: {
|
product_variables: {
|
||||||
platform_sdk_version: {
|
platform_sdk_version: {
|
||||||
asflags: ["-DPLATFORM_SDK_VERSION=%d"],
|
asflags: ["-DPLATFORM_SDK_VERSION=%d"],
|
||||||
@@ -1431,7 +1431,10 @@ cc_library_static {
|
|||||||
} `,
|
} `,
|
||||||
expectedBazelTargets: []string{`cc_library_static(
|
expectedBazelTargets: []string{`cc_library_static(
|
||||||
name = "foo_static",
|
name = "foo_static",
|
||||||
asflags = select({
|
asflags = [
|
||||||
|
"-I.",
|
||||||
|
"-I$(BINDIR)/.",
|
||||||
|
] + select({
|
||||||
"//build/bazel/product_variables:platform_sdk_version": ["-DPLATFORM_SDK_VERSION=$(Platform_sdk_version)"],
|
"//build/bazel/product_variables:platform_sdk_version": ["-DPLATFORM_SDK_VERSION=$(Platform_sdk_version)"],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
}),
|
}),
|
||||||
@@ -1440,7 +1443,7 @@ cc_library_static {
|
|||||||
"-I$(BINDIR)/.",
|
"-I$(BINDIR)/.",
|
||||||
],
|
],
|
||||||
linkstatic = True,
|
linkstatic = True,
|
||||||
srcs_c = ["common.c"],
|
srcs_as = ["common.S"],
|
||||||
)`},
|
)`},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -211,6 +211,7 @@ func TestCcObjectProductVariable(t *testing.T) {
|
|||||||
asflags: ["-DPLATFORM_SDK_VERSION=%d"],
|
asflags: ["-DPLATFORM_SDK_VERSION=%d"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
srcs: ["src.S"],
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
expectedBazelTargets: []string{`cc_object(
|
expectedBazelTargets: []string{`cc_object(
|
||||||
@@ -220,6 +221,7 @@ func TestCcObjectProductVariable(t *testing.T) {
|
|||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
}),
|
}),
|
||||||
copts = ["-fno-addrsig"],
|
copts = ["-fno-addrsig"],
|
||||||
|
srcs_as = ["src.S"],
|
||||||
)`,
|
)`,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -240,7 +242,7 @@ func TestCcObjectCflagsOneArch(t *testing.T) {
|
|||||||
cflags: ["-fPIC"], // string list
|
cflags: ["-fPIC"], // string list
|
||||||
},
|
},
|
||||||
arm: {
|
arm: {
|
||||||
srcs: ["arch/arm/file.S"], // label list
|
srcs: ["arch/arm/file.cpp"], // label list
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -257,7 +259,7 @@ func TestCcObjectCflagsOneArch(t *testing.T) {
|
|||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
}),
|
}),
|
||||||
srcs = ["a.cpp"] + select({
|
srcs = ["a.cpp"] + select({
|
||||||
"//build/bazel/platforms/arch:arm": ["arch/arm/file.S"],
|
"//build/bazel/platforms/arch:arm": ["arch/arm/file.cpp"],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
}),
|
}),
|
||||||
)`,
|
)`,
|
||||||
|
@@ -90,8 +90,11 @@ func depsBp2BuildMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
|
|
||||||
// TODO(b/186024507, b/186489250): Temporarily exclude adding
|
// TODO(b/186024507, b/186489250): Temporarily exclude adding
|
||||||
// system_shared_libs deps until libc and libm builds.
|
// system_shared_libs deps until libc and libm builds.
|
||||||
// allDeps = append(allDeps, lib.SharedProperties.Shared.System_shared_libs...)
|
if lib.static() {
|
||||||
// allDeps = append(allDeps, lib.StaticProperties.Static.System_shared_libs...)
|
allDeps = append(allDeps, lib.StaticProperties.Static.System_shared_libs...)
|
||||||
|
} else if lib.shared() {
|
||||||
|
allDeps = append(allDeps, lib.SharedProperties.Shared.System_shared_libs...)
|
||||||
|
}
|
||||||
|
|
||||||
// Deps in the target/arch nested static: { .. } and shared: { .. } props of a cc_library.
|
// Deps in the target/arch nested static: { .. } and shared: { .. } props of a cc_library.
|
||||||
// target: { <target>: shared: { ... } }
|
// target: { <target>: shared: { ... } }
|
||||||
@@ -253,7 +256,7 @@ func bp2buildParseStaticOrSharedProps(ctx android.TopDownMutatorContext, module
|
|||||||
Copts: bazel.StringListAttribute{Value: props.Cflags},
|
Copts: bazel.StringListAttribute{Value: props.Cflags},
|
||||||
Srcs: bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, props.Srcs)),
|
Srcs: bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, props.Srcs)),
|
||||||
Static_deps: bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, props.Static_libs)),
|
Static_deps: bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, props.Static_libs)),
|
||||||
Dynamic_deps: bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, props.Shared_libs)),
|
Dynamic_deps: bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, append(props.Shared_libs, props.System_shared_libs...))),
|
||||||
Whole_archive_deps: bazel.MakeLabelListAttribute(android.BazelLabelForModuleWholeDeps(ctx, props.Whole_static_libs)),
|
Whole_archive_deps: bazel.MakeLabelListAttribute(android.BazelLabelForModuleWholeDeps(ctx, props.Whole_static_libs)),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,16 +388,6 @@ func bp2BuildParseCompilerProps(ctx android.TopDownMutatorContext, module *Modul
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the list of copts.
|
|
||||||
parseCopts := func(baseCompilerProps *BaseCompilerProperties) []string {
|
|
||||||
var copts []string
|
|
||||||
copts = append(copts, parseCommandLineFlags(baseCompilerProps.Cflags)...)
|
|
||||||
for _, dir := range parseLocalIncludeDirs(baseCompilerProps) {
|
|
||||||
copts = append(copts, includeFlags(dir)...)
|
|
||||||
}
|
|
||||||
return copts
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse srcs from an arch or OS's props value.
|
// Parse srcs from an arch or OS's props value.
|
||||||
parseSrcs := func(baseCompilerProps *BaseCompilerProperties) bazel.LabelList {
|
parseSrcs := func(baseCompilerProps *BaseCompilerProperties) bazel.LabelList {
|
||||||
// Add srcs-like dependencies such as generated files.
|
// Add srcs-like dependencies such as generated files.
|
||||||
@@ -410,11 +403,15 @@ func bp2BuildParseCompilerProps(ctx android.TopDownMutatorContext, module *Modul
|
|||||||
for _, props := range module.compiler.compilerProps() {
|
for _, props := range module.compiler.compilerProps() {
|
||||||
if baseCompilerProps, ok := props.(*BaseCompilerProperties); ok {
|
if baseCompilerProps, ok := props.(*BaseCompilerProperties); ok {
|
||||||
srcs.SetValue(parseSrcs(baseCompilerProps))
|
srcs.SetValue(parseSrcs(baseCompilerProps))
|
||||||
copts.Value = parseCopts(baseCompilerProps)
|
copts.Value = parseCommandLineFlags(baseCompilerProps.Cflags)
|
||||||
asFlags.Value = parseCommandLineFlags(baseCompilerProps.Asflags)
|
asFlags.Value = parseCommandLineFlags(baseCompilerProps.Asflags)
|
||||||
conlyFlags.Value = parseCommandLineFlags(baseCompilerProps.Conlyflags)
|
conlyFlags.Value = parseCommandLineFlags(baseCompilerProps.Conlyflags)
|
||||||
cppFlags.Value = parseCommandLineFlags(baseCompilerProps.Cppflags)
|
cppFlags.Value = parseCommandLineFlags(baseCompilerProps.Cppflags)
|
||||||
|
|
||||||
|
for _, dir := range parseLocalIncludeDirs(baseCompilerProps) {
|
||||||
|
copts.Value = append(copts.Value, includeFlags(dir)...)
|
||||||
|
asFlags.Value = append(asFlags.Value, includeFlags(dir)...)
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -424,8 +421,10 @@ func bp2BuildParseCompilerProps(ctx android.TopDownMutatorContext, module *Modul
|
|||||||
// "-I<module-dir>" in its copts.
|
// "-I<module-dir>" in its copts.
|
||||||
if c, ok := module.compiler.(*baseCompiler); ok && c.includeBuildDirectory() {
|
if c, ok := module.compiler.(*baseCompiler); ok && c.includeBuildDirectory() {
|
||||||
copts.Value = append(copts.Value, includeFlags(".")...)
|
copts.Value = append(copts.Value, includeFlags(".")...)
|
||||||
|
asFlags.Value = append(asFlags.Value, includeFlags(".")...)
|
||||||
} else if c, ok := module.compiler.(*libraryDecorator); ok && c.includeBuildDirectory() {
|
} else if c, ok := module.compiler.(*libraryDecorator); ok && c.includeBuildDirectory() {
|
||||||
copts.Value = append(copts.Value, includeFlags(".")...)
|
copts.Value = append(copts.Value, includeFlags(".")...)
|
||||||
|
asFlags.Value = append(asFlags.Value, includeFlags(".")...)
|
||||||
}
|
}
|
||||||
|
|
||||||
archVariantCompilerProps := module.GetArchVariantProperties(ctx, &BaseCompilerProperties{})
|
archVariantCompilerProps := module.GetArchVariantProperties(ctx, &BaseCompilerProperties{})
|
||||||
@@ -440,8 +439,15 @@ func bp2BuildParseCompilerProps(ctx android.TopDownMutatorContext, module *Modul
|
|||||||
srcs.SetSelectValue(axis, config, srcsList)
|
srcs.SetSelectValue(axis, config, srcsList)
|
||||||
}
|
}
|
||||||
|
|
||||||
copts.SetSelectValue(axis, config, parseCopts(baseCompilerProps))
|
archVariantCopts := parseCommandLineFlags(baseCompilerProps.Cflags)
|
||||||
asFlags.SetSelectValue(axis, config, parseCommandLineFlags(baseCompilerProps.Asflags))
|
archVariantAsflags := parseCommandLineFlags(baseCompilerProps.Asflags)
|
||||||
|
for _, dir := range parseLocalIncludeDirs(baseCompilerProps) {
|
||||||
|
archVariantCopts = append(archVariantCopts, includeFlags(dir)...)
|
||||||
|
archVariantAsflags = append(archVariantAsflags, includeFlags(dir)...)
|
||||||
|
}
|
||||||
|
|
||||||
|
copts.SetSelectValue(axis, config, archVariantCopts)
|
||||||
|
asFlags.SetSelectValue(axis, config, archVariantAsflags)
|
||||||
conlyFlags.SetSelectValue(axis, config, parseCommandLineFlags(baseCompilerProps.Conlyflags))
|
conlyFlags.SetSelectValue(axis, config, parseCommandLineFlags(baseCompilerProps.Conlyflags))
|
||||||
cppFlags.SetSelectValue(axis, config, parseCommandLineFlags(baseCompilerProps.Cppflags))
|
cppFlags.SetSelectValue(axis, config, parseCommandLineFlags(baseCompilerProps.Cppflags))
|
||||||
}
|
}
|
||||||
@@ -554,7 +560,9 @@ func bp2BuildParseLinkerProps(ctx android.TopDownMutatorContext, module *Module)
|
|||||||
staticDeps.Value = android.BazelLabelForModuleDepsExcludes(ctx, staticLibs, baseLinkerProps.Exclude_static_libs)
|
staticDeps.Value = android.BazelLabelForModuleDepsExcludes(ctx, staticLibs, baseLinkerProps.Exclude_static_libs)
|
||||||
wholeArchiveLibs := android.FirstUniqueStrings(baseLinkerProps.Whole_static_libs)
|
wholeArchiveLibs := android.FirstUniqueStrings(baseLinkerProps.Whole_static_libs)
|
||||||
wholeArchiveDeps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleWholeDepsExcludes(ctx, wholeArchiveLibs, baseLinkerProps.Exclude_static_libs))
|
wholeArchiveDeps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleWholeDepsExcludes(ctx, wholeArchiveLibs, baseLinkerProps.Exclude_static_libs))
|
||||||
sharedLibs := android.FirstUniqueStrings(baseLinkerProps.Shared_libs)
|
// TODO(b/186024507): Handle system_shared_libs as its own attribute, so that the appropriate default
|
||||||
|
// may be supported.
|
||||||
|
sharedLibs := android.FirstUniqueStrings(append(baseLinkerProps.Shared_libs, baseLinkerProps.System_shared_libs...))
|
||||||
dynamicDeps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleDepsExcludes(ctx, sharedLibs, baseLinkerProps.Exclude_shared_libs))
|
dynamicDeps = bazel.MakeLabelListAttribute(android.BazelLabelForModuleDepsExcludes(ctx, sharedLibs, baseLinkerProps.Exclude_shared_libs))
|
||||||
|
|
||||||
headerLibs := android.FirstUniqueStrings(baseLinkerProps.Header_libs)
|
headerLibs := android.FirstUniqueStrings(baseLinkerProps.Header_libs)
|
||||||
@@ -581,7 +589,7 @@ func bp2BuildParseLinkerProps(ctx android.TopDownMutatorContext, module *Module)
|
|||||||
staticDeps.SetSelectValue(axis, config, android.BazelLabelForModuleDepsExcludes(ctx, staticLibs, baseLinkerProps.Exclude_static_libs))
|
staticDeps.SetSelectValue(axis, config, android.BazelLabelForModuleDepsExcludes(ctx, staticLibs, baseLinkerProps.Exclude_static_libs))
|
||||||
wholeArchiveLibs := android.FirstUniqueStrings(baseLinkerProps.Whole_static_libs)
|
wholeArchiveLibs := android.FirstUniqueStrings(baseLinkerProps.Whole_static_libs)
|
||||||
wholeArchiveDeps.SetSelectValue(axis, config, android.BazelLabelForModuleWholeDepsExcludes(ctx, wholeArchiveLibs, baseLinkerProps.Exclude_static_libs))
|
wholeArchiveDeps.SetSelectValue(axis, config, android.BazelLabelForModuleWholeDepsExcludes(ctx, wholeArchiveLibs, baseLinkerProps.Exclude_static_libs))
|
||||||
sharedLibs := android.FirstUniqueStrings(baseLinkerProps.Shared_libs)
|
sharedLibs := android.FirstUniqueStrings(append(baseLinkerProps.Shared_libs, baseLinkerProps.System_shared_libs...))
|
||||||
dynamicDeps.SetSelectValue(axis, config, android.BazelLabelForModuleDepsExcludes(ctx, sharedLibs, baseLinkerProps.Exclude_shared_libs))
|
dynamicDeps.SetSelectValue(axis, config, android.BazelLabelForModuleDepsExcludes(ctx, sharedLibs, baseLinkerProps.Exclude_shared_libs))
|
||||||
|
|
||||||
headerLibs := android.FirstUniqueStrings(baseLinkerProps.Header_libs)
|
headerLibs := android.FirstUniqueStrings(baseLinkerProps.Header_libs)
|
||||||
|
@@ -300,6 +300,12 @@ func CcLibraryBp2Build(ctx android.TopDownMutatorContext) {
|
|||||||
|
|
||||||
srcs := compilerAttrs.srcs
|
srcs := compilerAttrs.srcs
|
||||||
|
|
||||||
|
asFlags := compilerAttrs.asFlags
|
||||||
|
if compilerAttrs.asSrcs.IsEmpty() && sharedAttrs.Srcs_as.IsEmpty() && staticAttrs.Srcs_as.IsEmpty() {
|
||||||
|
// Skip asflags for BUILD file simplicity if there are no assembly sources.
|
||||||
|
asFlags = bazel.MakeStringListAttribute(nil)
|
||||||
|
}
|
||||||
|
|
||||||
attrs := &bazelCcLibraryAttributes{
|
attrs := &bazelCcLibraryAttributes{
|
||||||
Srcs: srcs,
|
Srcs: srcs,
|
||||||
Srcs_c: compilerAttrs.cSrcs,
|
Srcs_c: compilerAttrs.cSrcs,
|
||||||
@@ -308,7 +314,7 @@ func CcLibraryBp2Build(ctx android.TopDownMutatorContext) {
|
|||||||
Copts: compilerAttrs.copts,
|
Copts: compilerAttrs.copts,
|
||||||
Cppflags: compilerAttrs.cppFlags,
|
Cppflags: compilerAttrs.cppFlags,
|
||||||
Conlyflags: compilerAttrs.conlyFlags,
|
Conlyflags: compilerAttrs.conlyFlags,
|
||||||
Asflags: compilerAttrs.asFlags,
|
Asflags: asFlags,
|
||||||
|
|
||||||
Implementation_deps: linkerAttrs.deps,
|
Implementation_deps: linkerAttrs.deps,
|
||||||
Deps: linkerAttrs.exportedDeps,
|
Deps: linkerAttrs.exportedDeps,
|
||||||
@@ -2370,6 +2376,12 @@ func ccLibraryStaticBp2BuildInternal(ctx android.TopDownMutatorContext, module *
|
|||||||
linkerAttrs := bp2BuildParseLinkerProps(ctx, module)
|
linkerAttrs := bp2BuildParseLinkerProps(ctx, module)
|
||||||
exportedIncludes := bp2BuildParseExportedIncludes(ctx, module)
|
exportedIncludes := bp2BuildParseExportedIncludes(ctx, module)
|
||||||
|
|
||||||
|
asFlags := compilerAttrs.asFlags
|
||||||
|
if compilerAttrs.asSrcs.IsEmpty() {
|
||||||
|
// Skip asflags for BUILD file simplicity if there are no assembly sources.
|
||||||
|
asFlags = bazel.MakeStringListAttribute(nil)
|
||||||
|
}
|
||||||
|
|
||||||
attrs := &bazelCcLibraryStaticAttributes{
|
attrs := &bazelCcLibraryStaticAttributes{
|
||||||
Copts: compilerAttrs.copts,
|
Copts: compilerAttrs.copts,
|
||||||
Srcs: compilerAttrs.srcs,
|
Srcs: compilerAttrs.srcs,
|
||||||
@@ -2386,7 +2398,7 @@ func ccLibraryStaticBp2BuildInternal(ctx android.TopDownMutatorContext, module *
|
|||||||
Srcs_c: compilerAttrs.cSrcs,
|
Srcs_c: compilerAttrs.cSrcs,
|
||||||
Conlyflags: compilerAttrs.conlyFlags,
|
Conlyflags: compilerAttrs.conlyFlags,
|
||||||
Srcs_as: compilerAttrs.asSrcs,
|
Srcs_as: compilerAttrs.asSrcs,
|
||||||
Asflags: compilerAttrs.asFlags,
|
Asflags: asFlags,
|
||||||
}
|
}
|
||||||
|
|
||||||
props := bazel.BazelTargetModuleProperties{
|
props := bazel.BazelTargetModuleProperties{
|
||||||
|
11
cc/object.go
11
cc/object.go
@@ -123,6 +123,7 @@ func ObjectFactory() android.Module {
|
|||||||
// For bp2build conversion.
|
// For bp2build conversion.
|
||||||
type bazelObjectAttributes struct {
|
type bazelObjectAttributes struct {
|
||||||
Srcs bazel.LabelListAttribute
|
Srcs bazel.LabelListAttribute
|
||||||
|
Srcs_as bazel.LabelListAttribute
|
||||||
Hdrs bazel.LabelListAttribute
|
Hdrs bazel.LabelListAttribute
|
||||||
Deps bazel.LabelListAttribute
|
Deps bazel.LabelListAttribute
|
||||||
Copts bazel.StringListAttribute
|
Copts bazel.StringListAttribute
|
||||||
@@ -179,13 +180,19 @@ func ObjectBp2Build(ctx android.TopDownMutatorContext) {
|
|||||||
// and this isn't typically done for cc_object.
|
// and this isn't typically done for cc_object.
|
||||||
srcs := compilerAttrs.srcs
|
srcs := compilerAttrs.srcs
|
||||||
srcs.Append(compilerAttrs.cSrcs)
|
srcs.Append(compilerAttrs.cSrcs)
|
||||||
srcs.Append(compilerAttrs.asSrcs)
|
|
||||||
|
asFlags := compilerAttrs.asFlags
|
||||||
|
if compilerAttrs.asSrcs.IsEmpty() {
|
||||||
|
// Skip asflags for BUILD file simplicity if there are no assembly sources.
|
||||||
|
asFlags = bazel.MakeStringListAttribute(nil)
|
||||||
|
}
|
||||||
|
|
||||||
attrs := &bazelObjectAttributes{
|
attrs := &bazelObjectAttributes{
|
||||||
Srcs: srcs,
|
Srcs: srcs,
|
||||||
|
Srcs_as: compilerAttrs.asSrcs,
|
||||||
Deps: deps,
|
Deps: deps,
|
||||||
Copts: compilerAttrs.copts,
|
Copts: compilerAttrs.copts,
|
||||||
Asflags: compilerAttrs.asFlags,
|
Asflags: asFlags,
|
||||||
}
|
}
|
||||||
|
|
||||||
props := bazel.BazelTargetModuleProperties{
|
props := bazel.BazelTargetModuleProperties{
|
||||||
|
Reference in New Issue
Block a user