Merge "cargo_embargo: add option to set module visibility"

This commit is contained in:
Frederick Mayle
2023-02-16 19:26:27 +00:00
committed by Gerrit Code Review
2 changed files with 8 additions and 0 deletions

View File

@@ -118,6 +118,7 @@ impl BpProperties {
"target",
"ld_flags",
"apex_available",
"visibility",
];
let mut props: Vec<(&String, &BpValue)> = self.map.iter().collect();
props.sort_by_key(|(k, _)| {

View File

@@ -103,6 +103,9 @@ struct Config {
/// Modules in this list will not be generated.
#[serde(default)]
module_blocklist: Vec<String>,
/// Modules name => Soong "visibility" property.
#[serde(default)]
module_visibility: BTreeMap<String, Vec<String>>,
}
/// Options that apply to everything in a package (i.e. everything associated with a particular
@@ -569,6 +572,10 @@ fn crate_to_bp_modules(
m.props.set("apex_available", cfg.apex_available.clone());
}
if let Some(visibility) = cfg.module_visibility.get(module_name) {
m.props.set("visibility", visibility.clone());
}
if let Some(path) = &package_cfg.add_module_block {
let content = std::fs::read_to_string(path)
.with_context(|| format!("failed to read {path:?}"))?;