Skip to content

Commit

Permalink
Expose default tag as feature (#1492)
Browse files Browse the repository at this point in the history
  • Loading branch information
demoray authored Dec 6, 2023
1 parent 93f4c32 commit 5ceb125
Show file tree
Hide file tree
Showing 562 changed files with 1,800 additions and 1,517 deletions.
4 changes: 2 additions & 2 deletions services/autorust/codegen/src/cargo_toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{config_parser::Tag, jinja::CargoToml};
use camino::Utf8Path;

pub fn create(package_name: &str, tags: &[&Tag], default_tag: &Tag, has_xml: bool, path: &Utf8Path) -> Result<()> {
let default_feature = &default_tag.rust_feature_name();
let default_tag = &default_tag.rust_feature_name();

// https://docs.rs/about/metadata
// let docs_rs_features = docs_rs_features(tags, &default_feature);
Expand All @@ -12,7 +12,7 @@ pub fn create(package_name: &str, tags: &[&Tag], default_tag: &Tag, has_xml: boo
let azure_core_features = if has_xml { vec!["xml"] } else { Vec::new() };
let cargo_toml = CargoToml {
package_name,
default_feature,
default_tag,
features,
azure_core_features,
};
Expand Down
2 changes: 1 addition & 1 deletion services/autorust/codegen/src/jinja.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl<'a> CheckAllServicesYml<'a> {
#[template(path = "Cargo.toml.jinja")]
pub struct CargoToml<'a> {
pub package_name: &'a str,
pub default_feature: &'a str,
pub default_tag: &'a str,
pub features: Vec<String>,
pub azure_core_features: Vec<&'a str>,
}
Expand Down
2 changes: 1 addition & 1 deletion services/autorust/codegen/src/lib_rs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl ToTokens for BodyCode {
cfgs.extend(quote! {
#[cfg(feature = #feature_name)]
pub mod #mod_name;
#[cfg(all(feature = #feature_name, not(feature = "no-default-tag")))]
#[cfg(all(feature = #feature_name, not(feature = "without_tag_import")))]
pub use #mod_name::*;
});
}
Expand Down
5 changes: 3 additions & 2 deletions services/autorust/codegen/templates/Cargo.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ anyhow = "1.0"
all-features = true

[features]
default = ["{{default_feature}}", "enable_reqwest"]
default = ["default_tag", "enable_reqwest"]
enable_reqwest = ["azure_core/enable_reqwest"]
enable_reqwest_rustls = ["azure_core/enable_reqwest_rustls"]
no-default-tag = []
without_tag_import = []
default_tag = ["{{default_tag}}"]
{%- for feature in features %}
"{{feature}}" = []
{%- endfor %}
5 changes: 3 additions & 2 deletions services/mgmt/activedirectory/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions services/mgmt/activedirectory/src/lib.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions services/mgmt/addons/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions services/mgmt/addons/src/lib.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions services/mgmt/adhybridhealthservice/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion services/mgmt/adhybridhealthservice/src/lib.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions services/mgmt/adp/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions services/mgmt/adp/src/lib.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions services/mgmt/advisor/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions services/mgmt/advisor/src/lib.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions services/mgmt/agrifood/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions services/mgmt/agrifood/src/lib.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions services/mgmt/alertsmanagement/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions services/mgmt/alertsmanagement/src/lib.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions services/mgmt/analysisservices/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions services/mgmt/analysisservices/src/lib.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions services/mgmt/apicenter/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions services/mgmt/apicenter/src/lib.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions services/mgmt/apimanagement/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions services/mgmt/apimanagement/src/lib.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions services/mgmt/app/Cargo.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5ceb125

Please sign in to comment.