Share more ./mach build logic with mach check, doc, test-unit

Fixes #23659
This commit is contained in:
Simon Sapin 2019-07-01 19:25:10 +02:00
parent d9dbcd52c3
commit 7c85dc09b5
5 changed files with 144 additions and 129 deletions

View file

@ -236,7 +236,8 @@ class PostBuildCommands(CommandBase):
@CommandArgument(
'params', nargs='...',
help="Command-line arguments to be passed through to cargo doc")
def doc(self, params):
@CommandBase.build_like_command_arguments
def doc(self, params, **kwargs):
env = os.environ.copy()
env["RUSTUP_TOOLCHAIN"] = self.toolchain()
rustc_path = check_output(["rustup" + BIN_SUFFIX, "which", "rustc"], env=env)
@ -264,11 +265,7 @@ class PostBuildCommands(CommandBase):
else:
copy2(full_name, destination)
params += ["--features", "canvas2d-azure"]
returncode = self.call_rustup_run(
["cargo", "doc", "--manifest-path", self.ports_glutin_manifest()] + params,
env=self.build_env())
returncode = self.run_cargo_build_like_command("doc", params, **kwargs)
if returncode:
return returncode