Merge "Have ConvertWBp2build use Bp2buildMutatorContext" into main
This commit is contained in:
commit
c331812a59
49 changed files with 132 additions and 129 deletions
|
@ -168,7 +168,7 @@ type bazelAconfigDeclarationsAttributes struct {
|
|||
Package string
|
||||
}
|
||||
|
||||
func (module *DeclarationsModule) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (module *DeclarationsModule) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if ctx.ModuleType() != "aconfig_declarations" {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ type bazelAconfigValueSetAttributes struct {
|
|||
Values bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
func (module *ValueSetModule) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (module *ValueSetModule) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if ctx.ModuleType() != "aconfig_value_set" {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ type bazelAconfigValuesAttributes struct {
|
|||
Package string
|
||||
}
|
||||
|
||||
func (module *ValuesModule) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (module *ValuesModule) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if ctx.ModuleType() != "aconfig_values" {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ type bazelAidlLibraryAttributes struct {
|
|||
Deps bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
func (lib *AidlLibrary) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (lib *AidlLibrary) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
srcs := bazel.MakeLabelListAttribute(
|
||||
android.BazelLabelForModuleSrc(
|
||||
ctx,
|
||||
|
|
|
@ -162,7 +162,7 @@ type Bazelable interface {
|
|||
// Modules must implement this function to be bp2build convertible. The function
|
||||
// must either create at least one Bazel target module (using ctx.CreateBazelTargetModule or
|
||||
// its related functions), or declare itself unconvertible using ctx.MarkBp2buildUnconvertible.
|
||||
ConvertWithBp2build(ctx TopDownMutatorContext)
|
||||
ConvertWithBp2build(ctx Bp2buildMutatorContext)
|
||||
|
||||
// namespacedVariableProps is a map from a soong config variable namespace
|
||||
// (e.g. acme, android) to a map of interfaces{}, which are really
|
||||
|
|
|
@ -585,7 +585,7 @@ func PathsForBazelOut(ctx PathContext, paths []string) Paths {
|
|||
// For the first two cases, they are defined using the label attribute. For the third case,
|
||||
// it's defined with the string attribute.
|
||||
func BazelStringOrLabelFromProp(
|
||||
ctx TopDownMutatorContext,
|
||||
ctx Bp2buildMutatorContext,
|
||||
propToDistinguish *string) (bazel.LabelAttribute, bazel.StringAttribute) {
|
||||
|
||||
var labelAttr bazel.LabelAttribute
|
||||
|
|
|
@ -469,7 +469,7 @@ func mixedBuildModuleFactory() Module {
|
|||
return m
|
||||
}
|
||||
|
||||
func (m *mixedBuildModule) ConvertWithBp2build(ctx TopDownMutatorContext) {
|
||||
func (m *mixedBuildModule) ConvertWithBp2build(ctx Bp2buildMutatorContext) {
|
||||
}
|
||||
|
||||
func (m *mixedBuildModule) DepsMutator(ctx BottomUpMutatorContext) {
|
||||
|
|
|
@ -180,7 +180,7 @@ func (d *DefaultsModuleBase) GenerateAndroidBuildActions(ctx ModuleContext) {}
|
|||
|
||||
// ConvertWithBp2build to fulfill Bazelable interface; however, at this time defaults module are
|
||||
// *NOT* converted with bp2build
|
||||
func (defaultable *DefaultsModuleBase) ConvertWithBp2build(ctx TopDownMutatorContext) {
|
||||
func (defaultable *DefaultsModuleBase) ConvertWithBp2build(ctx Bp2buildMutatorContext) {
|
||||
// Defaults types are never convertible.
|
||||
ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_TYPE_UNSUPPORTED, "")
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ func (fg *fileGroup) ConvertWithApiBp2build(ctx TopDownMutatorContext) {
|
|||
}
|
||||
|
||||
// ConvertWithBp2build performs bp2build conversion of filegroup
|
||||
func (fg *fileGroup) ConvertWithBp2build(ctx TopDownMutatorContext) {
|
||||
func (fg *fileGroup) ConvertWithBp2build(ctx Bp2buildMutatorContext) {
|
||||
srcs := bazel.MakeLabelListAttribute(
|
||||
BazelLabelForModuleSrcExcludes(ctx, fg.properties.Srcs, fg.properties.Exclude_srcs))
|
||||
|
||||
|
@ -209,10 +209,10 @@ func (fg *fileGroup) ConvertWithBp2build(ctx TopDownMutatorContext) {
|
|||
}
|
||||
|
||||
type FileGroupPath interface {
|
||||
GetPath(ctx TopDownMutatorContext) string
|
||||
GetPath(ctx Bp2buildMutatorContext) string
|
||||
}
|
||||
|
||||
func (fg *fileGroup) GetPath(ctx TopDownMutatorContext) string {
|
||||
func (fg *fileGroup) GetPath(ctx Bp2buildMutatorContext) string {
|
||||
if fg.properties.Path != nil {
|
||||
return *fg.properties.Path
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ type bazelLicenseAttributes struct {
|
|||
Visibility []string
|
||||
}
|
||||
|
||||
func (m *licenseModule) ConvertWithBp2build(ctx TopDownMutatorContext) {
|
||||
func (m *licenseModule) ConvertWithBp2build(ctx Bp2buildMutatorContext) {
|
||||
attrs := &bazelLicenseAttributes{
|
||||
License_kinds: m.properties.License_kinds,
|
||||
Copyright_notice: m.properties.Copyright_notice,
|
||||
|
|
|
@ -50,7 +50,7 @@ type bazelLicenseKindAttributes struct {
|
|||
Visibility []string
|
||||
}
|
||||
|
||||
func (m *licenseKindModule) ConvertWithBp2build(ctx TopDownMutatorContext) {
|
||||
func (m *licenseKindModule) ConvertWithBp2build(ctx Bp2buildMutatorContext) {
|
||||
attrs := &bazelLicenseKindAttributes{
|
||||
Conditions: m.properties.Conditions,
|
||||
Url: m.properties.Url,
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
package android
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"android/soong/bazel"
|
||||
"android/soong/ui/metrics/bp2build_metrics_proto"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
)
|
||||
|
@ -229,37 +230,8 @@ var bp2buildPreArchMutators = []RegisterMutatorFunc{}
|
|||
// A minimal context for Bp2build conversion
|
||||
type Bp2buildMutatorContext interface {
|
||||
BazelConversionPathContext
|
||||
|
||||
CreateBazelTargetModule(bazel.BazelTargetModuleProperties, CommonAttributes, interface{})
|
||||
CreateBazelTargetModuleWithRestrictions(bazel.BazelTargetModuleProperties, CommonAttributes, interface{}, bazel.BoolAttribute)
|
||||
}
|
||||
|
||||
// PreArchBp2BuildMutators adds mutators to be register for converting Android Blueprint modules
|
||||
// into Bazel BUILD targets that should run prior to deps and conversion.
|
||||
func PreArchBp2BuildMutators(f RegisterMutatorFunc) {
|
||||
bp2buildPreArchMutators = append(bp2buildPreArchMutators, f)
|
||||
}
|
||||
|
||||
type BaseMutatorContext interface {
|
||||
BaseModuleContext
|
||||
|
||||
// MutatorName returns the name that this mutator was registered with.
|
||||
MutatorName() string
|
||||
|
||||
// Rename all variants of a module. The new name is not visible to calls to ModuleName,
|
||||
// AddDependency or OtherModuleName until after this mutator pass is complete.
|
||||
Rename(name string)
|
||||
}
|
||||
|
||||
type TopDownMutator func(TopDownMutatorContext)
|
||||
|
||||
type TopDownMutatorContext interface {
|
||||
BaseMutatorContext
|
||||
|
||||
// CreateModule creates a new module by calling the factory method for the specified moduleType, and applies
|
||||
// the specified property structs to it as if the properties were set in a blueprint file.
|
||||
CreateModule(ModuleFactory, ...interface{}) Module
|
||||
|
||||
// CreateBazelTargetModule creates a BazelTargetModule by calling the
|
||||
// factory method, just like in CreateModule, but also requires
|
||||
// BazelTargetModuleProperties containing additional metadata for the
|
||||
|
@ -290,6 +262,34 @@ type TopDownMutatorContext interface {
|
|||
CreateBazelConfigSetting(csa bazel.ConfigSettingAttributes, ca CommonAttributes, dir string)
|
||||
}
|
||||
|
||||
// PreArchBp2BuildMutators adds mutators to be register for converting Android Blueprint modules
|
||||
// into Bazel BUILD targets that should run prior to deps and conversion.
|
||||
func PreArchBp2BuildMutators(f RegisterMutatorFunc) {
|
||||
bp2buildPreArchMutators = append(bp2buildPreArchMutators, f)
|
||||
}
|
||||
|
||||
type BaseMutatorContext interface {
|
||||
BaseModuleContext
|
||||
|
||||
// MutatorName returns the name that this mutator was registered with.
|
||||
MutatorName() string
|
||||
|
||||
// Rename all variants of a module. The new name is not visible to calls to ModuleName,
|
||||
// AddDependency or OtherModuleName until after this mutator pass is complete.
|
||||
Rename(name string)
|
||||
}
|
||||
|
||||
type TopDownMutator func(TopDownMutatorContext)
|
||||
|
||||
type TopDownMutatorContext interface {
|
||||
BaseMutatorContext
|
||||
Bp2buildMutatorContext
|
||||
|
||||
// CreateModule creates a new module by calling the factory method for the specified moduleType, and applies
|
||||
// the specified property structs to it as if the properties were set in a blueprint file.
|
||||
CreateModule(ModuleFactory, ...interface{}) Module
|
||||
}
|
||||
|
||||
type topDownMutatorContext struct {
|
||||
bp blueprint.TopDownMutatorContext
|
||||
baseModuleContext
|
||||
|
|
|
@ -54,7 +54,7 @@ type packageModule struct {
|
|||
|
||||
var _ Bazelable = &packageModule{}
|
||||
|
||||
func (p *packageModule) ConvertWithBp2build(ctx TopDownMutatorContext) {
|
||||
func (p *packageModule) ConvertWithBp2build(ctx Bp2buildMutatorContext) {
|
||||
defaultPackageMetadata := bazel.MakeLabelListAttribute(BazelLabelForModuleDeps(ctx, p.properties.Default_applicable_licenses))
|
||||
// If METADATA file exists in the package, add it to package(default_package_metadata=) using a
|
||||
// filegroup(name="default_metadata_file") which can be accessed later on each module in Bazel
|
||||
|
|
16
apex/apex.go
16
apex/apex.go
|
@ -2623,7 +2623,7 @@ func OverrideApexFactory() android.Module {
|
|||
return m
|
||||
}
|
||||
|
||||
func (o *OverrideApex) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (o *OverrideApex) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if ctx.ModuleType() != "override_apex" {
|
||||
return
|
||||
}
|
||||
|
@ -3261,7 +3261,7 @@ const (
|
|||
)
|
||||
|
||||
// ConvertWithBp2build performs bp2build conversion of an apex
|
||||
func (a *apexBundle) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (a *apexBundle) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
// We only convert apex and apex_test modules at this time
|
||||
if ctx.ModuleType() != "apex" && ctx.ModuleType() != "apex_test" {
|
||||
return
|
||||
|
@ -3272,7 +3272,7 @@ func (a *apexBundle) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
|||
ctx.CreateBazelTargetModule(props, commonAttrs, &attrs)
|
||||
}
|
||||
|
||||
func convertWithBp2build(a *apexBundle, ctx android.TopDownMutatorContext) (bazelApexBundleAttributes, bazel.BazelTargetModuleProperties, android.CommonAttributes) {
|
||||
func convertWithBp2build(a *apexBundle, ctx android.Bp2buildMutatorContext) (bazelApexBundleAttributes, bazel.BazelTargetModuleProperties, android.CommonAttributes) {
|
||||
var manifestLabelAttribute bazel.LabelAttribute
|
||||
manifestLabelAttribute.SetValue(android.BazelLabelForModuleSrcSingle(ctx, proptools.StringDefault(a.properties.Manifest, "apex_manifest.json")))
|
||||
|
||||
|
@ -3432,7 +3432,7 @@ func convertWithBp2build(a *apexBundle, ctx android.TopDownMutatorContext) (baze
|
|||
// both, 32/32, 64/none, 32&64/32, 64/32
|
||||
// first, 32/32, 64/none, 64/32, 64/32
|
||||
|
||||
func convert32Libs(ctx android.TopDownMutatorContext, compileMultilb string,
|
||||
func convert32Libs(ctx android.Bp2buildMutatorContext, compileMultilb string,
|
||||
libs []string, nativeSharedLibs *convertedNativeSharedLibs) {
|
||||
libsLabelList := android.BazelLabelForModuleDeps(ctx, libs)
|
||||
switch compileMultilb {
|
||||
|
@ -3447,7 +3447,7 @@ func convert32Libs(ctx android.TopDownMutatorContext, compileMultilb string,
|
|||
}
|
||||
}
|
||||
|
||||
func convert64Libs(ctx android.TopDownMutatorContext, compileMultilb string,
|
||||
func convert64Libs(ctx android.Bp2buildMutatorContext, compileMultilb string,
|
||||
libs []string, nativeSharedLibs *convertedNativeSharedLibs) {
|
||||
libsLabelList := android.BazelLabelForModuleDeps(ctx, libs)
|
||||
switch compileMultilb {
|
||||
|
@ -3460,7 +3460,7 @@ func convert64Libs(ctx android.TopDownMutatorContext, compileMultilb string,
|
|||
}
|
||||
}
|
||||
|
||||
func convertBothLibs(ctx android.TopDownMutatorContext, compileMultilb string,
|
||||
func convertBothLibs(ctx android.Bp2buildMutatorContext, compileMultilb string,
|
||||
libs []string, nativeSharedLibs *convertedNativeSharedLibs) {
|
||||
libsLabelList := android.BazelLabelForModuleDeps(ctx, libs)
|
||||
switch compileMultilb {
|
||||
|
@ -3478,7 +3478,7 @@ func convertBothLibs(ctx android.TopDownMutatorContext, compileMultilb string,
|
|||
}
|
||||
}
|
||||
|
||||
func convertFirstLibs(ctx android.TopDownMutatorContext, compileMultilb string,
|
||||
func convertFirstLibs(ctx android.Bp2buildMutatorContext, compileMultilb string,
|
||||
libs []string, nativeSharedLibs *convertedNativeSharedLibs) {
|
||||
libsLabelList := android.BazelLabelForModuleDeps(ctx, libs)
|
||||
switch compileMultilb {
|
||||
|
@ -3521,7 +3521,7 @@ func makeSharedLibsAttributes(config string, libsLabelList bazel.LabelList,
|
|||
labelListAttr.Append(list)
|
||||
}
|
||||
|
||||
func invalidCompileMultilib(ctx android.TopDownMutatorContext, value string) {
|
||||
func invalidCompileMultilib(ctx android.Bp2buildMutatorContext, value string) {
|
||||
ctx.PropertyErrorf("compile_multilib", "Invalid value: %s", value)
|
||||
}
|
||||
|
||||
|
|
|
@ -208,11 +208,11 @@ type bazelApexKeyAttributes struct {
|
|||
}
|
||||
|
||||
// ConvertWithBp2build performs conversion apexKey for bp2build
|
||||
func (m *apexKey) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (m *apexKey) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
apexKeyBp2BuildInternal(ctx, m)
|
||||
}
|
||||
|
||||
func apexKeyBp2BuildInternal(ctx android.TopDownMutatorContext, module *apexKey) {
|
||||
func apexKeyBp2BuildInternal(ctx android.Bp2buildMutatorContext, module *apexKey) {
|
||||
privateKeyLabelAttribute, privateKeyNameAttribute :=
|
||||
android.BazelStringOrLabelFromProp(ctx, module.properties.Private_key)
|
||||
|
||||
|
|
|
@ -497,7 +497,7 @@ func (m *customModule) dir() *string {
|
|||
return m.props.Dir
|
||||
}
|
||||
|
||||
func (m *customModule) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (m *customModule) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if p := m.props.One_to_many_prop; p != nil && *p {
|
||||
customBp2buildOneToMany(ctx, m)
|
||||
return
|
||||
|
@ -555,7 +555,7 @@ func (m *customModule) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
|||
|
||||
}
|
||||
|
||||
func (m *customModule) createConfigSetting(ctx android.TopDownMutatorContext) {
|
||||
func (m *customModule) createConfigSetting(ctx android.Bp2buildMutatorContext) {
|
||||
csa := bazel.ConfigSettingAttributes{
|
||||
Flag_values: bazel.StringMapAttribute{
|
||||
"//build/bazel/rules/my_string_setting": m.Name(),
|
||||
|
@ -590,7 +590,7 @@ func (c *customModule) ConvertWithApiBp2build(ctx android.TopDownMutatorContext)
|
|||
|
||||
// A bp2build mutator that uses load statements and creates a 1:M mapping from
|
||||
// module to target.
|
||||
func customBp2buildOneToMany(ctx android.TopDownMutatorContext, m *customModule) {
|
||||
func customBp2buildOneToMany(ctx android.Bp2buildMutatorContext, m *customModule) {
|
||||
|
||||
baseName := m.Name()
|
||||
attrs := &customBazelModuleAttributes{}
|
||||
|
|
|
@ -313,7 +313,7 @@ type bazelBpfAttributes struct {
|
|||
}
|
||||
|
||||
// bpf bp2build converter
|
||||
func (b *bpf) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (b *bpf) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if ctx.ModuleType() != "bpf" {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -599,7 +599,7 @@ func (handler *ccBinaryBazelHandler) ProcessBazelQueryResponse(ctx android.Modul
|
|||
handler.module.setAndroidMkVariablesFromCquery(info.CcAndroidMkInfo)
|
||||
}
|
||||
|
||||
func binaryBp2buildAttrs(ctx android.TopDownMutatorContext, m *Module) binaryAttributes {
|
||||
func binaryBp2buildAttrs(ctx android.Bp2buildMutatorContext, m *Module) binaryAttributes {
|
||||
baseAttrs := bp2BuildParseBaseProps(ctx, m)
|
||||
binaryLinkerAttrs := bp2buildBinaryLinkerProps(ctx, m)
|
||||
|
||||
|
@ -661,7 +661,7 @@ func binaryBp2buildAttrs(ctx android.TopDownMutatorContext, m *Module) binaryAtt
|
|||
return attrs
|
||||
}
|
||||
|
||||
func binaryBp2build(ctx android.TopDownMutatorContext, m *Module) {
|
||||
func binaryBp2build(ctx android.Bp2buildMutatorContext, m *Module) {
|
||||
// shared with cc_test
|
||||
binaryAttrs := binaryBp2buildAttrs(ctx, m)
|
||||
|
||||
|
|
2
cc/cc.go
2
cc/cc.go
|
@ -4214,7 +4214,7 @@ func (c *Module) typ() moduleType {
|
|||
}
|
||||
|
||||
// ConvertWithBp2build converts Module to Bazel for bp2build.
|
||||
func (c *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (c *Module) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
prebuilt := c.IsPrebuilt()
|
||||
switch c.typ() {
|
||||
case binary:
|
||||
|
|
|
@ -45,7 +45,7 @@ type bazelFdoProfileAttributes struct {
|
|||
Profile bazel.StringAttribute
|
||||
}
|
||||
|
||||
func (fp *fdoProfile) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (fp *fdoProfile) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
var profileAttr bazel.StringAttribute
|
||||
|
||||
archVariantProps := fp.GetArchVariantProperties(ctx, &fdoProfileProperties{})
|
||||
|
|
|
@ -308,7 +308,7 @@ func stripAttrsFromLinkerAttrs(la *linkerAttributes) stripAttributes {
|
|||
}
|
||||
}
|
||||
|
||||
func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) {
|
||||
func libraryBp2Build(ctx android.Bp2buildMutatorContext, m *Module) {
|
||||
sharedAttrs := bp2BuildParseSharedProps(ctx, m)
|
||||
staticAttrs := bp2BuildParseStaticProps(ctx, m)
|
||||
baseAttributes := bp2BuildParseBaseProps(ctx, m)
|
||||
|
@ -480,7 +480,7 @@ func libraryBp2Build(ctx android.TopDownMutatorContext, m *Module) {
|
|||
createStubsBazelTargetIfNeeded(ctx, m, compilerAttrs, exportedIncludes, baseAttributes)
|
||||
}
|
||||
|
||||
func createStubsBazelTargetIfNeeded(ctx android.TopDownMutatorContext, m *Module, compilerAttrs compilerAttributes, exportedIncludes BazelIncludes, baseAttributes baseAttributes) {
|
||||
func createStubsBazelTargetIfNeeded(ctx android.Bp2buildMutatorContext, m *Module, compilerAttrs compilerAttributes, exportedIncludes BazelIncludes, baseAttributes baseAttributes) {
|
||||
if compilerAttrs.stubsSymbolFile != nil && len(compilerAttrs.stubsVersions.Value) > 0 {
|
||||
stubSuitesProps := bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "cc_stub_suite",
|
||||
|
@ -2886,7 +2886,7 @@ func maybeInjectBoringSSLHash(ctx android.ModuleContext, outputFile android.Modu
|
|||
return outputFile
|
||||
}
|
||||
|
||||
func bp2buildParseAbiCheckerProps(ctx android.TopDownMutatorContext, module *Module) bazelCcHeaderAbiCheckerAttributes {
|
||||
func bp2buildParseAbiCheckerProps(ctx android.Bp2buildMutatorContext, module *Module) bazelCcHeaderAbiCheckerAttributes {
|
||||
lib, ok := module.linker.(*libraryDecorator)
|
||||
if !ok {
|
||||
return bazelCcHeaderAbiCheckerAttributes{}
|
||||
|
@ -2909,7 +2909,7 @@ func bp2buildParseAbiCheckerProps(ctx android.TopDownMutatorContext, module *Mod
|
|||
return abiCheckerAttrs
|
||||
}
|
||||
|
||||
func sharedOrStaticLibraryBp2Build(ctx android.TopDownMutatorContext, module *Module, isStatic bool) {
|
||||
func sharedOrStaticLibraryBp2Build(ctx android.Bp2buildMutatorContext, module *Module, isStatic bool) {
|
||||
baseAttributes := bp2BuildParseBaseProps(ctx, module)
|
||||
compilerAttrs := baseAttributes.compilerAttributes
|
||||
linkerAttrs := baseAttributes.linkerAttributes
|
||||
|
|
|
@ -129,7 +129,7 @@ type bazelCcLibraryHeadersAttributes struct {
|
|||
sdkAttributes
|
||||
}
|
||||
|
||||
func libraryHeadersBp2Build(ctx android.TopDownMutatorContext, module *Module) {
|
||||
func libraryHeadersBp2Build(ctx android.Bp2buildMutatorContext, module *Module) {
|
||||
baseAttributes := bp2BuildParseBaseProps(ctx, module)
|
||||
exportedIncludes := bp2BuildParseExportedIncludes(ctx, module, &baseAttributes.includes)
|
||||
linkerAttrs := baseAttributes.linkerAttributes
|
||||
|
|
|
@ -584,7 +584,7 @@ func apiHeaderLabels(ctx android.TopDownMutatorContext, hdrLibs []string) bazel.
|
|||
return android.BazelLabelForModuleDepsWithFn(ctx, hdrLibs, addSuffix)
|
||||
}
|
||||
|
||||
func ndkLibraryBp2build(ctx android.TopDownMutatorContext, c *Module) {
|
||||
func ndkLibraryBp2build(ctx android.Bp2buildMutatorContext, c *Module) {
|
||||
ndk, _ := c.linker.(*stubDecorator)
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "cc_stub_suite",
|
||||
|
|
|
@ -148,7 +148,7 @@ var (
|
|||
|
||||
// stlSrcBp2build returns a bazel label for the checked-in .so/.a file
|
||||
// It contains a select statement for each ABI
|
||||
func stlSrcBp2build(ctx android.TopDownMutatorContext, c *Module) bazel.LabelAttribute {
|
||||
func stlSrcBp2build(ctx android.Bp2buildMutatorContext, c *Module) bazel.LabelAttribute {
|
||||
libName := strings.TrimPrefix(c.Name(), "ndk_")
|
||||
libExt := ".so" // TODO - b/201079053: Support windows
|
||||
if ctx.ModuleType() == "ndk_prebuilt_static_stl" {
|
||||
|
@ -180,7 +180,7 @@ func stlIncludesBp2build(c *Module) bazel.StringListAttribute {
|
|||
return bazel.MakeStringListAttribute(android.FirstUniqueStrings(includeDirs))
|
||||
}
|
||||
|
||||
func ndkPrebuiltStlBp2build(ctx android.TopDownMutatorContext, c *Module) {
|
||||
func ndkPrebuiltStlBp2build(ctx android.Bp2buildMutatorContext, c *Module) {
|
||||
if ctx.ModuleType() == "ndk_prebuilt_static_stl" {
|
||||
ndkPrebuiltStaticStlBp2build(ctx, c)
|
||||
} else {
|
||||
|
@ -188,7 +188,7 @@ func ndkPrebuiltStlBp2build(ctx android.TopDownMutatorContext, c *Module) {
|
|||
}
|
||||
}
|
||||
|
||||
func ndkPrebuiltStaticStlBp2build(ctx android.TopDownMutatorContext, c *Module) {
|
||||
func ndkPrebuiltStaticStlBp2build(ctx android.Bp2buildMutatorContext, c *Module) {
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "cc_prebuilt_library_static",
|
||||
Bzl_load_location: "//build/bazel/rules/cc:cc_prebuilt_library_static.bzl",
|
||||
|
@ -201,7 +201,7 @@ func ndkPrebuiltStaticStlBp2build(ctx android.TopDownMutatorContext, c *Module)
|
|||
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: c.Name()}, attrs)
|
||||
}
|
||||
|
||||
func ndkPrebuiltSharedStlBp2build(ctx android.TopDownMutatorContext, c *Module) {
|
||||
func ndkPrebuiltSharedStlBp2build(ctx android.Bp2buildMutatorContext, c *Module) {
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "cc_prebuilt_library_shared",
|
||||
Bzl_load_location: "//build/bazel/rules/cc:cc_prebuilt_library_shared.bzl",
|
||||
|
|
|
@ -156,7 +156,7 @@ type bazelObjectAttributes struct {
|
|||
|
||||
// objectBp2Build is the bp2build converter from cc_object modules to the
|
||||
// Bazel equivalent target, plus any necessary include deps for the cc_object.
|
||||
func objectBp2Build(ctx android.TopDownMutatorContext, m *Module) {
|
||||
func objectBp2Build(ctx android.Bp2buildMutatorContext, m *Module) {
|
||||
if m.compiler == nil {
|
||||
// a cc_object must have access to the compiler decorator for its props.
|
||||
ctx.ModuleErrorf("compiler must not be nil for a cc_object module")
|
||||
|
|
|
@ -363,12 +363,12 @@ type bazelPrebuiltLibraryStaticAttributes struct {
|
|||
// all variants
|
||||
//
|
||||
// In all cases, cc_prebuilt_library_static target names will be appended with "_bp2build_cc_library_static".
|
||||
func prebuiltLibraryBp2Build(ctx android.TopDownMutatorContext, module *Module) {
|
||||
func prebuiltLibraryBp2Build(ctx android.Bp2buildMutatorContext, module *Module) {
|
||||
prebuiltLibraryStaticBp2Build(ctx, module, true)
|
||||
prebuiltLibrarySharedBp2Build(ctx, module)
|
||||
}
|
||||
|
||||
func prebuiltLibraryStaticBp2Build(ctx android.TopDownMutatorContext, module *Module, fullBuild bool) {
|
||||
func prebuiltLibraryStaticBp2Build(ctx android.Bp2buildMutatorContext, module *Module, fullBuild bool) {
|
||||
prebuiltAttrs := Bp2BuildParsePrebuiltLibraryProps(ctx, module, true)
|
||||
exportedIncludes := bp2BuildParseExportedIncludes(ctx, module, nil)
|
||||
|
||||
|
@ -404,7 +404,7 @@ type bazelPrebuiltLibrarySharedAttributes struct {
|
|||
Export_system_includes bazel.StringListAttribute
|
||||
}
|
||||
|
||||
func prebuiltLibrarySharedBp2Build(ctx android.TopDownMutatorContext, module *Module) {
|
||||
func prebuiltLibrarySharedBp2Build(ctx android.Bp2buildMutatorContext, module *Module) {
|
||||
prebuiltAttrs := Bp2BuildParsePrebuiltLibraryProps(ctx, module, false)
|
||||
exportedIncludes := bp2BuildParseExportedIncludes(ctx, module, nil)
|
||||
|
||||
|
@ -637,7 +637,7 @@ type bazelPrebuiltObjectAttributes struct {
|
|||
Src bazel.LabelAttribute
|
||||
}
|
||||
|
||||
func prebuiltObjectBp2Build(ctx android.TopDownMutatorContext, module *Module) {
|
||||
func prebuiltObjectBp2Build(ctx android.Bp2buildMutatorContext, module *Module) {
|
||||
prebuiltAttrs := bp2BuildParsePrebuiltObjectProps(ctx, module)
|
||||
|
||||
attrs := &bazelPrebuiltObjectAttributes{
|
||||
|
@ -797,7 +797,7 @@ type bazelPrebuiltBinaryAttributes struct {
|
|||
Strip stripAttributes
|
||||
}
|
||||
|
||||
func prebuiltBinaryBp2Build(ctx android.TopDownMutatorContext, module *Module) {
|
||||
func prebuiltBinaryBp2Build(ctx android.Bp2buildMutatorContext, module *Module) {
|
||||
prebuiltAttrs := bp2BuildParsePrebuiltBinaryProps(ctx, module)
|
||||
|
||||
var la linkerAttributes
|
||||
|
|
|
@ -700,7 +700,7 @@ type testBinaryAttributes struct {
|
|||
// TODO(b/244432609): handle `isolated` property.
|
||||
// TODO(b/244432134): handle custom runpaths for tests that assume runfile layouts not
|
||||
// default to bazel. (see linkerInit function)
|
||||
func testBinaryBp2build(ctx android.TopDownMutatorContext, m *Module) {
|
||||
func testBinaryBp2build(ctx android.Bp2buildMutatorContext, m *Module) {
|
||||
var testBinaryAttrs testBinaryAttributes
|
||||
testBinaryAttrs.binaryAttributes = binaryBp2buildAttrs(ctx, m)
|
||||
|
||||
|
|
|
@ -712,7 +712,7 @@ type bazelPrebuiltFileAttributes struct {
|
|||
// Bp2buildHelper returns a bazelPrebuiltFileAttributes used for the conversion
|
||||
// of prebuilt_* modules. bazelPrebuiltFileAttributes has the common attributes
|
||||
// used by both prebuilt_etc_xml and other prebuilt_* moodules
|
||||
func (module *PrebuiltEtc) Bp2buildHelper(ctx android.TopDownMutatorContext) (*bazelPrebuiltFileAttributes, bool) {
|
||||
func (module *PrebuiltEtc) Bp2buildHelper(ctx android.Bp2buildMutatorContext) (*bazelPrebuiltFileAttributes, bool) {
|
||||
var src bazel.LabelAttribute
|
||||
for axis, configToProps := range module.GetArchVariantProperties(ctx, &prebuiltEtcProperties{}) {
|
||||
for config, p := range configToProps {
|
||||
|
@ -794,7 +794,7 @@ func (module *PrebuiltEtc) Bp2buildHelper(ctx android.TopDownMutatorContext) (*b
|
|||
// ConvertWithBp2build performs bp2build conversion of PrebuiltEtc
|
||||
// prebuilt_* modules (except prebuilt_etc_xml) are PrebuiltEtc,
|
||||
// which we treat as *PrebuiltFile*
|
||||
func (module *PrebuiltEtc) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (module *PrebuiltEtc) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
var dir = module.installDirBase
|
||||
// prebuilt_file supports only `etc` or `usr/share`
|
||||
if !(dir == "etc" || dir == "usr/share") {
|
||||
|
|
|
@ -920,7 +920,7 @@ type BazelGenruleAttributes struct {
|
|||
}
|
||||
|
||||
// ConvertWithBp2build converts a Soong module -> Bazel target.
|
||||
func (m *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (m *Module) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
// Bazel only has the "tools" attribute.
|
||||
tools_prop := android.BazelLabelForModuleDeps(ctx, m.properties.Tools)
|
||||
tool_files_prop := android.BazelLabelForModuleSrc(ctx, m.properties.Tool_files)
|
||||
|
|
|
@ -1239,7 +1239,7 @@ type bazelAndroidLibraryImport struct {
|
|||
Sdk_version bazel.StringAttribute
|
||||
}
|
||||
|
||||
func (a *aapt) convertAaptAttrsWithBp2Build(ctx android.TopDownMutatorContext) (*bazelAapt, bool) {
|
||||
func (a *aapt) convertAaptAttrsWithBp2Build(ctx android.Bp2buildMutatorContext) (*bazelAapt, bool) {
|
||||
manifest := proptools.StringDefault(a.aaptProperties.Manifest, "AndroidManifest.xml")
|
||||
|
||||
resourceFiles := bazel.LabelList{
|
||||
|
@ -1275,7 +1275,7 @@ func (a *aapt) convertAaptAttrsWithBp2Build(ctx android.TopDownMutatorContext) (
|
|||
}, true
|
||||
}
|
||||
|
||||
func (a *AARImport) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (a *AARImport) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
aars := android.BazelLabelForModuleSrcExcludes(ctx, a.properties.Aars, []string{})
|
||||
exportableStaticLibs := []string{}
|
||||
// TODO(b/240716882): investigate and handle static_libs deps that are not imports. They are not supported for export by Bazel.
|
||||
|
@ -1328,7 +1328,7 @@ func AndroidLibraryBazelTargetModuleProperties() bazel.BazelTargetModuleProperti
|
|||
}
|
||||
}
|
||||
|
||||
func (a *AndroidLibrary) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (a *AndroidLibrary) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
commonAttrs, bp2buildInfo, supported := a.convertLibraryAttrsBp2Build(ctx)
|
||||
if !supported {
|
||||
return
|
||||
|
|
10
java/app.go
10
java/app.go
|
@ -1594,11 +1594,11 @@ type bazelAndroidAppCertificateAttributes struct {
|
|||
Certificate string
|
||||
}
|
||||
|
||||
func (m *AndroidAppCertificate) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (m *AndroidAppCertificate) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
androidAppCertificateBp2Build(ctx, m)
|
||||
}
|
||||
|
||||
func androidAppCertificateBp2Build(ctx android.TopDownMutatorContext, module *AndroidAppCertificate) {
|
||||
func androidAppCertificateBp2Build(ctx android.Bp2buildMutatorContext, module *AndroidAppCertificate) {
|
||||
var certificate string
|
||||
if module.properties.Certificate != nil {
|
||||
certificate = *module.properties.Certificate
|
||||
|
@ -1634,7 +1634,7 @@ type bazelAndroidAppAttributes struct {
|
|||
Proguard_specs bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
func convertWithBp2build(ctx android.TopDownMutatorContext, a *AndroidApp) (bool, android.CommonAttributes, *bazelAndroidAppAttributes) {
|
||||
func convertWithBp2build(ctx android.Bp2buildMutatorContext, a *AndroidApp) (bool, android.CommonAttributes, *bazelAndroidAppAttributes) {
|
||||
aapt, supported := a.convertAaptAttrsWithBp2Build(ctx)
|
||||
if !supported {
|
||||
return false, android.CommonAttributes{}, &bazelAndroidAppAttributes{}
|
||||
|
@ -1745,7 +1745,7 @@ func convertWithBp2build(ctx android.TopDownMutatorContext, a *AndroidApp) (bool
|
|||
}
|
||||
|
||||
// ConvertWithBp2build is used to convert android_app to Bazel.
|
||||
func (a *AndroidApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (a *AndroidApp) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if ok, commonAttrs, appAttrs := convertWithBp2build(ctx, a); ok {
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "android_binary",
|
||||
|
@ -1758,7 +1758,7 @@ func (a *AndroidApp) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
|||
}
|
||||
|
||||
// ConvertWithBp2build is used to convert android_test to Bazel.
|
||||
func (at *AndroidTest) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (at *AndroidTest) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if ok, commonAttrs, appAttrs := convertWithBp2build(ctx, &at.AndroidApp); ok {
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "android_test",
|
||||
|
|
|
@ -2359,7 +2359,7 @@ type ModuleWithStem interface {
|
|||
|
||||
var _ ModuleWithStem = (*Module)(nil)
|
||||
|
||||
func (j *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (j *Module) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
switch ctx.ModuleType() {
|
||||
case "java_library", "java_library_host", "java_library_static", "tradefed_java_library_host":
|
||||
if lib, ok := ctx.Module().(*Library); ok {
|
||||
|
|
|
@ -198,7 +198,7 @@ type bazelDeviceHostConverterAttributes struct {
|
|||
Exports bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
func (d *DeviceHostConverter) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (d *DeviceHostConverter) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
ctx.CreateBazelTargetModule(
|
||||
bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "java_host_for_device",
|
||||
|
|
|
@ -871,7 +871,7 @@ func (d *ExportedDroiddocDir) GenerateAndroidBuildActions(ctx android.ModuleCont
|
|||
}
|
||||
|
||||
// ConvertWithBp2build implements android.BazelModule.
|
||||
func (d *ExportedDroiddocDir) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (d *ExportedDroiddocDir) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
// Use the native py_library rule.
|
||||
Rule_class: "droiddoc_exported_dir",
|
||||
|
|
16
java/java.go
16
java/java.go
|
@ -2775,7 +2775,7 @@ type javaResourcesAttributes struct {
|
|||
Additional_resources bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
func (m *Library) getResourceFilegroupStripPrefix(ctx android.TopDownMutatorContext, resourceFilegroup string) (*string, bool) {
|
||||
func (m *Library) getResourceFilegroupStripPrefix(ctx android.Bp2buildMutatorContext, resourceFilegroup string) (*string, bool) {
|
||||
if otherM, ok := ctx.ModuleFromName(resourceFilegroup); ok {
|
||||
if fg, isFilegroup := otherM.(android.FileGroupPath); isFilegroup {
|
||||
return proptools.StringPtr(filepath.Join(ctx.OtherModuleDir(otherM), fg.GetPath(ctx))), true
|
||||
|
@ -2784,7 +2784,7 @@ func (m *Library) getResourceFilegroupStripPrefix(ctx android.TopDownMutatorCont
|
|||
return proptools.StringPtr(""), false
|
||||
}
|
||||
|
||||
func (m *Library) convertJavaResourcesAttributes(ctx android.TopDownMutatorContext) *javaResourcesAttributes {
|
||||
func (m *Library) convertJavaResourcesAttributes(ctx android.Bp2buildMutatorContext) *javaResourcesAttributes {
|
||||
var resources bazel.LabelList
|
||||
var resourceStripPrefix *string
|
||||
|
||||
|
@ -2915,7 +2915,7 @@ func javaXsdTargetName(xsd android.XsdConfigBp2buildTargets) string {
|
|||
// which has other non-attribute information needed for bp2build conversion
|
||||
// that needs different handling depending on the module types, and thus needs
|
||||
// to be returned to the calling function.
|
||||
func (m *Library) convertLibraryAttrsBp2Build(ctx android.TopDownMutatorContext) (*javaCommonAttributes, *bp2BuildJavaInfo, bool) {
|
||||
func (m *Library) convertLibraryAttrsBp2Build(ctx android.Bp2buildMutatorContext) (*javaCommonAttributes, *bp2BuildJavaInfo, bool) {
|
||||
var srcs bazel.LabelListAttribute
|
||||
var deps bazel.LabelListAttribute
|
||||
var staticDeps bazel.LabelListAttribute
|
||||
|
@ -3136,7 +3136,7 @@ func javaLibraryBazelTargetModuleProperties() bazel.BazelTargetModuleProperties
|
|||
}
|
||||
}
|
||||
|
||||
func javaLibraryBp2Build(ctx android.TopDownMutatorContext, m *Library) {
|
||||
func javaLibraryBp2Build(ctx android.Bp2buildMutatorContext, m *Library) {
|
||||
commonAttrs, bp2BuildInfo, supported := m.convertLibraryAttrsBp2Build(ctx)
|
||||
if !supported {
|
||||
return
|
||||
|
@ -3192,7 +3192,7 @@ type javaBinaryHostAttributes struct {
|
|||
}
|
||||
|
||||
// JavaBinaryHostBp2Build is for java_binary_host bp2build.
|
||||
func javaBinaryHostBp2Build(ctx android.TopDownMutatorContext, m *Binary) {
|
||||
func javaBinaryHostBp2Build(ctx android.Bp2buildMutatorContext, m *Binary) {
|
||||
commonAttrs, bp2BuildInfo, supported := m.convertLibraryAttrsBp2Build(ctx)
|
||||
if !supported {
|
||||
return
|
||||
|
@ -3279,7 +3279,7 @@ type javaTestHostAttributes struct {
|
|||
}
|
||||
|
||||
// javaTestHostBp2Build is for java_test_host bp2build.
|
||||
func javaTestHostBp2Build(ctx android.TopDownMutatorContext, m *TestHost) {
|
||||
func javaTestHostBp2Build(ctx android.Bp2buildMutatorContext, m *TestHost) {
|
||||
commonAttrs, bp2BuildInfo, supported := m.convertLibraryAttrsBp2Build(ctx)
|
||||
if !supported {
|
||||
return
|
||||
|
@ -3332,7 +3332,7 @@ type libraryCreationInfo struct {
|
|||
|
||||
// helper function that creates java_library target from java_binary_host or java_test_host,
|
||||
// and returns the library target name,
|
||||
func createLibraryTarget(ctx android.TopDownMutatorContext, libInfo libraryCreationInfo) string {
|
||||
func createLibraryTarget(ctx android.Bp2buildMutatorContext, libInfo libraryCreationInfo) string {
|
||||
libName := libInfo.baseName + "_lib"
|
||||
var libProps bazel.BazelTargetModuleProperties
|
||||
if libInfo.hasKotlin {
|
||||
|
@ -3355,7 +3355,7 @@ type bazelJavaImportAttributes struct {
|
|||
}
|
||||
|
||||
// java_import bp2Build converter.
|
||||
func (i *Import) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (i *Import) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
var jars bazel.LabelListAttribute
|
||||
archVariantProps := i.GetArchVariantProperties(ctx, &ImportProperties{})
|
||||
for axis, configToProps := range archVariantProps {
|
||||
|
|
|
@ -130,7 +130,7 @@ type bazelPlatformCompatConfigAttributes struct {
|
|||
Src bazel.LabelAttribute
|
||||
}
|
||||
|
||||
func (p *platformCompatConfig) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (p *platformCompatConfig) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
Rule_class: "platform_compat_config",
|
||||
Bzl_load_location: "//build/bazel/rules/java:platform_compat_config.bzl",
|
||||
|
|
|
@ -64,7 +64,7 @@ type pluginAttributes struct {
|
|||
}
|
||||
|
||||
// ConvertWithBp2build is used to convert android_app to Bazel.
|
||||
func (p *Plugin) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (p *Plugin) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
pluginName := p.Name()
|
||||
commonAttrs, bp2BuildInfo, supported := p.convertLibraryAttrsBp2Build(ctx)
|
||||
if !supported {
|
||||
|
|
|
@ -2284,7 +2284,7 @@ type bazelSdkLibraryAttributes struct {
|
|||
}
|
||||
|
||||
// java_sdk_library bp2build converter
|
||||
func (module *SdkLibrary) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (module *SdkLibrary) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if ctx.ModuleType() != "java_sdk_library" {
|
||||
ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_TYPE_UNSUPPORTED, "")
|
||||
return
|
||||
|
@ -2449,7 +2449,7 @@ func sdkLibraryImportFactory() android.Module {
|
|||
}
|
||||
|
||||
// java_sdk_library bp2build converter
|
||||
func (i *SdkLibraryImport) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (i *SdkLibraryImport) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
nameToAttr := make(map[string]*bazel.Label)
|
||||
|
||||
for scope, props := range i.scopeProperties {
|
||||
|
|
|
@ -107,7 +107,7 @@ type linkerConfigAttributes struct {
|
|||
Src bazel.LabelAttribute
|
||||
}
|
||||
|
||||
func (l *linkerConfig) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (l *linkerConfig) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if l.properties.Src == nil {
|
||||
ctx.PropertyErrorf("src", "empty src is not supported")
|
||||
ctx.MarkBp2buildUnconvertible(bp2build_metrics_proto.UnconvertedReasonType_UNSUPPORTED, "")
|
||||
|
|
|
@ -54,7 +54,7 @@ type baseAttributes struct {
|
|||
Imports bazel.StringListAttribute
|
||||
}
|
||||
|
||||
func (m *PythonLibraryModule) makeArchVariantBaseAttributes(ctx android.TopDownMutatorContext) baseAttributes {
|
||||
func (m *PythonLibraryModule) makeArchVariantBaseAttributes(ctx android.Bp2buildMutatorContext) baseAttributes {
|
||||
var attrs baseAttributes
|
||||
archVariantBaseProps := m.GetArchVariantProperties(ctx, &BaseProperties{})
|
||||
for axis, configToProps := range archVariantBaseProps {
|
||||
|
@ -123,7 +123,7 @@ func (m *PythonLibraryModule) makeArchVariantBaseAttributes(ctx android.TopDownM
|
|||
return attrs
|
||||
}
|
||||
|
||||
func (m *PythonLibraryModule) bp2buildPythonVersion(ctx android.TopDownMutatorContext) *string {
|
||||
func (m *PythonLibraryModule) bp2buildPythonVersion(ctx android.Bp2buildMutatorContext) *string {
|
||||
py3Enabled := proptools.BoolDefault(m.properties.Version.Py3.Enabled, true)
|
||||
py2Enabled := proptools.BoolDefault(m.properties.Version.Py2.Enabled, false)
|
||||
if py2Enabled && !py3Enabled {
|
||||
|
@ -146,7 +146,7 @@ type bazelPythonBinaryAttributes struct {
|
|||
Imports bazel.StringListAttribute
|
||||
}
|
||||
|
||||
func (p *PythonLibraryModule) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (p *PythonLibraryModule) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
// TODO(b/182306917): this doesn't fully handle all nested props versioned
|
||||
// by the python version, which would have been handled by the version split
|
||||
// mutator. This is sufficient for very simple python_library modules under
|
||||
|
@ -176,7 +176,7 @@ func (p *PythonLibraryModule) ConvertWithBp2build(ctx android.TopDownMutatorCont
|
|||
}, attrs)
|
||||
}
|
||||
|
||||
func (p *PythonBinaryModule) bp2buildBinaryProperties(ctx android.TopDownMutatorContext) (*bazelPythonBinaryAttributes, bazel.LabelListAttribute) {
|
||||
func (p *PythonBinaryModule) bp2buildBinaryProperties(ctx android.Bp2buildMutatorContext) (*bazelPythonBinaryAttributes, bazel.LabelListAttribute) {
|
||||
// TODO(b/182306917): this doesn't fully handle all nested props versioned
|
||||
// by the python version, which would have been handled by the version split
|
||||
// mutator. This is sufficient for very simple python_binary_host modules
|
||||
|
@ -209,7 +209,7 @@ func (p *PythonBinaryModule) bp2buildBinaryProperties(ctx android.TopDownMutator
|
|||
return attrs, baseAttrs.Data
|
||||
}
|
||||
|
||||
func (p *PythonBinaryModule) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (p *PythonBinaryModule) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
attrs, data := p.bp2buildBinaryProperties(ctx)
|
||||
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
|
@ -223,7 +223,7 @@ func (p *PythonBinaryModule) ConvertWithBp2build(ctx android.TopDownMutatorConte
|
|||
}, attrs)
|
||||
}
|
||||
|
||||
func (p *PythonTestModule) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (p *PythonTestModule) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
// Python tests are currently exactly the same as binaries, but with a different module type
|
||||
attrs, data := p.bp2buildBinaryProperties(ctx)
|
||||
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
package rust
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/bazel"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -199,7 +200,7 @@ type rustBinaryLibraryAttributes struct {
|
|||
Rustc_flags bazel.StringListAttribute
|
||||
}
|
||||
|
||||
func binaryBp2build(ctx android.TopDownMutatorContext, m *Module) {
|
||||
func binaryBp2build(ctx android.Bp2buildMutatorContext, m *Module) {
|
||||
binary := m.compiler.(*binaryDecorator)
|
||||
|
||||
var srcs bazel.LabelList
|
||||
|
|
|
@ -810,7 +810,7 @@ type rustLibraryAttributes struct {
|
|||
Proc_macro_deps bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
func libraryBp2build(ctx android.TopDownMutatorContext, m *Module) {
|
||||
func libraryBp2build(ctx android.Bp2buildMutatorContext, m *Module) {
|
||||
lib := m.compiler.(*libraryDecorator)
|
||||
|
||||
srcs, compileData := srcsAndCompileDataAttrs(ctx, *lib.baseCompiler)
|
||||
|
@ -887,7 +887,7 @@ type cargoBuildScriptAttributes struct {
|
|||
Version bazel.StringAttribute
|
||||
}
|
||||
|
||||
func cargoBuildScriptBp2build(ctx android.TopDownMutatorContext, m *Module) *string {
|
||||
func cargoBuildScriptBp2build(ctx android.Bp2buildMutatorContext, m *Module) *string {
|
||||
// Soong treats some crates like libprotobuf as special in that they have
|
||||
// cargo build script ran to produce an out folder and check it into AOSP
|
||||
// For example, https://cs.android.com/android/platform/superproject/main/+/main:external/rust/crates/protobuf/out/
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
package rust
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/bazel"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -114,7 +115,7 @@ type procMacroAttributes struct {
|
|||
Rustc_flags bazel.StringListAttribute
|
||||
}
|
||||
|
||||
func procMacroBp2build(ctx android.TopDownMutatorContext, m *Module) {
|
||||
func procMacroBp2build(ctx android.Bp2buildMutatorContext, m *Module) {
|
||||
procMacro := m.compiler.(*procMacroDecorator)
|
||||
srcs, compileData := srcsAndCompileDataAttrs(ctx, *procMacro.baseCompiler)
|
||||
deps := android.BazelLabelForModuleDeps(ctx, append(
|
||||
|
|
|
@ -282,7 +282,7 @@ type protoLibraryAttributes struct {
|
|||
Srcs bazel.LabelListAttribute
|
||||
}
|
||||
|
||||
func protoLibraryBp2build(ctx android.TopDownMutatorContext, m *Module) {
|
||||
func protoLibraryBp2build(ctx android.Bp2buildMutatorContext, m *Module) {
|
||||
var protoFiles []string
|
||||
|
||||
for _, propsInterface := range m.sourceProvider.SourceProviderProps() {
|
||||
|
|
|
@ -15,11 +15,12 @@
|
|||
package rust
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"android/soong/bazel"
|
||||
"android/soong/bloaty"
|
||||
"android/soong/ui/metrics/bp2build_metrics_proto"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
@ -1845,7 +1846,7 @@ func (c *Module) Partition() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (m *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (m *Module) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
if ctx.ModuleType() == "rust_library_host" || ctx.ModuleType() == "rust_library" {
|
||||
libraryBp2build(ctx, m)
|
||||
} else if ctx.ModuleType() == "rust_proc_macro" {
|
||||
|
@ -1864,7 +1865,7 @@ func (m *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
|||
// TODO(b/297344471): When crate_root prop is set which enforces inputs sandboxing,
|
||||
// always use `srcs` and `compile_data` props to generate `srcs` and `compile_data` attributes
|
||||
// instead of using globs.
|
||||
func srcsAndCompileDataAttrs(ctx android.TopDownMutatorContext, c baseCompiler) (bazel.LabelList, bazel.LabelList) {
|
||||
func srcsAndCompileDataAttrs(ctx android.Bp2buildMutatorContext, c baseCompiler) (bazel.LabelList, bazel.LabelList) {
|
||||
var srcs bazel.LabelList
|
||||
var compileData bazel.LabelList
|
||||
|
||||
|
|
|
@ -583,7 +583,7 @@ type bazelShTestAttributes struct {
|
|||
Auto_gen_config *bool
|
||||
}
|
||||
|
||||
func (m *ShBinary) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (m *ShBinary) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
srcs := bazel.MakeLabelListAttribute(
|
||||
android.BazelLabelForModuleSrc(ctx, []string{*m.properties.Src}))
|
||||
|
||||
|
@ -611,7 +611,7 @@ func (m *ShBinary) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
|||
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: m.Name()}, attrs)
|
||||
}
|
||||
|
||||
func (m *ShTest) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (m *ShTest) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
srcs := bazel.MakeLabelListAttribute(
|
||||
android.BazelLabelForModuleSrc(ctx, []string{*m.properties.Src}))
|
||||
|
||||
|
|
|
@ -591,7 +591,7 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
|
|||
}
|
||||
|
||||
// TODO(b/240463568): Additional properties will be added for API validation
|
||||
func (m *syspropLibrary) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (m *syspropLibrary) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
labels := cc.SyspropLibraryLabels{
|
||||
SyspropLibraryLabel: m.BaseModuleName(),
|
||||
SharedLibraryLabel: m.CcImplementationModuleName(),
|
||||
|
|
|
@ -49,7 +49,7 @@ type TestConfigAttributes struct {
|
|||
}
|
||||
|
||||
func GetTestConfigAttributes(
|
||||
ctx android.TopDownMutatorContext,
|
||||
ctx android.Bp2buildMutatorContext,
|
||||
testConfig *string,
|
||||
extraTestConfigs []string,
|
||||
autoGenConfig *bool,
|
||||
|
@ -93,7 +93,7 @@ func GetTestConfigAttributes(
|
|||
}
|
||||
|
||||
func GetTestConfig(
|
||||
ctx android.TopDownMutatorContext,
|
||||
ctx android.Bp2buildMutatorContext,
|
||||
testConfig *string,
|
||||
) *bazel.Label {
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ type bazelPrebuiltEtcXmlAttributes struct {
|
|||
Schema *string
|
||||
}
|
||||
|
||||
func (p *prebuiltEtcXml) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
|
||||
func (p *prebuiltEtcXml) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
||||
baseAttrs, convertible := p.PrebuiltEtc.Bp2buildHelper(ctx)
|
||||
|
||||
if !convertible {
|
||||
|
|
Loading…
Reference in a new issue