Move the servo crate from root to components/servo

This commit is contained in:
Simon Sapin 2014-11-28 08:16:02 +00:00
parent b2b6d4d0d1
commit 2f413c8937
15 changed files with 55 additions and 45 deletions

6
.gitignore vendored
View file

@ -1,7 +1,5 @@
/.cargo/config /.cargo/config
/target /components/servo/target
/rust
/cargo
/ports/cef/target /ports/cef/target
/ports/android/bin /ports/android/bin
/ports/android/libs /ports/android/libs
@ -16,7 +14,7 @@
/components/script/dom/bindings/codegen/UnionTypes.h /components/script/dom/bindings/codegen/UnionTypes.h
/components/script/dom/bindings/codegen/UnionConversions.h /components/script/dom/bindings/codegen/UnionConversions.h
/.servobuild /.servobuild
/_virtualenv /tests/wpt/_virtualenv
*~ *~
*# *#
*.o *.o

View file

@ -6,22 +6,24 @@ authors = ["The Servo Project Developers"]
[lib] [lib]
name = "servo" name = "servo"
path = "lib.rs"
crate-type = ["rlib"] crate-type = ["rlib"]
[[bin]] [[bin]]
name = "servo" name = "servo"
path = "main.rs"
test = false test = false
doc = false doc = false
bench = false bench = false
[[test]] [[test]]
name = "reftest" name = "reftest"
path = "tests/reftest.rs" path = "../../tests/reftest.rs"
harness = false harness = false
[[test]] [[test]]
name = "contenttest" name = "contenttest"
path = "tests/contenttest.rs" path = "../../tests/contenttest.rs"
harness = false harness = false
[features] [features]
@ -29,32 +31,32 @@ default = ["glfw_app"]
glutin = ["glutin_app"] glutin = ["glutin_app"]
[dependencies.compositing] [dependencies.compositing]
path = "components/compositing" path = "../compositing"
[dependencies.net] [dependencies.net]
path = "components/net" path = "../net"
[dependencies.msg] [dependencies.msg]
path = "components/msg" path = "../msg"
[dependencies.util] [dependencies.util]
path = "components/util" path = "../util"
[dependencies.script] [dependencies.script]
path = "components/script" path = "../script"
[dependencies.layout] [dependencies.layout]
path = "components/layout" path = "../layout"
[dependencies.gfx] [dependencies.gfx]
path = "components/gfx" path = "../gfx"
[dependencies.glfw_app] [dependencies.glfw_app]
path = "ports/glfw" path = "../../ports/glfw"
optional = true optional = true
[dependencies.glutin_app] [dependencies.glutin_app]
path = "ports/glutin" path = "../../ports/glutin"
optional = true optional = true
[dependencies.url] [dependencies.url]

View file

