Home | History | Annotate | Download | only in chromium
      1 #
      2 # Copyright (C) 2014 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 current version code scheme for the package apk is:
     18 #      Mbbbba
     19 # where
     20 #    M - Chromium milestone number minus 36. (1 or more digits). This is to
     21 #        ensure that our version codes are lower than the ones currently used by
     22 #        Chrome for Android, so that we can adopt their scheme in future.
     23 # bbbb - manually specified build number (exactly 4 digits). This defaults to
     24 #        0000, or 9999 in local builds.
     25 #    a - device architecture (exactly 1 digit). Current valid values are:
     26 #           1 : armv7-a
     27 #           2 : armv8-a (arm64)
     28 #           4 : mips
     29 #           7 : x86
     30 #           8 : x86_64
     31 #        64-bit architectures must be higher than their corresponding 32-bit
     32 #        architectures to ensure that 64-bit devices receive the multiarch APK.
     33 #        x86 must be higher than ARM to avoid x86 devices receiving ARM APKs
     34 #        and running them in emulation.
     35 
     36 # TODO(torne): get this from Chromium automatically.
     37 version_milestone := 37
     38 version_offset_milestone := $(shell echo $(version_milestone) \
     39                               | awk '{print $$1 - 36}')
     40 
     41 ifneq "" "$(filter eng.%,$(BUILD_NUMBER))"
     42   version_build_number := 9999
     43   # BUILD_NUMBER has a timestamp in it, which means that
     44   # it will change every time. Pick a stable value.
     45   version_name_tag := eng.$(USER)
     46 else
     47   ifeq "$(version_build_number)" ""
     48     version_build_number := 0000
     49   endif
     50   version_name_tag := $(BUILD_NUMBER)
     51 endif
     52 
     53 ifeq "$(TARGET_ARCH)" "x86_64"
     54   version_arch := 8
     55 else ifeq "$(TARGET_ARCH)" "x86"
     56   version_arch := 7
     57 else ifeq "$(TARGET_ARCH)" "mips"
     58   version_arch := 4
     59 else ifeq "$(TARGET_ARCH)" "arm64"
     60   version_arch := 2
     61 else ifeq "$(TARGET_ARCH)" "arm"
     62   version_arch := 1
     63 else
     64   version_arch := 0
     65   $(warning Could not determine target architecture for versioning)
     66 endif
     67 
     68 version_code := $(version_offset_milestone)$(version_build_number)$(version_arch)
     69 
     70 # Use the milestone, build number and architecture to construct a version
     71 # name like "37 (1424323-arm64)".
     72 # TODO(torne): get the full version number from Chromium.
     73 version_name := $(version_milestone) ($(version_name_tag)-$(TARGET_ARCH))
     74 
     75 # Clean up locals
     76 version_milestone :=
     77 version_build_number :=
     78 version_name_tag :=
     79 version_arch :=
     80