Bug 1384202 - Pre: Make mozboot/android.py an executable script. r=rillian
authorNick Alexander <nalexander@mozilla.com>
Tue, 18 Jul 2017 15:47:04 -0700
changeset 370870 bcfce9e21f29b6e719740ee13d4c0388d5fac2ab
parent 370869 9658d6703c27b47126b6b0202b2e5ca2253c2c21
child 370871 95b831898973394e5d8e55fcd16b2f8926e5e500
push id47205
push usernalexander@mozilla.com
push dateTue, 25 Jul 2017 20:24:11 +0000
treeherderautoland@95b831898973 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs1384202
milestone56.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 1384202 - Pre: Make mozboot/android.py an executable script. r=rillian This looks ahead to using |mach bootstrap| when building docker images. MozReview-Commit-ID: LoMU7ji5T0x
python/mozboot/mozboot/android.py
--- a/python/mozboot/mozboot/android.py
+++ b/python/mozboot/mozboot/android.py
@@ -235,8 +235,39 @@ def android_ndk_url(os_name, ver='r11c')
         os_name = 'darwin'
 
     if sys.maxsize > 2**32:
         arch = 'x86_64'
     else:
         arch = 'x86'
 
     return '%s-%s-%s-%s.zip' % (base_url, ver, os_name, arch)
+
+
+def main(argv):
+    import optparse # No argparse, which is new in Python 2.7.
+    import platform
+
+    parser = optparse.OptionParser()
+    parser.add_option('-a', '--artifact-mode', dest='artifact_mode', action='store_true',
+                      help='If true, install only the Android SDK (and not the Android NDK).')
+
+    options, _ = parser.parse_args(argv)
+
+    os_name = None
+    if platform.system() == 'Darwin':
+        os_name = 'macosx'
+    elif platform.system() == 'Linux':
+        os_name = 'linux'
+    elif platform.system() == 'Windows':
+        os_name = 'windows'
+    else:
+        raise NotImplementedError("We don't support bootstrapping the Android SDK (or Android NDK) "
+                                  "on {} yet!".format(platform.system()))
+
+    ensure_android(os_name, options.artifact_mode)
+    suggest_mozconfig(os_name, options.artifact_mode)
+
+    return 0
+
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))