Bug 1365060 - Move MOZ_{NATIVE_DEVICES, INSTALL_TRACKING} to moz.configure. r=chmanchester
authorNick Alexander <nalexander@mozilla.com>
Mon, 15 May 2017 14:37:54 -0700
changeset 358517 23c76f63807b6cc64542b37ee5a3274a12f35903
parent 358516 651b63732c13c34e010fec82e1e296db5e3cfbde
child 358518 df7170fb820d3813fda92a33fb7be11864c4172d
push id31827
push usercbook@mozilla.com
push dateTue, 16 May 2017 10:34:19 +0000
treeherdermozilla-central@49365d675cbb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1365060
milestone55.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 1365060 - Move MOZ_{NATIVE_DEVICES, INSTALL_TRACKING} to moz.configure. r=chmanchester This intentionally allows to set MOZ_INSTALL_TRACKING without reference to the milestone being release or beta. That is, we separate the default value (which depends on release or beta) from the value specified, making life easier for developers. MozReview-Commit-ID: 3vPF7KO7fEX
build/autoconf/android.m4
build/moz.configure/keyfiles.configure
mobile/android/confvars.sh
mobile/android/docs/adjust.rst
mobile/android/moz.configure
old-configure.in
toolkit/content/moz.build
--- a/build/autoconf/android.m4
+++ b/build/autoconf/android.m4
@@ -196,18 +196,16 @@ AC_DEFUN([MOZ_ANDROID_AAR],[
   MOZ_ANDROID_AAR_COMPONENT(concat(local_aar_var, _INTERNAL_LIB), concat(root, libs/$1-$2-internal_impl-$2.jar), $5)
   MOZ_ANDROID_AAR_COMPONENT(concat(local_aar_var, _ASSETS), concat(root, assets), $6)
 ])
 
 AC_DEFUN([MOZ_ANDROID_GOOGLE_PLAY_SERVICES],
 [
 
 if test -n "$MOZ_NATIVE_DEVICES" ; then
-    AC_SUBST(MOZ_NATIVE_DEVICES)
-
     MOZ_ANDROID_AAR(play-services-base, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
     MOZ_ANDROID_AAR(play-services-basement, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
     MOZ_ANDROID_AAR(play-services-cast, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
     MOZ_ANDROID_AAR(mediarouter-v7, $ANDROID_SUPPORT_LIBRARY_VERSION, android, com/android/support, REQUIRED_INTERNAL_IMPL)
 fi
 
 ])
 
@@ -222,17 +220,16 @@ if test -n "$MOZ_ANDROID_GCM" ; then
 fi
 
 ])
 
 AC_DEFUN([MOZ_ANDROID_INSTALL_TRACKING],
 [
 
 if test -n "$MOZ_INSTALL_TRACKING"; then
-    AC_SUBST(MOZ_INSTALL_TRACKING)
     MOZ_ANDROID_AAR(play-services-ads, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
     MOZ_ANDROID_AAR(play-services-basement, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
 fi
 
 ])
 
 dnl Configure an Android SDK.
 dnl Arg 1: target SDK version, like 23.
--- a/build/moz.configure/keyfiles.configure
+++ b/build/moz.configure/keyfiles.configure
@@ -32,20 +32,16 @@ def keyfile(desc, help=None, callback=la
 
     return keyfile
 
 
 @template
 def simple_keyfile(desc):
     value = keyfile(desc)
     set_config('MOZ_%s_KEY' % desc.upper().replace(' ', '_'), value)
-    # Only really required for MOZ_ADJUST_SDK_KEY currently still used in
-    # old-configure.
-    add_old_configure_assignment('MOZ_%s_KEY' % desc.upper().replace(' ', '_'),
-                                 value)
 
 
 @template
 def id_and_secret_keyfile(desc):
     def id_and_secret(value):
         if value.startswith('no-') and value.endswith('-key'):
             id = value[:-3] + 'clientid'
             secret = value
--- a/mobile/android/confvars.sh
+++ b/mobile/android/confvars.sh
@@ -30,24 +30,13 @@ MOZ_XULRUNNER=
 MOZ_CAPTURE=1
 MOZ_RAW=1
 
 # use custom widget for html:select
 MOZ_USE_NATIVE_POPUP_WINDOWS=1
 
 MOZ_APP_ID={aa3c5121-dab2-40e2-81ca-7ea25febc110}
 
-# Enable second screen using native Android libraries.
-MOZ_NATIVE_DEVICES=1
-
-# Enable install tracking SDK if we have Google Play support; MOZ_NATIVE_DEVICES
-# is a proxy flag for that support.
-if test "$RELEASE_OR_BETA"; then
-if test "$MOZ_NATIVE_DEVICES"; then
-  MOZ_INSTALL_TRACKING=1
-fi
-fi
-
 # Use the low-memory GC tuning.
 export JS_GC_SMALL_CHUNK_SIZE=1
 
 # Enable checking that add-ons are signed by the trusted root
 MOZ_ADDON_SIGNING=1
--- a/mobile/android/docs/adjust.rst
+++ b/mobile/android/docs/adjust.rst
@@ -122,22 +122,19 @@ Technical notes
 
 Build flags controlling the Adjust SDK integration
 ==================================================
 
 Add the following to your mozconfig to compile with the Adjust SDK::
 
  export MOZ_INSTALL_TRACKING=1
  export MOZ_NATIVE_DEVICES=1
- export RELEASE_OR_BETA=1
  ac_add_options --with-adjust-sdk-keyfile="$topsrcdir/mobile/android/base/adjust-sdk-sandbox.token"
 
-``MOZ_NATIVE_DEVICES`` && ``RELEASE_OR_BETA`` are required for an unknown
-reason.  If you build without them, the ``StubAdjustHelper`` will be
-returned.
+``MOZ_NATIVE_DEVICES`` is required to provide some Google Play Services dependencies.
 
 No trace of the Adjust SDK should be present in Fennec if
 ``MOZ_INSTALL_TRACKING`` is not defined.
 
 Access to the Adjust backend is controlled by a private App-specific
 token. Fennec's token is managed by Release Engineering and should not
 be exposed if at all possible; for example, it should *not* leak to build
 logs.  The value of the token is read from the file specified using the
--- a/mobile/android/moz.configure
+++ b/mobile/android/moz.configure
@@ -8,20 +8,44 @@ project_flag('MOZ_ANDROID_EXCLUDE_FONTS'
              help='Whether to exclude font files from the build',
              default=True)
 
 project_flag('MOZ_LOCALE_SWITCHER',
              help='Enable runtime locale switching',
              default=True)
 
 project_flag('MOZ_ANDROID_GCM',
-             help='Enable GCM registration on Nightly builds only',
+             help='Enable GCM (Google Cloud Messaging) registration',
              default=True,
              set_for_old_configure=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',
+                             depends_if('MOZ_NATIVE_DEVICES')(lambda _: True))
+
+# Enable install tracking SDK if we have Google Play support; MOZ_NATIVE_DEVICES
+# is a proxy flag for that support.
+@depends(milestone, 'MOZ_NATIVE_DEVICES', '--help')
+def install_tracking_default(milestone, native_devices, help):
+    return bool(milestone.is_release_or_beta and native_devices)
+
+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))
+
 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)
 
@@ -79,8 +103,21 @@ def check_target(target):
                   'other valid Android target) when building mobile/android.')
         die('See https://developer.mozilla.org/docs/Mozilla/Developer_guide/'
             'Build_Instructions/Simple_Firefox_for_Android_build '
             'for more information about the necessary options.')
 
 include('../../toolkit/moz.configure')
 include('../../build/moz.configure/java.configure')
 include('gradle.configure')
