Bug 1384202 - Pre: Make mozboot/android.py an executable script. r=rillian draft
authorNick Alexander <nalexander@mozilla.com>
Tue, 18 Jul 2017 15:47:04 -0700
changeset 615332 2885195855497d69b1cbba02a943964dd3286b93
parent 615330 3cd1fef88cbb47fc9cd4e47a2a4bc2277c576c58
child 615333 5a80bdd5ddfb551b374464f42c3783fef5a71fc3
push id70322
push usernalexander@mozilla.com
push dateTue, 25 Jul 2017 20:22:42 +0000
reviewersrillian
bugs1384202
milestone56.0a1
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))