aflags: Ensure <partition>/aconfig_flags.pb exists before reading

In some build targets/combinations aconfig_flags.pb
may not be generated.

For example in GSI only system/aconfig_flags.pb exists
and system-only updates won't have vendor/aconfig_flags.pb.

Test: m, aflags
Change-Id: I136345a8748bc6d80bd98e673f90e0a2ab380ab1
This commit is contained in:
Luca Stefani 2024-06-17 22:44:54 +02:00 committed by Bartłomiej Rudecki
parent a83dd3bc49
commit c5505418b4
Signed by: przekichane
GPG key ID: 751F23C6F014EF76

View file

@ -30,9 +30,11 @@ fn read_partition_paths() -> Vec<PathBuf> {
.collect() .collect()
} }
/// Determine all paths that contain an aconfig protobuf file. /// Determines all paths that contain an aconfig protobuf file,
/// filtering out nonexistent partition protobuf files.
pub fn parsed_flags_proto_paths() -> Result<Vec<PathBuf>> { pub fn parsed_flags_proto_paths() -> Result<Vec<PathBuf>> {
let mut result: Vec<PathBuf> = read_partition_paths(); let mut result: Vec<PathBuf> =
read_partition_paths().into_iter().filter(|s| s.exists()).collect();
for dir in fs::read_dir("/apex")? { for dir in fs::read_dir("/apex")? {
let dir = dir?; let dir = dir?;