mirror of
https://github.com/servo/servo.git
synced 2025-07-30 10:40:27 +01:00
Clean up cross-compilation and features
Integrate cross-compilation and media-stack handling into the `build_like_command_arguments` decorator. This removes a lot of repetition in the code and standardizes how targets are selected for all similar commands. Now cross compilation targets, feature flags, and helper variables are stored in the CommandBase instance. This also avoids having to continuously pass these arguments down to functions called by the commands.
This commit is contained in:
parent
e9a7787a4d
commit
debc37a7d3
6 changed files with 181 additions and 172 deletions
|
@ -242,8 +242,7 @@ class PostBuildCommands(CommandBase):
|
|||
'params', nargs='...',
|
||||
help="Command-line arguments to be passed through to cargo doc")
|
||||
@CommandBase.build_like_command_arguments
|
||||
def doc(self, params, features, target=None, android=False,
|
||||
media_stack=None, **kwargs):
|
||||
def doc(self, params, **kwargs):
|
||||
self.ensure_bootstrapped(rustup_components=["rust-docs"])
|
||||
rustc_path = check_output(
|
||||
["rustup" + BIN_SUFFIX, "which", "--toolchain", self.rust_toolchain(), "rustc"]
|
||||
|
@ -271,15 +270,8 @@ class PostBuildCommands(CommandBase):
|
|||
else:
|
||||
copy2(full_name, destination)
|
||||
|
||||
features = features or []
|
||||
|
||||
target, android = self.pick_target_triple(target, android)
|
||||
|
||||
features += self.pick_media_stack(media_stack, target)
|
||||
|
||||
env = self.build_env(target=target, is_build=True, features=features)
|
||||
|
||||
returncode = self.run_cargo_build_like_command("doc", params, features=features, env=env, **kwargs)
|
||||
env = self.build_env(is_build=True)
|
||||
returncode = self.run_cargo_build_like_command("doc", params, env=env, **kwargs)
|
||||
if returncode:
|
||||
return returncode
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue