Support a few more attrs in cc_aconfig_library.
More might be added later when we have an allowlist. Bug: 305998969 Test: b build with the change in ag/25094394 Change-Id: I92df843ac81f4e33ce7506db61c989a380015975
This commit is contained in:
parent
de88e35004
commit
f11b7c3093
7 changed files with 28 additions and 20 deletions
|
@ -143,6 +143,7 @@ func (this *CcAconfigLibraryCallbacks) GeneratorBuildActions(ctx cc.ModuleContex
|
|||
}
|
||||
|
||||
type bazelCcAconfigLibraryAttributes struct {
|
||||
cc.SdkAttributes
|
||||
Aconfig_declarations bazel.LabelAttribute
|
||||
Dynamic_deps bazel.LabelListAttribute
|
||||
}
|
||||
|
@ -154,12 +155,13 @@ type bazelCcAconfigLibraryAttributes struct {
|
|||
// module type returns a cc library and the bp2build conversion is called on the
|
||||
// cc library type.
|
||||
|
||||
func (this *CcAconfigLibraryCallbacks) GeneratorBp2build(ctx android.Bp2buildMutatorContext) bool {
|
||||
func (this *CcAconfigLibraryCallbacks) GeneratorBp2build(ctx android.Bp2buildMutatorContext, module *cc.Module) bool {
|
||||
if ctx.ModuleType() != "cc_aconfig_library" {
|
||||
return false
|
||||
}
|
||||
|
||||
attrs := bazelCcAconfigLibraryAttributes{
|
||||
SdkAttributes: cc.Bp2BuildParseSdkAttributes(module),
|
||||
Aconfig_declarations: *bazel.MakeLabelAttribute(android.BazelLabelForModuleDepSingle(ctx, this.properties.Aconfig_declarations).Label),
|
||||
Dynamic_deps: bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, []string{baseLibDep})),
|
||||
}
|
||||
|
@ -168,6 +170,12 @@ func (this *CcAconfigLibraryCallbacks) GeneratorBp2build(ctx android.Bp2buildMut
|
|||
Bzl_load_location: "//build/bazel/rules/cc:cc_aconfig_library.bzl",
|
||||
}
|
||||
|
||||
ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: ctx.ModuleName()}, &attrs)
|
||||
ctx.CreateBazelTargetModule(
|
||||
props,
|
||||
android.CommonAttributes{
|
||||
Name: ctx.ModuleName(),
|
||||
Tags: android.ApexAvailableTagsWithoutTestApexes(ctx, module),
|
||||
},
|
||||
&attrs)
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -651,7 +651,7 @@ func binaryBp2buildAttrs(ctx android.Bp2buildMutatorContext, m *Module) binaryAt
|
|||
|
||||
Features: baseAttrs.features,
|
||||
|
||||
sdkAttributes: bp2BuildParseSdkAttributes(m),
|
||||
SdkAttributes: Bp2BuildParseSdkAttributes(m),
|
||||
|
||||
Native_coverage: baseAttrs.Native_coverage,
|
||||
}
|
||||
|
@ -708,7 +708,7 @@ type binaryAttributes struct {
|
|||
|
||||
Features bazel.StringListAttribute
|
||||
|
||||
sdkAttributes
|
||||
SdkAttributes
|
||||
|
||||
tidyAttributes
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ type staticOrSharedAttributes struct {
|
|||
|
||||
Features bazel.StringListAttribute
|
||||
|
||||
sdkAttributes
|
||||
SdkAttributes
|
||||
|
||||
tidyAttributes
|
||||
}
|
||||
|
@ -1185,7 +1185,7 @@ func bp2buildCcAidlLibrary(
|
|||
implementationDynamicDeps := linkerAttrs.dynamicDeps.Clone()
|
||||
implementationDynamicDeps.Append(linkerAttrs.implementationDynamicDeps)
|
||||
|
||||
sdkAttrs := bp2BuildParseSdkAttributes(m)
|
||||
sdkAttrs := Bp2BuildParseSdkAttributes(m)
|
||||
|
||||
exportedIncludes := bp2BuildParseExportedIncludes(ctx, m, &compilerAttrs.includes)
|
||||
includeAttrs := includesAttributes{
|
||||
|
@ -1207,7 +1207,7 @@ func bp2buildCcAidlLibrary(
|
|||
Implementation_deps: *implementationDeps,
|
||||
Implementation_dynamic_deps: *implementationDynamicDeps,
|
||||
Tags: apexAvailableTags,
|
||||
sdkAttributes: sdkAttrs,
|
||||
SdkAttributes: sdkAttrs,
|
||||
includesAttributes: includeAttrs,
|
||||
},
|
||||
)
|
||||
|
@ -1222,14 +1222,14 @@ func bp2buildCcAidlLibrary(
|
|||
return nil
|
||||
}
|
||||
|
||||
func bp2BuildParseSdkAttributes(module *Module) sdkAttributes {
|
||||
return sdkAttributes{
|
||||
func Bp2BuildParseSdkAttributes(module *Module) SdkAttributes {
|
||||
return SdkAttributes{
|
||||
Sdk_version: module.Properties.Sdk_version,
|
||||
Min_sdk_version: module.Properties.Min_sdk_version,
|
||||
}
|
||||
}
|
||||
|
||||
type sdkAttributes struct {
|
||||
type SdkAttributes struct {
|
||||
Sdk_version *string
|
||||
Min_sdk_version *string
|
||||
}
|
||||
|
|
4
cc/cc.go
4
cc/cc.go
|
@ -589,7 +589,7 @@ type Generator interface {
|
|||
GeneratorFlags(ctx ModuleContext, flags Flags, deps PathDeps) Flags
|
||||
GeneratorSources(ctx ModuleContext) GeneratedSource
|
||||
GeneratorBuildActions(ctx ModuleContext, flags Flags, deps PathDeps)
|
||||
GeneratorBp2build(ctx android.Bp2buildMutatorContext) bool
|
||||
GeneratorBp2build(ctx android.Bp2buildMutatorContext, module *Module) bool
|
||||
}
|
||||
|
||||
// compiler is the interface for a compiler helper object. Different module decorators may implement
|
||||
|
@ -4218,7 +4218,7 @@ func (c *Module) ConvertWithBp2build(ctx android.Bp2buildMutatorContext) {
|
|||
if len(c.generators) > 0 {
|
||||
allConverted := true
|
||||
for _, generator := range c.generators {
|
||||
allConverted = allConverted && generator.GeneratorBp2build(ctx)
|
||||
allConverted = allConverted && generator.GeneratorBp2build(ctx, c)
|
||||
}
|
||||
if allConverted {
|
||||
return
|
||||
|
|
|
@ -286,7 +286,7 @@ type ccAidlLibraryAttributes struct {
|
|||
Implementation_dynamic_deps bazel.LabelListAttribute
|
||||
Tags bazel.StringListAttribute
|
||||
|
||||
sdkAttributes
|
||||
SdkAttributes
|
||||
includesAttributes
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ func libraryBp2Build(ctx android.Bp2buildMutatorContext, m *Module) {
|
|||
Whole_archive_deps: *linkerAttrs.wholeArchiveDeps.Clone().Append(staticAttrs.Whole_archive_deps),
|
||||
System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(staticAttrs.System_dynamic_deps),
|
||||
Runtime_deps: linkerAttrs.runtimeDeps,
|
||||
sdkAttributes: bp2BuildParseSdkAttributes(m),
|
||||
SdkAttributes: Bp2BuildParseSdkAttributes(m),
|
||||
Native_coverage: baseAttributes.Native_coverage,
|
||||
Additional_compiler_inputs: compilerAttrs.additionalCompilerInputs,
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ func libraryBp2Build(ctx android.Bp2buildMutatorContext, m *Module) {
|
|||
Implementation_whole_archive_deps: linkerAttrs.implementationWholeArchiveDeps,
|
||||
System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(sharedAttrs.System_dynamic_deps),
|
||||
Runtime_deps: linkerAttrs.runtimeDeps,
|
||||
sdkAttributes: bp2BuildParseSdkAttributes(m),
|
||||
SdkAttributes: Bp2BuildParseSdkAttributes(m),
|
||||
Native_coverage: baseAttributes.Native_coverage,
|
||||
Additional_compiler_inputs: compilerAttrs.additionalCompilerInputs,
|
||||
}
|
||||
|
@ -2861,7 +2861,7 @@ func sharedOrStaticLibraryBp2Build(ctx android.Bp2buildMutatorContext, module *M
|
|||
Whole_archive_deps: linkerAttrs.wholeArchiveDeps,
|
||||
Implementation_whole_archive_deps: linkerAttrs.implementationWholeArchiveDeps,
|
||||
System_dynamic_deps: linkerAttrs.systemDynamicDeps,
|
||||
sdkAttributes: bp2BuildParseSdkAttributes(module),
|
||||
SdkAttributes: Bp2BuildParseSdkAttributes(module),
|
||||
Runtime_deps: linkerAttrs.runtimeDeps,
|
||||
Native_coverage: baseAttributes.Native_coverage,
|
||||
Additional_compiler_inputs: compilerAttrs.additionalCompilerInputs,
|
||||
|
|
|
@ -122,7 +122,7 @@ type bazelCcLibraryHeadersAttributes struct {
|
|||
Export_absolute_includes bazel.StringListAttribute
|
||||
Export_system_includes bazel.StringListAttribute
|
||||
Deps bazel.LabelListAttribute
|
||||
sdkAttributes
|
||||
SdkAttributes
|
||||
}
|
||||
|
||||
func libraryHeadersBp2Build(ctx android.Bp2buildMutatorContext, module *Module) {
|
||||
|
@ -138,7 +138,7 @@ func libraryHeadersBp2Build(ctx android.Bp2buildMutatorContext, module *Module)
|
|||
Export_system_includes: exportedIncludes.SystemIncludes,
|
||||
Deps: linkerAttrs.deps,
|
||||
Hdrs: baseAttributes.hdrs,
|
||||
sdkAttributes: bp2BuildParseSdkAttributes(module),
|
||||
SdkAttributes: Bp2BuildParseSdkAttributes(module),
|
||||
}
|
||||
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
|
|
|
@ -151,7 +151,7 @@ type bazelObjectAttributes struct {
|
|||
Stl *string
|
||||
Linker_script bazel.LabelAttribute
|
||||
Crt *bool
|
||||
sdkAttributes
|
||||
SdkAttributes
|
||||
}
|
||||
|
||||
// objectBp2Build is the bp2build converter from cc_object modules to the
|
||||
|
@ -218,7 +218,7 @@ func objectBp2Build(ctx android.Bp2buildMutatorContext, m *Module) {
|
|||
Stl: compilerAttrs.stl,
|
||||
Linker_script: linkerScript,
|
||||
Crt: m.linker.(*objectLinker).Properties.Crt,
|
||||
sdkAttributes: bp2BuildParseSdkAttributes(m),
|
||||
SdkAttributes: Bp2BuildParseSdkAttributes(m),
|
||||
}
|
||||
|
||||
props := bazel.BazelTargetModuleProperties{
|
||||
|
|
Loading…
Reference in a new issue