mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +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
|
@ -73,7 +73,7 @@ class MachCommands(CommandBase):
|
|||
else:
|
||||
status = subprocess.call(
|
||||
["cargo", "build"] + opts,
|
||||
env=self.build_env(), cwd="components/servo")
|
||||
env=self.build_env(), cwd=self.servo_crate())
|
||||
elapsed = time() - build_start
|
||||
|
||||
print("Build completed in %0.2fs" % elapsed)
|
||||
|
@ -106,7 +106,7 @@ class MachCommands(CommandBase):
|
|||
build_start = time()
|
||||
with cd(path.join("ports", "cef")):
|
||||
ret = subprocess.call(["cargo", "build"],
|
||||
env=self.build_env(), cwd="components/servo")
|
||||
env=self.build_env(), cwd=self.servo_crate())
|
||||
elapsed = time() - build_start
|
||||
|
||||
print("CEF build completed in %0.2fs" % elapsed)
|
||||
|
@ -126,7 +126,7 @@ class MachCommands(CommandBase):
|
|||
opts += ["-j", jobs]
|
||||
return subprocess.call(
|
||||
["cargo", "test", "--no-run"],
|
||||
env=self.build_env(), cwd="components/servo")
|
||||
env=self.build_env(), cwd=self.servo_crate())
|
||||
|
||||
@Command('clean',
|
||||
description='Clean the build directory.',
|
||||
|
@ -147,4 +147,4 @@ class MachCommands(CommandBase):
|
|||
opts += ["-v"]
|
||||
|
||||
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
|
||||
|
||||
def servo_crate(self):
|
||||
return path.join(self.context.topdir, "components", "servo")
|
||||
|
||||
def ensure_bootstrapped(self):
|
||||
if self.context.bootstrapped:
|
||||
return
|
||||
|
|
|
@ -22,7 +22,7 @@ class MachCommands(CommandBase):
|
|||
help="Command-line arguments to be passed through to Cargo")
|
||||
def cargo(self, params):
|
||||
return subprocess.call(["cargo"] + params,
|
||||
env=self.build_env(), cwd="components/servo")
|
||||
env=self.build_env(), cwd=self.servo_crate())
|
||||
|
||||
@Command('update-cargo',
|
||||
description='Update Cargo dependencies',
|
||||
|
|
|
@ -71,7 +71,7 @@ class MachCommands(CommandBase):
|
|||
def doc(self, params):
|
||||
self.ensure_bootstrapped()
|
||||
return subprocess.call(["cargo", "doc"] + params,
|
||||
env=self.build_env(), cwd="components/servo")
|
||||
env=self.build_env(), cwd=self.servo_crate())
|
||||
|
||||
@Command('serve-docs',
|
||||
description='Locally serve Servo and Rust documentation',
|
||||
|
|
|
@ -107,7 +107,7 @@ class MachCommands(CommandBase):
|
|||
def cargo_test(component):
|
||||
return 0 != subprocess.call(
|
||||
["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"):
|
||||
ret = ret or cargo_test(component)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue