diff options
-rw-r--r-- | android/Android.bp | 1 | ||||
-rw-r--r-- | android/config.go | 7 | ||||
-rw-r--r-- | android/updatable_modules.go | 36 | ||||
-rw-r--r-- | apex/apex_test.go | 4 | ||||
-rw-r--r-- | apex/builder.go | 6 | ||||
-rw-r--r-- | apex/testing.go | 3 | ||||
-rw-r--r-- | java/app.go | 2 | ||||
-rw-r--r-- | java/app_test.go | 4 | ||||
-rw-r--r-- | java/testing.go | 2 |
9 files changed, 20 insertions, 45 deletions
diff --git a/android/Android.bp b/android/Android.bp index 16a34b7de..90d932c16 100644 --- a/android/Android.bp +++ b/android/Android.bp @@ -105,7 +105,6 @@ bootstrap_go_package { "test_asserts.go", "test_suites.go", "testing.go", - "updatable_modules.go", "util.go", "variable.go", "vintf_fragment.go", diff --git a/android/config.go b/android/config.go index 368e57381..ebf478109 100644 --- a/android/config.go +++ b/android/config.go @@ -245,6 +245,13 @@ func (c Config) ReleaseDefaultModuleBuildFromSource() bool { Bool(c.config.productVariables.ReleaseDefaultModuleBuildFromSource) } +func (c Config) ReleaseDefaultUpdatableModuleVersion() string { + if val, exists := c.GetBuildFlag("RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION"); exists { + return val + } + panic("RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION is missing from build flags.") +} + func (c Config) ReleaseDisableVerifyOverlaps() bool { return c.config.productVariables.GetBuildFlagBool("RELEASE_DISABLE_VERIFY_OVERLAPS_CHECK") } diff --git a/android/updatable_modules.go b/android/updatable_modules.go deleted file mode 100644 index d2595ed14..000000000 --- a/android/updatable_modules.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2022 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package android - -// This file contains branch specific constants. They are stored in a separate -// file to minimise the potential of merge conflicts between branches when -// the code from the package is changed. - -// The default manifest version for all the modules on this branch. -// This version code will be used only if there is no version field in the -// module's apex_manifest.json. Release branches have their version injected -// into apex_manifest.json by the tooling and will not use the version set -// here. Developers can also set the version field locally in the -// apex_manifest.json to build a module with a specific version. -// -// The value follows the schema from go/mainline-version-codes, and is chosen -// based on the branch such that the builds from testing and development -// branches will have a version higher than the prebuilts. -// Versions per branch: -// * x-dev - xx0090000 (where xx is the branch SDK level) -// * AOSP - xx9990000 -// * x-mainline-prod - xx9990000 -// * master - 990090000 -const DefaultUpdatableModuleVersion = "352090000" diff --git a/apex/apex_test.go b/apex/apex_test.go index 2b9772821..aaa72be00 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -6516,14 +6516,14 @@ func TestApexAvailable_ApexAvailableNameWithVersionCode(t *testing.T) { `) fooManifestRule := result.ModuleForTests("foo", "android_common_foo").Rule("apexManifestRule") - fooExpectedDefaultVersion := android.DefaultUpdatableModuleVersion + fooExpectedDefaultVersion := testDefaultUpdatableModuleVersion fooActualDefaultVersion := fooManifestRule.Args["default_version"] if fooActualDefaultVersion != fooExpectedDefaultVersion { t.Errorf("expected to find defaultVersion %q; got %q", fooExpectedDefaultVersion, fooActualDefaultVersion) } barManifestRule := result.ModuleForTests("bar", "android_common_bar").Rule("apexManifestRule") - defaultVersionInt, _ := strconv.Atoi(android.DefaultUpdatableModuleVersion) + defaultVersionInt, _ := strconv.Atoi(testDefaultUpdatableModuleVersion) barExpectedDefaultVersion := fmt.Sprint(defaultVersionInt + 3) barActualDefaultVersion := barManifestRule.Args["default_version"] if barActualDefaultVersion != barExpectedDefaultVersion { diff --git a/apex/builder.go b/apex/builder.go index 437189fdb..0be802612 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -359,14 +359,14 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs, } manifestJsonFullOut := android.PathForModuleOut(ctx, "apex_manifest_full.json") - defaultVersion := android.DefaultUpdatableModuleVersion + defaultVersion := ctx.Config().ReleaseDefaultUpdatableModuleVersion() if a.properties.Variant_version != nil { defaultVersionInt, err := strconv.Atoi(defaultVersion) if err != nil { - ctx.ModuleErrorf("expected DefaultUpdatableModuleVersion to be an int, but got %s", defaultVersion) + ctx.ModuleErrorf("expected RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION to be an int, but got %s", defaultVersion) } if defaultVersionInt%10 != 0 { - ctx.ModuleErrorf("expected DefaultUpdatableModuleVersion to end in a zero, but got %s", defaultVersion) + ctx.ModuleErrorf("expected RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION to end in a zero, but got %s", defaultVersion) } variantVersion := []rune(*a.properties.Variant_version) if len(variantVersion) != 1 || variantVersion[0] < '0' || variantVersion[0] > '9' { diff --git a/apex/testing.go b/apex/testing.go index 3b200f05b..63c5b699e 100644 --- a/apex/testing.go +++ b/apex/testing.go @@ -16,6 +16,8 @@ package apex import "android/soong/android" +const testDefaultUpdatableModuleVersion = "340090000" + var PrepareForTestWithApexBuildComponents = android.GroupFixturePreparers( android.FixtureRegisterWithContext(registerApexBuildComponents), android.FixtureRegisterWithContext(registerApexKeyBuildComponents), @@ -29,4 +31,5 @@ var PrepareForTestWithApexBuildComponents = android.GroupFixturePreparers( // Needed by prebuilt_apex. "build/soong/scripts/unpack-prebuilt-apex.sh": nil, }.AddToFixture(), + android.PrepareForTestWithBuildFlag("RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION", testDefaultUpdatableModuleVersion), ) diff --git a/java/app.go b/java/app.go index 4ac42a750..9b7b7a432 100644 --- a/java/app.go +++ b/java/app.go @@ -586,7 +586,7 @@ func (a *AndroidApp) aaptBuildActions(ctx android.ModuleContext) { if override := ctx.Config().Getenv("OVERRIDE_APEX_MANIFEST_DEFAULT_VERSION"); override != "" { a.aapt.defaultManifestVersion = override } else { - a.aapt.defaultManifestVersion = android.DefaultUpdatableModuleVersion + a.aapt.defaultManifestVersion = ctx.Config().ReleaseDefaultUpdatableModuleVersion() } } diff --git a/java/app_test.go b/java/app_test.go index ec97a553f..b593e298a 100644 --- a/java/app_test.go +++ b/java/app_test.go @@ -530,9 +530,9 @@ func TestUpdatableApps_ApplyDefaultUpdatableModuleVersion(t *testing.T) { `) foo := result.ModuleForTests("com.android.foo", "android_common").Rule("manifestFixer") android.AssertStringDoesContain(t, - "com.android.foo: expected manifest fixer to set override-placeholder-version to android.DefaultUpdatableModuleVersion", + "com.android.foo: expected manifest fixer to set override-placeholder-version to RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION", foo.BuildParams.Args["args"], - fmt.Sprintf("--override-placeholder-version %s", android.DefaultUpdatableModuleVersion), + fmt.Sprintf("--override-placeholder-version %s", testDefaultUpdatableModuleVersion), ) } diff --git a/java/testing.go b/java/testing.go index 0c79e9f7e..b27e69b80 100644 --- a/java/testing.go +++ b/java/testing.go @@ -30,6 +30,7 @@ import ( ) const defaultJavaDir = "default/java" +const testDefaultUpdatableModuleVersion = "340090000" // Test fixture preparer that will register most java build components. // @@ -61,6 +62,7 @@ var PrepareForTestWithJavaBuildComponents = android.GroupFixturePreparers( // Needed for the global lint checks provided from frameworks/base "prebuilts/cmdline-tools/AndroidGlobalLintChecker.jar": nil, }.AddToFixture(), + android.PrepareForTestWithBuildFlag("RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION", testDefaultUpdatableModuleVersion), ) var prepareForTestWithFrameworkDeps = android.GroupFixturePreparers( |