aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo
diff options
context:
space:
mode:
Diffstat (limited to 'python/servo')
-rw-r--r--python/servo/bootstrap_commands.py4
-rw-r--r--python/servo/build_commands.py64
-rw-r--r--python/servo/command_base.py75
-rw-r--r--python/servo/devenv_commands.py3
-rw-r--r--python/servo/testing_commands.py24
5 files changed, 51 insertions, 119 deletions
diff --git a/python/servo/bootstrap_commands.py b/python/servo/bootstrap_commands.py
index 5630b778771..659826fea66 100644
--- a/python/servo/bootstrap_commands.py
+++ b/python/servo/bootstrap_commands.py
@@ -69,8 +69,8 @@ def download(desc, src, writer, start_byte=0):
print("No Rust compiler binary available for this platform. "
"Please see https://github.com/servo/servo/#prerequisites")
sys.exit(1)
- except urllib2.URLError:
- print("Error downloading Rust compiler; are you connected to the internet?")
+ except urllib2.URLError, e:
+ print("Error downloading Rust compiler: " + str(e.reason) + ". The failing URL was: " + src)
sys.exit(1)
except KeyboardInterrupt:
writer.flush()
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index 369918595ce..7e2845b598f 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -23,7 +23,11 @@ from mach.decorators import (
Command,
)
-from servo.command_base import CommandBase, cd, call
+from servo.command_base import CommandBase, cd, call, BIN_SUFFIX
+
+
+def format_duration(seconds):
+ return str(datetime.timedelta(seconds=int(seconds)))
def notify_linux(title, text):
@@ -86,7 +90,7 @@ def notify_build_done(elapsed):
"""Generate desktop notification when build is complete and the
elapsed build time was longer than 30 seconds."""
if elapsed > 30:
- notify("Servo build", "Completed in %s" % str(datetime.timedelta(seconds=elapsed)))
+ notify("Servo build", "Completed in %s" % format_duration(elapsed))
def notify(title, text):
@@ -147,7 +151,7 @@ class MachCommands(CommandBase):
features=None, android=None, verbose=False, debug_mozjs=False, params=None):
if android is None:
android = self.config["build"]["android"]
- features = features or []
+ features = features or self.servo_features()
opts = params or []
@@ -194,7 +198,7 @@ class MachCommands(CommandBase):
self.ensure_bootstrapped(target=target)
- if debug_mozjs or self.config["build"]["debug-mozjs"]:
+ if debug_mozjs:
features += ["script/debugmozjs"]
if features:
@@ -226,8 +230,10 @@ class MachCommands(CommandBase):
env['OPENSSL_INCLUDE_DIR'] = path.join(openssl_dir, "include")
env['OPENSSL_STATIC'] = 'TRUE'
+ cargo_binary = "cargo" + BIN_SUFFIX
+
status = call(
- ["cargo", "build"] + opts,
+ [cargo_binary, "build"] + opts,
env=env, cwd=self.servo_crate(), verbose=verbose)
elapsed = time() - build_start
@@ -238,7 +244,7 @@ class MachCommands(CommandBase):
# Generate Desktop Notification if elapsed-time > some threshold value
notify_build_done(elapsed)
- print("Build completed in %s" % str(datetime.timedelta(seconds=elapsed)))
+ print("Build completed in %s" % format_duration(elapsed))
return status
@Command('build-cef',
@@ -265,6 +271,10 @@ class MachCommands(CommandBase):
if release:
opts += ["--release"]
+ servo_features = self.servo_features()
+ if servo_features:
+ opts += ["--features", "%s" % ' '.join("servo/" + x for x in servo_features)]
+
build_start = time()
with cd(path.join("ports", "cef")):
ret = call(["cargo", "build"] + opts,
@@ -274,7 +284,7 @@ class MachCommands(CommandBase):
# Generate Desktop Notification if elapsed-time > some threshold value
notify_build_done(elapsed)
- print("CEF build completed in %s" % str(datetime.timedelta(seconds=elapsed)))
+ print("CEF build completed in %s" % format_duration(elapsed))
return ret
@@ -311,45 +321,7 @@ class MachCommands(CommandBase):
# Generate Desktop Notification if elapsed-time > some threshold value
notify_build_done(elapsed)
- print("GeckoLib build completed in %s" % str(datetime.timedelta(seconds=elapsed)))
-
- return ret
-
- @Command('build-gonk',
- description='Build the Gonk port',
- category='build')
- @CommandArgument('--jobs', '-j',
- default=None,
- help='Number of jobs to run in parallel')
- @CommandArgument('--verbose', '-v',
- action='store_true',
- help='Print verbose output')
- @CommandArgument('--release', '-r',
- action='store_true',
- help='Build in release mode')
- def build_gonk(self, jobs=None, verbose=False, release=False):
- target = "arm-linux-androideabi"
- self.ensure_bootstrapped(target=target)
-
- opts = []
- if jobs is not None:
- opts += ["-j", jobs]
- if verbose:
- opts += ["-v"]
- if release:
- opts += ["--release"]
-
- opts += ["--target", self.config["android"]["target"]]
- env = self.build_env(gonk=True)
- build_start = time()
- with cd(path.join("ports", "gonk")):
- ret = call(["cargo", "build"] + opts, env=env, verbose=verbose)
- elapsed = time() - build_start
-
- # Generate Desktop Notification if elapsed-time > some threshold value
- notify_build_done(elapsed)
-
- print("Gonk build completed in %s" % str(datetime.timedelta(seconds=elapsed)))
+ print("GeckoLib build completed in %s" % format_duration(elapsed))
return ret
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index 921825dbf96..497717ea9b2 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -178,12 +178,9 @@ class CommandBase(object):
self.config["android"].setdefault("sdk", "")
self.config["android"].setdefault("ndk", "")
self.config["android"].setdefault("toolchain", "")
+ self.config["android"].setdefault("platform", "android-18")
self.config["android"].setdefault("target", "arm-linux-androideabi")
- self.config.setdefault("gonk", {})
- self.config["gonk"].setdefault("b2g", "")
- self.config["gonk"].setdefault("product", "flame")
-
_rust_path = None
_cargo_build_id = None
@@ -256,7 +253,7 @@ class CommandBase(object):
" --release" if release else ""))
sys.exit()
- def build_env(self, gonk=False, hosts_file_path=None, target=None):
+ def build_env(self, hosts_file_path=None, target=None):
"""Return an extended environment dictionary."""
env = os.environ.copy()
if sys.platform == "win32" and type(env['PATH']) == unicode:
@@ -318,65 +315,8 @@ class CommandBase(object):
env["ANDROID_NDK"] = self.config["android"]["ndk"]
if self.config["android"]["toolchain"]:
env["ANDROID_TOOLCHAIN"] = self.config["android"]["toolchain"]
-
- if gonk:
- if self.config["gonk"]["b2g"]:
- env["GONKDIR"] = self.config["gonk"]["b2g"]
- if "GONKDIR" not in env:
- # Things can get pretty opaque if this hasn't been set
- print("Please set $GONKDIR in your environment or .servobuild file")
- sys.exit(1)
- if self.config["gonk"]["product"]:
- env["GONK_PRODUCT"] = self.config["gonk"]["product"]
-
- env["ARCH_DIR"] = "arch-arm"
- env["CPPFLAGS"] = (
- "-DANDROID -DTARGET_OS_GONK "
- "-DANDROID_VERSION=19 "
- "-DGR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE=1 "
- "-isystem %(gonkdir)s/bionic/libc/%(archdir)s/include "
- "-isystem %(gonkdir)s/bionic/libc/include/ "
- "-isystem %(gonkdir)s/bionic/libc/kernel/common "
- "-isystem %(gonkdir)s/bionic/libc/kernel/%(archdir)s "
- "-isystem %(gonkdir)s/bionic/libm/include "
- "-I%(gonkdir)s/system "
- "-I%(gonkdir)s/system/core/include "
- "-I%(gonkdir)s/frameworks/native/opengl/include "
- "-I%(gonkdir)s/external/zlib "
- ) % {"gonkdir": env["GONKDIR"], "archdir": env["ARCH_DIR"]}
- env["CXXFLAGS"] = (
- "-O2 -mandroid -fPIC "
- "-isystem %(gonkdir)s/api/cpp/include "
- "-isystem %(gonkdir)s/external/stlport/stlport "
- "-isystem %(gonkdir)s/bionic "
- "-isystem %(gonkdir)s/bionic/libstdc++/include "
- "%(cppflags)s"
- ) % {"gonkdir": env["GONKDIR"], "cppflags": env["CPPFLAGS"]}
- env["CFLAGS"] = (
- "%(cxxflags)s"
- ) % {"cxxflags": env["CXXFLAGS"]}
-
- another_extra_path = path.join(
- env["GONKDIR"], "prebuilts", "gcc", "linux-x86", "arm", "arm-linux-androideabi-4.7", "bin")
-
- env["gonkdir"] = env["GONKDIR"]
- env["gonk_toolchain_prefix"] = (
- "%(toolchain)s/arm-linux-androideabi-"
- ) % {"toolchain": another_extra_path}
-
- env["PATH"] = "%s%s%s" % (another_extra_path, os.pathsep, env["PATH"])
- env["LDFLAGS"] = (
- "-mandroid -L%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/lib "
- "-Wl,-rpath-link=%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/lib "
- "--sysroot=%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/"
- ) % {"gonkdir": env["GONKDIR"], "gonkproduct": env["GONK_PRODUCT"]}
-
- # Not strictly necessary for a vanilla build, but might be when tweaking the openssl build
- openssl_dir = (
- "%(gonkdir)s/out/target/product/%(gonkproduct)s/obj/lib"
- ) % {"gonkdir": env["GONKDIR"], "gonkproduct": env["GONK_PRODUCT"]}
- env["OPENSSL_LIB_DIR"] = openssl_dir
- env['OPENSSL_INCLUDE_DIR'] = path.join(env["GONKDIR"], "external/openssl/include")
+ if self.config["android"]["platform"]:
+ env["ANDROID_PLATFORM"] = self.config["android"]["platform"]
# These are set because they are the variable names that build-apk
# expects. However, other submodules have makefiles that reference
@@ -415,6 +355,13 @@ class CommandBase(object):
def servo_crate(self):
return path.join(self.context.topdir, "components", "servo")
+ def servo_features(self):
+ """Return a list of optional features to enable for the Servo crate"""
+ features = []
+ if self.config["build"]["debug-mozjs"]:
+ features += ["script/debugmozjs"]
+ return features
+
def android_support_dir(self):
return path.join(self.context.topdir, "support", "android")
diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py
index 95bb2d054a9..2619827c226 100644
--- a/python/servo/devenv_commands.py
+++ b/python/servo/devenv_commands.py
@@ -83,8 +83,7 @@ class MachCommands(CommandBase):
cargo_paths = [path.join('components', 'servo'),
path.join('ports', 'cef'),
- path.join('ports', 'geckolib'),
- path.join('ports', 'gonk')]
+ path.join('ports', 'geckolib')]
for cargo_path in cargo_paths:
with cd(cargo_path):
diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py
index 7a821a08679..e42663b75e6 100644
--- a/python/servo/testing_commands.py
+++ b/python/servo/testing_commands.py
@@ -178,6 +178,10 @@ class MachCommands(CommandBase):
args += ["-p", "%s_tests" % crate]
args += test_patterns
+ features = self.servo_features()
+ if features:
+ args += ["--features", "%s" % ' '.join(features)]
+
env = self.build_env()
env["RUST_BACKTRACE"] = "1"
@@ -255,18 +259,18 @@ class MachCommands(CommandBase):
@Command('test-tidy',
description='Run the source code tidiness check',
category='testing')
- @CommandArgument('--faster', default=False, action="store_true",
- help="Only check changed files and skip the WPT lint in tidy, "
- "if there are no changes in the WPT files")
+ @CommandArgument('--all', default=False, action="store_true", dest="all_files",
+ help="Check all files, and run the WPT lint in tidy, "
+ "even if unchanged")
@CommandArgument('--no-progress', default=False, action="store_true",
help="Don't show progress for tidy")
@CommandArgument('--self-test', default=False, action="store_true",
help="Run unit tests for tidy")
- def test_tidy(self, faster, no_progress, self_test):
+ def test_tidy(self, all_files, no_progress, self_test):
if self_test:
return test_tidy.do_tests()
else:
- return tidy.scan(faster, not no_progress)
+ return tidy.scan(not all_files, not no_progress)
@Command('test-webidl',
description='Run the WebIDL parser tests',
@@ -344,6 +348,11 @@ class MachCommands(CommandBase):
self.ensure_bootstrapped()
run_file = path.abspath(path.join("tests", "wpt", "update.py"))
kwargs["no_patch"] = not patch
+
+ if kwargs["no_patch"] and kwargs["sync"]:
+ print("Are you sure you don't want a patch?")
+ return 1
+
run_globals = {"__file__": run_file}
execfile(run_file, run_globals)
return run_globals["update_tests"](**kwargs)
@@ -399,6 +408,11 @@ class MachCommands(CommandBase):
self.ensure_bootstrapped()
run_file = path.abspath(path.join("tests", "wpt", "update_css.py"))
kwargs["no_patch"] = not patch
+
+ if kwargs["no_patch"] and kwargs["sync"]:
+ print("Are you sure you don't want a patch?")
+ return 1
+
run_globals = {"__file__": run_file}
execfile(run_file, run_globals)
return run_globals["update_tests"](**kwargs)