blob: 2b6077a4024bebc69b7e752212dc26c675c313d3 [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.
32
33# Specify the following manually. Note that base_version_minor must be exactly 1 digit and
34# base_version_build must be exactly 3 digits.
35base_version_major := 2
36base_version_minor := 0
37base_version_build := 001
38
39#####################################################
40#####################################################
41# Collect automatic version code parameters
42ifneq "" "$(filter eng.%,$(BUILD_NUMBER))"
43 # This is an eng build
44 base_version_buildtype := 0
45else
46 # This is a build server build
47 base_version_buildtype := 1
48endif
49
50ifeq "$(TARGET_ARCH)" "x86"
51 base_version_arch := 7
52else ifeq "$(TARGET_ARCH)" "mips"
53 base_version_arch := 5
54else ifeq "$(TARGET_ARCH)" "arm"
55 ifeq ($(TARGET_ARCH_VARIANT),armv5te)
56 base_version_arch := 1
57 else
58 base_version_arch := 3
59 endif
60else
61 base_version_arch := 0
62endif
63
64ifeq "$(package_dpi)" "mdpi"
65 base_version_density := 2
66else ifeq "$(package_dpi)" "hdpi"
67 base_version_density := 4
68else ifeq "$(package_dpi)" "xhdpi"
69 base_version_density := 6
70else
71 base_version_density := 0
72endif
73
74# Build the version code
75version_code_package := $(base_version_major)$(base_version_minor)$(base_version_build)$(base_version_buildtype)$(base_version_arch)$(base_version_density)
76
77# The version name scheme for the package apk is:
78# - For eng build (t=0): M.m.bbb eng.$(USER)-hh
79# - For build server (t=1): M.m.bbb (nnnnnn-hh)
80# where nnnnnn is the build number from the build server (no zero-padding)
81# On eng builds, the BUILD_NUMBER has the user and timestamp inline
82ifneq "" "$(filter eng.%,$(BUILD_NUMBER))"
83 git_hash := $(shell git --git-dir $(LOCAL_PATH)/.git log -n 1 --pretty=format:%h)
84 date_string := $(shell date +%m%d%y_%H%M%S)
85 version_name_package := $(base_version_major).$(base_version_minor).$(base_version_build) (eng.$(USER).$(git_hash).$(date_string)-$(base_version_arch)$(base_version_density))
86else
87 version_name_package := $(base_version_major).$(base_version_minor).$(base_version_build) ($(BUILD_NUMBER)-$(base_version_arch)$(base_version_density))
88endif
89
90# Cleanup the locals
91base_version_major :=
92base_version_minor :=
93base_version_build :=
94base_version_buildtype :=
95base_version_arch :=
96base_version_density :=
97git_hash :=
98date_string :=