Stop deapexer module type from being treated as a prebuilt

Previously, the private deapexer module type was treated as a prebuilt
as that was the quickest way to implement it. However, there is no
reason why it should be as there is no corresponding source module type
which it might replace.

This change removes the prebuilt support to simplify the module type in
preparation for future work. As part of that it extracts the logic for
retrieving a single path from a PrebuiltSrcsSupplier to ensure
consistent behavior.

Bug: 181267622
Test: m droid
Change-Id: I1b2bb49601c13a3fff99a0026c235eaa70d2e612
This commit is contained in:
Paul Duffin
2021-03-01 13:18:44 +00:00
parent c0609c603c
commit 56dc66e2ea
2 changed files with 22 additions and 21 deletions

View File

@@ -51,7 +51,6 @@ type DeapexerProperties struct {
type Deapexer struct {
android.ModuleBase
prebuilt android.Prebuilt
properties DeapexerProperties
apexFileProperties ApexFileProperties
@@ -65,19 +64,10 @@ func privateDeapexerFactory() android.Module {
&module.properties,
&module.apexFileProperties,
)
android.InitPrebuiltModuleWithSrcSupplier(module, module.apexFileProperties.prebuiltApexSelector, "src")
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
return module
}
func (p *Deapexer) Prebuilt() *android.Prebuilt {
return &p.prebuilt
}
func (p *Deapexer) Name() string {
return p.prebuilt.Name(p.ModuleBase.Name())
}
func (p *Deapexer) DepsMutator(ctx android.BottomUpMutatorContext) {
// Add dependencies from the java modules to which this exports files from the `.apex` file onto
// this module so that they can access the `DeapexerInfo` object that this provides.
@@ -88,7 +78,7 @@ func (p *Deapexer) DepsMutator(ctx android.BottomUpMutatorContext) {
}
func (p *Deapexer) GenerateAndroidBuildActions(ctx android.ModuleContext) {
p.inputApex = p.Prebuilt().SingleSourcePath(ctx)
p.inputApex = android.SingleSourcePathFromSupplier(ctx, p.apexFileProperties.prebuiltApexSelector, "src")
// Create and remember the directory into which the .apex file's contents will be unpacked.
deapexerOutput := android.PathForModuleOut(ctx, "deapexer")