Bug 1321408 - Move ENABLE_MARIONETTE to python configure. r=chmanchester draft
authorNick Alexander <nalexander@mozilla.com>
Wed, 30 Nov 2016 17:33:32 -0800
changeset 446165 10f03110de90fdb2f7b36b1d0e30b781b7eecad4
parent 446164 8a10372e651e06c0c37508188d9548ef00b9d83e
child 538715 86344529972ffb769ff4dce29c477a839b4cf0c6
push id37712
push usernalexander@mozilla.com
push dateThu, 01 Dec 2016 01:44:07 +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 ad-hoc ENABLE_MARIONETTE entrypoint with --enable-marionette. 2) Fold the default value -- on unless building for Android or building with toolkit gonk -- into the flag, rather than repeating the condition throughout 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. I can't recall how */installer/Makefile.in knows that ENABLE_MARIONETTE is set (in order to set -DENABLE_MARIONETTE=1 for */installer/package-manifest.in), but I see no additional special handling of flags used this way and it works locally. MozReview-Commit-ID: AkkmybyP1uI
b2g/app/moz.build
b2g/config/mozconfigs/ics_armv7a_gecko/debug
b2g/config/mozconfigs/ics_armv7a_gecko/nightly
b2g/config/mozconfigs/linux32_gecko/debug
b2g/config/mozconfigs/macosx64_gecko/debug
b2g/config/mozconfigs/win32_gecko/debug
b2g/graphene/config/horizon-mozconfigs/linux32/debug
b2g/graphene/config/horizon-mozconfigs/linux64/debug
b2g/graphene/config/horizon-mozconfigs/macosx64/debug
b2g/graphene/config/horizon-mozconfigs/win32/debug
b2g/graphene/config/mozconfigs/linux32/debug
b2g/graphene/config/mozconfigs/linux64/debug
b2g/graphene/config/mozconfigs/macosx64/debug
b2g/graphene/config/mozconfigs/win32/debug
b2g/graphene/moz.build
b2g/installer/package-manifest.in
build/moz.configure/marionette.configure
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/b2g/app/moz.build
+++ b/b2g/app/moz.build
@@ -19,16 +19,20 @@ if CONFIG['_MSC_VER']:
 
 USE_LIBS += [
     'zlib',
 ]
 
 for var in ('MOZ_APP_NAME', 'MOZ_APP_VERSION', 'MOZ_UPDATER'):
     DEFINES[var] = CONFIG[var]
 
