Bug 1368035 - Enable geckodriver building in automation; r=ted
authorAndreas Tolfsen <ato@mozilla.com>
Sat, 27 May 2017 18:51:40 +0100
changeset 361276 ba93b845139510e6eaf5a1e6eee585b6c5b1ddbe
parent 361275 ed5505b795eac0d3609e2f2ea9fe556490a30c5f
child 361277 99605b5c6d2082f312dfc78638464134137788d0
push id43707
push useratolfsen@mozilla.com
push dateTue, 30 May 2017 14:41:55 +0000
treeherderautoland@ba93b8451395 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1368035, 1368084
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 1368035 - Enable geckodriver building in automation; r=ted geckodriver compilation was disabled by default in https://bugzilla.mozilla.org/show_bug.cgi?id=1368084 due to issues building it locally on Windows. This re-enables building of geckodriver in automation, but gives developers an option, --enable-geckodriver, to opt-in to building it locally. geckodriver is implied on supported platforms when MOZ_AUTOMATION is set, but we also provide the option for developers to use. This means geckodriver will be built in CI by default, but not in developers' local environments. MozReview-Commit-ID: ACkO97ekVsi
build/moz.configure/toolchain.configure
toolkit/moz.configure
toolkit/toolkit.mozbuild
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -135,19 +135,16 @@ set_config('MOZ_USING_SCCACHE', using_sc
 option(env='SCCACHE_VERBOSE_STATS', help='Print verbose sccache stats after build')
 
 @depends(using_sccache, 'SCCACHE_VERBOSE_STATS')
 def sccache_verbose_stats(using_sccache, verbose_stats):
     return using_sccache and bool(verbose_stats)
 
 set_config('SCCACHE_VERBOSE_STATS', sccache_verbose_stats)
 
-option(env='MOZ_HAZARD', help='Build for the GC rooting hazard analysis')
-set_config('MOZ_HAZARD', depends_if('MOZ_HAZARD')(lambda _: True))
-
 @depends('--with-compiler-wrapper', ccache)
 @imports(_from='mozbuild.shellutil', _import='split', _as='shell_split')
 def compiler_wrapper(wrapper, ccache):
     if wrapper:
         raw_wrapper = wrapper[0]
         wrapper = shell_split(raw_wrapper)
         wrapper_program = find_program(wrapper[0])
         if not wrapper_program:
@@ -167,16 +164,28 @@ add_old_configure_assignment('COMPILER_W
 
 @depends_if(compiler_wrapper)
 def using_compiler_wrapper(compiler_wrapper):
     return True
 
 set_config('MOZ_USING_COMPILER_WRAPPER', using_compiler_wrapper)
 
 
+# GC rooting and hazard analysis.
+# ==============================================================
+option(env='MOZ_HAZARD', help='Build for the GC rooting hazard analysis')
+
+@depends('MOZ_HAZARD')
+def hazard_analysis(value):
+    if value:
+        return True
+
+set_config('MOZ_HAZARD', hazard_analysis)
+
+
 # Cross-compilation related things.
 # ==============================================================
 js_option('--with-toolchain-prefix', env='TOOLCHAIN_PREFIX', nargs=1,
           help='Prefix for the target toolchain')
 
 @depends('--with-toolchain-prefix', target, cross_compiling)
 def toolchain_prefix(value, target, cross_compiling):
     if value:
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -1085,8 +1085,40 @@ option('--enable-marionette',
        help='Enable Marionette remote protocol')
 
 @depends('--enable-marionette')
 def marionette(value):
     if value:
         return True
 
 set_config('ENABLE_MARIONETTE', marionette)
+
+# geckodriver WebDriver implementation
+# ==============================================================
+option('--enable-geckodriver', help='Enable WebDriver implementation')
+
+@depends('--enable-geckodriver',
+         'MOZ_AUTOMATION',
+         compile_environment,
+         cross_compiling,
+         hazard_analysis,
+         target)
+def geckodriver(enable, automation, compile_env, cross_compile, hazard, target):
+    """
+    geckodriver is implied on supported platforms when MOZ_AUTOMATION
+    is set, but we also provide the --enable-geckodriver option for
+    developers to use.
+
+    At the present time, we want individual developers to be able to
+    opt-in to building geckodriver locally, and for it to be enabled by
+    default on supported CI build platforms.
+    """
+    if enable:
+        return True
+
+    if enable.origin == 'default':
+        linux32 = target.kernel == 'Linux' and target.cpu == 'x86'
+        broken_platforms = cross_compile or linux32 or hazard
+
+        if automation and compile_env and not broken_platforms:
+            return True
+
+set_config('ENABLE_GECKODRIVER', geckodriver)
--- a/toolkit/toolkit.mozbuild
+++ b/toolkit/toolkit.mozbuild
@@ -149,37 +149,18 @@ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']
 DIRS += ['/addon-sdk']
 
 if CONFIG['ENABLE_MARIONETTE']:
     DIRS += [
         '/testing/firefox-ui',
         '/testing/marionette',
     ]
 
-    """
-    Temporarily disable building ../testing/geckodriver
-    until https://bugzilla.mozilla.org/show_bug.cgi?id=1368035,
-    letting local developer builds opt in with --enable-geckodriver is fixed.
-
-    # Disable building of geckodriver for artifact builds and in
-    # environments where cross compiling occurs (macOS and Android),
-    # on hazard builds, and on Linux x86 (linking problems).
-    #
-    # https://bugzilla.mozilla.org/show_bug.cgi?id=1341041
-    # https://bugzilla.mozilla.org/show_bug.cgi?id=1329737
-    # https://bugzilla.mozilla.org/show_bug.cgi?id=1367519
-    # https://bugzilla.mozilla.org/show_bug.cgi?id=1367736
-    if (not CONFIG['COMPILE_ENVIRONMENT'] or
-            CONFIG['CROSS_COMPILE'] or
-            (CONFIG['OS_TARGET'] == 'Linux' and CONFIG['TARGET_CPU'] == 'i686') or
-            CONFIG['MOZ_HAZARD']):
-        pass
-    else:
-        DIRS += ['/testing/geckodriver']
-    """
+if CONFIG['ENABLE_GECKODRIVER']:
+    DIRS += ['/testing/geckodriver']
 
 DIRS += [
     '/tools/quitter',
     '/media/gmp-clearkey/0.1',
 ]
 
 if CONFIG['ENABLE_TESTS']:
     DIRS += [