Bug 1321408 - Move ENABLE_MARIONETTE to python configure. r=chmanchester draft
authorNick Alexander <nalexander@mozilla.com>
Fri, 16 Dec 2016 15:49:14 -0800
changeset 450556 c2c8b268c60350ff39d872cee357b53f17e79eef
parent 450555 20fe1d59943bb22d4381dcb8457c0df7964d0ef7
child 450557 a8fcf08d2edaec504c73c1eb8f399fbb581123e0
push id38897
push usernalexander@mozilla.com
push dateFri, 16 Dec 2016 23:57:19 +0000
reviewerschmanchester
bugs1321408
milestone53.0a1
Bug 1321408 - Move ENABLE_MARIONETTE to python configure. r=chmanchester This patch tries to do three things: 1) Replace the ENABLE_MARIONETTE entrypoint with --enable-marionette. 2) Fold the default value -- forced on unless building for target OS Android or building with toolkit gonk -- into the flag, rather than embedding that condition in the tree. 3) Stop using AC_DEFINE and instead use only AC_SUBST, so that no compiled code needs to be rebuilt if the flag is flipped locally. n.b., each installer/Makefile.in knows that ENABLE_MARIONETTE is set (in order to set -DENABLE_MARIONETTE=1 for */installer/package-manifest.in) due to it being an AC_SUBST. MozReview-Commit-ID: AkkmybyP1uI
layout/tools/reftest/mach_commands.py
mobile/android/config/mozconfigs/android-api-15/debug
mobile/android/config/mozconfigs/android-api-15/debug-artifact
old-configure.in
toolkit/moz.configure
toolkit/toolkit.mozbuild
--- a/layout/tools/reftest/mach_commands.py
+++ b/layout/tools/reftest/mach_commands.py
@@ -53,17 +53,17 @@ If you do not have a non-debug gaia prof
     $ make
 
 The profile should be generated in a directory called 'profile'.
 '''.lstrip()
 
 MARIONETTE_DISABLED = '''
 The reftest command requires a marionette enabled build on Mulet.
 
-Add 'ENABLE_MARIONETTE=1' to your mozconfig file and re-build the application.
+Add 'ac_add_options --enable-marionette' to your mozconfig file and re-build the application.
 Your currently active mozconfig is %s.
 '''.lstrip()
 
 parser = None
 
 
 class ReftestRunner(MozbuildObject):
     """Easily run reftests.
--- a/mobile/android/config/mozconfigs/android-api-15/debug
+++ b/mobile/android/config/mozconfigs/android-api-15/debug
@@ -1,13 +1,13 @@
 . "$topsrcdir/mobile/android/config/mozconfigs/common"
 
 # Global options
 ac_add_options --enable-debug
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 
 # Android
 ac_add_options --with-android-min-sdk=15
 ac_add_options --target=arm-linux-androideabi
 
 export MOZILLA_OFFICIAL=1
 export MOZ_TELEMETRY_REPORTING=1
 
--- a/mobile/android/config/mozconfigs/android-api-15/debug-artifact
+++ b/mobile/android/config/mozconfigs/android-api-15/debug-artifact
@@ -3,17 +3,17 @@ MOZ_AUTOMATION_L10N_CHECK=0
 
 NO_CACHE=1
 NO_NDK=1
 
 . "$topsrcdir/mobile/android/config/mozconfigs/common"
 
 # Global options
 ac_add_options --enable-debug
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 
 . "$topsrcdir/mobile/android/config/mozconfigs/android-api-15/nightly"
 
 unset CC
 unset CXX
 unset HOST_CC
 unset HOST_CXX
 unset RUSTC
--- a/old-configure.in
+++ b/old-configure.in
@@ -5226,27 +5226,16 @@ MOZ_ARG_DISABLE_BOOL(cookies,
     NECKO_COOKIES=,
     NECKO_COOKIES=1)
 AC_SUBST(NECKO_COOKIES)
 if test "$NECKO_COOKIES"; then
     AC_DEFINE(NECKO_COOKIES)
     _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
 fi
 
-dnl
-dnl Always build Marionette if not Android or B2G
-dnl
-if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
-    AC_DEFINE(ENABLE_MARIONETTE)
-fi
-AC_SUBST(ENABLE_MARIONETTE)
-if test "$ENABLE_MARIONETTE"; then
-    AC_DEFINE(ENABLE_MARIONETTE)
-fi
-
 dnl ========================================================
 if test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
 fi
 
 dnl ========================================================
 dnl =
 dnl = Maintainer debug option (no --enable equivalent)
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -860,8 +860,44 @@ with only_when('--enable-compile-environ
         if fuzzing and not afl:
             return True
 
     set_config('FUZZING', enable_fuzzing)
     set_define('FUZZING', enable_fuzzing)
 
     set_config('LIBFUZZER', enable_libfuzzer)
     set_define('LIBFUZZER', enable_libfuzzer)
+
+# Marionette is a Web Driver / Selenium comamnd server and client automation
+# driver for Mozilla's Gecko engine.  For more, see
+# https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette.
+#
+# Marionette isn't really a toolkit feature, it's a Gecko engine feature, but
+# it's enabled based on the toolkit (and target), so here it lives.
+
+@depends(target, toolkit)
+def marionette_default(target, toolkit):
+    # By default, enable Marionette if not Android and not gonk.
+    #
+    # None means "don't set anything", which allows to override with
+    # --enable-marionette.  False means --disable-marionette, which
+    # cannot be overridden with --enable-marionette.  We want to allow
+    # overrides.
+    if target.os == 'Android':
+        return None
+
+    if toolkit == 'gonk':
+        return None
+
+    return True
+
+imply_option('--enable-marionette', marionette_default,
+             reason='not Android and not gonk')
+
+option('--enable-marionette',
+       help='Enable internal Marionette command server')
+
+@depends('--enable-marionette')
+def marionette(value):
+    if value:
+        return True
+
+set_config('ENABLE_MARIONETTE', marionette)
--- a/toolkit/toolkit.mozbuild
+++ b/toolkit/toolkit.mozbuild
@@ -154,17 +154,17 @@ DIRS += [
     '/toolkit/library',
 ]
 
 if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
     DIRS += ['/toolkit/system/gnome']
 
 DIRS += ['/addon-sdk']
 
-if CONFIG['ENABLE_MARIONETTE'] or CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('gonk', 'android'):
+if CONFIG['ENABLE_MARIONETTE']:
     DIRS += [
         '/testing/firefox-ui',
         '/testing/marionette',
     ]
 
 DIRS += [
     '/tools/quitter',
     '/media/gmp-clearkey/0.1',