Bug 1419581 - Part 5: Add --without-google-play-services. r=chmanchester

Historically, we used MOZ_NATIVE_DEVICES to proxy for Google Play
Services.  (MOZ_NATIVE_DEVICES was the first GPS-consuming feature in
Fennec.)  With Python moz.configure, we can easily add the real
top-level flag that distributions like F-Droid actually want, which is
to build without (non-free) Google Play Services entirely.

MozReview-Commit-ID: 7YJKw3G1lQA

--HG--
extra : rebase_source : f599de01c63b873a95252d6b01128a6f069ff105
extra : intermediate-source : 060290b66b370137cfd3dbbac7c442ef107aaa68
extra : source : be888fa125dc1948fc073ed69aa8116f47e22877
This commit is contained in:
Nick Alexander 2018-01-04 15:37:15 -08:00
Родитель b43c5179f1
Коммит 847818a3e1
4 изменённых файлов: 51 добавлений и 30 удалений

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

@ -42,11 +42,13 @@
<meta-data android:name="android.max_aspect" android:value="2.1"/> <meta-data android:name="android.max_aspect" android:value="2.1"/>
#ifdef MOZ_NATIVE_DEVICES #ifdef MOZ_ANDROID_GOOGLE_PLAY_SERVICES
<!-- This resources comes from Google Play Services. Required for casting support. --> <!-- This resources comes from Google Play Services. Required for casting support. -->
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<service android:name="org.mozilla.gecko.RemotePresentationService" android:exported="false"/> #endif
#ifdef MOZ_NATIVE_DEVICES
<service android:name="org.mozilla.gecko.RemotePresentationService" android:exported="false"/>
#endif #endif
<!-- This activity handles all incoming Intents and dispatches them to other activities. --> <!-- This activity handles all incoming Intents and dispatches them to other activities. -->

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

@ -52,12 +52,15 @@ JAVA_CLASSPATH += \
$(ANDROID_PALETTE_V7_AAR_LIB) \ $(ANDROID_PALETTE_V7_AAR_LIB) \
$(NULL) $(NULL)
# If native devices are enabled, add Google Play Services and some of the v7 ifdef MOZ_ANDROID_GOOGLE_PLAY_SERVICES
# compat libraries.
ifdef MOZ_NATIVE_DEVICES
JAVA_CLASSPATH += \ JAVA_CLASSPATH += \
$(ANDROID_PLAY_SERVICES_BASE_AAR_LIB) \ $(ANDROID_PLAY_SERVICES_BASE_AAR_LIB) \
$(ANDROID_PLAY_SERVICES_BASEMENT_AAR_LIB) \ $(ANDROID_PLAY_SERVICES_BASEMENT_AAR_LIB) \
$(NULL)
endif
ifdef MOZ_NATIVE_DEVICES
JAVA_CLASSPATH += \
$(ANDROID_PLAY_SERVICES_CAST_AAR_LIB) \ $(ANDROID_PLAY_SERVICES_CAST_AAR_LIB) \
$(ANDROID_MEDIAROUTER_V7_AAR_LIB) \ $(ANDROID_MEDIAROUTER_V7_AAR_LIB) \
$(ANDROID_MEDIAROUTER_V7_AAR_INTERNAL_LIB) \ $(ANDROID_MEDIAROUTER_V7_AAR_INTERNAL_LIB) \
@ -80,7 +83,7 @@ ifdef MOZ_INSTALL_TRACKING
$(NULL) $(NULL)
endif endif
# MOZ_ANDROID_MMA requires MOZ_ANDROID_GCM and MOZ_NATIVE_DEVICES, # MOZ_ANDROID_MMA requires MOZ_ANDROID_GCM and MOZ_ANDROID_GOOGLE_PLAY_SERVICES,
# which take care of the Play Services requirements in JAVA_CLASSPATH. # which take care of the Play Services requirements in JAVA_CLASSPATH.
# Based on the import of # Based on the import of
# `com.google.android.gms.ads.identifier.AdvertisingIdClient` in # `com.google.android.gms.ads.identifier.AdvertisingIdClient` in
@ -107,6 +110,13 @@ java_bundled_libs := \
$(ANDROID_PALETTE_V7_AAR_LIB) \ $(ANDROID_PALETTE_V7_AAR_LIB) \
$(NULL) $(NULL)
ifdef MOZ_ANDROID_GOOGLE_PLAY_SERVICES
java_bundled_libs += \
$(ANDROID_PLAY_SERVICES_BASE_AAR_LIB) \
$(ANDROID_PLAY_SERVICES_BASEMENT_AAR_LIB) \
$(NULL)
endif
ifdef MOZ_NATIVE_DEVICES ifdef MOZ_NATIVE_DEVICES
java_bundled_libs += \ java_bundled_libs += \
$(ANDROID_PLAY_SERVICES_BASE_AAR_LIB) \ $(ANDROID_PLAY_SERVICES_BASE_AAR_LIB) \
@ -133,7 +143,7 @@ ifdef MOZ_INSTALL_TRACKING
$(NULL) $(NULL)
endif endif
# MOZ_ANDROID_MMA requires MOZ_ANDROID_GCM and MOZ_NATIVE_DEVICES, # MOZ_ANDROID_MMA requires MOZ_ANDROID_GCM and MOZ_ANDROID_GOOGLE_PLAY_SERVICES,
# which take care of the Play Services requirements in # which take care of the Play Services requirements in
# java_bundled_libs. See the note above. # java_bundled_libs. See the note above.

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

