Bug 1360291 - Produce android version codes for AArch64/ARM64 Fennec; r=nalexander

Add AArch64/ARM64 support to the script that produces android version
codes. Use the same scheme for AArch64 as x86, since the two
architectures don't overlap, and AArch64 should override ARM just like
x86 should override ARM.
This commit is contained in:
Jim Chen 2017-05-04 19:19:31 -04:00
Родитель 055a903128
Коммит 15251765f1
2 изменённых файлов: 18 добавлений и 7 удалений

Просмотреть файл

@ -49,9 +49,14 @@ def android_version_code_v1(buildid, cpu_arch=None, min_sdk=0, max_sdk=0):
The bits labelled 'x', 'p', and 'g' are feature flags. 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 The bit labelled 'x' is 1 if the build is for an x86 or ARM64 architecture,
otherwise, which means the build is for an ARM architecture. (Fennec no and 0 otherwise, which means the build is for a (32-bit) ARM architecture.
longer supports ARMv6, so ARM is equivalent to ARMv7 and above.) (Fennec no longer supports ARMv6, so ARM is equivalent to ARMv7.
ARM64 is also known as AArch64; it is logically ARMv8.)
For the same release, x86 and ARM64 builds have higher version codes and
take precedence over ARM builds, so that they are preferred over ARM on
devices that have ARM emulation.
The bit labelled 'p' is a placeholder that is always 0 (for now). The bit labelled 'p' is a placeholder that is always 0 (for now).
@ -120,7 +125,7 @@ def android_version_code_v1(buildid, cpu_arch=None, min_sdk=0, max_sdk=0):
else: else:
raise ValueError("Don't know how to compute android:versionCode " raise ValueError("Don't know how to compute android:versionCode "
"for CPU arch %s and min SDK %s" % (cpu_arch, min_sdk)) "for CPU arch %s and min SDK %s" % (cpu_arch, min_sdk))
elif cpu_arch in ['x86']: elif cpu_arch in ['x86', 'arm64-v8a']:
version |= 1 << 2 version |= 1 << 2
else: else:
raise ValueError("Don't know how to compute android:versionCode " raise ValueError("Don't know how to compute android:versionCode "
@ -143,7 +148,11 @@ def main(argv):
default=False, default=False,
help='Be verbose') help='Be verbose')
parser.add_argument('--with-android-cpu-arch', dest='cpu_arch', parser.add_argument('--with-android-cpu-arch', dest='cpu_arch',
choices=['armeabi', 'armeabi-v7a', 'mips', 'x86'], choices=['armeabi',
'armeabi-v7a',
'arm64-v8a',
'mips',
'x86'],
help='The target CPU architecture') help='The target CPU architecture')
parser.add_argument('--with-android-min-sdk-version', dest='min_sdk', parser.add_argument('--with-android-min-sdk-version', dest='min_sdk',
type=int, default=0, type=int, default=0,

Просмотреть файл

@ -23,9 +23,11 @@ class TestAndroidVersionCode(unittest.TestCase):
def test_android_version_code_v1(self): def test_android_version_code_v1(self):
buildid = '20150825141628' buildid = '20150825141628'
arm_api15 = 0b01111000001000000001001001110001 arm_api15 = 0b01111000001000000001001001110001
x86_api9 = 0b01111000001000000001001001110100 arm64_api21 = 0b01111000001000000001001001110100
x86_api9 = 0b01111000001000000001001001110100
self.assertEqual(android_version_code_v1(buildid, cpu_arch='armeabi-v7a', min_sdk=15, max_sdk=None), arm_api15) self.assertEqual(android_version_code_v1(buildid, cpu_arch='armeabi-v7a', min_sdk=15, max_sdk=None), arm_api15)
self.assertEqual(android_version_code_v1(buildid, cpu_arch='arm64-v8a', min_sdk=21, max_sdk=None), arm64_api21)
self.assertEqual(android_version_code_v1(buildid, cpu_arch='x86', min_sdk=9, max_sdk=None), x86_api9) 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): def test_android_version_code_v1_underflow(self):