1 # 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) 21 # C - code major version (for legacy reasons this is M+3) 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 51 base_version_minor := 11 52 53 # code_version_major will overflow at 22 54 code_version_major := $(shell echo $$(($(base_version_major)+3))) 55 56 # x86 and arm sometimes don't match. 57 code_version_build := 011 58 ##################################################### 59 ##################################################### 60 # Collect automatic version code parameters 61 ifneq "" "$(filter eng.%,$(BUILD_NUMBER))" 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: 90 # - For platform builds: M.mm.bbb 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 95 # On eng builds, the BUILD_NUMBER has the user and timestamp inline 96 ifdef TARGET_BUILD_APPS 97 ifneq "" "$(filter eng.%,$(BUILD_NUMBER))" 98 git_hash := $(shell git --git-dir $(LOCAL_PATH)/.git log -n 1 --pretty=format:%h) 99 date_string := $(shell date +%m%d%y_%H%M%S) 100 version_name_package := $(base_version_major).$(base_version_minor).$(code_version_build) (eng.$(USER).$(git_hash).$(date_string)-$(base_version_arch)$(base_version_density)) 101 else 102 version_name_package := $(base_version_major).$(base_version_minor).$(code_version_build) ($(BUILD_NUMBER)-$(base_version_arch)$(base_version_density)) 103 endif 104 else # !TARGET_BUILD_APPS 105 version_name_package := $(base_version_major).$(base_version_minor).$(code_version_build) 106 endif 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 := 118 git_hash := 119 date_string := 120