Refactor cc/cc.go cc/library.go shouldCreateSourceAbiDump()

* Consolidate the two shouldCreateSourceAbiDump() in cc/cc.go and
  cc/library.go into cc/sabi.go.
* Rename SAbiProperties.CreateSAbiDumps to ShouldCreateSourceAbiDump.
* sabiDepsMutator determines whether a library needs to generate ABI
  dump, and mark their ShouldCreateSourceAbiDump property.
* After this change, sabi.Properties.ShouldCreateSourceAbiDump is the
  single source of truth of whether ABI dump should be created or not.
  GenerateAndroidBuildActions() should check the property, or call the
  property accessor (*sabi).shouldCreateSourceAbiDump().
* classifySourceAbiDump() is no longer a *libraryDecorator receiver.
  Instead it uses the libraryInterface object in the
  ctx.Module().(*cc.Module).library field. This way
  classifySourceAbiDump() doesn't need to depend on the internal fields
  of libraryDecorator.

Bug: 145608479
Bug: 173492236
Test: Presubmit
Test: Dump the list of module names marked by sabi_deps mutator
Change-Id: Ibfc29fe0153551ab6e2d56ff38ab9bae2c179e0b
This commit is contained in:
Yo Chiang
2020-12-14 11:42:16 +08:00
parent 8aa4e3f99e
commit 2bbadfaef7
3 changed files with 139 additions and 120 deletions

View File

@@ -419,7 +419,6 @@ type ModuleContextIntf interface {
inRamdisk() bool
inVendorRamdisk() bool
inRecovery() bool
shouldCreateSourceAbiDump() bool
selectedStl() string
baseModuleName() string
getVndkExtendsModuleName() string
@@ -1283,42 +1282,6 @@ func (ctx *moduleContextImpl) mustUseVendorVariant() bool {
return ctx.mod.MustUseVendorVariant()
}
// Check whether ABI dumps should be created for this module.
func (ctx *moduleContextImpl) shouldCreateSourceAbiDump() bool {
if ctx.ctx.Config().IsEnvTrue("SKIP_ABI_CHECKS") {
return false
}
// Coverage builds have extra symbols.
if ctx.mod.isCoverageVariant() {
return false
}
if ctx.ctx.Fuchsia() {
return false
}
if sanitize := ctx.mod.sanitize; sanitize != nil {
if !sanitize.isVariantOnProductionDevice() {
return false
}
}
if !ctx.ctx.Device() {
// Host modules do not need ABI dumps.
return false
}
if ctx.isNDKStubLibrary() {
// Stubs do not need ABI dumps.
return false
}
if lib := ctx.mod.library; lib != nil && lib.buildStubs() {
// Stubs do not need ABI dumps.
return false
}
return true
}
func (ctx *moduleContextImpl) selectedStl() string {
if stl := ctx.mod.stl; stl != nil {
return stl.Properties.SelectedStl