mirror of
https://github.com/servo/servo.git
synced 2025-07-24 07:40:27 +01:00
Make build system more independent of current directory.
This commit is contained in:
parent
ff4877b473
commit
cc4ea7507f
8 changed files with 14 additions and 9 deletions
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
cd "$(dirname $0)/../.."
|
||||||
|
|
||||||
mkdir -p components/servo/target/doc
|
mkdir -p components/servo/target/doc
|
||||||
./mach bootstrap-rust
|
./mach bootstrap-rust
|
||||||
# Ordered so that:
|
# Ordered so that:
|
||||||
|
|
|
@ -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(), cwd="components/servo")
|
env=self.build_env(), cwd=self.servo_crate())
|
||||||
elapsed = time() - build_start
|
elapsed = time() - build_start
|
||||||
|
|
||||||
print("Build completed in %0.2fs" % elapsed)
|
print("Build completed in %0.2fs" % elapsed)
|
||||||
|
@ -106,7 +106,7 @@ 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"],
|
ret = subprocess.call(["cargo", "build"],
|
||||||
env=self.build_env(), cwd="components/servo")
|
env=self.build_env(), cwd=self.servo_crate())
|
||||||
elapsed = time() - build_start
|
elapsed = time() - build_start
|
||||||
|
|
||||||
print("CEF build completed in %0.2fs" % elapsed)
|
print("CEF build completed in %0.2fs" % elapsed)
|
||||||
|
@ -126,7 +126,7 @@ class MachCommands(CommandBase):
|
||||||
opts += ["-j", jobs]
|
opts += ["-j", jobs]
|
||||||
return subprocess.call(
|
return subprocess.call(
|
||||||
["cargo", "test", "--no-run"],
|
["cargo", "test", "--no-run"],
|
||||||
env=self.build_env(), cwd="components/servo")
|
env=self.build_env(), cwd=self.servo_crate())
|
||||||
|
|
||||||
@Command('clean',
|
@Command('clean',
|
||||||
description='Clean the build directory.',
|
description='Clean the build directory.',
|
||||||
|
@ -147,4 +147,4 @@ class MachCommands(CommandBase):
|
||||||
opts += ["-v"]
|
opts += ["-v"]
|
||||||
|
|
||||||
return subprocess.call(["cargo", "clean"] + opts,
|
return subprocess.call(["cargo", "clean"] + opts,
|
||||||
env=self.build_env(), cwd="components/servo")
|
env=self.build_env(), cwd=self.servo_crate())
|
||||||
|
|
|
@ -142,6 +142,9 @@ class CommandBase(object):
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
def servo_crate(self):
|
||||||
|
return path.join(self.context.topdir, "components", "servo")
|
||||||
|
|
||||||
def ensure_bootstrapped(self):
|
def ensure_bootstrapped(self):
|
||||||
if self.context.bootstrapped:
|
if self.context.bootstrapped:
|
||||||
return
|
return
|
||||||
|
|
|
@ -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(), cwd="components/servo")
|
env=self.build_env(), cwd=self.servo_crate())
|
||||||
|
|
||||||
@Command('update-cargo',
|
@Command('update-cargo',
|
||||||
description='Update Cargo dependencies',
|
description='Update Cargo dependencies',
|
||||||
|
|
|
@ -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(), cwd="components/servo")
|
env=self.build_env(), cwd=self.servo_crate())
|
||||||
|
|
||||||
@Command('serve-docs',
|
@Command('serve-docs',
|
||||||
description='Locally serve Servo and Rust documentation',
|
description='Locally serve Servo and Rust documentation',
|
||||||
|
|
|
@ -107,7 +107,7 @@ 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,
|
["cargo", "test", "-p", component] + test_name,
|
||||||
env=self.build_env(), cwd="components/servo")
|
env=self.build_env(), cwd=self.servo_crate())
|
||||||
|
|
||||||
for component in os.listdir("components"):
|
for component in os.listdir("components"):
|
||||||
ret = ret or cargo_test(component)
|
ret = ret or cargo_test(component)
|
||||||
|
|
|
@ -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("components/servo/target/servo")
|
let mut prc = match Command::new(os::self_exe_path().unwrap().join("servo"))
|
||||||
.args(args)
|
.args(args)
|
||||||
.stdin(Ignored)
|
.stdin(Ignored)
|
||||||
.stdout(stdout)
|
.stdout(stdout)
|
||||||
|
|
|
@ -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("components/servo/target/servo");
|
let mut command = Command::new(os::self_exe_path().unwrap().join("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.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue