Files
build/tools/aconfig/tests/test.aconfig
Mårten Kongstad 6353c6c635 aconfig: require exactly one bug field
Some consumers of `aconfig dump` do not support multiple bugs. At the
same time, we want all flags to be associated with at least one bug.

Teach aconfig to require that the bug field in the flag_declaration and
parsed_flag proto messages appear exactly once.

This change could have been implemented as a change of `repeated` to
`optional` in the proto definition. However, the chosen approach, with a
runtime check, is easier to revert if we want to support multiple bugs
in the future.

Bug: 293156797
Test: m all_aconfig_declarations && printflags
Test: atest aconfig.test aconfig.test.java aconfig.test.cpp
Change-Id: Ib87dac68b392986a8daa64e56cd85477c92fbe83
2023-07-27 09:44:00 +02:00

43 lines
1.1 KiB
Plaintext

package: "com.android.aconfig.test"
# This flag's final value is calculated from:
# - test.aconfig: DISABLED + READ_WRITE (default)
# - first.values: DISABLED + READ_WRITE
# - second.values: ENABLED + READ_ONLY
flag {
name: "enabled_ro"
namespace: "aconfig_test"
description: "This flag is ENABLED + READ_ONLY"
bug: "abc"
}
# This flag's final value is calculated from:
# - test.aconfig: DISABLED + READ_WRITE (default)
# - first.values: ENABLED + READ_WRITE
flag {
name: "enabled_rw"
namespace: "aconfig_test"
description: "This flag is ENABLED + READ_WRITE"
# for bug fields, the empty string is a discouraged but valid value
bug: ""
}
# This flag's final value is calculated from:
# - test.aconfig: DISABLED + READ_WRITE (default)
# - first.values: DISABLED + READ_ONLY
flag {
name: "disabled_ro"
namespace: "aconfig_test"
description: "This flag is DISABLED + READ_ONLY"
bug: "123"
}
# This flag's final value is calculated from:
# - test.aconfig: DISABLED + READ_WRITE (default)
flag {
name: "disabled_rw"
namespace: "aconfig_test"
description: "This flag is DISABLED + READ_WRITE"
bug: "456"
}