Sascha Haeberling | 3023993 | 2013-08-28 14:51:53 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2013 Google Inc. |
| 3 | # |
| 4 | |
| 5 | # The version code scheme for the package apk is: |
| 6 | # Mmbbbtad |
| 7 | # where |
| 8 | # M - major version (one or more digits) |
| 9 | # m - minor version (exactly 1 digit) |
| 10 | # bbb - manually specified build number (exactly 3 digits) |
| 11 | # t - build type (exactly 1 digit). Current valid values are: |
| 12 | # 0 : eng build |
| 13 | # 1 : build server build |
| 14 | # a - device architecture (exactly 1 digit). Current valid values are: |
| 15 | # 0 : non-native |
| 16 | # 1 : armv5te |
| 17 | # 3 : armv7-a |
| 18 | # 5 : mips |
| 19 | # 7 : x86 |
| 20 | # d - asset density (exactly 1 digit). Current valid values are: |
| 21 | # 0 : all densities |
| 22 | # 2 : mdpi |
| 23 | # 4 : hdpi |
| 24 | # 6 : xhdpi |
| 25 | # Mmbbb is specified manually. tad is automatically set during the build. |
| 26 | # |
| 27 | # For the client jar, the version code is agnostic to the target architecture and density: Mmbbbt00 |
| 28 | # |
| 29 | # NOTE: arch needs to be more significant than density because x86 devices support running ARM |
| 30 | # code in emulation mode, so all x86 versions must be higher than all ARM versions to ensure |
| 31 | # we deliver true x86 code to those devices. |
Sascha Haeberling | 73da1e3 | 2013-10-21 13:33:28 -0700 | [diff] [blame] | 32 | # |
| 33 | # HISTORY: |
| 34 | # 2.0.001 - Factory ROM and 0-day OTA 4.4 (KK) |
| 35 | # 2.0.002 - 4.4 MR1 system image |
Sascha Haeberling | 3023993 | 2013-08-28 14:51:53 -0700 | [diff] [blame] | 36 | |
jinwu | cf6a76c | 2017-09-26 17:11:33 +0800 | [diff] [blame] | 37 | # Specify the following manually. |
| 38 | # base_version_major is reserved. |
| 39 | # base_version_minor is 2 digits and auto-increment for developing FR. |
| 40 | # base_version_build is 3 digits and auto-increment for fixing CR. |
Sascha Haeberling | 3023993 | 2013-08-28 14:51:53 -0700 | [diff] [blame] | 41 | base_version_major := 2 |
jinwu | 87757d6 | 2018-03-08 16:36:36 +0800 | [diff] [blame] | 42 | base_version_minor := 02 |
Aoao Yang | 92740f5 | 2020-12-03 10:39:17 +0800 | [diff] [blame] | 43 | base_version_build := 073 |
Sascha Haeberling | 3023993 | 2013-08-28 14:51:53 -0700 | [diff] [blame] | 44 | |
| 45 | ##################################################### |
| 46 | ##################################################### |
| 47 | # Collect automatic version code parameters |
jinwu | dae6529 | 2018-12-27 17:35:51 +0800 | [diff] [blame] | 48 | ifneq "" "$(filter eng.%,$(BUILD_NUMBER_FROM_FILE))" |
Sascha Haeberling | 3023993 | 2013-08-28 14:51:53 -0700 | [diff] [blame] | 49 | # This is an eng build |
| 50 | base_version_buildtype := 0 |
| 51 | else |
| 52 | # This is a build server build |
| 53 | base_version_buildtype := 1 |
| 54 | endif |
| 55 | |
| 56 | ifeq "$(TARGET_ARCH)" "x86" |
| 57 | base_version_arch := 7 |
| 58 | else ifeq "$(TARGET_ARCH)" "mips" |
| 59 | base_version_arch := 5 |
| 60 | else ifeq "$(TARGET_ARCH)" "arm" |
| 61 | ifeq ($(TARGET_ARCH_VARIANT),armv5te) |
| 62 | base_version_arch := 1 |
| 63 | else |
| 64 | base_version_arch := 3 |
| 65 | endif |
| 66 | else |
| 67 | base_version_arch := 0 |
| 68 | endif |
| 69 | |
| 70 | ifeq "$(package_dpi)" "mdpi" |
| 71 | base_version_density := 2 |
| 72 | else ifeq "$(package_dpi)" "hdpi" |
| 73 | base_version_density := 4 |
| 74 | else ifeq "$(package_dpi)" "xhdpi" |
| 75 | base_version_density := 6 |
| 76 | else |
| 77 | base_version_density := 0 |
| 78 | endif |
| 79 | |
| 80 | # Build the version code |
| 81 | version_code_package := $(base_version_major)$(base_version_minor)$(base_version_build)$(base_version_buildtype)$(base_version_arch)$(base_version_density) |
| 82 | |
| 83 | # The version name scheme for the package apk is: |
| 84 | # - For eng build (t=0): M.m.bbb eng.$(USER)-hh |
| 85 | # - For build server (t=1): M.m.bbb (nnnnnn-hh) |
| 86 | # where nnnnnn is the build number from the build server (no zero-padding) |
jinwu | dae6529 | 2018-12-27 17:35:51 +0800 | [diff] [blame] | 87 | # On eng builds, the BUILD_NUMBER_FROM_FILE has the user and timestamp inline |
| 88 | ifneq "" "$(filter eng.%,$(BUILD_NUMBER_FROM_FILE))" |
Sascha Haeberling | 3023993 | 2013-08-28 14:51:53 -0700 | [diff] [blame] | 89 | git_hash := $(shell git --git-dir $(LOCAL_PATH)/.git log -n 1 --pretty=format:%h) |
Weijie Wang | b59cf61 | 2017-09-05 10:42:58 +0800 | [diff] [blame] | 90 | date_string := $$(date +%m%d%y_%H%M%S) |
Sascha Haeberling | 3023993 | 2013-08-28 14:51:53 -0700 | [diff] [blame] | 91 | version_name_package := $(base_version_major).$(base_version_minor).$(base_version_build) (eng.$(USER).$(git_hash).$(date_string)-$(base_version_arch)$(base_version_density)) |
| 92 | else |
Weijie Wang | b59cf61 | 2017-09-05 10:42:58 +0800 | [diff] [blame] | 93 | version_name_package := $(base_version_major).$(base_version_minor).$(base_version_build) ($(BUILD_NUMBER_FROM_FILE)-$(base_version_arch)$(base_version_density)) |
Sascha Haeberling | 3023993 | 2013-08-28 14:51:53 -0700 | [diff] [blame] | 94 | endif |
| 95 | |
| 96 | # Cleanup the locals |
| 97 | base_version_major := |
| 98 | base_version_minor := |
| 99 | base_version_build := |
| 100 | base_version_buildtype := |
| 101 | base_version_arch := |
| 102 | base_version_density := |
| 103 | git_hash := |
| 104 | date_string := |