Bug 1365089 - Add MOZ_ANDROID_MMA and --with-leanplum-sdk-keyfile to configure. r=chmanchester
This is the equivalent of MOZ_INSTALL_TRACKING, but for MMA (Mobile
Marketing Automation) using the Leanplum SDK.
To test this locally, add lines like:
export MOZ_ANDROID_MMA=1
ac_add_options --with-adjust-sdk-keyfile=/path/to/adjust-sdk-developer.token
MOZ_ANDROID_MMA depends on MOZ_NATIVE_DEVICES and MOZ_ANDROID_GCM,
since Leanplum requires Google Play Services library that those flags
are a proxy for and enable, respectiviely.
We want to enable MOZ_ANDROID_MMA in Nightly, but only for
MOZILLA_OFFICIAL builds. Since MOZILLA_OFFICIAL is still defined in
old-configure.in, we can't interrogate it in
mobile/android/moz.configure, and therefore we enable using the
automation mozconfigs.
MozReview-Commit-ID: 1tiToeyH5Hx
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -73,20 +73,25 @@ endif
ifdef MOZ_INSTALL_TRACKING
JAVA_CLASSPATH += \
$(ANDROID_PLAY_SERVICES_ADS_AAR_LIB) \
$(ANDROID_PLAY_SERVICES_BASEMENT_AAR_LIB) \
$(NULL)
endif
-
-# MOZ_ANDROID_MMA requires MOZ_ANDROID_GCM and MOZ_INSTALL_TRACKING,
-# so we don't need a separate clause adding to JAVA_CLASSPATH for
-# MMA (Leanplum) support.
+# MOZ_ANDROID_MMA requires MOZ_ANDROID_GCM and MOZ_NATIVE_DEVICES,
+# which take care of the Play Services requirements in JAVA_CLASSPATH.
+# Based on the import of
+# `com.google.android.gms.ads.identifier.AdvertisingIdClient` in
+# `com.leanplum.internal.Util` one would assume that
+# `play-services-ads` is required, by in version 8.4.0 (at least) that
+# class is defined in `play-services-basement`. Therefore, unlike
+# MOZ_INSTALL_TRACKING, we don't need to depend on
+# `play-services-ads`.
JAVA_CLASSPATH := $(subst $(NULL) ,:,$(strip $(JAVA_CLASSPATH)))
# Library jars that we're bundling: these are subject to Proguard before inclusion
# into classes.dex.
java_bundled_libs := \
$(ANDROID_SUPPORT_V4_AAR_LIB) \
$(ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB) \
@@ -121,19 +126,19 @@ endif
ifdef MOZ_INSTALL_TRACKING
java_bundled_libs += \
$(ANDROID_PLAY_SERVICES_ADS_AAR_LIB) \
$(ANDROID_PLAY_SERVICES_BASEMENT_AAR_LIB) \
$(NULL)
endif
-# MOZ_ANDROID_MMA requires MOZ_ANDROID_GCM and MOZ_INSTALL_TRACKING,
-# so we don't need a separate clause adding to java_bundled_libs for
-# MMA (Leanplum) support.
+# MOZ_ANDROID_MMA requires MOZ_ANDROID_GCM and MOZ_NATIVE_DEVICES,
+# which take care of the Play Services requirements in
+# java_bundled_libs. See the note above.
# uniq purloined from http://stackoverflow.com/a/16151140.
uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
java_bundled_libs := $(call uniq,$(java_bundled_libs))
java_bundled_libs := $(subst $(NULL) ,:,$(strip $(java_bundled_libs)))
GECKOVIEW_JARS = \
--- a/mobile/android/base/generate_build_config.py
+++ b/mobile/android/base/generate_build_config.py
@@ -99,16 +99,19 @@ def _defines():
else:
DEFINES['MOZ_MIN_CPU_VERSION'] = 5
# It's okay to use MOZ_ADJUST_SDK_KEY here because this doesn't
# leak the value to build logs.
if CONFIG['MOZ_INSTALL_TRACKING']:
DEFINES['MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN'] = CONFIG['MOZ_ADJUST_SDK_KEY']
+ if CONFIG['MOZ_ANDROID_MMA']:
+ DEFINES['MOZ_LEANPLUM_SDK_KEY'] = CONFIG['MOZ_LEANPLUM_SDK_KEY']
+
DEFINES['MOZ_BUILDID'] = open(os.path.join(buildconfig.topobjdir, 'buildid.h')).readline().split()[2]
# Set the appropriate version code if not set by MOZ_APP_ANDROID_VERSION_CODE.
if CONFIG.get('MOZ_APP_ANDROID_VERSION_CODE'):
DEFINES['ANDROID_VERSION_CODE'] = \
CONFIG.get('MOZ_APP_ANDROID_VERSION_CODE')
else:
min_sdk = int(CONFIG.get('MOZ_ANDROID_MIN_SDK_VERSION') or '0') or None
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/leanplum-sdk-sandbox.token
@@ -0,0 +1,1 @@
+APP_ID TOKEN
--- a/mobile/android/config/mozconfigs/common
+++ b/mobile/android/config/mozconfigs/common
@@ -59,16 +59,31 @@ ac_add_options --with-mozilla-api-keyfil
# In all cases, we don't upload Adjust pings in automation.
if test "$MOZ_UPDATE_CHANNEL" = "release" ; then
ac_add_options --with-adjust-sdk-keyfile=/builds/adjust-sdk.token
elif test "$MOZ_UPDATE_CHANNEL" = "beta" ; then
ac_add_options --with-adjust-sdk-keyfile=/builds/adjust-sdk-beta.token
else
ac_add_options --with-adjust-sdk-keyfile="$topsrcdir/mobile/android/base/adjust-sdk-sandbox.token"
fi
+
+# MOZ_ANDROID_MMA depends on --with-leanplum-sdk-keyfile, and there's no default
+# keyfile set, so if we misconfigure beta or release, the builds will fail (at
+# configure time).
+if test "$MOZ_UPDATE_CHANNEL" = "release" ; then
+ ac_add_options --with-leanplum-sdk-keyfile=/builds/leanplum-sdk-release.token
+elif test "$MOZ_UPDATE_CHANNEL" = "beta" ; then
+ ac_add_options --with-leanplum-sdk-keyfile=/builds/leanplum-sdk-beta.token
+elif test "$MOZ_UPDATE_CHANNEL" = "nightly" ; then
+ export MOZ_ANDROID_MMA=1
+ ac_add_options --with-leanplum-sdk-keyfile=/builds/leanplum-sdk-nightly.token
+else
+ ac_add_options --with-leanplum-sdk-keyfile="$topsrcdir/mobile/android/base/leanplum-sdk-sandbox.token"
+fi
+
export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1
# Use ccache
. "$topsrcdir/build/mozconfig.cache"
--- a/mobile/android/moz.configure
+++ b/mobile/android/moz.configure
@@ -36,16 +36,23 @@ option(env='MOZ_INSTALL_TRACKING',
help='Enable install tracking (currently using the Adjust SDK).',
default=install_tracking_default)
set_config('MOZ_INSTALL_TRACKING',
depends_if('MOZ_INSTALL_TRACKING')(lambda _: True))
add_old_configure_assignment('MOZ_INSTALL_TRACKING',
depends_if('MOZ_INSTALL_TRACKING')(lambda _: True))
+option(env='MOZ_ANDROID_MMA',
+ help='Enable mobile marketing automation (currently using the Leanplum SDK).',
+ default=False)
+
+set_config('MOZ_ANDROID_MMA',
+ depends_if('MOZ_ANDROID_MMA')(lambda _: True))
+
project_flag('MOZ_ANDROID_DOWNLOADS_INTEGRATION',
help='Enable system download manager on Android',
default=True)
project_flag('MOZ_ANDROID_BEAM',
help='Enable NFC permission on Android',
default=True)
@@ -120,8 +127,28 @@ def check_install_tracking(install_track
adjust_sdk_keyfile):
if install_tracking:
if not native_devices:
die('You must specify MOZ_NATIVE_DEVICES=1 when'
' building with MOZ_INSTALL_TRACKING=1')
if not adjust_sdk_keyfile:
die('You must specify --with-adjust-sdk-keyfile=/path/to/keyfile when'
' building with MOZ_INSTALL_TRACKING=1')
+
+# Must come after the ../../toolkit/moz.configure.
+@depends('MOZ_ANDROID_MMA',
+ 'MOZ_NATIVE_DEVICES',
+ 'MOZ_ANDROID_GCM',
+ '--with-leanplum-sdk-keyfile')
+def check_android_mma(android_mma,
+ native_devices,
+ android_gcm,
+ leanplum_sdk_keyfile):
+ if android_mma:
+ if not native_devices:
+ die('You must specify MOZ_NATIVE_DEVICES=1 when'
+ ' building with MOZ_ANDROID_MMA=1')
+ if not android_gcm:
+ die('You must specify MOZ_ANDROID_GCM=1 when'
+ ' building with MOZ_ANDROID_MMA=1')
+ if not leanplum_sdk_keyfile:
+ die('You must specify --with-leanplum-sdk-keyfile=/path/to/keyfile when'
+ ' building with MOZ_ANDROID_MMA=1')
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -609,16 +609,18 @@ include('../build/moz.configure/keyfiles
simple_keyfile('Mozilla API')
simple_keyfile('Google API')
id_and_secret_keyfile('Bing API')
simple_keyfile('Adjust SDK')
+id_and_secret_keyfile('Leanplum SDK')
+
# Servo integration
# ==============================================================
option('--enable-stylo', nargs='?', choices=('build',),
help='Include Stylo in the build and/or enable it at runtime')
@depends('--enable-stylo')
def stylo_config(value):
build_stylo = None