Loading tools/aconfig/src/commands.rs +2 −0 Original line number Original line Diff line number Diff line Loading @@ -127,6 +127,8 @@ pub fn parse_flags(package: &str, declarations: Vec<Input>, values: Vec<Input>) } } } } // Create a sorted parsed_flags crate::protos::parsed_flags::sort_parsed_flags(&mut parsed_flags); crate::protos::parsed_flags::verify_fields(&parsed_flags)?; crate::protos::parsed_flags::verify_fields(&parsed_flags)?; let mut output = Vec::new(); let mut output = Vec::new(); parsed_flags.write_to_vec(&mut output)?; parsed_flags.write_to_vec(&mut output)?; Loading tools/aconfig/src/protos.rs +4 −0 Original line number Original line Diff line number Diff line Loading @@ -255,6 +255,10 @@ pub mod parsed_flags { Ok(merged) 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 { fn create_sorting_key(pf: &ProtoParsedFlag) -> String { format!("{}.{}", pf.package(), pf.name()) format!("{}.{}", pf.package(), pf.name()) } } Loading tools/aconfig/tests/test.aconfig +17 −17 Original line number Original line Diff line number Diff line Loading @@ -2,41 +2,41 @@ package: "com.android.aconfig.test" # This flag's final value is calculated from: # This flag's final value is calculated from: # - test.aconfig: DISABLED + READ_WRITE (default) # - test.aconfig: DISABLED + READ_WRITE (default) # - first.values: DISABLED + READ_ONLY # - first.values: DISABLED + READ_WRITE # - second.values: ENABLED + READ_ONLY flag { flag { name: "disabled_ro" name: "enabled_ro" namespace: "aconfig_test" namespace: "aconfig_test" description: "This flag is DISABLED + READ_ONLY" description: "This flag is ENABLED + READ_ONLY" bug: "123" bug: "789" bug: "abc" } } # This flag's final value is calculated from: # This flag's final value is calculated from: # - test.aconfig: DISABLED + READ_WRITE (default) # - test.aconfig: DISABLED + READ_WRITE (default) # - first.values: ENABLED + READ_WRITE flag { flag { name: "disabled_rw" name: "enabled_rw" namespace: "aconfig_test" namespace: "aconfig_test" description: "This flag is DISABLED + READ_WRITE" description: "This flag is ENABLED + READ_WRITE" bug: "456" # no bug field: bug is not mandatory } } # This flag's final value is calculated from: # This flag's final value is calculated from: # - test.aconfig: DISABLED + READ_WRITE (default) # - test.aconfig: DISABLED + READ_WRITE (default) # - first.values: DISABLED + READ_WRITE # - first.values: DISABLED + READ_ONLY # - second.values: ENABLED + READ_ONLY flag { flag { name: "enabled_ro" name: "disabled_ro" namespace: "aconfig_test" namespace: "aconfig_test" description: "This flag is ENABLED + READ_ONLY" description: "This flag is DISABLED + READ_ONLY" bug: "789" bug: "123" bug: "abc" } } # This flag's final value is calculated from: # This flag's final value is calculated from: # - test.aconfig: DISABLED + READ_WRITE (default) # - test.aconfig: DISABLED + READ_WRITE (default) # - first.values: ENABLED + READ_WRITE flag { flag { name: "enabled_rw" name: "disabled_rw" namespace: "aconfig_test" namespace: "aconfig_test" description: "This flag is ENABLED + READ_WRITE" description: "This flag is DISABLED + READ_WRITE" # no bug field: bug is not mandatory bug: "456" } } Loading
tools/aconfig/src/commands.rs +2 −0 Original line number Original line Diff line number Diff line Loading @@ -127,6 +127,8 @@ pub fn parse_flags(package: &str, declarations: Vec<Input>, values: Vec<Input>) } } } } // Create a sorted parsed_flags crate::protos::parsed_flags::sort_parsed_flags(&mut parsed_flags); crate::protos::parsed_flags::verify_fields(&parsed_flags)?; crate::protos::parsed_flags::verify_fields(&parsed_flags)?; let mut output = Vec::new(); let mut output = Vec::new(); parsed_flags.write_to_vec(&mut output)?; parsed_flags.write_to_vec(&mut output)?; Loading
tools/aconfig/src/protos.rs +4 −0 Original line number Original line Diff line number Diff line Loading @@ -255,6 +255,10 @@ pub mod parsed_flags { Ok(merged) 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 { fn create_sorting_key(pf: &ProtoParsedFlag) -> String { format!("{}.{}", pf.package(), pf.name()) format!("{}.{}", pf.package(), pf.name()) } } Loading
tools/aconfig/tests/test.aconfig +17 −17 Original line number Original line Diff line number Diff line Loading @@ -2,41 +2,41 @@ package: "com.android.aconfig.test" # This flag's final value is calculated from: # This flag's final value is calculated from: # - test.aconfig: DISABLED + READ_WRITE (default) # - test.aconfig: DISABLED + READ_WRITE (default) # - first.values: DISABLED + READ_ONLY # - first.values: DISABLED + READ_WRITE # - second.values: ENABLED + READ_ONLY flag { flag { name: "disabled_ro" name: "enabled_ro" namespace: "aconfig_test" namespace: "aconfig_test" description: "This flag is DISABLED + READ_ONLY" description: "This flag is ENABLED + READ_ONLY" bug: "123" bug: "789" bug: "abc" } } # This flag's final value is calculated from: # This flag's final value is calculated from: # - test.aconfig: DISABLED + READ_WRITE (default) # - test.aconfig: DISABLED + READ_WRITE (default) # - first.values: ENABLED + READ_WRITE flag { flag { name: "disabled_rw" name: "enabled_rw" namespace: "aconfig_test" namespace: "aconfig_test" description: "This flag is DISABLED + READ_WRITE" description: "This flag is ENABLED + READ_WRITE" bug: "456" # no bug field: bug is not mandatory } } # This flag's final value is calculated from: # This flag's final value is calculated from: # - test.aconfig: DISABLED + READ_WRITE (default) # - test.aconfig: DISABLED + READ_WRITE (default) # - first.values: DISABLED + READ_WRITE # - first.values: DISABLED + READ_ONLY # - second.values: ENABLED + READ_ONLY flag { flag { name: "enabled_ro" name: "disabled_ro" namespace: "aconfig_test" namespace: "aconfig_test" description: "This flag is ENABLED + READ_ONLY" description: "This flag is DISABLED + READ_ONLY" bug: "789" bug: "123" bug: "abc" } } # This flag's final value is calculated from: # This flag's final value is calculated from: # - test.aconfig: DISABLED + READ_WRITE (default) # - test.aconfig: DISABLED + READ_WRITE (default) # - first.values: ENABLED + READ_WRITE flag { flag { name: "enabled_rw" name: "disabled_rw" namespace: "aconfig_test" namespace: "aconfig_test" description: "This flag is ENABLED + READ_WRITE" description: "This flag is DISABLED + READ_WRITE" # no bug field: bug is not mandatory bug: "456" } }