Merge "cargo_embargo: add option to set module visibility" am: 97f5616689 am: 5f1b7a1e59

Original change: https://android-review.googlesource.com/c/platform/development/+/2438516

Change-Id: I98bb519b530f8a4fef09f8679aee278fd9ae3466
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Frederick Mayle
2023-02-16 21:22:21 +00:00
committed by Automerger Merge Worker
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:?}"))?;