blob: f50a46a8db7d65c81ab185aa18e6128f6a277e27 [file] [log] [blame]
Live Channels Team94477982018-01-17 13:56:41 -08001#####################################################
Nick Chalko816a4be2015-08-03 15:39:56 -07002# 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 Chalko07b043d2015-09-01 09:05:04 -070021# C - code major version (for legacy reasons this is M+3)
Nick Chalko816a4be2015-08-03 15:39:56 -070022# 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
Live Channels Team94477982018-01-17 13:56:41 -080051base_version_minor := 17
Nick Chalko816a4be2015-08-03 15:39:56 -070052
53# code_version_major will overflow at 22
54code_version_major := $(shell echo $$(($(base_version_major)+3)))
55
Nick Chalko1abddd92015-12-09 13:48:17 -080056# x86 and arm sometimes don't match.
Live Channels Team94477982018-01-17 13:56:41 -080057code_version_build := 001
Nick Chalko816a4be2015-08-03 15:39:56 -070058#####################################################
59#####################################################
60# Collect automatic version code parameters
Nan Zhange4c531c2018-02-20 13:29:14 -080061ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
Nick Chalko816a4be2015-08-03 15:39:56 -070062 # 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:
Dan Willemsen04bf2c22016-09-16 14:43:52 -070090# - For platform builds: M.mm.bbb
Nick Chalko816a4be2015-08-03 15:39:56 -070091# - 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 Lobdell18357162018-12-05 15:21:23 -080095# On eng builds, the BUILD_NUMBER_FROM_FILE has the user and timestamp inline
Dan Willemsen04bf2c22016-09-16 14:43:52 -070096ifdef TARGET_BUILD_APPS
Nan Zhange4c531c2018-02-20 13:29:14 -080097ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
Nick Chalko816a4be2015-08-03 15:39:56 -070098 git_hash := $(shell git --git-dir $(LOCAL_PATH)/.git log -n 1 --pretty=format:%h)
Nick Chalko633eb822017-10-03 10:16:37 -070099 date_string := $(shell date +%Y-%m-%d)
Dan Willemsen8c664c52019-01-02 14:22:49 -0800100 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 Chalko816a4be2015-08-03 15:39:56 -0700101else
Scott Lobdell18357162018-12-05 15:21:23 -0800102 version_name_package := $(base_version_major).$(base_version_minor).$(code_version_build) ($(BUILD_NUMBER_FROM_FILE)-$(base_version_arch)$(base_version_density))
Nick Chalko816a4be2015-08-03 15:39:56 -0700103endif
Dan Willemsen04bf2c22016-09-16 14:43:52 -0700104else # !TARGET_BUILD_APPS
105 version_name_package := $(base_version_major).$(base_version_minor).$(code_version_build)
106endif
Nick Chalko816a4be2015-08-03 15:39:56 -0700107
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 :=
Nick Chalko816a4be2015-08-03 15:39:56 -0700118git_hash :=
119date_string :=