Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a95f2b23 authored by Jihoon Kang's avatar Jihoon Kang
Browse files

Add new dump format map in aconfig

The `aconfig dump --format map` lists aconfig keys mapped to its boolean
values that represents whether the flag is enabled or not, as seen below:
```
flag.name1=true
flag.name2=false
```

Test: aconfig dump --format map --cache out/soong/.intermediates/build/make/tools/aconfig/aconfig.test.flags/intermediate.pb && inspect output
Bug: 306024510
Change-Id: Ic4990c168f6fa9c87869113ba695c07394adbc67
parent 2118e738
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -268,6 +268,7 @@ pub enum DumpFormat {
    Verbose,
    Verbose,
    Protobuf,
    Protobuf,
    Textproto,
    Textproto,
    Bool,
}
}


pub fn dump_parsed_flags(
pub fn dump_parsed_flags(
@@ -318,6 +319,17 @@ pub fn dump_parsed_flags(
            let s = protobuf::text_format::print_to_string_pretty(&parsed_flags);
            let s = protobuf::text_format::print_to_string_pretty(&parsed_flags);
            output.extend_from_slice(s.as_bytes());
            output.extend_from_slice(s.as_bytes());
        }
        }
        DumpFormat::Bool => {
            for parsed_flag in parsed_flags.parsed_flag.into_iter() {
                let line = format!(
                    "{}.{}={:?}\n",
                    parsed_flag.package(),
                    parsed_flag.name(),
                    parsed_flag.state() == ProtoFlagState::ENABLED
                );
                output.extend_from_slice(line.as_bytes());
            }
        }
    }
    }
    Ok(output)
    Ok(output)
}
}