Skip to content

Commit

Permalink
Add tools attribute for CrateSettings (#487)
Browse files Browse the repository at this point in the history
  • Loading branch information
alealv authored May 28, 2022
1 parent 4f1a074 commit 5efa40e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions impl/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub struct CrateDependencyContext {
pub build_proc_macro_dependencies: BTreeSet<BuildableDependency>,
// build_data_dependencies can only be set when using cargo-raze as a library at the moment.
pub build_data_dependencies: BTreeSet<BuildableDependency>,
pub build_tools_dependencies: BTreeSet<BuildableDependency>,
pub dev_dependencies: BTreeSet<BuildableDependency>,
/// Aliased dependencies, sorted/keyed by their `target` name in the `DependencyAlias` struct.
pub aliased_dependencies: BTreeMap<String, DependencyAlias>,
Expand Down
1 change: 1 addition & 0 deletions impl/src/rendering/bazel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ mod tests {
build_dependencies: BTreeSet::new(),
build_proc_macro_dependencies: BTreeSet::new(),
build_data_dependencies: BTreeSet::new(),
build_tools_dependencies: BTreeSet::new(),
dev_dependencies: BTreeSet::new(),
aliased_dependencies: BTreeMap::new(),
},
Expand Down
9 changes: 8 additions & 1 deletion impl/src/rendering/templates/partials/build_script.template
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ cargo_build_script(
"{{flag}}",
{%- endfor %}
],
{%- if crate.raze_settings.build_tools_dependencies %}
tools = [
{%- for tools in crate.raze_settings.build_tools_dependencies %}
"{{tools}}",
{%- endfor %}
],
{%- endif %}
tags = [
"cargo-raze",
"manual",
Expand Down Expand Up @@ -89,4 +96,4 @@ cargo_build_script(
{%- endfor -%}
{%- else -%}
{%- endif %},
)
)
5 changes: 5 additions & 0 deletions impl/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ pub struct CrateSettings {
#[serde(default)]
pub build_data_dependencies: Vec<String>,

/// The `tools` attribute for buildrs targets
#[serde(default)]
pub build_tools_dependencies: Vec<String>,

/// Additional environment variables to add when running the build script.
#[serde(default)]
pub buildrs_additional_environment_variables: BTreeMap<String, String>,
Expand Down Expand Up @@ -272,6 +276,7 @@ impl Default for CrateSettings {
data_dependencies: Vec::new(),
compile_data_attr: None,
build_data_dependencies: Vec::new(),
build_tools_dependencies: Vec::new(),
buildrs_additional_deps: Vec::new(),
buildrs_additional_environment_variables: BTreeMap::new(),
patch_args: Vec::new(),
Expand Down

0 comments on commit 5efa40e

Please sign in to comment.