Loading android/apex.go +15 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,9 @@ type ApexInfo struct { // Returns the value of `apex_available_name` ApexAvailableName string // Returns the apex names that this module is available for ApexAvailableFor []string } // AllApexInfo holds the ApexInfo of all apexes that include this module. Loading Loading @@ -213,6 +216,12 @@ type ApexModule interface { // apex_available property of the module. AvailableFor(what string) bool // Returns the apexes that are available for this module, valid values include // "//apex_available:platform", "//apex_available:anyapex" and specific apexes. // There are some differences between this one and the ApexAvailable on // ApexModuleBase for cc, java library and sdkLibraryXml. ApexAvailableFor() []string // AlwaysRequiresPlatformApexVariant allows the implementing module to determine whether an // APEX mutator should always be created for it. // Loading Loading @@ -320,6 +329,10 @@ func (m *ApexModuleBase) ApexAvailable() []string { return CopyOf(availableToPlatformList) } func (m *ApexModuleBase) ApexAvailableFor() []string { return m.ApexAvailable() } // Implements ApexModule func (m *ApexModuleBase) BuildForApex(apex ApexInfo) { m.apexInfosLock.Lock() Loading Loading @@ -420,7 +433,7 @@ func CheckAvailableForApex(what string, apex_available []string) bool { // Implements ApexModule func (m *ApexModuleBase) AvailableFor(what string) bool { return CheckAvailableForApex(what, m.ApexProperties.Apex_available) return CheckAvailableForApex(what, m.ApexAvailableFor()) } // Implements ApexModule Loading Loading @@ -614,6 +627,7 @@ func MutateApexTransition(ctx BaseModuleContext, variation string) { } else { panic(fmt.Errorf("failed to find apexInfo for incoming variation %q", variation)) } thisApexInfo.ApexAvailableFor = module.ApexAvailableFor() SetProvider(ctx, ApexInfoProvider, thisApexInfo) } Loading android/module_proxy.go +1 −1 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ func (m ModuleProxy) VariablesForTests() map[string]string { } func (m ModuleProxy) String() string { return m.module.Name() return m.module.String() } func (m ModuleProxy) qualifiedModuleId(ctx BaseModuleContext) qualifiedModuleName { Loading apex/apex.go +3 −12 Original line number Diff line number Diff line Loading @@ -2694,7 +2694,7 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { return } a.WalkPayloadDeps(ctx, func(ctx android.BaseModuleContext, from android.Module, to android.ApexModule, externalDep bool) bool { a.WalkPayloadDepsProxy(ctx, func(ctx android.BaseModuleContext, from, to android.ModuleProxy, externalDep bool) bool { // As soon as the dependency graph crosses the APEX boundary, don't go further. if externalDep { return false Loading @@ -2711,17 +2711,8 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { fromName := ctx.OtherModuleName(from) toName := ctx.OtherModuleName(to) // If `to` is not actually in the same APEX as `from` then it does not need // apex_available and neither do any of its dependencies. // // It is ok to call DepIsInSameApex() directly from within WalkPayloadDeps(). if am, ok := from.(android.DepIsInSameApex); ok && !am.DepIsInSameApex(ctx, to) { // As soon as the dependency graph crosses the APEX boundary, don't go // further. return false } if to.AvailableFor(apexName) { if android.CheckAvailableForApex(apexName, android.OtherModuleProviderOrDefault(ctx, to, android.ApexInfoProvider).ApexAvailableFor) { return true } Loading apex/apex_test.go +7 −1 Original line number Diff line number Diff line Loading @@ -6353,10 +6353,16 @@ func TestApexAvailable_IndirectDep(t *testing.T) { testApexError(t, `requires "libbaz" that doesn't list the APEX under 'apex_available'.\n\nDependency path: .*via tag apex\.dependencyTag\{"sharedLib"\} .*-> libfoo.*link:shared.* .*via tag cc\.dependencyTag.* .*-> libfoo.*link:static.* .*via tag cc\.libraryDependencyTag.*Kind:sharedLibraryDependency.* .*-> libbar.*link:shared.* .*via tag cc\.dependencyTag.* .*-> libbar.*link:static.* .*via tag cc\.libraryDependencyTag.*Kind:sharedLibraryDependency.* .*-> libbaz.*link:shared.*`, ` .*-> libbaz.*link:shared.* .*via tag cc\.dependencyTag.* .*-> libbaz.*link:static.*`, ` apex { name: "myapex", key: "myapex.key", Loading cc/cc.go +9 −4 Original line number Diff line number Diff line Loading @@ -3689,13 +3689,18 @@ func (c *Module) IsInstallableToApex() bool { } func (c *Module) AvailableFor(what string) bool { return android.CheckAvailableForApex(what, c.ApexAvailableFor()) } func (c *Module) ApexAvailableFor() []string { list := c.ApexModuleBase.ApexAvailable() if linker, ok := c.linker.(interface { availableFor(string) bool apexAvailable() []string }); ok { return c.ApexModuleBase.AvailableFor(what) || linker.availableFor(what) } else { return c.ApexModuleBase.AvailableFor(what) list = append(list, linker.apexAvailable()...) } return android.FirstUniqueStrings(list) } func (c *Module) EverInstallable() bool { Loading Loading
android/apex.go +15 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,9 @@ type ApexInfo struct { // Returns the value of `apex_available_name` ApexAvailableName string // Returns the apex names that this module is available for ApexAvailableFor []string } // AllApexInfo holds the ApexInfo of all apexes that include this module. Loading Loading @@ -213,6 +216,12 @@ type ApexModule interface { // apex_available property of the module. AvailableFor(what string) bool // Returns the apexes that are available for this module, valid values include // "//apex_available:platform", "//apex_available:anyapex" and specific apexes. // There are some differences between this one and the ApexAvailable on // ApexModuleBase for cc, java library and sdkLibraryXml. ApexAvailableFor() []string // AlwaysRequiresPlatformApexVariant allows the implementing module to determine whether an // APEX mutator should always be created for it. // Loading Loading @@ -320,6 +329,10 @@ func (m *ApexModuleBase) ApexAvailable() []string { return CopyOf(availableToPlatformList) } func (m *ApexModuleBase) ApexAvailableFor() []string { return m.ApexAvailable() } // Implements ApexModule func (m *ApexModuleBase) BuildForApex(apex ApexInfo) { m.apexInfosLock.Lock() Loading Loading @@ -420,7 +433,7 @@ func CheckAvailableForApex(what string, apex_available []string) bool { // Implements ApexModule func (m *ApexModuleBase) AvailableFor(what string) bool { return CheckAvailableForApex(what, m.ApexProperties.Apex_available) return CheckAvailableForApex(what, m.ApexAvailableFor()) } // Implements ApexModule Loading Loading @@ -614,6 +627,7 @@ func MutateApexTransition(ctx BaseModuleContext, variation string) { } else { panic(fmt.Errorf("failed to find apexInfo for incoming variation %q", variation)) } thisApexInfo.ApexAvailableFor = module.ApexAvailableFor() SetProvider(ctx, ApexInfoProvider, thisApexInfo) } Loading
android/module_proxy.go +1 −1 Original line number Diff line number Diff line Loading @@ -189,7 +189,7 @@ func (m ModuleProxy) VariablesForTests() map[string]string { } func (m ModuleProxy) String() string { return m.module.Name() return m.module.String() } func (m ModuleProxy) qualifiedModuleId(ctx BaseModuleContext) qualifiedModuleName { Loading
apex/apex.go +3 −12 Original line number Diff line number Diff line Loading @@ -2694,7 +2694,7 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { return } a.WalkPayloadDeps(ctx, func(ctx android.BaseModuleContext, from android.Module, to android.ApexModule, externalDep bool) bool { a.WalkPayloadDepsProxy(ctx, func(ctx android.BaseModuleContext, from, to android.ModuleProxy, externalDep bool) bool { // As soon as the dependency graph crosses the APEX boundary, don't go further. if externalDep { return false Loading @@ -2711,17 +2711,8 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) { fromName := ctx.OtherModuleName(from) toName := ctx.OtherModuleName(to) // If `to` is not actually in the same APEX as `from` then it does not need // apex_available and neither do any of its dependencies. // // It is ok to call DepIsInSameApex() directly from within WalkPayloadDeps(). if am, ok := from.(android.DepIsInSameApex); ok && !am.DepIsInSameApex(ctx, to) { // As soon as the dependency graph crosses the APEX boundary, don't go // further. return false } if to.AvailableFor(apexName) { if android.CheckAvailableForApex(apexName, android.OtherModuleProviderOrDefault(ctx, to, android.ApexInfoProvider).ApexAvailableFor) { return true } Loading
apex/apex_test.go +7 −1 Original line number Diff line number Diff line Loading @@ -6353,10 +6353,16 @@ func TestApexAvailable_IndirectDep(t *testing.T) { testApexError(t, `requires "libbaz" that doesn't list the APEX under 'apex_available'.\n\nDependency path: .*via tag apex\.dependencyTag\{"sharedLib"\} .*-> libfoo.*link:shared.* .*via tag cc\.dependencyTag.* .*-> libfoo.*link:static.* .*via tag cc\.libraryDependencyTag.*Kind:sharedLibraryDependency.* .*-> libbar.*link:shared.* .*via tag cc\.dependencyTag.* .*-> libbar.*link:static.* .*via tag cc\.libraryDependencyTag.*Kind:sharedLibraryDependency.* .*-> libbaz.*link:shared.*`, ` .*-> libbaz.*link:shared.* .*via tag cc\.dependencyTag.* .*-> libbaz.*link:static.*`, ` apex { name: "myapex", key: "myapex.key", Loading
cc/cc.go +9 −4 Original line number Diff line number Diff line Loading @@ -3689,13 +3689,18 @@ func (c *Module) IsInstallableToApex() bool { } func (c *Module) AvailableFor(what string) bool { return android.CheckAvailableForApex(what, c.ApexAvailableFor()) } func (c *Module) ApexAvailableFor() []string { list := c.ApexModuleBase.ApexAvailable() if linker, ok := c.linker.(interface { availableFor(string) bool apexAvailable() []string }); ok { return c.ApexModuleBase.AvailableFor(what) || linker.availableFor(what) } else { return c.ApexModuleBase.AvailableFor(what) list = append(list, linker.apexAvailable()...) } return android.FirstUniqueStrings(list) } func (c *Module) EverInstallable() bool { Loading