mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Auto merge of #16276 - servo:cargo-geckolib, r=Wafflespeanut
Add cargo-geckolib and rustc-geckolib commands to mach <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16276) <!-- Reviewable:end -->
This commit is contained in:
commit
b89dc6a08c
3 changed files with 46 additions and 3 deletions
|
@ -416,9 +416,8 @@ class MachCommands(CommandBase):
|
||||||
self.set_use_stable_rust()
|
self.set_use_stable_rust()
|
||||||
self.ensure_bootstrapped()
|
self.ensure_bootstrapped()
|
||||||
|
|
||||||
env = self.build_env(is_build=True)
|
env = self.build_env(is_build=True, geckolib=True)
|
||||||
geckolib_build_path = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")
|
geckolib_build_path = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")
|
||||||
env["CARGO_TARGET_DIR"] = geckolib_build_path
|
|
||||||
|
|
||||||
ret = None
|
ret = None
|
||||||
opts = []
|
opts = []
|
||||||
|
|
|
@ -382,7 +382,7 @@ class CommandBase(object):
|
||||||
" --release" if release else ""))
|
" --release" if release else ""))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
def build_env(self, hosts_file_path=None, target=None, is_build=False):
|
def build_env(self, hosts_file_path=None, target=None, is_build=False, geckolib=False):
|
||||||
"""Return an extended environment dictionary."""
|
"""Return an extended environment dictionary."""
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
if sys.platform == "win32" and type(env['PATH']) == unicode:
|
if sys.platform == "win32" and type(env['PATH']) == unicode:
|
||||||
|
@ -519,6 +519,10 @@ class CommandBase(object):
|
||||||
|
|
||||||
env['GIT_INFO'] = '-'.join(git_info)
|
env['GIT_INFO'] = '-'.join(git_info)
|
||||||
|
|
||||||
|
if geckolib:
|
||||||
|
geckolib_build_path = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")
|
||||||
|
env["CARGO_TARGET_DIR"] = geckolib_build_path
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|
||||||
def servo_crate(self):
|
def servo_crate(self):
|
||||||
|
|
|
@ -33,11 +33,32 @@ class MachCommands(CommandBase):
|
||||||
if not params:
|
if not params:
|
||||||
params = []
|
params = []
|
||||||
|
|
||||||
|
self.ensure_bootstrapped()
|
||||||
|
|
||||||
if self.context.topdir == getcwd():
|
if self.context.topdir == getcwd():
|
||||||
with cd(path.join('components', 'servo')):
|
with cd(path.join('components', 'servo')):
|
||||||
return call(["cargo"] + params, env=self.build_env())
|
return call(["cargo"] + params, env=self.build_env())
|
||||||
return call(['cargo'] + params, env=self.build_env())
|
return call(['cargo'] + params, env=self.build_env())
|
||||||
|
|
||||||
|
@Command('cargo-geckolib',
|
||||||
|
description='Run Cargo with the same compiler version and root crate as build-geckolib',
|
||||||
|
category='devenv')
|
||||||
|
@CommandArgument(
|
||||||
|
'params', default=None, nargs='...',
|
||||||
|
help="Command-line arguments to be passed through to Cargo")
|
||||||
|
def cargo_geckolib(self, params):
|
||||||
|
if not params:
|
||||||
|
params = []
|
||||||
|
|
||||||
|
self.set_use_stable_rust()
|
||||||
|
self.ensure_bootstrapped()
|
||||||
|
env = self.build_env(geckolib=True)
|
||||||
|
|
||||||
|
if self.context.topdir == getcwd():
|
||||||
|
with cd(path.join('ports', 'geckolib')):
|
||||||
|
return call(["cargo"] + params, env=env)
|
||||||
|
return call(['cargo'] + params, env=env)
|
||||||
|
|
||||||
@Command('cargo-update',
|
@Command('cargo-update',
|
||||||
description='Same as update-cargo',
|
description='Same as update-cargo',
|
||||||
category='devenv')
|
category='devenv')
|
||||||
|
@ -95,8 +116,27 @@ class MachCommands(CommandBase):
|
||||||
def rustc(self, params):
|
def rustc(self, params):
|
||||||
if params is None:
|
if params is None:
|
||||||
params = []
|
params = []
|
||||||
|
|
||||||
|
self.ensure_bootstrapped()
|
||||||
|
|
||||||
return call(["rustc"] + params, env=self.build_env())
|
return call(["rustc"] + params, env=self.build_env())
|
||||||
|
|
||||||
|
@Command('rustc-geckolib',
|
||||||
|
description='Run the Rust compiler with the same compiler version and root crate as build-geckolib',
|
||||||
|
category='devenv')
|
||||||
|
@CommandArgument(
|
||||||
|
'params', default=None, nargs='...',
|
||||||
|
help="Command-line arguments to be passed through to rustc")
|
||||||
|
def rustc_geckolib(self, params):
|
||||||
|
if params is None:
|
||||||
|
params = []
|
||||||
|
|
||||||
|
self.set_use_stable_rust()
|
||||||
|
self.ensure_bootstrapped()
|
||||||
|
env = self.build_env(geckolib=True)
|
||||||
|
|
||||||
|
return call(["rustc"] + params, env=env)
|
||||||
|
|
||||||
@Command('rust-root',
|
@Command('rust-root',
|
||||||
description='Print the path to the root of the Rust compiler',
|
description='Print the path to the root of the Rust compiler',
|
||||||
category='devenv')
|
category='devenv')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue