Auto merge of #9873 - metajack:mach-run-bhtml, r=ecoal95

Adds browserhtml dependency and mach run --browserhtml

This makes the experience for testing browserhtml super easy.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9873)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-03-05 04:33:18 +05:30
commit 69f52d0f21
5 changed files with 45 additions and 1 deletions

View file

@ -4,6 +4,7 @@ version = "0.0.1"
dependencies = [ dependencies = [
"android_glue 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "android_glue 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"browserhtml 0.1.2 (git+https://github.com/browserhtml/browserhtml?branch=gh-pages)",
"canvas 0.0.1", "canvas 0.0.1",
"canvas_traits 0.0.1", "canvas_traits 0.0.1",
"compiletest_helper 0.0.1", "compiletest_helper 0.0.1",
@ -141,6 +142,11 @@ name = "brotli"
version = "0.3.20" version = "0.3.20"
source = "git+https://github.com/ende76/brotli-rs#c243045b88b2d2924c35269586fa9b770184c74c" source = "git+https://github.com/ende76/brotli-rs#c243045b88b2d2924c35269586fa9b770184c74c"
[[package]]
name = "browserhtml"
version = "0.1.2"
source = "git+https://github.com/browserhtml/browserhtml?branch=gh-pages#120c811302a9993f3aad103fbb695847693969ea"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
version = "0.4.2" version = "0.4.2"

View file

@ -170,6 +170,10 @@ version = "0.2"
[dependencies.offscreen_gl_context] [dependencies.offscreen_gl_context]
git = "https://github.com/ecoal95/rust-offscreen-rendering-context" git = "https://github.com/ecoal95/rust-offscreen-rendering-context"
[dependencies.browserhtml]
git = "https://github.com/browserhtml/browserhtml"
branch = "gh-pages"
[dependencies] [dependencies]
bitflags = "0.3" bitflags = "0.3"
env_logger = "0.3" env_logger = "0.3"

6
ports/cef/Cargo.lock generated
View file

@ -127,6 +127,11 @@ name = "brotli"
version = "0.3.20" version = "0.3.20"
source = "git+https://github.com/ende76/brotli-rs#c243045b88b2d2924c35269586fa9b770184c74c" source = "git+https://github.com/ende76/brotli-rs#c243045b88b2d2924c35269586fa9b770184c74c"
[[package]]
name = "browserhtml"
version = "0.1.2"
source = "git+https://github.com/browserhtml/browserhtml?branch=gh-pages#120c811302a9993f3aad103fbb695847693969ea"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
version = "0.4.2" version = "0.4.2"
@ -1660,6 +1665,7 @@ name = "servo"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"browserhtml 0.1.2 (git+https://github.com/browserhtml/browserhtml?branch=gh-pages)",
"canvas 0.0.1", "canvas 0.0.1",
"canvas_traits 0.0.1", "canvas_traits 0.0.1",
"compositing 0.0.1", "compositing 0.0.1",

6
ports/gonk/Cargo.lock generated
View file

@ -120,6 +120,11 @@ name = "brotli"
version = "0.3.20" version = "0.3.20"
source = "git+https://github.com/ende76/brotli-rs#c243045b88b2d2924c35269586fa9b770184c74c" source = "git+https://github.com/ende76/brotli-rs#c243045b88b2d2924c35269586fa9b770184c74c"
[[package]]
name = "browserhtml"
version = "0.1.2"
source = "git+https://github.com/browserhtml/browserhtml?branch=gh-pages#120c811302a9993f3aad103fbb695847693969ea"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
version = "0.4.2" version = "0.4.2"
@ -1642,6 +1647,7 @@ name = "servo"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"browserhtml 0.1.2 (git+https://github.com/browserhtml/browserhtml?branch=gh-pages)",
"canvas 0.0.1", "canvas 0.0.1",
"canvas_traits 0.0.1", "canvas_traits 0.0.1",
"compositing 0.0.1", "compositing 0.0.1",

View file

@ -9,6 +9,7 @@
from __future__ import print_function, unicode_literals from __future__ import print_function, unicode_literals
from glob import glob
import os import os
import os.path as path import os.path as path
import subprocess import subprocess
@ -32,6 +33,18 @@ def read_file(filename, if_exists=False):
return f.read() return f.read()
def find_dep_path_newest(package, bin_path):
deps_path = path.join(path.split(bin_path)[0], "build")
with cd(deps_path):
print(os.getcwd())
candidates = glob(package + '-*')
candidates = (path.join(deps_path, c) for c in candidates)
candidate_times = sorted(((path.getmtime(c), c) for c in candidates), reverse=True)
if len(candidate_times) > 0:
return candidate_times[0][1]
return None
@CommandProvider @CommandProvider
class PostBuildCommands(CommandBase): class PostBuildCommands(CommandBase):
@Command('run', @Command('run',
@ -50,10 +63,12 @@ class PostBuildCommands(CommandBase):
'have no effect without this.') 'have no effect without this.')
@CommandArgument('--debugger', default=None, type=str, @CommandArgument('--debugger', default=None, type=str,
help='Name of debugger to use.') help='Name of debugger to use.')
@CommandArgument('--browserhtml', '-b', action='store_true',
help='Launch with Browser.html')
@CommandArgument( @CommandArgument(
'params', nargs='...', 'params', nargs='...',
help="Command-line arguments to be passed through to Servo") help="Command-line arguments to be passed through to Servo")
def run(self, params, release=False, dev=False, android=None, debug=False, debugger=None): def run(self, params, release=False, dev=False, android=None, debug=False, debugger=None, browserhtml=False):
env = self.build_env() env = self.build_env()
env["RUST_BACKTRACE"] = "1" env["RUST_BACKTRACE"] = "1"
@ -110,6 +125,13 @@ class PostBuildCommands(CommandBase):
# Prepend the debugger args. # Prepend the debugger args.
args = ([command] + self.debuggerInfo.args + args = ([command] + self.debuggerInfo.args +
args + params) args + params)
elif browserhtml:
browserhtml_path = find_dep_path_newest('browserhtml', args[0])
if browserhtml_path is None:
print("Could not find browserhtml package; perhaps you haven't built Servo.")
return 1
args = args + ['-w', '-b', '--pref', 'dom.mozbrowser.enabled',
path.join(browserhtml_path, 'out', 'index.html')]
else: else:
args = args + params args = args + params