Lines Matching full:variants
18 //! have multiple "variants". A variant is a particular configuration for building a set of
19 //! packages, such as what feature flags to enable. Multiple variants are most often used to build
24 //! apply across all variants of a package), and a vector of `VariantConfig`s. There must be at
59 pub variants: Vec<VariantConfig>, field
60 /// Package specific config options across all variants.
80 /// Names of all fields in [`Config`] other than `variants` (which is treated specially).
99 // Flatten variants. First, get the variants from the config file. in from_json_str()
100 let mut variants = match config.remove("variants") { in from_json_str() localVariable
102 Some(_) => bail!("Failed to parse config: variants is not an array"), in from_json_str()
104 // There are no variants, so just put everything into a single variant. in from_json_str()
108 // Set default values in variants from top-level config. in from_json_str()
109 for variant in &mut variants { in from_json_str()
143 // Remove other entries from the top-level config, and put variants back. in from_json_str()
157 config.insert("variants".to_string(), Value::Array(variants)); in from_json_str()
170 // Factor out common options which are set for all variants. in to_json_string()
171 let Value::Array(mut variants) = config.remove("variants").unwrap() else { in to_json_string()
172 panic!("variants wasn't an array.") in to_json_string()
179 for (key, value) in variants[0].as_object().unwrap() { in to_json_string()
183 … // Check whether all other variants have the same entry for the same package. in to_json_string()
184 if variants[1..variants.len()].iter().all(|variant| { in to_json_string()
207 // Check whether all the other variants have the same entry. in to_json_string()
208 if variants[1..variants.len()] in to_json_string()
217 // Remove factored out common options from all variants. in to_json_string()
219 for variant in &mut variants { in to_json_string()
223 // Likewise, remove package options factored out from variants. in to_json_string()
226 for variant in &mut variants { in to_json_string()
238 for variant in &mut variants { in to_json_string()
247 // Put packages and variants back into the top-level config. in to_json_string()
248 if variants.len() > 1 || !variants[0].as_object().unwrap().is_empty() { in to_json_string()
249 config.insert("variants".to_string(), Value::Array(variants)); in to_json_string()
366 /// Cargo.toml file), for all variants.
488 "variants": [ in variant_config()
514 variants: vec![ in variant_config()
601 variants: vec![ in factor_variants()
659 "variants": [ in factor_variants()
681 variants: vec![VariantConfig { in factor_trivial_variant()