Skip to content

Commit

Permalink
renamed short_name to feature_name
Browse files Browse the repository at this point in the history
  • Loading branch information
carloskiki committed Aug 2, 2024
1 parent 6d20d14 commit e42ad86
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions build/src/fs/cargo_toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl CargoToml {
#[template(path = "main_lib/Cargo.toml", escape = "none")]
struct Template<'a> {
short_name_version: Vec<(&'a str, String)>,
short_name_full_name: Vec<(&'a str, String)>,
short_name_feature_name: Vec<(&'a str, String)>,
}

let short_name_version: Vec<_> = crate::Packages::get()?
Expand All @@ -49,12 +49,12 @@ impl CargoToml {
})
.collect();

let short_name_full_name: Vec<_> = crate::Packages::get()?
let short_name_feature_name: Vec<_> = crate::Packages::get()?
.iter()
.map(|package| (&*package.meta.short_name, package.meta.package_name.to_kebab_case()))
.collect();

Ok(Template { short_name_version, short_name_full_name }.render()?)
Ok(Template { short_name_version, short_name_feature_name }.render()?)
}

LibType::IconIndex => unimplemented!("IconIndex does not generate a Cargo.toml file."),
Expand Down
6 changes: 3 additions & 3 deletions build/src/fs/lib_rs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ impl LibRs {
#[derive(Template)]
#[template(path = "main_lib/lib.rs", escape = "none")]
struct Template<'a> {
short_name_full_name: Vec<(&'a str, String)>,
short_name_feature_name: Vec<(&'a str, String)>,
}

let short_name_full_name = Packages::get()?
let short_name_feature_name = Packages::get()?
.iter()
.map(|package| (package.meta.short_name.as_ref(), package.meta.package_name.to_kebab_case()))
.collect::<Vec<_>>();

Ok(Template { short_name_full_name }.render()?)
Ok(Template { short_name_feature_name }.render()?)
}
LibType::IconIndex => {
#[derive(Template)]
Expand Down
8 changes: 4 additions & 4 deletions build/templates/main_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ icondata_{{short_name}} = { path = "../icondata_{{short_name}}", version = "{{ve
serde = ["icondata_core/serde"]

default = [
{% for (_, full_name) in short_name_full_name -%}
"{{full_name}}",
{% for (_, feature_name) in short_name_feature_name -%}
"{{feature_name}}",
{% endfor -%}
]

{% for (short_name, full_name) in short_name_full_name -%}
{{full_name}} = ["dep:icondata_{{short_name}}"]
{% for (short_name, feature_name) in short_name_feature_name -%}
{{feature_name}} = ["dep:icondata_{{short_name}}"]
{% endfor -%}
4 changes: 2 additions & 2 deletions build/templates/main_lib/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
//! [dependencies]
//! icondata = { version = "...", default-features = false, features = ["lu", "bi"] }
//! ```
{% for (short_name, full_name) in short_name_full_name %}
#[cfg(feature = "{{full_name}}")]
{% for (short_name, feature_name) in short_name_feature_name %}
#[cfg(feature = "{{feature_name}}")]
pub use icondata_{{short_name}}::*;
{%- endfor %}

Expand Down

0 comments on commit e42ad86

Please sign in to comment.