Bug 1340637 - Provide build rules for geckodriver; r=ted
geckodriver is the Mozilla implementation of the WebDriver remote
control interface for Gecko, and provides an HTTPD proxy that
translates the WebDriver protocol to Marionette.
Building this as part of the Firefox build will allow us to run
WPT WebDriver tests to verify our implementation of Marionette and
geckodriver. It also makes it less painful to make changes across
projects.
This change will cause the geckodriver program to be built as part
of regular Firefox builds, except on macOS and Android, and when artifact
builds are enabled.
RUST_PROGRAMS in cross-compile environments cause the wrong linker to
be used. When this bug is fixed, we should be able to enable building
of geckodriver on macOS. This work is tracked in:
https://bugzilla.mozilla.org/show_bug.cgi?id=1329737
On Android, we may one to build a binary for the host system to use
(x86_64), instead of an ARM binary for the emulator.
MozReview-Commit-ID: FG5tmPv4iut
--- a/python/mozbuild/mozbuild/vendor_rust.py
+++ b/python/mozbuild/mozbuild/vendor_rust.py
@@ -263,16 +263,17 @@ license file's hash.
self.log(logging.INFO, 'rm_vendor_dir', {}, 'rm -rf %s' % vendor_dir)
mozfile.remove(vendor_dir)
# Once we require a new enough cargo to switch to workspaces, we can
# just do this once on the workspace root crate.
crates_and_roots = (
('gkrust', 'toolkit/library/rust'),
('gkrust-gtest', 'toolkit/library/gtest/rust'),
('mozjs_sys', 'js/src'),
+ ('geckodriver', 'testing/geckodriver'),
)
for (lib, crate_root) in crates_and_roots:
path = mozpath.join(self.topsrcdir, crate_root)
# We do an |update -p| here to regenerate the Cargo.lock file with minimal changes. See bug 1324462
self._run_command_in_srcdir(args=[cargo, 'update', '--manifest-path', mozpath.join(path, 'Cargo.toml'), '-p', lib])
self._run_command_in_srcdir(args=[cargo, 'vendor', '--sync', mozpath.join(path, 'Cargo.lock'), vendor_dir])
if not self._check_licenses(vendor_dir):
--- a/testing/geckodriver/Cargo.toml
+++ b/testing/geckodriver/Cargo.toml
@@ -24,8 +24,11 @@ regex = "0.2"
rustc-serialize = "0.3"
slog = "1"
slog-atomic = "0.4"
slog-stdlog = "1"
slog-stream = "1"
uuid = "0.1.18"
webdriver = "0.25"
zip = "0.1"
+
+[[bin]]
+name = "geckodriver"
new file mode 100644
--- /dev/null
+++ b/testing/geckodriver/moz.build
@@ -0,0 +1,8 @@
+# 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/.
+
+RUST_PROGRAMS += ["geckodriver"]
+
+with Files("**"):
+ BUG_COMPONENT = ("Testing", "Marionette")
--- a/toolkit/toolkit.mozbuild
+++ b/toolkit/toolkit.mozbuild
@@ -149,16 +149,24 @@ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']
DIRS += ['/addon-sdk']
if CONFIG['ENABLE_MARIONETTE']:
DIRS += [
'/testing/firefox-ui',
'/testing/marionette',
]
+ # Disable building of geckodriver for artifcat builds and in
+ # environments where cross compiling occurs (macOS and Android).
+ #
+ # https://bugzilla.mozilla.org/show_bug.cgi?id=1341041
+ # https://bugzilla.mozilla.org/show_bug.cgi?id=1329737
+ if CONFIG['COMPILE_ENVIRONMENT'] and not CONFIG['CROSS_COMPILE']:
+ DIRS += ['/testing/geckodriver']
+
DIRS += [
'/tools/quitter',
'/media/gmp-clearkey/0.1',
]
if CONFIG['ENABLE_TESTS']:
DIRS += [
'/testing/mochitest',