Skip apex dep check when sanitizer diag is enabled am: 18417cbd72
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1523578 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I0d4bf142624d9fdfa9115a970ed9d1937ed5e295
This commit is contained in:
commit
262139d285
4 changed files with 33 additions and 2 deletions
|
@ -253,6 +253,12 @@ type CopyDirectlyInAnyApexTag interface {
|
||||||
CopyDirectlyInAnyApex()
|
CopyDirectlyInAnyApex()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Interface that identifies dependencies to skip Apex dependency check
|
||||||
|
type SkipApexAllowedDependenciesCheck interface {
|
||||||
|
// Returns true to skip the Apex dependency check, which limits the allowed dependency in build.
|
||||||
|
SkipApexAllowedDependenciesCheck() bool
|
||||||
|
}
|
||||||
|
|
||||||
// ApexModuleBase provides the default implementation for the ApexModule interface. APEX-aware
|
// ApexModuleBase provides the default implementation for the ApexModule interface. APEX-aware
|
||||||
// modules are expected to include this struct and call InitApexModule().
|
// modules are expected to include this struct and call InitApexModule().
|
||||||
type ApexModuleBase struct {
|
type ApexModuleBase struct {
|
||||||
|
|
|
@ -902,6 +902,12 @@ func (a *apexBundle) buildApexDependencyInfo(ctx android.ModuleContext) {
|
||||||
return !externalDep
|
return !externalDep
|
||||||
}
|
}
|
||||||
|
|
||||||
|
depTag := ctx.OtherModuleDependencyTag(to)
|
||||||
|
if skipDepCheck, ok := depTag.(android.SkipApexAllowedDependenciesCheck); ok && skipDepCheck.SkipApexAllowedDependenciesCheck() {
|
||||||
|
// Check to see if dependency been marked to skip the dependency check
|
||||||
|
return !externalDep
|
||||||
|
}
|
||||||
|
|
||||||
if info, exists := depInfos[to.Name()]; exists {
|
if info, exists := depInfos[to.Name()]; exists {
|
||||||
if !android.InList(from.Name(), info.From) {
|
if !android.InList(from.Name(), info.From) {
|
||||||
info.From = append(info.From, from.Name())
|
info.From = append(info.From, from.Name())
|
||||||
|
|
3
cc/cc.go
3
cc/cc.go
|
@ -609,6 +609,9 @@ type libraryDependencyTag struct {
|
||||||
|
|
||||||
makeSuffix string
|
makeSuffix string
|
||||||
|
|
||||||
|
// Whether or not this dependency should skip the apex dependency check
|
||||||
|
skipApexAllowedDependenciesCheck bool
|
||||||
|
|
||||||
// Whether or not this dependency has to be followed for the apex variants
|
// Whether or not this dependency has to be followed for the apex variants
|
||||||
excludeInApex bool
|
excludeInApex bool
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,6 +204,13 @@ type sanitize struct {
|
||||||
Properties SanitizeProperties
|
Properties SanitizeProperties
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark this tag with a check to see if apex dependency check should be skipped
|
||||||
|
func (t libraryDependencyTag) SkipApexAllowedDependenciesCheck() bool {
|
||||||
|
return t.skipApexAllowedDependenciesCheck
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ android.SkipApexAllowedDependenciesCheck = (*libraryDependencyTag)(nil)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
android.RegisterMakeVarsProvider(pctx, cfiMakeVarsProvider)
|
android.RegisterMakeVarsProvider(pctx, cfiMakeVarsProvider)
|
||||||
android.RegisterMakeVarsProvider(pctx, hwasanMakeVarsProvider)
|
android.RegisterMakeVarsProvider(pctx, hwasanMakeVarsProvider)
|
||||||
|
@ -1038,9 +1045,18 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
|
||||||
runtimeLibrary = lib
|
runtimeLibrary = lib
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Skip apex dependency check for sharedLibraryDependency
|
||||||
|
// when sanitizer diags are enabled. Skipping the check will allow
|
||||||
|
// building with diag libraries without having to list the
|
||||||
|
// dependency in Apex's allowed_deps file.
|
||||||
|
diagEnabled := len(diagSanitizers) > 0
|
||||||
// dynamic executable and shared libs get shared runtime libs
|
// dynamic executable and shared libs get shared runtime libs
|
||||||
depTag := libraryDependencyTag{Kind: sharedLibraryDependency, Order: earlyLibraryDependency}
|
depTag := libraryDependencyTag{
|
||||||
|
Kind: sharedLibraryDependency,
|
||||||
|
Order: earlyLibraryDependency,
|
||||||
|
|
||||||
|
skipApexAllowedDependenciesCheck: diagEnabled,
|
||||||
|
}
|
||||||
variations := append(mctx.Target().Variations(),
|
variations := append(mctx.Target().Variations(),
|
||||||
blueprint.Variation{Mutator: "link", Variation: "shared"})
|
blueprint.Variation{Mutator: "link", Variation: "shared"})
|
||||||
if c.Device() {
|
if c.Device() {
|
||||||
|
|
Loading…
Reference in a new issue