Allow building against prerelease prebuilt APEXes

Generally, when building system images from prebuilt APEXes the APEXes
should be released versions and the build ensures that is the case when
extracting .apex files from prebuilt .apks files. However, it is useful
to test building against prebuilt APEXes before finalization to flush
out any issues early on. Previously, the build would fail in that case.
This change adds support for using the SOONG_ALLOW_PRERELEASE_APEXES
environment variable to allow prerelease APEXes to be suppported.

Bug: 259958590
Test: m MODULE_BUILD_FROM_SOURCE=false droid
      # Above fails because it could not find non-prelease APEXes in the
      # prebuilt .apks files.
      m SOONG_ALLOW_PRERELEASE_APEXES=true MODULE_BUILD_FROM_SOURCE=false droid
      # Above works.
Change-Id: I20b8e5db0b9fd2a21434be25652195fae929bd3f
This commit is contained in:
Paul Duffin 2022-12-12 18:00:47 +00:00
parent 4f2282c2d8
commit 76fdd67f9f

View file

@ -830,6 +830,7 @@ func (p *prebuiltApexExtractorModule) GenerateAndroidBuildActions(ctx android.Mo
srcsSupplier := func(ctx android.BaseModuleContext, prebuilt android.Module) []string {
return p.properties.prebuiltSrcs(ctx)
}
defaultAllowPrerelease := ctx.Config().IsEnvTrue("SOONG_ALLOW_PRERELEASE_APEXES")
apexSet := android.SingleSourcePathFromSupplier(ctx, srcsSupplier, "set")
p.extractedApex = android.PathForModuleOut(ctx, "extracted", apexSet.Base())
// Filter out NativeBridge archs (b/260115309)
@ -842,7 +843,7 @@ func (p *prebuiltApexExtractorModule) GenerateAndroidBuildActions(ctx android.Mo
Output: p.extractedApex,
Args: map[string]string{
"abis": strings.Join(abis, ","),
"allow-prereleased": strconv.FormatBool(proptools.Bool(p.properties.Prerelease)),
"allow-prereleased": strconv.FormatBool(proptools.BoolDefault(p.properties.Prerelease, defaultAllowPrerelease)),
"sdk-version": ctx.Config().PlatformSdkVersion().String(),
},
})