Allow multiple entries for license_text.
Test: Ran on unicode-ident crate
Change-Id: I689c67923384cc50425999d37bdb06e1d9c37031
diff --git a/tools/cargo_embargo/src/config.rs b/tools/cargo_embargo/src/config.rs
index 77b9b24..1b6bc43 100644
--- a/tools/cargo_embargo/src/config.rs
+++ b/tools/cargo_embargo/src/config.rs
@@ -379,7 +379,7 @@
/// `license_text` to use for `license` module, overriding the `license_file` given by the
/// package or the default "LICENSE".
#[serde(skip_serializing_if = "Option::is_none")]
- pub license_text: Option<String>,
+ pub license_text: Option<Vec<String>>,
}
impl PackageConfig {
diff --git a/tools/cargo_embargo/src/main.rs b/tools/cargo_embargo/src/main.rs
index 48d1d87..a84dd08 100644
--- a/tools/cargo_embargo/src/main.rs
+++ b/tools/cargo_embargo/src/main.rs
@@ -719,12 +719,10 @@
.map(|license| format!("SPDX-license-identifier-{}", license))
.collect::<Vec<_>>(),
);
- let license_text = package_cfg
- .license_text
- .as_deref()
- .unwrap_or_else(|| first.license_file.as_deref().unwrap_or("LICENSE"))
- .to_string();
- license_module.props.set("license_text", vec![license_text]);
+ let license_text = package_cfg.license_text.clone().unwrap_or_else(|| {
+ vec![first.license_file.as_deref().unwrap_or("LICENSE").to_string()]
+ });
+ license_module.props.set("license_text", license_text);
modules.push(license_module);
let mut bp_contents = "// This file is generated by cargo_embargo.\n".to_owned()