Add current build release

Previously, the build releases only included named releases so did not
have a way to represent the latest build release. This adds the current
build release (named after the current API level) to represent that.

Bug: 240406019
Test: m nothing
Change-Id: Ib8336da716b447448b23bc9684ce3be1ab78648a
This commit is contained in:
Paul Duffin
2022-08-17 22:09:55 +00:00
parent 3f1ae0b55a
commit 42a49f1278
4 changed files with 46 additions and 20 deletions

View File

@@ -387,12 +387,11 @@ func (s *sdk) buildSnapshot(ctx android.ModuleContext, sdkVariants []*sdk) {
// Always add -current to the end
snapshotFileSuffix := "-current"
currentBuildRelease := latestBuildRelease()
targetBuildReleaseEnv := config.GetenvWithDefault("SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE", currentBuildRelease.name)
targetBuildReleaseEnv := config.GetenvWithDefault("SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE", buildReleaseCurrent.name)
targetBuildRelease, err := nameToRelease(targetBuildReleaseEnv)
if err != nil {
ctx.ModuleErrorf("invalid SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE: %s", err)
targetBuildRelease = currentBuildRelease
targetBuildRelease = buildReleaseCurrent
}
builder := &snapshotBuilder{
@@ -472,7 +471,7 @@ be unnecessary as every module in the sdk already has its own licenses property.
contents := bp.content.String()
// If the snapshot is being generated for the current build release then check the syntax to make
// sure that it is compatible.
if targetBuildRelease == currentBuildRelease {
if targetBuildRelease == buildReleaseCurrent {
syntaxCheckSnapshotBpFile(ctx, contents)
}