+
+# Must come after the ../../toolkit/moz.configure.
+@depends('MOZ_INSTALL_TRACKING', 'MOZ_NATIVE_DEVICES', '--with-adjust-sdk-keyfile')
+def check_install_tracking(install_tracking,
+                           native_devices,
+                           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')
--- a/old-configure.in
+++ b/old-configure.in
@@ -2203,17 +2203,16 @@ MOZ_UI_LOCALE=en-US
 MOZ_UNIVERSALCHARDET=1
 MOZ_URL_CLASSIFIER=
 MOZ_XUL=1
 MOZ_ZIPWRITER=1
 MOZ_NO_SMART_CARDS=
 NECKO_COOKIES=1
 MOZ_USE_NATIVE_POPUP_WINDOWS=
 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
-MOZ_INSTALL_TRACKING=
 ACCESSIBILITY=1
 MOZ_TIME_MANAGER=
 MOZ_CONTENT_SANDBOX=
 MOZ_GMP_SANDBOX=
 MOZ_SANDBOX=1
 MOZ_BINARY_EXTENSIONS=
 MOZ_DEVTOOLS=server
 
@@ -2626,25 +2625,16 @@ AC_SUBST(MOZ_ENABLE_DBUS)
 dnl =========================================================
 dnl = Whether to exclude hyphenations files in the build
 dnl =========================================================
 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
     AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
 fi
 
 dnl ========================================================
-dnl = Include install tracking on Android
-dnl ========================================================
-if test -n "$MOZ_INSTALL_TRACKING"; then
-    if test -z "$MOZ_ADJUST_SDK_KEY"; then
-        AC_MSG_ERROR([Must specify --with-adjust-sdk-keyfile when MOZ_INSTALL_TRACKING is defined!])
-    fi
-fi
-
-dnl ========================================================
 dnl accessibility support on by default on all platforms
 dnl ========================================================
 MOZ_ARG_DISABLE_BOOL(accessibility,
 [  --disable-accessibility Disable accessibility support],
     ACCESSIBILITY=,
     ACCESSIBILITY=1 )
 if test "$ACCESSIBILITY"; then
     case "$target" in
@@ -4982,17 +4972,16 @@ AC_SUBST(MOZ_D3D_CPU_SUFFIX)
 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
 
 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
 AC_SUBST(MOZ_ANDROID_SEARCH_INTENT_CLASS)
 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
-AC_SUBST(MOZ_INSTALL_TRACKING)
 AC_SUBST(ENABLE_STRIP)
 AC_SUBST(PKG_SKIP_STRIP)
 AC_SUBST(STRIP_FLAGS)
 AC_SUBST(USE_ELF_HACK)
 AC_SUBST(INCREMENTAL_LINKER)
 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
 
 AC_SUBST(MOZ_FIX_LINK_PATHS)
--- a/toolkit/content/moz.build
+++ b/toolkit/content/moz.build
@@ -9,16 +9,19 @@ TEST_DIRS += ['tests']
 for var in ('target', 'MOZ_CONFIGURE_OPTIONS', 'CC', 'CC_VERSION', 'CXX'):
     DEFINES[var] = CONFIG[var]
 
 DEFINES['CFLAGS'] = CONFIG['OS_CFLAGS']
 
 if CONFIG['OS_TARGET'] == 'Android':
     DEFINES['ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME']
 
+if CONFIG['MOZ_INSTALL_TRACKING']:
+    DEFINES['MOZ_INSTALL_TRACKING'] = 1
+
 if CONFIG['MOZ_ANDROID_CXX_STL'] == 'libc++':
     DEFINES['MOZ_USE_LIBCXX'] = True
 
 if CONFIG['MOZ_BUILD_APP'] == 'mobile/android':
     DEFINES['MOZ_FENNEC'] = True
 
 JAR_MANIFESTS += ['jar.mn']