Aconfig: sort the parsed flag order in create-cache
This change will sorted the parsed flags from the declarations. Without
this change the code will expect the passed in declarations sorted.
After this change the code will still guarantee the parsed flags in the
cache is sorted, but it won't expect the passed in declarations are
sorted
Test: atest aconfig.test
Bug: 291926035
Change-Id: I5f0637fe770003224b128591890e04277bc09345
diff --git a/tools/aconfig/src/protos.rs b/tools/aconfig/src/protos.rs
index a621b87..4ddada7 100644
--- a/tools/aconfig/src/protos.rs
+++ b/tools/aconfig/src/protos.rs
@@ -255,6 +255,10 @@
Ok(merged)
}
+ pub fn sort_parsed_flags(pf: &mut ProtoParsedFlags) {
+ pf.parsed_flag.sort_by_key(create_sorting_key);
+ }
+
fn create_sorting_key(pf: &ProtoParsedFlag) -> String {
format!("{}.{}", pf.package(), pf.name())
}