Bug 1419581 - Part 4: Allow setting MOZ_ANDROID_GCM in mozconfig. r=chmanchester draft
authorNick Alexander <nalexander@mozilla.com>
Wed, 22 Nov 2017 09:48:02 -0800
changeset 747339 c02766104281a895ab57e58079a1f651e1b9f832
parent 747338 277c272236fed0a4d316401d7369bf025221fe75
child 747340 17a25d2a15868f3661248a06b9048741e5a1dca5
push id96881
push usernalexander@mozilla.com
push dateThu, 25 Jan 2018 22:25:52 +0000
reviewerschmanchester
bugs1419581
milestone60.0a1
Bug 1419581 - Part 4: Allow setting MOZ_ANDROID_GCM in mozconfig. r=chmanchester This also verifies that we have Google Play Services (via MOZ_NATIVE_DEVICES=1) if we ask to build with GCM. This was just an oversight earlier. MozReview-Commit-ID: BvJi7Sfo4pu
mobile/android/moz.configure
--- a/mobile/android/moz.configure
+++ b/mobile/android/moz.configure
@@ -3,20 +3,24 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 project_flag('MOZ_ANDROID_EXCLUDE_FONTS',
              help='Whether to exclude font files from the build',
              default=True)
 
-project_flag('MOZ_ANDROID_GCM',
-             help='Enable GCM (Google Cloud Messaging) registration',
-             default=True,
-             set_for_old_configure=True)
+option(env='MOZ_ANDROID_GCM',
+       help='Enable GCM (Google Cloud Messaging) registration',
+       default=True)
+
+set_config('MOZ_ANDROID_GCM',
+           depends_if('MOZ_ANDROID_GCM')(lambda _: True))
+add_old_configure_assignment('MOZ_ANDROID_GCM',
+                             depends_if('MOZ_ANDROID_GCM')(lambda _: True))
 
 option(env='MOZ_NATIVE_DEVICES',
        help='Enable second screen support using native Android libraries.',
        default=True)
 
 set_config('MOZ_NATIVE_DEVICES',
            depends_if('MOZ_NATIVE_DEVICES')(lambda _: True))
 add_old_configure_assignment('MOZ_NATIVE_DEVICES',
@@ -153,8 +157,17 @@ def check_android_mma(android_mma,
                 ' building with MOZ_ANDROID_MMA=1')
 
 @depends('MOZ_ANDROID_POCKET',
          '--with-pocket-api-keyfile')
 def check_android_pocket(android_pocket, pocket_api_keyfile):
     if android_pocket and not pocket_api_keyfile:
         die('You must specify --with-pocket-api-keyfile=/path/to/keyfile when'
             ' building with MOZ_ANDROID_POCKET=1')
+
+# Must come after the ../../toolkit/moz.configure.
+@depends('MOZ_ANDROID_GCM', 'MOZ_NATIVE_DEVICES')
+def check_android_gcm(android_gcm,
+                      native_devices):
+    if android_gcm:
+        if not native_devices:
+            die('You must specify MOZ_NATIVE_DEVICES=1 when'
+                ' building with MOZ_ANDROID_GCM=1')