Bug 1219512 - Bump Android version code computation check. r=nalexander
authorRichard Newman <rnewman@mozilla.com>
Wed, 28 Oct 2015 18:38:55 -0700
changeset 305219 e58416c87b3ab34a3da9203c4079d6d63dd1c561
parent 305218 a209e72c3b1344a681b6b49cd99defb5b2545c00
child 305220 686ffb6a3171cee0169fc7b9468ee1b80bc2319f
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1219512
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1219512 - Bump Android version code computation check. r=nalexander
python/mozbuild/mozbuild/android_version_code.py
python/mozbuild/mozbuild/test/test_android_version_code.py
--- a/python/mozbuild/mozbuild/android_version_code.py
+++ b/python/mozbuild/mozbuild/android_version_code.py
@@ -50,19 +50,22 @@ def android_version_code_v1(buildid, cpu
     The bits labelled 'x', 'p', and 'g' are feature flags.
 
     The bit labelled 'x' is 1 if the build is for an x86 architecture and 0
     otherwise, which means the build is for an ARM architecture.  (Fennec no
     longer supports ARMv6, so ARM is equivalent to ARMv7 and above.)
 
     The bit labelled 'p' is a placeholder that is always 0 (for now).
 
-    The bit labelled 'g' is 1 if the build is targetting Android API 11+ and 0
+    The bit labelled 'g' is 1 if the build is targeting Android API 11/14+ and 0
     otherwise, which means the build targets Android API 9-10 (Gingerbread).
-    (Fennec no longer supports below Android API 9.)
+
+    Fennec no longer supports Android API 8 or earlier. After Bug 1155801 it
+    no longer supports API 11-13. API 9 is still supported due to significant usage.
+    We temporarily treat both 11 and 14 the same: Bug 1219512.
 
     We throw an explanatory exception when we are within one calendar year of
     running out of build events.  This gives lots of time to update the version
     scheme.  The responsible individual should then bump the range (to allow
     builds to continue) and use the time remaining to update the version scheme
     via the reserved high order bits.
 
     N.B.: the reserved 0 bit to the left of the highest order 't' bit can,
@@ -102,17 +105,19 @@ def android_version_code_v1(buildid, cpu
     # for architecture and APK splits.
     version |= base << 3
 
     # None is interpreted as arm.
     if not cpu_arch or cpu_arch in ['armeabi', 'armeabi-v7a']:
         # 0 is interpreted as SDK 9.
         if not min_sdk or min_sdk == 9:
             pass
-        elif min_sdk == 11:
+        # This used to compare to 11. The 14+ APK directly supersedes 11+, so
+        # we reuse this check.
+        elif min_sdk == 14 or min_sdk == 11:
             version |= 1 << 0
         else:
             raise ValueError("Don't know how to compute android:versionCode "
                              "for CPU arch %s and min SDK %s" % (cpu_arch, min_sdk))
     elif cpu_arch in ['x86']:
         version |= 1 << 2
     else:
         raise ValueError("Don't know how to compute android:versionCode "
--- a/python/mozbuild/mozbuild/test/test_android_version_code.py
+++ b/python/mozbuild/mozbuild/test/test_android_version_code.py
@@ -20,19 +20,21 @@ class TestAndroidVersionCode(unittest.Te
         self.assertEqual(android_version_code_v0(buildid, cpu_arch='armeabi', min_sdk=9, max_sdk=None), arm_api9)
         self.assertEqual(android_version_code_v0(buildid, cpu_arch='armeabi-v7a', min_sdk=11, max_sdk=None), arm_api11)
         self.assertEqual(android_version_code_v0(buildid, cpu_arch='x86', min_sdk=9, max_sdk=None), x86_api9)
 
     def test_android_version_code_v1(self):
         buildid = '20150825141628'
         arm_api9  = 0b01111000001000000001001001110000
         arm_api11 = 0b01111000001000000001001001110001
+        arm_api14 = 0b01111000001000000001001001110001
         x86_api9  = 0b01111000001000000001001001110100
         self.assertEqual(android_version_code_v1(buildid, cpu_arch='armeabi', min_sdk=9, max_sdk=None), arm_api9)
         self.assertEqual(android_version_code_v1(buildid, cpu_arch='armeabi-v7a', min_sdk=11, max_sdk=None), arm_api11)
+        self.assertEqual(android_version_code_v1(buildid, cpu_arch='armeabi-v7a', min_sdk=14, max_sdk=None), arm_api14)
         self.assertEqual(android_version_code_v1(buildid, cpu_arch='x86', min_sdk=9, max_sdk=None), x86_api9)
 
     def test_android_version_code_v1_underflow(self):
         '''Verify that it is an error to ask for v1 codes predating the cutoff.'''
         buildid = '201508010000' # Earliest possible.
         arm_api9 = 0b01111000001000000000000000000000
         self.assertEqual(android_version_code_v1(buildid, cpu_arch='armeabi', min_sdk=9, max_sdk=None), arm_api9)
         with self.assertRaises(ValueError) as cm: