Skip to content

Commit

Permalink
Merge changes I0edb681b,I0ea2327f into main
Browse files Browse the repository at this point in the history
* changes:
  Remove internal deapexer module
  Remove deapex support from java_*_import
  • Loading branch information
dasspandan authored and Gerrit Code Review committed Sep 23, 2024
2 parents 168b3f8 + 52c01a1 commit e2860d9
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 509 deletions.
44 changes: 0 additions & 44 deletions android/deapexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package android

import (
"fmt"
"strings"

"github.com/google/blueprint"
Expand Down Expand Up @@ -109,10 +108,6 @@ func (i DeapexerInfo) GetExportedModuleNames() []string {
return i.exportedModuleNames
}

// Provider that can be used from within the `GenerateAndroidBuildActions` of a module that depends
// on a `deapexer` module to retrieve its `DeapexerInfo`.
var DeapexerProvider = blueprint.NewProvider[DeapexerInfo]()

// NewDeapexerInfo creates and initializes a DeapexerInfo that is suitable
// for use with a prebuilt_apex module.
//
Expand Down Expand Up @@ -169,45 +164,6 @@ type RequiresFilesFromPrebuiltApexTag interface {
RequiresFilesFromPrebuiltApex()
}

// FindDeapexerProviderForModule searches through the direct dependencies of the current context
// module for a DeapexerTag dependency and returns its DeapexerInfo. If a single nonambiguous
// deapexer module isn't found then it returns it an error
// clients should check the value of error and call ctx.ModuleErrof if a non nil error is received
func FindDeapexerProviderForModule(ctx ModuleContext) (*DeapexerInfo, error) {
var di *DeapexerInfo
var err error
ctx.VisitDirectDepsWithTag(DeapexerTag, func(m Module) {
if err != nil {
// An err has been found. Do not visit further.
return
}
c, ok := OtherModuleProvider(ctx, m, DeapexerProvider)
if !ok {
ctx.ModuleErrorf("Expected all deps with DeapexerTag to have a DeapexerProvider, but module %q did not", m.Name())
return
}
p := &c
if di != nil {
// If two DeapexerInfo providers have been found then check if they are
// equivalent. If they are then use the selected one, otherwise fail.
if selected := equivalentDeapexerInfoProviders(di, p); selected != nil {
di = selected
return
}
err = fmt.Errorf("Multiple installable prebuilt APEXes provide ambiguous deapexers: %s and %s", di.ApexModuleName(), p.ApexModuleName())
}
di = p
})
if err != nil {
return nil, err
}
if di != nil {
return di, nil
}
ai, _ := ModuleProvider(ctx, ApexInfoProvider)
return nil, fmt.Errorf("No prebuilt APEX provides a deapexer module for APEX variant %s", ai.ApexVariationName)
}

// removeCompressedApexSuffix removes the _compressed suffix from the name if present.
func removeCompressedApexSuffix(name string) string {
return strings.TrimSuffix(name, "_compressed")
Expand Down
Loading

0 comments on commit e2860d9

Please sign in to comment.