@ -202,7 +202,7 @@ To test this locally, add lines like:
export MOZ_ANDROID_MMA=1 export MOZ_ANDROID_MMA=1
ac_add_options --with-leanplum-sdk-keyfile=/path/to/leanplum-sdk-developer.token ac_add_options --with-leanplum-sdk-keyfile=/path/to/leanplum-sdk-developer.token
MOZ_ANDROID_MMA depends on MOZ_NATIVE_DEVICES and MOZ_ANDROID_GCM. MOZ_ANDROID_MMA depends on MOZ_ANDROID_GOOGLE_PLAY_SERVICES and MOZ_ANDROID_GCM.
Since Leanplum requires Google Play Services library, those flags are a proxy for it, and enable respectively. Since Leanplum requires Google Play Services library, those flags are a proxy for it, and enable respectively.
We want to enable MOZ_ANDROID_MMA in Nightly, but only for We want to enable MOZ_ANDROID_MMA in Nightly, but only for

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

@ -8,9 +8,22 @@ project_flag('MOZ_ANDROID_EXCLUDE_FONTS',
help='Whether to exclude font files from the build', help='Whether to exclude font files from the build',
default=True) default=True)
option('--with-google-play-services',
help='Enable features that depend on non-free Google Play Services',
default=True)
@depends('--with-google-play-services')
def google_play_services(value):
return bool(value)
set_config('MOZ_ANDROID_GOOGLE_PLAY_SERVICES', depends_if(google_play_services)(lambda _: True))
set_config('ANDROID_GOOGLE_PLAY_SERVICES_VERSION', '8.4.0')
add_old_configure_assignment('ANDROID_GOOGLE_PLAY_SERVICES_VERSION', '8.4.0')
option(env='MOZ_ANDROID_GCM', option(env='MOZ_ANDROID_GCM',
help='Enable GCM (Google Cloud Messaging) registration', help='Enable GCM (Google Cloud Messaging) registration',
default=True) default=google_play_services)
set_config('MOZ_ANDROID_GCM', set_config('MOZ_ANDROID_GCM',
depends_if('MOZ_ANDROID_GCM')(lambda _: True)) depends_if('MOZ_ANDROID_GCM')(lambda _: True))
@ -19,18 +32,17 @@ add_old_configure_assignment('MOZ_ANDROID_GCM',
option(env='MOZ_NATIVE_DEVICES', option(env='MOZ_NATIVE_DEVICES',
help='Enable second screen support using native Android libraries.', help='Enable second screen support using native Android libraries.',
default=True) default=google_play_services)
set_config('MOZ_NATIVE_DEVICES', set_config('MOZ_NATIVE_DEVICES',
depends_if('MOZ_NATIVE_DEVICES')(lambda _: True)) depends_if('MOZ_NATIVE_DEVICES')(lambda _: True))
add_old_configure_assignment('MOZ_NATIVE_DEVICES', add_old_configure_assignment('MOZ_NATIVE_DEVICES',
depends_if('MOZ_NATIVE_DEVICES')(lambda _: True)) depends_if('MOZ_NATIVE_DEVICES')(lambda _: True))
# Enable install tracking SDK if we have Google Play support; MOZ_NATIVE_DEVICES # Enable install tracking SDK if we have Google Play support.
# is a proxy flag for that support. @depends(milestone, google_play_services, '--help')
@depends(milestone, 'MOZ_NATIVE_DEVICES', '--help') def install_tracking_default(milestone, google_play_services, help):
def install_tracking_default(milestone, native_devices, help): return bool(milestone.is_release_or_beta and google_play_services)
return bool(milestone.is_release_or_beta and native_devices)
option(env='MOZ_INSTALL_TRACKING', option(env='MOZ_INSTALL_TRACKING',
help='Enable install tracking (currently using the Adjust SDK).', help='Enable install tracking (currently using the Adjust SDK).',
@ -107,9 +119,6 @@ imply_option('--enable-small-chunk-size', True)
set_config('ANDROID_SUPPORT_LIBRARY_VERSION', '23.4.0') set_config('ANDROID_SUPPORT_LIBRARY_VERSION', '23.4.0')
add_old_configure_assignment('ANDROID_SUPPORT_LIBRARY_VERSION', '23.4.0') add_old_configure_assignment('ANDROID_SUPPORT_LIBRARY_VERSION', '23.4.0')
set_config('ANDROID_GOOGLE_PLAY_SERVICES_VERSION', '8.4.0')
add_old_configure_assignment('ANDROID_GOOGLE_PLAY_SERVICES_VERSION', '8.4.0')
@depends(target) @depends(target)
def check_target(target): def check_target(target):
if target.os != 'Android': if target.os != 'Android':
@ -124,13 +133,13 @@ include('../../build/moz.configure/java.configure')
include('gradle.configure') include('gradle.configure')
# Must come after the ../../toolkit/moz.configure. # Must come after the ../../toolkit/moz.configure.
@depends('MOZ_INSTALL_TRACKING', 'MOZ_NATIVE_DEVICES', '--with-adjust-sdk-keyfile') @depends('MOZ_INSTALL_TRACKING', google_play_services, '--with-adjust-sdk-keyfile')
def check_install_tracking(install_tracking, def check_install_tracking(install_tracking,
native_devices, google_play_services,
adjust_sdk_keyfile): adjust_sdk_keyfile):
if install_tracking: if install_tracking:
if not native_devices: if not google_play_services:
die('You must specify MOZ_NATIVE_DEVICES=1 when' die('You must specify --with-google-play-services when'
' building with MOZ_INSTALL_TRACKING=1') ' building with MOZ_INSTALL_TRACKING=1')
if not adjust_sdk_keyfile: if not adjust_sdk_keyfile:
die('You must specify --with-adjust-sdk-keyfile=/path/to/keyfile when' die('You must specify --with-adjust-sdk-keyfile=/path/to/keyfile when'
@ -138,16 +147,16 @@ def check_install_tracking(install_tracking,
# Must come after the ../../toolkit/moz.configure. # Must come after the ../../toolkit/moz.configure.
@depends('MOZ_ANDROID_MMA', @depends('MOZ_ANDROID_MMA',
'MOZ_NATIVE_DEVICES', google_play_services,
'MOZ_ANDROID_GCM', 'MOZ_ANDROID_GCM',
'--with-leanplum-sdk-keyfile') '--with-leanplum-sdk-keyfile')
def check_android_mma(android_mma, def check_android_mma(android_mma,
native_devices, google_play_services,
android_gcm, android_gcm,
leanplum_sdk_keyfile): leanplum_sdk_keyfile):
if android_mma: if android_mma:
if not native_devices: if not google_play_services:
die('You must specify MOZ_NATIVE_DEVICES=1 when' die('You must specify --with-google-play-services when'
' building with MOZ_ANDROID_MMA=1') ' building with MOZ_ANDROID_MMA=1')
if not android_gcm: if not android_gcm:
die('You must specify MOZ_ANDROID_GCM=1 when' die('You must specify MOZ_ANDROID_GCM=1 when'
@ -164,10 +173,10 @@ def check_android_pocket(android_pocket, pocket_api_keyfile):
' building with MOZ_ANDROID_POCKET=1') ' building with MOZ_ANDROID_POCKET=1')
# Must come after the ../../toolkit/moz.configure. # Must come after the ../../toolkit/moz.configure.
@depends('MOZ_ANDROID_GCM', 'MOZ_NATIVE_DEVICES') @depends('MOZ_ANDROID_GCM', google_play_services)
def check_android_gcm(android_gcm, def check_android_gcm(android_gcm,
native_devices): google_play_services):
if android_gcm: if android_gcm:
if not native_devices: if not google_play_services:
die('You must specify MOZ_NATIVE_DEVICES=1 when' die('You must specify --with-google-play-services when'
' building with MOZ_ANDROID_GCM=1') ' building with MOZ_ANDROID_GCM=1')