Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 130da8b8 authored by Alyssa Ketpreechasawat's avatar Alyssa Ketpreechasawat Committed by Gerrit Code Review
Browse files

Merge "Set version code of apex and apk based on...

Merge "Set version code of apex and apk based on RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION." into main
parents c27cb7a8 3a6eced4
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ bootstrap_go_package {
        "test_asserts.go",
        "test_suites.go",
        "testing.go",
        "updatable_modules.go",
        "util.go",
        "variable.go",
        "vintf_fragment.go",
+7 −0
Original line number Diff line number Diff line
@@ -250,6 +250,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")
}

android/updatable_modules.go

deleted100644 → 0
+0 −36
Original line number Diff line number Diff line
// 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"
+2 −2
Original line number Diff line number Diff line
@@ -6425,14 +6425,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 {
+3 −3
Original line number Diff line number Diff line
@@ -360,14 +360,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' {
Loading