Live Channels Team | 9447798 | 2018-01-17 13:56:41 -0800 | [diff] [blame] | 1 | ##################################################### |
Nick Chalko | 816a4be | 2015-08-03 15:39:56 -0700 | [diff] [blame] | 2 | # Copyright (C) 2015 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
| 17 | # The version code scheme for the package apk is: |
| 18 | # Cmmbbbtad |
| 19 | # where |
| 20 | # M - major version (one or more digits) |
Nick Chalko | 07b043d | 2015-09-01 09:05:04 -0700 | [diff] [blame] | 21 | # C - code major version (for legacy reasons this is M+3) |
Nick Chalko | 816a4be | 2015-08-03 15:39:56 -0700 | [diff] [blame] | 22 | # m - minor version (exactly 2) |
| 23 | # bbb - automatically specified build number (exactly 3 digits) |
| 24 | # t - build type (exactly 1 digit). Current valid values are: |
| 25 | # 0 : eng build |
| 26 | # 1 : build server build |
| 27 | # a - device architecture (exactly 1 digit). Current valid values are: |
| 28 | # 0 : non-native |
| 29 | # 1 : armv5te |
| 30 | # 3 : armv7-a |
| 31 | # 5 : mips |
| 32 | # 7 : x86 |
| 33 | # d - asset density (exactly 1 digit). Current valid values are: |
| 34 | # 0 : all densities |
| 35 | # Mmmbbb is specified manually. tad is automatically set during the build. |
| 36 | # |
| 37 | # For the client jar, the version code is agnostic to the target architecture and density: Mmbbbt00 |
| 38 | # |
| 39 | # NOTE: arch needs to be more significant than density because x86 devices support running ARM |
| 40 | # code in emulation mode, so all x86 versions must be higher than all ARM versions to ensure |
| 41 | # we deliver true x86 code to those devices. |
| 42 | # |
| 43 | |
| 44 | # Specify the following manually. Note that base_version_minor must be exactly 2 digit and |
| 45 | # base_version_build must be exactly 3 digits. |
| 46 | # Always submit version number changes as DO NOT MERGE |
| 47 | |
| 48 | |
| 49 | base_version_major := 1 |
| 50 | # Change this for each branch |
Live Channels Team | 9447798 | 2018-01-17 13:56:41 -0800 | [diff] [blame] | 51 | base_version_minor := 17 |
Nick Chalko | 816a4be | 2015-08-03 15:39:56 -0700 | [diff] [blame] | 52 | |
| 53 | # code_version_major will overflow at 22 |
| 54 | code_version_major := $(shell echo $$(($(base_version_major)+3))) |
| 55 | |
Nick Chalko | 1abddd9 | 2015-12-09 13:48:17 -0800 | [diff] [blame] | 56 | # x86 and arm sometimes don't match. |
Live Channels Team | 9447798 | 2018-01-17 13:56:41 -0800 | [diff] [blame] | 57 | code_version_build := 001 |
Nick Chalko | 816a4be | 2015-08-03 15:39:56 -0700 | [diff] [blame] | 58 | ##################################################### |
| 59 | ##################################################### |
| 60 | # Collect automatic version code parameters |
Nan Zhang | e4c531c | 2018-02-20 13:29:14 -0800 | [diff] [blame] | 61 | ifeq ($(strip $(HAS_BUILD_NUMBER)),false) |
Nick Chalko | 816a4be | 2015-08-03 15:39:56 -0700 | [diff] [blame] | 62 | # This is an eng build |
| 63 | base_version_buildtype := 0 |
| 64 | else |
| 65 | # This is a build server build |
| 66 | base_version_buildtype := 1 |
| 67 | endif |
| 68 | |
| 69 | ifeq "$(TARGET_ARCH)" "x86" |
| 70 | base_version_arch := 7 |
| 71 | else ifeq "$(TARGET_ARCH)" "mips" |
| 72 | base_version_arch := 5 |
| 73 | else ifeq "$(TARGET_ARCH)" "arm" |
| 74 | ifeq ($(TARGET_ARCH_VARIANT),armv5te) |
| 75 | base_version_arch := 1 |
| 76 | else |
| 77 | base_version_arch := 3 |
| 78 | endif |
| 79 | else |
| 80 | base_version_arch := 0 |
| 81 | endif |
| 82 | |
| 83 | # Currently supported densities. |
| 84 | base_version_density := 0 |
| 85 | |
| 86 | # Build the version code |
| 87 | version_code_package := $(code_version_major)$(base_version_minor)$(code_version_build)$(base_version_buildtype)$(base_version_arch)$(base_version_density) |
| 88 | |
| 89 | # The version name scheme for the package apk is: |
Dan Willemsen | 04bf2c2 | 2016-09-16 14:43:52 -0700 | [diff] [blame] | 90 | # - For platform builds: M.mm.bbb |
Nick Chalko | 816a4be | 2015-08-03 15:39:56 -0700 | [diff] [blame] | 91 | # - For eng build (t=0): M.mm.bbb eng.$(USER)-hh-date-ad |
| 92 | # - For build server (t=1): M.mm.bbb (nnnnnn-ad) |
| 93 | # where nnnnnn is the build number from the build server (no zero-padding) |
| 94 | # and hh is the git hash |
Scott Lobdell | 1835716 | 2018-12-05 15:21:23 -0800 | [diff] [blame] | 95 | # On eng builds, the BUILD_NUMBER_FROM_FILE has the user and timestamp inline |
Dan Willemsen | 04bf2c2 | 2016-09-16 14:43:52 -0700 | [diff] [blame] | 96 | ifdef TARGET_BUILD_APPS |
Nan Zhang | e4c531c | 2018-02-20 13:29:14 -0800 | [diff] [blame] | 97 | ifeq ($(strip $(HAS_BUILD_NUMBER)),false) |
Nick Chalko | 816a4be | 2015-08-03 15:39:56 -0700 | [diff] [blame] | 98 | git_hash := $(shell git --git-dir $(LOCAL_PATH)/.git log -n 1 --pretty=format:%h) |
Nick Chalko | 633eb82 | 2017-10-03 10:16:37 -0700 | [diff] [blame] | 99 | date_string := $(shell date +%Y-%m-%d) |
Dan Willemsen | 8c664c5 | 2019-01-02 14:22:49 -0800 | [diff] [blame] | 100 | version_name_package := $(base_version_major).$(base_version_minor).$(code_version_build) (eng.$(BUILD_USERNAME).$(git_hash).$(date_string)-$(base_version_arch)$(base_version_density)) |
Nick Chalko | 816a4be | 2015-08-03 15:39:56 -0700 | [diff] [blame] | 101 | else |
Scott Lobdell | 1835716 | 2018-12-05 15:21:23 -0800 | [diff] [blame] | 102 | version_name_package := $(base_version_major).$(base_version_minor).$(code_version_build) ($(BUILD_NUMBER_FROM_FILE)-$(base_version_arch)$(base_version_density)) |
Nick Chalko | 816a4be | 2015-08-03 15:39:56 -0700 | [diff] [blame] | 103 | endif |
Dan Willemsen | 04bf2c2 | 2016-09-16 14:43:52 -0700 | [diff] [blame] | 104 | else # !TARGET_BUILD_APPS |
| 105 | version_name_package := $(base_version_major).$(base_version_minor).$(code_version_build) |
| 106 | endif |
Nick Chalko | 816a4be | 2015-08-03 15:39:56 -0700 | [diff] [blame] | 107 | |
| 108 | # Cleanup the locals |
| 109 | code_version_major := |
| 110 | code_version_build := |
| 111 | base_version_major := |
| 112 | base_version_minor := |
| 113 | base_version_since := |
| 114 | base_version_buildtype := |
| 115 | base_version_arch := |
| 116 | base_version_density := |
| 117 | git_commit_count := |
Nick Chalko | 816a4be | 2015-08-03 15:39:56 -0700 | [diff] [blame] | 118 | git_hash := |
| 119 | date_string := |