blob: 3424b9d418da921d749c48bbba28da1bf8b0d5e0 [file] [log] [blame]
Sascha Haeberling30239932013-08-28 14:51:53 -07001#
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 Haeberling73da1e32013-10-21 13:33:28 -070032#
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 Haeberling30239932013-08-28 14:51:53 -070036
37# Specify the following manually. Note that base_version_minor must be exactly 1 digit and
38# base_version_build must be exactly 3 digits.
39base_version_major := 2
40base_version_minor := 0
Sascha Haeberling73da1e32013-10-21 13:33:28 -070041base_version_build := 002
Sascha Haeberling30239932013-08-28 14:51:53 -070042
43#####################################################
44#####################################################
45# Collect automatic version code parameters
Nan Zhang083ba4d2018-02-20 13:27:56 -080046ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
Sascha Haeberling30239932013-08-28 14:51:53 -070047 # This is an eng build
48 base_version_buildtype := 0
49else
50 # This is a build server build
51 base_version_buildtype := 1
52endif
53
54ifeq "$(TARGET_ARCH)" "x86"
55 base_version_arch := 7
56else ifeq "$(TARGET_ARCH)" "mips"
57 base_version_arch := 5
58else ifeq "$(TARGET_ARCH)" "arm"
59 ifeq ($(TARGET_ARCH_VARIANT),armv5te)
60 base_version_arch := 1
61 else
62 base_version_arch := 3
63 endif
64else
65 base_version_arch := 0
66endif
67
68ifeq "$(package_dpi)" "mdpi"
69 base_version_density := 2
70else ifeq "$(package_dpi)" "hdpi"
71 base_version_density := 4
72else ifeq "$(package_dpi)" "xhdpi"
73 base_version_density := 6
74else
75 base_version_density := 0
76endif
77
78# Build the version code
79version_code_package := $(base_version_major)$(base_version_minor)$(base_version_build)$(base_version_buildtype)$(base_version_arch)$(base_version_density)
80
81# The version name scheme for the package apk is:
Dan Willemsen5e0f4cf2015-10-28 16:45:38 -070082# - For platform builds: M.m.bbb
Sascha Haeberling30239932013-08-28 14:51:53 -070083# - For eng build (t=0): M.m.bbb eng.$(USER)-hh
84# - For build server (t=1): M.m.bbb (nnnnnn-hh)
85# where nnnnnn is the build number from the build server (no zero-padding)
86# On eng builds, the BUILD_NUMBER has the user and timestamp inline
Dan Willemsen5e0f4cf2015-10-28 16:45:38 -070087ifdef TARGET_BUILD_APPS
Nan Zhang083ba4d2018-02-20 13:27:56 -080088ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
Sascha Haeberling30239932013-08-28 14:51:53 -070089 git_hash := $(shell git --git-dir $(LOCAL_PATH)/.git log -n 1 --pretty=format:%h)
Colin Cross6e537882015-07-17 10:26:47 -070090 date_string := $$(date +%m%d%y_%H%M%S)
Sascha Haeberling30239932013-08-28 14:51:53 -070091 version_name_package := $(base_version_major).$(base_version_minor).$(base_version_build) (eng.$(USER).$(git_hash).$(date_string)-$(base_version_arch)$(base_version_density))
92else
Colin Cross6e537882015-07-17 10:26:47 -070093 version_name_package := $(base_version_major).$(base_version_minor).$(base_version_build) ($(BUILD_NUMBER_FROM_FILE)-$(base_version_arch)$(base_version_density))
Sascha Haeberling30239932013-08-28 14:51:53 -070094endif
Dan Willemsen5e0f4cf2015-10-28 16:45:38 -070095else # !TARGET_BUILD_APPS
96 version_name_package := $(base_version_major).$(base_version_minor).$(base_version_build)
97endif
Sascha Haeberling30239932013-08-28 14:51:53 -070098
99# Cleanup the locals
100base_version_major :=
101base_version_minor :=
102base_version_build :=
103base_version_buildtype :=
104base_version_arch :=
105base_version_density :=
106git_hash :=
107date_string :=