@ -17,11 +17,15 @@ pub fn resources_dir_path() -> Path {
#[cfg(not(target_os = "android"))] #[cfg(not(target_os = "android"))]
pub fn resources_dir_path() -> Path { pub fn resources_dir_path() -> Path {
// FIXME: Find a way to not rely on the executable being under `<servo source>/target`. // FIXME: Find a way to not rely on the executable being
// under `<servo source>/components/servo/target`
// or `<servo source>/components/servo/target/release`.
let mut path = os::self_exe_path().expect("can't get exe path"); let mut path = os::self_exe_path().expect("can't get exe path");
path.pop(); path.pop();
path.pop();
path.pop();
path.push("resources"); path.push("resources");
if !path.is_dir() { if !path.is_dir() { // self_exe_path() is probably in .../target/release
path.pop(); path.pop();
path.pop(); path.pop();
path.push("resources"); path.push("resources");

View file

@ -6,14 +6,14 @@
set -e set -e
mkdir -p target/doc mkdir -p components/servo/target/doc
./mach bootstrap-rust ./mach bootstrap-rust
# Ordered so that: # Ordered so that:
# * etc/doc.servo.org/index.html overwrites $(mach rust-root)/doc/index.html # * etc/doc.servo.org/index.html overwrites $(mach rust-root)/doc/index.html
# * ./mach doc overwrites $(mach rust-root)/doc/search-index.js # * ./mach doc overwrites $(mach rust-root)/doc/search-index.js
cp -R $(./mach rust-root)/doc/* target/doc/ cp -R $(./mach rust-root)/doc/* components/servo/target/doc/
cp etc/doc.servo.org/* target/doc/ cp etc/doc.servo.org/* components/servo/target/doc/
./mach doc ./mach doc
ghp-import -n target/doc ghp-import -n components/servo/target/doc
git push -qf https://${TOKEN}@github.com/servo/doc.servo.org.git gh-pages git push -qf https://${TOKEN}@github.com/servo/doc.servo.org.git gh-pages

View file

@ -9,7 +9,7 @@ path = "lib.rs"
crate-type = ["dylib"] crate-type = ["dylib"]
[dependencies.servo] [dependencies.servo]
path = "../.." path = "../../components/servo"
[dependencies.glfw_app] [dependencies.glfw_app]
path = "../glfw" path = "../glfw"

View file

@ -73,7 +73,7 @@ class MachCommands(CommandBase):
else: else:
status = subprocess.call( status = subprocess.call(
["cargo", "build"] + opts, ["cargo", "build"] + opts,
env=self.build_env()) env=self.build_env(), cwd="components/servo")
elapsed = time() - build_start elapsed = time() - build_start
print("Build completed in %0.2fs" % elapsed) print("Build completed in %0.2fs" % elapsed)
@ -105,7 +105,8 @@ class MachCommands(CommandBase):
build_start = time() build_start = time()
with cd(path.join("ports", "cef")): with cd(path.join("ports", "cef")):
ret = subprocess.call(["cargo", "build"], env=self.build_env()) ret = subprocess.call(["cargo", "build"],
env=self.build_env(), cwd="components/servo")
elapsed = time() - build_start elapsed = time() - build_start
print("CEF build completed in %0.2fs" % elapsed) print("CEF build completed in %0.2fs" % elapsed)
@ -124,7 +125,8 @@ class MachCommands(CommandBase):
if jobs is not None: if jobs is not None:
opts += ["-j", jobs] opts += ["-j", jobs]
return subprocess.call( return subprocess.call(
["cargo", "test", "--no-run"], env=self.build_env()) ["cargo", "test", "--no-run"],
env=self.build_env(), cwd="components/servo")
@Command('clean', @Command('clean',
description='Clean the build directory.', description='Clean the build directory.',
@ -144,4 +146,5 @@ class MachCommands(CommandBase):
if verbose: if verbose:
opts += ["-v"] opts += ["-v"]
return subprocess.call(["cargo", "clean"] + opts, env=self.build_env()) return subprocess.call(["cargo", "clean"] + opts,
env=self.build_env(), cwd="components/servo")

View file

@ -22,7 +22,7 @@ class MachCommands(CommandBase):
help="Command-line arguments to be passed through to Cargo") help="Command-line arguments to be passed through to Cargo")
def cargo(self, params): def cargo(self, params):
return subprocess.call(["cargo"] + params, return subprocess.call(["cargo"] + params,
env=self.build_env()) env=self.build_env(), cwd="components/servo")
@Command('update-cargo', @Command('update-cargo',
description='Update Cargo dependencies', description='Update Cargo dependencies',

View file

@ -37,7 +37,7 @@ class MachCommands(CommandBase):
env = self.build_env() env = self.build_env()
env["RUST_BACKTRACE"] = "1" env["RUST_BACKTRACE"] = "1"
args = [path.join("target", "servo")] args = [path.join("components", "servo", "target", "servo")]
# Borrowed and modified from: # Borrowed and modified from:
# http://hg.mozilla.org/mozilla-central/file/c9cfa9b91dea/python/mozbuild/mozbuild/mach_commands.py#l883 # http://hg.mozilla.org/mozilla-central/file/c9cfa9b91dea/python/mozbuild/mozbuild/mach_commands.py#l883
@ -71,7 +71,7 @@ class MachCommands(CommandBase):
def doc(self, params): def doc(self, params):
self.ensure_bootstrapped() self.ensure_bootstrapped()
return subprocess.call(["cargo", "doc"] + params, return subprocess.call(["cargo", "doc"] + params,
env=self.build_env()) env=self.build_env(), cwd="components/servo")
@Command('serve-docs', @Command('serve-docs',
description='Locally serve Servo and Rust documentation', description='Locally serve Servo and Rust documentation',
@ -81,13 +81,13 @@ class MachCommands(CommandBase):
help="Port to serve documentation at (default is 8888)") help="Port to serve documentation at (default is 8888)")
def serve_docs(self, port): def serve_docs(self, port):
self.doc([]) self.doc([])
servedir = path.join("target", "serve-docs") servedir = path.join("components", "servo", "target", "serve-docs")
docdir = path.join("target", "doc") docdir = path.join("components", "servo", "target", "doc")
rmtree(servedir, True) rmtree(servedir, True)
copytree(docdir, servedir, ignore=ignore_patterns('.*')) copytree(docdir, servedir, ignore=ignore_patterns('.*'))
rustdocs = path.join("rust", self.rust_snapshot_path(), "doc") rustdocs = path.join(self.config["tools"]["rust-root"], "doc")
copytree(rustdocs, path.join(servedir, "rust"), ignore=ignore_patterns('.*')) copytree(rustdocs, path.join(servedir, "rust"), ignore=ignore_patterns('.*'))
chdir(servedir) chdir(servedir)

View file

@ -31,10 +31,12 @@ class MachCommands(CommandBase):
self.context.built_tests = True self.context.built_tests = True
def find_test(self, prefix): def find_test(self, prefix):
target_contents = os.listdir(path.join(self.context.topdir, "target")) target_contents = os.listdir(path.join(
self.context.topdir, "components", "servo", "target"))
for filename in target_contents: for filename in target_contents:
if filename.startswith(prefix + "-"): if filename.startswith(prefix + "-"):
filepath = path.join(self.context.topdir, "target", filename) filepath = path.join(
self.context.topdir, "components", "servo", "target", filename)
if path.isfile(filepath) and os.access(filepath, os.X_OK): if path.isfile(filepath) and os.access(filepath, os.X_OK):
return filepath return filepath
@ -104,7 +106,8 @@ class MachCommands(CommandBase):
def cargo_test(component): def cargo_test(component):
return 0 != subprocess.call( return 0 != subprocess.call(
["cargo", "test", "-p", component] + test_name, env=self.build_env()) ["cargo", "test", "-p", component] + test_name,
env=self.build_env(), cwd="components/servo")
for component in os.listdir("components"): for component in os.listdir("components"):
ret = ret or cargo_test(component) ret = ret or cargo_test(component)

View file

@ -99,7 +99,7 @@ fn run_test(file: String) {
let stderr = InheritFd(2); let stderr = InheritFd(2);
let args = ["-z", "-f", infile.as_slice()]; let args = ["-z", "-f", infile.as_slice()];
let mut prc = match Command::new("target/servo") let mut prc = match Command::new("components/servo/target/servo")
.args(args) .args(args)
.stdin(Ignored) .stdin(Ignored)
.stdout(stdout) .stdout(stdout)

View file

@ -248,7 +248,7 @@ fn make_test(reftest: Reftest) -> TestDescAndFn {
fn capture(reftest: &Reftest, side: uint) -> (u32, u32, Vec<u8>) { fn capture(reftest: &Reftest, side: uint) -> (u32, u32, Vec<u8>) {
let png_filename = format!("/tmp/servo-reftest-{:06u}-{:u}.png", reftest.id, side); let png_filename = format!("/tmp/servo-reftest-{:06u}-{:u}.png", reftest.id, side);
let mut command = Command::new("target/servo"); let mut command = Command::new("components/servo/target/servo");
command command
.args(reftest.servo_args.as_slice()) .args(reftest.servo_args.as_slice())
// Allows pixel perfect rendering of Ahem font for reftests. // Allows pixel perfect rendering of Ahem font for reftests.

View file

@ -4,22 +4,22 @@
set -e set -e
servo_root=$(pwd) wpt_root=$(dirname $0)
PYTHON=$(which python2 2> /dev/null || echo python) PYTHON=$(which python2 2> /dev/null || echo python)
VIRTUALENV=$(which virtualenv2 2> /dev/null || echo virtualenv) VIRTUALENV=$(which virtualenv2 2> /dev/null || echo virtualenv)
test -d _virtualenv || $VIRTUALENV _virtualenv -p $PYTHON test -d $wpt_root/_virtualenv || $VIRTUALENV $wpt_root/_virtualenv -p $PYTHON
test -d $servo_root/tests/wpt/metadata || mkdir -p $servo_root/tests/wpt/metadata test -d $wpt_root/metadata || mkdir -p $wpt_root/metadata
test -d $servo_root/tests/wpt/prefs || mkdir -p $servo_root/tests/wpt/prefs test -d $wpt_root/prefs || mkdir -p $wpt_root/prefs
source _virtualenv/bin/activate source $wpt_root/_virtualenv/bin/activate
if [[ $* == *--update-manifest* ]]; then if [[ $* == *--update-manifest* ]]; then
(python -c "import html5lib" &>/dev/null) || pip install html5lib (python -c "import html5lib" &>/dev/null) || pip install html5lib
fi fi
(python -c "import wptrunner" &>/dev/null) || pip install 'wptrunner==1.7' (python -c "import wptrunner" &>/dev/null) || pip install 'wptrunner==1.7'
python $servo_root/tests/wpt/run.py \ python $wpt_root/run.py \
--config $servo_root/tests/wpt/config.ini \ --config $wpt_root/config.ini \
--binary target/servo \ --binary $wpt_root/../../components/servo/target/servo \
--log-mach - \ --log-mach - \
"$@" "$@"