Skip to content

Commit

Permalink
support compile_data
Browse files Browse the repository at this point in the history
  • Loading branch information
dae committed Dec 1, 2020
1 parent 3359c69 commit 50af54c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ time:

```
[package.metadata.raze.crates.ring.'*']
data_attr = "glob([\"src/**\"])"
compile_data_attr = "glob([\"**/*.der\"])"
```

If you wish to disable the build script on an individual crate, you can do so
Expand Down
1 change: 1 addition & 0 deletions impl/src/planning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@ mod tests {
assert!(test_dep.skipped_deps.is_empty());
assert!(test_dep.additional_build_file.is_none());
assert!(test_dep.data_attr.is_none());
assert!(test_dep.compile_data_attr.is_none());
};

assert_dep_not_match("anyhow", "*");
Expand Down
3 changes: 3 additions & 0 deletions impl/src/rendering/templates/partials/common_attrs.template
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
{%- if crate.raze_settings.data_attr %}
data = {{crate.raze_settings.data_attr}},
{%- endif %}
{%- if crate.raze_settings.compile_data_attr %}
compile_data = {{crate.raze_settings.compile_data_attr}},
{%- endif %}
edition = "{{ target.edition }}",
{%- if crate.default_deps.proc_macro_dependencies %}
proc_macro_deps = [
Expand Down
7 changes: 7 additions & 0 deletions impl/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ pub struct CrateSettings {
#[serde(default = "default_crate_settings_field_data_attr")]
pub data_attr: Option<String>,

/**
* The verbatim `compile_data` clause to be included for the generated build targets.
*/
#[serde(default)]
pub compile_data_attr: Option<String>,

/**
* Additional environment variables to add when running the build script.
*/
Expand Down Expand Up @@ -302,6 +308,7 @@ impl Default for CrateSettings {
additional_env: HashMap::new(),
gen_buildrs: default_crate_settings_field_gen_buildrs(),
data_attr: default_crate_settings_field_data_attr(),
compile_data_attr: None,
buildrs_additional_environment_variables: HashMap::new(),
patch_args: Vec::new(),
patch_cmds: Vec::new(),
Expand Down

0 comments on commit 50af54c

Please sign in to comment.