Merge "Refactor cc/bp2build.go to use parse helper" am: 4dc57a6d7b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2072288 Change-Id: Ib5980bf23cea4f8663da6c665c50dea288805d6c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -167,21 +167,17 @@ func bp2buildParseStaticOrSharedProps(ctx android.BazelConversionPathContext, mo
|
||||
attrs.System_dynamic_deps.ForceSpecifyEmptyList = true
|
||||
|
||||
if isStatic {
|
||||
for axis, configToProps := range module.GetArchVariantProperties(ctx, &StaticProperties{}) {
|
||||
for config, props := range configToProps {
|
||||
bp2BuildPropParseHelper(ctx, module, &StaticProperties{}, func(axis bazel.ConfigurationAxis, config string, props interface{}) {
|
||||
if staticOrSharedProps, ok := props.(*StaticProperties); ok {
|
||||
setAttrs(axis, config, staticOrSharedProps.Static)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
for axis, configToProps := range module.GetArchVariantProperties(ctx, &SharedProperties{}) {
|
||||
for config, props := range configToProps {
|
||||
bp2BuildPropParseHelper(ctx, module, &SharedProperties{}, func(axis bazel.ConfigurationAxis, config string, props interface{}) {
|
||||
if staticOrSharedProps, ok := props.(*SharedProperties); ok {
|
||||
setAttrs(axis, config, staticOrSharedProps.Shared)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
partitionedSrcs := groupSrcsByExtension(ctx, attrs.Srcs)
|
||||
@@ -359,12 +355,10 @@ func (ca *compilerAttributes) bp2buildForAxisAndConfig(ctx android.BazelConversi
|
||||
}
|
||||
|
||||
func (ca *compilerAttributes) convertStlProps(ctx android.ArchVariantContext, module *Module) {
|
||||
stlPropsByArch := module.GetArchVariantProperties(ctx, &StlProperties{})
|
||||
for _, configToProps := range stlPropsByArch {
|
||||
for _, props := range configToProps {
|
||||
bp2BuildPropParseHelper(ctx, module, &StlProperties{}, func(axis bazel.ConfigurationAxis, config string, props interface{}) {
|
||||
if stlProps, ok := props.(*StlProperties); ok {
|
||||
if stlProps.Stl == nil {
|
||||
continue
|
||||
return
|
||||
}
|
||||
if ca.stl == nil {
|
||||
ca.stl = stlProps.Stl
|
||||
@@ -372,8 +366,7 @@ func (ca *compilerAttributes) convertStlProps(ctx android.ArchVariantContext, mo
|
||||
ctx.ModuleErrorf("Unsupported conversion: module with different stl for different variants: %s and %s", *ca.stl, stlProps.Stl)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (ca *compilerAttributes) convertProductVariables(ctx android.BazelConversionPathContext, productVariableProps android.ProductConfigProperties) {
|
||||
@@ -713,8 +706,7 @@ func (la *linkerAttributes) bp2buildForAxisAndConfig(ctx android.BazelConversion
|
||||
}
|
||||
|
||||
func (la *linkerAttributes) convertStripProps(ctx android.BazelConversionPathContext, module *Module) {
|
||||
for axis, configToProps := range module.GetArchVariantProperties(ctx, &StripProperties{}) {
|
||||
for config, props := range configToProps {
|
||||
bp2BuildPropParseHelper(ctx, module, &StripProperties{}, func(axis bazel.ConfigurationAxis, config string, props interface{}) {
|
||||
if stripProperties, ok := props.(*StripProperties); ok {
|
||||
la.stripKeepSymbols.SetSelectValue(axis, config, stripProperties.Strip.Keep_symbols)
|
||||
la.stripKeepSymbolsList.SetSelectValue(axis, config, stripProperties.Strip.Keep_symbols_list)
|
||||
@@ -722,8 +714,7 @@ func (la *linkerAttributes) convertStripProps(ctx android.BazelConversionPathCon
|
||||
la.stripAll.SetSelectValue(axis, config, stripProperties.Strip.All)
|
||||
la.stripNone.SetSelectValue(axis, config, stripProperties.Strip.None)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (la *linkerAttributes) convertProductVariables(ctx android.BazelConversionPathContext, productVariableProps android.ProductConfigProperties) {
|
||||
@@ -859,8 +850,7 @@ func bp2BuildParseExportedIncludesHelper(ctx android.BazelConversionPathContext,
|
||||
} else {
|
||||
exported = BazelIncludes{}
|
||||
}
|
||||
for axis, configToProps := range module.GetArchVariantProperties(ctx, &FlagExporterProperties{}) {
|
||||
for config, props := range configToProps {
|
||||
bp2BuildPropParseHelper(ctx, module, &FlagExporterProperties{}, func(axis bazel.ConfigurationAxis, config string, props interface{}) {
|
||||
if flagExporterProperties, ok := props.(*FlagExporterProperties); ok {
|
||||
if len(flagExporterProperties.Export_include_dirs) > 0 {
|
||||
exported.Includes.SetSelectValue(axis, config, android.FirstUniqueStrings(append(exported.Includes.SelectValue(axis, config), flagExporterProperties.Export_include_dirs...)))
|
||||
@@ -869,8 +859,7 @@ func bp2BuildParseExportedIncludesHelper(ctx android.BazelConversionPathContext,
|
||||
exported.SystemIncludes.SetSelectValue(axis, config, android.FirstUniqueStrings(append(exported.SystemIncludes.SelectValue(axis, config), flagExporterProperties.Export_system_include_dirs...)))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
exported.AbsoluteIncludes.DeduplicateAxesFromBase()
|
||||
exported.Includes.DeduplicateAxesFromBase()
|
||||
exported.SystemIncludes.DeduplicateAxesFromBase()
|
||||
@@ -938,11 +927,9 @@ type binaryLinkerAttrs struct {
|
||||
|
||||
func bp2buildBinaryLinkerProps(ctx android.BazelConversionPathContext, m *Module) binaryLinkerAttrs {
|
||||
attrs := binaryLinkerAttrs{}
|
||||
archVariantProps := m.GetArchVariantProperties(ctx, &BinaryLinkerProperties{})
|
||||
for axis, configToProps := range archVariantProps {
|
||||
for _, p := range configToProps {
|
||||
props := p.(*BinaryLinkerProperties)
|
||||
staticExecutable := props.Static_executable
|
||||
bp2BuildPropParseHelper(ctx, m, &BinaryLinkerProperties{}, func(axis bazel.ConfigurationAxis, config string, props interface{}) {
|
||||
linkerProps := props.(*BinaryLinkerProperties)
|
||||
staticExecutable := linkerProps.Static_executable
|
||||
if axis == bazel.NoConfigAxis {
|
||||
if linkBinaryShared := !proptools.Bool(staticExecutable); !linkBinaryShared {
|
||||
attrs.Linkshared = &linkBinaryShared
|
||||
@@ -952,8 +939,7 @@ func bp2buildBinaryLinkerProps(ctx android.BazelConversionPathContext, m *Module
|
||||
// nonconfigurable attribute. Only 4 AOSP modules use this feature, defer handling
|
||||
ctx.ModuleErrorf("bp2build cannot migrate a module with arch/target-specific static_executable values")
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return attrs
|
||||
}
|
||||
|
Reference in New Issue
Block a user