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 {
|
type bazelCcAconfigLibraryAttributes struct {
|
||||||
|
cc.SdkAttributes
|
||||||
Aconfig_declarations bazel.LabelAttribute
|
Aconfig_declarations bazel.LabelAttribute
|
||||||
Dynamic_deps bazel.LabelListAttribute
|
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
|
// module type returns a cc library and the bp2build conversion is called on the
|
||||||
// cc library type.
|
// 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" {
|
if ctx.ModuleType() != "cc_aconfig_library" {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
attrs := bazelCcAconfigLibraryAttributes{
|
attrs := bazelCcAconfigLibraryAttributes{
|
||||||
|
SdkAttributes: cc.Bp2BuildParseSdkAttributes(module),
|
||||||
Aconfig_declarations: *bazel.MakeLabelAttribute(android.BazelLabelForModuleDepSingle(ctx, this.properties.Aconfig_declarations).Label),
|
Aconfig_declarations: *bazel.MakeLabelAttribute(android.BazelLabelForModuleDepSingle(ctx, this.properties.Aconfig_declarations).Label),
|
||||||
Dynamic_deps: bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, []string{baseLibDep})),
|
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",
|
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
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -651,7 +651,7 @@ func binaryBp2buildAttrs(ctx android.Bp2buildMutatorContext, m *Module) binaryAt
|
||||||
|
|
||||||
Features: baseAttrs.features,
|
Features: baseAttrs.features,
|
||||||
|
|
||||||
sdkAttributes: bp2BuildParseSdkAttributes(m),
|
SdkAttributes: Bp2BuildParseSdkAttributes(m),
|
||||||
|
|
||||||
Native_coverage: baseAttrs.Native_coverage,
|
Native_coverage: baseAttrs.Native_coverage,
|
||||||
}
|
}
|
||||||
|
@ -708,7 +708,7 @@ type binaryAttributes struct {
|
||||||
|
|
||||||
Features bazel.StringListAttribute
|
Features bazel.StringListAttribute
|
||||||
|
|
||||||
sdkAttributes
|
SdkAttributes
|
||||||
|
|
||||||
tidyAttributes
|
tidyAttributes
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ type staticOrSharedAttributes struct {
|
||||||
|
|
||||||
Features bazel.StringListAttribute
|
Features bazel.StringListAttribute
|
||||||
|
|
||||||
sdkAttributes
|
SdkAttributes
|
||||||
|
|
||||||
tidyAttributes
|
tidyAttributes
|
||||||
}
|
}
|
||||||
|
@ -1185,7 +1185,7 @@ func bp2buildCcAidlLibrary(
|
||||||
implementationDynamicDeps := linkerAttrs.dynamicDeps.Clone()
|
implementationDynamicDeps := linkerAttrs.dynamicDeps.Clone()
|
||||||
implementationDynamicDeps.Append(linkerAttrs.implementationDynamicDeps)
|
implementationDynamicDeps.Append(linkerAttrs.implementationDynamicDeps)
|
||||||
|
|
||||||
sdkAttrs := bp2BuildParseSdkAttributes(m)
|
sdkAttrs := Bp2BuildParseSdkAttributes(m)
|
||||||
|
|
||||||
exportedIncludes := bp2BuildParseExportedIncludes(ctx, m, &compilerAttrs.includes)
|
exportedIncludes := bp2BuildParseExportedIncludes(ctx, m, &compilerAttrs.includes)
|
||||||
includeAttrs := includesAttributes{
|
includeAttrs := includesAttributes{
|
||||||
|
@ -1207,7 +1207,7 @@ func bp2buildCcAidlLibrary(
|
||||||
Implementation_deps: *implementationDeps,
|
Implementation_deps: *implementationDeps,
|
||||||
Implementation_dynamic_deps: *implementationDynamicDeps,
|
Implementation_dynamic_deps: *implementationDynamicDeps,
|
||||||
Tags: apexAvailableTags,
|
Tags: apexAvailableTags,
|
||||||
sdkAttributes: sdkAttrs,
|
SdkAttributes: sdkAttrs,
|
||||||
includesAttributes: includeAttrs,
|
includesAttributes: includeAttrs,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -1222,14 +1222,14 @@ func bp2buildCcAidlLibrary(
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func bp2BuildParseSdkAttributes(module *Module) sdkAttributes {
|
func Bp2BuildParseSdkAttributes(module *Module) SdkAttributes {
|
||||||
return sdkAttributes{
|
return SdkAttributes{
|
||||||
Sdk_version: module.Properties.Sdk_version,
|
Sdk_version: module.Properties.Sdk_version,
|
||||||
Min_sdk_version: module.Properties.Min_sdk_version,
|
Min_sdk_version: module.Properties.Min_sdk_version,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type sdkAttributes struct {
|
type SdkAttributes struct {
|
||||||
Sdk_version *string
|
Sdk_version *string
|
||||||
Min_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
|
GeneratorFlags(ctx ModuleContext, flags Flags, deps PathDeps) Flags
|
||||||
GeneratorSources(ctx ModuleContext) GeneratedSource
|
GeneratorSources(ctx ModuleContext) GeneratedSource
|
||||||
GeneratorBuildActions(ctx ModuleContext, flags Flags, deps PathDeps)
|
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
|
// 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 {
|
if len(c.generators) > 0 {
|
||||||
allConverted := true
|
allConverted := true
|
||||||
for _, generator := range c.generators {
|
for _, generator := range c.generators {
|
||||||
allConverted = allConverted && generator.GeneratorBp2build(ctx)
|
allConverted = allConverted && generator.GeneratorBp2build(ctx, c)
|
||||||
}
|
}
|
||||||
if allConverted {
|
if allConverted {
|
||||||
return
|
return
|
||||||
|
|
|
@ -286,7 +286,7 @@ type ccAidlLibraryAttributes struct {
|
||||||
Implementation_dynamic_deps bazel.LabelListAttribute
|
Implementation_dynamic_deps bazel.LabelListAttribute
|
||||||
Tags bazel.StringListAttribute
|
Tags bazel.StringListAttribute
|
||||||
|
|
||||||
sdkAttributes
|
SdkAttributes
|
||||||
includesAttributes
|
includesAttributes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ func libraryBp2Build(ctx android.Bp2buildMutatorContext, m *Module) {
|
||||||
Whole_archive_deps: *linkerAttrs.wholeArchiveDeps.Clone().Append(staticAttrs.Whole_archive_deps),
|
Whole_archive_deps: *linkerAttrs.wholeArchiveDeps.Clone().Append(staticAttrs.Whole_archive_deps),
|
||||||
System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(staticAttrs.System_dynamic_deps),
|
System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(staticAttrs.System_dynamic_deps),
|
||||||
Runtime_deps: linkerAttrs.runtimeDeps,
|
Runtime_deps: linkerAttrs.runtimeDeps,
|
||||||
sdkAttributes: bp2BuildParseSdkAttributes(m),
|
SdkAttributes: Bp2BuildParseSdkAttributes(m),
|
||||||
Native_coverage: baseAttributes.Native_coverage,
|
Native_coverage: baseAttributes.Native_coverage,
|
||||||
Additional_compiler_inputs: compilerAttrs.additionalCompilerInputs,
|
Additional_compiler_inputs: compilerAttrs.additionalCompilerInputs,
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ func libraryBp2Build(ctx android.Bp2buildMutatorContext, m *Module) {
|
||||||
Implementation_whole_archive_deps: linkerAttrs.implementationWholeArchiveDeps,
|
Implementation_whole_archive_deps: linkerAttrs.implementationWholeArchiveDeps,
|
||||||
System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(sharedAttrs.System_dynamic_deps),
|
System_dynamic_deps: *linkerAttrs.systemDynamicDeps.Clone().Append(sharedAttrs.System_dynamic_deps),
|
||||||
Runtime_deps: linkerAttrs.runtimeDeps,
|
Runtime_deps: linkerAttrs.runtimeDeps,
|
||||||
sdkAttributes: bp2BuildParseSdkAttributes(m),
|
SdkAttributes: Bp2BuildParseSdkAttributes(m),
|
||||||
Native_coverage: baseAttributes.Native_coverage,
|
Native_coverage: baseAttributes.Native_coverage,
|
||||||
Additional_compiler_inputs: compilerAttrs.additionalCompilerInputs,
|
Additional_compiler_inputs: compilerAttrs.additionalCompilerInputs,
|
||||||
}
|
}
|
||||||
|
@ -2861,7 +2861,7 @@ func sharedOrStaticLibraryBp2Build(ctx android.Bp2buildMutatorContext, module *M
|
||||||
Whole_archive_deps: linkerAttrs.wholeArchiveDeps,
|
Whole_archive_deps: linkerAttrs.wholeArchiveDeps,
|
||||||
Implementation_whole_archive_deps: linkerAttrs.implementationWholeArchiveDeps,
|
Implementation_whole_archive_deps: linkerAttrs.implementationWholeArchiveDeps,
|
||||||
System_dynamic_deps: linkerAttrs.systemDynamicDeps,
|
System_dynamic_deps: linkerAttrs.systemDynamicDeps,
|
||||||
sdkAttributes: bp2BuildParseSdkAttributes(module),
|
SdkAttributes: Bp2BuildParseSdkAttributes(module),
|
||||||
Runtime_deps: linkerAttrs.runtimeDeps,
|
Runtime_deps: linkerAttrs.runtimeDeps,
|
||||||
Native_coverage: baseAttributes.Native_coverage,
|
Native_coverage: baseAttributes.Native_coverage,
|
||||||
Additional_compiler_inputs: compilerAttrs.additionalCompilerInputs,
|
Additional_compiler_inputs: compilerAttrs.additionalCompilerInputs,
|
||||||
|
|
|
@ -122,7 +122,7 @@ type bazelCcLibraryHeadersAttributes struct {
|
||||||
Export_absolute_includes bazel.StringListAttribute
|
Export_absolute_includes bazel.StringListAttribute
|
||||||
Export_system_includes bazel.StringListAttribute
|
Export_system_includes bazel.StringListAttribute
|
||||||
Deps bazel.LabelListAttribute
|
Deps bazel.LabelListAttribute
|
||||||
sdkAttributes
|
SdkAttributes
|
||||||
}
|
}
|
||||||
|
|
||||||
func libraryHeadersBp2Build(ctx android.Bp2buildMutatorContext, module *Module) {
|
func libraryHeadersBp2Build(ctx android.Bp2buildMutatorContext, module *Module) {
|
||||||
|
@ -138,7 +138,7 @@ func libraryHeadersBp2Build(ctx android.Bp2buildMutatorContext, module *Module)
|
||||||
Export_system_includes: exportedIncludes.SystemIncludes,
|
Export_system_includes: exportedIncludes.SystemIncludes,
|
||||||
Deps: linkerAttrs.deps,
|
Deps: linkerAttrs.deps,
|
||||||
Hdrs: baseAttributes.hdrs,
|
Hdrs: baseAttributes.hdrs,
|
||||||
sdkAttributes: bp2BuildParseSdkAttributes(module),
|
SdkAttributes: Bp2BuildParseSdkAttributes(module),
|
||||||
}
|
}
|
||||||
|
|
||||||
props := bazel.BazelTargetModuleProperties{
|
props := bazel.BazelTargetModuleProperties{
|
||||||
|
|
|
@ -151,7 +151,7 @@ type bazelObjectAttributes struct {
|
||||||
Stl *string
|
Stl *string
|
||||||
Linker_script bazel.LabelAttribute
|
Linker_script bazel.LabelAttribute
|
||||||
Crt *bool
|
Crt *bool
|
||||||
sdkAttributes
|
SdkAttributes
|
||||||
}
|
}
|
||||||
|
|
||||||
// objectBp2Build is the bp2build converter from cc_object modules to the
|
// 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,
|
Stl: compilerAttrs.stl,
|
||||||
Linker_script: linkerScript,
|
Linker_script: linkerScript,
|
||||||
Crt: m.linker.(*objectLinker).Properties.Crt,
|
Crt: m.linker.(*objectLinker).Properties.Crt,
|
||||||
sdkAttributes: bp2BuildParseSdkAttributes(m),
|
SdkAttributes: Bp2BuildParseSdkAttributes(m),
|
||||||
}
|
}
|
||||||
|
|
||||||
props := bazel.BazelTargetModuleProperties{
|
props := bazel.BazelTargetModuleProperties{
|
||||||
|
|
Loading…
Reference in a new issue