Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor cleanup of internal function #1138

Merged
merged 2 commits into from
Feb 15, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions cargo/private/cargo_utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -106,49 +106,49 @@ def get_host_triple(repository_ctx, abi = None):

def _resolve_repository_template(
template,
version = None,
triple = None,
abi = None,
arch = None,
vendor = None,
system = None,
abi = None,
tool = None):
tool = None,
triple = None,
vendor = None,
version = None):
"""Render values into a repository template string

Args:
template (str): The template to use for rendering
version (str, optional): The Rust version used in the toolchain.
triple (str, optional): The host triple
abi (str, optional): The host ABI
arch (str, optional): The host CPU architecture
vendor (str, optional): The host vendor name
system (str, optional): The host system name
abi (str, optional): The host ABI
tool (str, optional): The tool to expect in the particular repository.
Eg. `cargo`, `rustc`, `stdlib`.
triple (str, optional): The host triple
vendor (str, optional): The host vendor name
version (str, optional): The Rust version used in the toolchain.
Returns:
string: The resolved template string based on the given parameters
"""
if version:
template = template.replace("{version}", version)

if triple:
template = template.replace("{triple}", triple)
if abi:
template = template.replace("{abi}", abi)

if arch:
template = template.replace("{arch}", arch)

if vendor:
template = template.replace("{vendor}", vendor)

if system:
template = template.replace("{system}", system)

if abi:
template = template.replace("{abi}", abi)

if tool:
template = template.replace("{tool}", tool)

if triple:
template = template.replace("{triple}", triple)

if vendor:
template = template.replace("{vendor}", vendor)

if version:
template = template.replace("{version}", version)

return template

def get_rust_tools(cargo_template, rustc_template, host_triple, version):
Expand Down