+for var in ('ENABLE_MARIONETTE'):
+    if CONFIG[var]:
+        DEFINES['ENABLE_MARIONETTE'] = 1
+
 LOCAL_INCLUDES += [
     '!/build',
     '/toolkit/xre',
     '/xpcom/base',
     '/xpcom/build',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
--- a/b2g/config/mozconfigs/ics_armv7a_gecko/debug
+++ b/b2g/config/mozconfigs/ics_armv7a_gecko/debug
@@ -7,14 +7,14 @@ ac_add_options --enable-b2g-camera
 
 ac_add_options --target=arm-linux-androideabi
 ac_add_options --with-gonk="$topsrcdir/gonk-toolchain"
 export TOOLCHAIN_HOST=linux-x86
 export GONK_PRODUCT=generic
 ac_add_options --with-gonk-toolchain-prefix="$topsrcdir/gonk-toolchain/prebuilt/$TOOLCHAIN_HOST/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-"
 ac_add_options --enable-debug-symbols
 ac_add_options --enable-debug
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 
 # Enable dump() from JS.
 export CXXFLAGS="-DMOZ_ENABLE_JS_DUMP -include $topsrcdir/gonk-toolchain/gonk-misc/Unicode.h -include $topsrcdir/gonk-toolchain/system/vold/ResponseCode.h"
 
 . "$topsrcdir/b2g/config/mozconfigs/common.override"
--- a/b2g/config/mozconfigs/ics_armv7a_gecko/nightly
+++ b/b2g/config/mozconfigs/ics_armv7a_gecko/nightly
@@ -8,14 +8,14 @@ ac_add_options --enable-updater
 
 ac_add_options --target=arm-linux-androideabi
 ac_add_options --with-gonk="$topsrcdir/gonk-toolchain"
 export TOOLCHAIN_HOST=linux-x86
 export GONK_PRODUCT=generic
 ac_add_options --with-gonk-toolchain-prefix="$topsrcdir/gonk-toolchain/prebuilt/$TOOLCHAIN_HOST/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-"
 ac_add_options --enable-debug-symbols
 # ac_add_options --enable-profiling
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 
 # Enable dump() from JS.
 export CXXFLAGS="-DMOZ_ENABLE_JS_DUMP -include $topsrcdir/gonk-toolchain/gonk-misc/Unicode.h -include $topsrcdir/gonk-toolchain/system/vold/ResponseCode.h"
 
 . "$topsrcdir/b2g/config/mozconfigs/common.override"
--- a/b2g/config/mozconfigs/linux32_gecko/debug
+++ b/b2g/config/mozconfigs/linux32_gecko/debug
@@ -18,17 +18,17 @@ export MOZILLA_OFFICIAL=1
 
 export MOZ_TELEMETRY_REPORTING=1
 
 # Use sccache
 no_sccache=
 
 #B2G options
 ac_add_options --enable-application=b2g
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
 
 GAIADIR=$topsrcdir/gaia
 
 # Include Firefox OS fonts.
 MOZTTDIR=$topsrcdir/moz-tt
 
 . "$topsrcdir/b2g/config/mozconfigs/common.override"
--- a/b2g/config/mozconfigs/macosx64_gecko/debug
+++ b/b2g/config/mozconfigs/macosx64_gecko/debug
@@ -16,17 +16,17 @@ export MOZILLA_OFFICIAL=1
 export MOZ_TELEMETRY_REPORTING=1
 
 #ac_add_options --with-macbundlename-prefix=Firefox
 
 # B2G Stuff
 ac_add_options --enable-application=b2g
 ac_add_options --enable-debug-symbols
 ac_add_options --enable-debug
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 
 export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
 
 GAIADIR=$topsrcdir/gaia
 
 # Include Firefox OS fonts.
 MOZTTDIR=$topsrcdir/moz-tt
 
--- a/b2g/config/mozconfigs/win32_gecko/debug
+++ b/b2g/config/mozconfigs/win32_gecko/debug
@@ -12,17 +12,17 @@ ac_add_options --enable-debug
 export MOZILLA_OFFICIAL=1
 
 export MOZ_TELEMETRY_REPORTING=1
 
 . $topsrcdir/build/win32/mozconfig.vs-latest
 
 # B2G Options
 ac_add_options --enable-application=b2g
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 
 export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
 
 GAIADIR=$topsrcdir/gaia
 
 # Include Firefox OS fonts.
 MOZTTDIR=$topsrcdir/moz-tt
 
--- a/b2g/graphene/config/horizon-mozconfigs/linux32/debug
+++ b/b2g/graphene/config/horizon-mozconfigs/linux32/debug
@@ -14,12 +14,12 @@ STRIP_FLAGS="--strip-debug"
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 # Use sccache
 no_sccache=
 . "$topsrcdir/build/mozconfig.cache"
 
 # graphene options
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
 
 . "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common.override"
--- a/b2g/graphene/config/horizon-mozconfigs/linux64/debug
+++ b/b2g/graphene/config/horizon-mozconfigs/linux64/debug
@@ -14,12 +14,12 @@ STRIP_FLAGS="--strip-debug"
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 # Use sccache
 no_sccache=
 . "$topsrcdir/build/mozconfig.cache"
 
 # graphene options
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
 
 . "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common.override"
--- a/b2g/graphene/config/horizon-mozconfigs/macosx64/debug
+++ b/b2g/graphene/config/horizon-mozconfigs/macosx64/debug
@@ -11,13 +11,13 @@ ac_add_options --enable-js-diagnostics
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 #ac_add_options --with-macbundlename-prefix=Firefox
 
 # graphene Stuff
 ac_add_options --enable-debug-symbols
 ac_add_options --enable-debug
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 
 export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
 
 . "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common.override"
--- a/b2g/graphene/config/horizon-mozconfigs/win32/debug
+++ b/b2g/graphene/config/horizon-mozconfigs/win32/debug
@@ -7,13 +7,13 @@ ac_add_options --enable-debug
 ac_add_options --enable-js-diagnostics
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 . $topsrcdir/build/win32/mozconfig.vs-latest
 
 # graphene Options
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 
 export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
 
 . "$topsrcdir/b2g/graphene/config/mozconfigs/common.override"
--- a/b2g/graphene/config/mozconfigs/linux32/debug
+++ b/b2g/graphene/config/mozconfigs/linux32/debug
@@ -14,12 +14,12 @@ STRIP_FLAGS="--strip-debug"
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 # Use sccache
 no_sccache=
 . "$topsrcdir/build/mozconfig.cache"
 
 # graphene options
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
 
 . "$topsrcdir/b2g/graphene/config/mozconfigs/common.override"
--- a/b2g/graphene/config/mozconfigs/linux64/debug
+++ b/b2g/graphene/config/mozconfigs/linux64/debug
@@ -14,12 +14,12 @@ STRIP_FLAGS="--strip-debug"
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 # Use sccache
 no_sccache=
 . "$topsrcdir/build/mozconfig.cache"
 
 # graphene options
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
 
 . "$topsrcdir/b2g/graphene/config/mozconfigs/common.override"
--- a/b2g/graphene/config/mozconfigs/macosx64/debug
+++ b/b2g/graphene/config/mozconfigs/macosx64/debug
@@ -11,13 +11,13 @@ ac_add_options --enable-js-diagnostics
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 #ac_add_options --with-macbundlename-prefix=Firefox
 
 # graphene Stuff
 ac_add_options --enable-debug-symbols
 ac_add_options --enable-debug
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 
 export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
 
 . "$topsrcdir/b2g/graphene/config/mozconfigs/common.override"
--- a/b2g/graphene/config/mozconfigs/win32/debug
+++ b/b2g/graphene/config/mozconfigs/win32/debug
@@ -7,13 +7,13 @@ ac_add_options --enable-debug
 ac_add_options --enable-js-diagnostics
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 . $topsrcdir/build/win32/mozconfig.vs-latest
 
 # graphene Options
-ENABLE_MARIONETTE=1
+ac_add_options --enable-marionette
 
 export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
 
 . "$topsrcdir/b2g/grapheneconfig/mozconfigs/common.override"
new file mode 100644
--- /dev/null
+++ b/b2g/graphene/moz.build
@@ -0,0 +1,9 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+for var in ('ENABLE_MARIONETTE'):
+    if CONFIG[var]:
+        DEFINES['ENABLE_MARIONETTE'] = 1
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -762,17 +762,17 @@ bin/libfreebl_32int64_3.so
 @BINPATH@/ssltunnel
 #endif
 #endif
 @RESPATH@/chrome/icons/
 @RESPATH@/chrome/chrome@JAREXT@
 @RESPATH@/chrome/chrome.manifest
 @RESPATH@/components/B2GComponents.manifest
 @BINPATH@/@DLL_PREFIX@omxplugin@DLL_SUFFIX@
-#if defined(ENABLE_MARIONETTE) || !defined(MOZ_WIDGET_GONK)
+#if defined(ENABLE_MARIONETTE)
 @RESPATH@/chrome/marionette@JAREXT@
 @RESPATH@/chrome/marionette.manifest
 @RESPATH@/components/marionette.manifest
 @RESPATH@/components/marionette.js
 #endif
 @RESPATH@/components/AlertsService.js
 @RESPATH@/components/ContentPermissionPrompt.js
 @RESPATH@/components/DirectoryProvider.js
new file mode 100644
--- /dev/null
+++ b/build/moz.configure/marionette.configure
@@ -0,0 +1,27 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+# 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.
+option('--enable-marionette',
+       help='Enable internal Marionette command server')
+
+@depends('--enable-marionette', target, toolkit)
+def marionette(value, target, toolkit):
+    if value.origin != 'default':
+        return bool(value) or None
+
+    # Always enable Marionette if not Android or B2G.
+    if target.os == 'Android':
+        return False
+
+    if toolkit == 'gonk':
+        return False
+
+    return True
+
+set_config('ENABLE_MARIONETTE', marionette)
--- 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
 
--- a/old-configure.in
+++ b/old-configure.in
@@ -5248,27 +5248,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
@@ -845,8 +845,14 @@ 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 isn't really a toolkit feature, it's a Gecko engine feature, but
+# it's not clear how to set a project- or application-specific default, so the
+# default is determined in the included file, and we include the file here so
+# that toolkit is available to it.
+include('../build/moz.configure/marionette.configure')
--- 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',