• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
49base_version_major := 1
50# Change this for each branch
51base_version_minor := 17
52
53# code_version_major will overflow at 22
54code_version_major := $(shell echo $$(($(base_version_major)+3)))
55
56# x86 and arm sometimes don't match.
57code_version_build := 001
58#####################################################
59#####################################################
60# Collect automatic version code parameters
61ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
62    # This is an eng build
63    base_version_buildtype := 0
64else
65    # This is a build server build
66    base_version_buildtype := 1
67endif
68
69ifeq "$(TARGET_ARCH)" "x86"
70    base_version_arch := 7
71else ifeq "$(TARGET_ARCH)" "mips"
72    base_version_arch := 5
73else ifeq "$(TARGET_ARCH)" "arm"
74    ifeq ($(TARGET_ARCH_VARIANT),armv5te)
75        base_version_arch := 1
76    else
77        base_version_arch := 3
78    endif
79else
80    base_version_arch := 0
81endif
82
83# Currently supported densities.
84base_version_density := 0
85
86# Build the version code
87version_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
96ifdef TARGET_BUILD_APPS
97ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
98    git_hash := $(shell git --git-dir $(LOCAL_PATH)/.git log -n 1 --pretty=format:%h)
99    date_string := $(shell date +%Y-%m-%d)
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))
101else
102    version_name_package := $(base_version_major).$(base_version_minor).$(code_version_build) ($(BUILD_NUMBER_FROM_FILE)-$(base_version_arch)$(base_version_density))
103endif
104else # !TARGET_BUILD_APPS
105    version_name_package := $(base_version_major).$(base_version_minor).$(code_version_build)
106endif
107
108# Cleanup the locals
109code_version_major :=
110code_version_build :=
111base_version_major :=
112base_version_minor :=
113base_version_since :=
114base_version_buildtype :=
115base_version_arch :=
116base_version_density :=
117git_commit_count :=
118git_hash :=
119date_string :=
120