summaryrefslogtreecommitdiff
path: root/chromium/version.mk
blob: fe4b6ae93c8cc5d37ab83b567fad2b5556f7aef4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#
# Copyright (C) 2014 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# The current version code scheme for the package apk is:
#      Mbbbba
# where
#    M - Chromium milestone number minus 36. (1 or more digits). This is to
#        ensure that our version codes are lower than the ones currently used by
#        Chrome for Android, so that we can adopt their scheme in future.
# bbbb - manually specified build number (exactly 4 digits). This defaults to
#        0000, or 9999 in local builds.
#    a - device architecture (exactly 1 digit). Current valid values are:
#           1 : armv7-a
#           2 : armv8-a (arm64)
#           4 : mips
#           7 : x86
#           8 : x86_64
#        64-bit architectures must be higher than their corresponding 32-bit
#        architectures to ensure that 64-bit devices receive the multiarch APK.
#        x86 must be higher than ARM to avoid x86 devices receiving ARM APKs
#        and running them in emulation.

# TODO(torne): get this from Chromium automatically.
version_milestone := 40
version_offset_milestone := $(shell echo $(version_milestone) \
                              | awk '{print $$1 - 36}')

ifneq "" "$(filter eng.%,$(BUILD_NUMBER))"
  version_build_number := 9999
  # BUILD_NUMBER has a timestamp in it, which means that
  # it will change every time. Pick a stable value.
  version_name_tag := eng.$(USER)
else
  ifeq "$(version_build_number)" ""
    version_build_number := 0000
  endif
  version_name_tag := $(BUILD_NUMBER)
endif

ifeq "$(TARGET_ARCH)" "x86_64"
  version_arch := 8
else ifeq "$(TARGET_ARCH)" "x86"
  version_arch := 7
else ifeq "$(TARGET_ARCH)" "mips"
  version_arch := 4
else ifeq "$(TARGET_ARCH)" "arm64"
  version_arch := 2
else ifeq "$(TARGET_ARCH)" "arm"
  version_arch := 1
else
  version_arch := 0
  $(warning Could not determine target architecture for versioning)
endif

version_code := $(version_offset_milestone)$(version_build_number)$(version_arch)

# Use the milestone, build number and architecture to construct a version
# name like "37 (1424323-arm64)".
# TODO(torne): get the full version number from Chromium.
version_name := $(version_milestone) ($(version_name_tag)-$(TARGET_ARCH))

# Clean up locals
version_milestone :=
version_build_number :=
version_name_tag :=
version_arch :=