The aconfig dump command can now limit which flags to print by passing
in one or more --filter=<query> commands.
If multiple --filter arguments are provided, flags that match any filter
will be included in the output.
The <query> syntax is <what>:<value>, where <what> is the name of a
ProtoParsedFlag field. Multiple queries can be AND-ed together by
joining them with a plus ('+') character.
Example queries:
- --filter='is_exported:true' # only show exported flags
- --filter='permission:READ_ONLY+state:ENABLED' # only show flags that are read-only and enabled
- --filter='permission:READ_ONLY' --filter='state:ENABLED' # only show flags that are read-only or enabled (or both)
Current limitations that may be addressed in future CLs:
- No support to invert a query, e.g. "flags *not* in the following
namespace"
- No support to quote strings; this makes description matching
difficult
- No support to glob strings, only exact matches are considered
- No support to filter by description, trace or metadata fields
Bug: 315487153
Test: atest aconfig.test
Test: printflags --format="{fully_qualified_name}={state}" --filter=permission:READ_ONLY # manually verify output
Change-Id: Ie1e40fa444cec429e336048439da955f30e22979
* changes:
aconfig: pass ownership of ProtoParsedFlag items to Java codegen
aconfig: pass ownership of ProtoParsedFlag items to C++ codegen
aconfig: pass ownership of ProtoParsedFlag items to Rust codegen
This is the first step towards teaching dump to (optionally) filter
which flags to print.
A follow-up CL will implement dump::create_filter_predicate.
Bug: 315487153
Test: atest aconfig.test
Change-Id: Ibe0d4ce6563d3b5718fedd3ebfd45fbf5d935b92
Teach `dump --format=<arg>` to format the output according to a
user-defined format string. The format string now accepts these
arguments:
- "protobuf": output all data as binary protobuf (as before)
- "textproto": output all data as text protobuf (as before)
- any other string: format according to the format spec, see below
Custom format spec: placeholders, enclosed in { and } and named after
the fields of ProtoParsedFlag, will be replaced by the actual values.
All other text is output verbatim. As an example:
- "{name}={state}" -> "enabled_ro=ENABLED"
Some fields support an alternative formatting via {<field>:<format>}. As
an example:
- "{name}={state:bool}" -> "enabled_ro=true"
Note that the text replacement does not support escaping { and }. This
means there is no way to print the string "{name}" without expanding it
to the actual flag's name. If needed this feature can be introduced in a
later CL.
For backwards compatibility, the following format strings have special
meaning and will produce an output identically to what it was before
this change:
- "text"
- "verbose"
- "bool"
A follow-up CL will add a new `dump --filter=` argument to limit which
parsed flags are included in the output.
Test: atest
Bug: b/315487153
Change-Id: If7c14b5fb3e7b41ea962425078bd04b4996318f4
Raising the go.mod version to 1.17 or higher enables module graph
pruning (https://go.dev/ref/mod#graph-pruning), which prevents the
go tools like "go build ./..." from loading unused transitive
dependencies, including ones that are missing from our tree.
Bug: 314133304
Test: prebuilts/build-tools/build-prebuilts.sh
Change-Id: If1cc0fda1dc744e65fc3367b7f44b8c91230e5ce
Pass ownership of the ProtoParsedFlag iterator items to the Java
codegen: this removes the need for an explicit lifetime annotation.
Bug: N/A
Test: atest aconfig.test
Change-Id: I78705b65b4cf41c3e23b59afbd122a029ee45df4
Pass ownership of the ProtoParsedFlag iterator items to the C++ codegen:
this removes the need for an explicit lifetime annotation.
Bug: N/A
Test: atest aconfig.test
Change-Id: Ic6606a9ab01ddcb61aa668d7ac901469b1e25a1f
Pass ownership of the ProtoParsedFlag iterator items to the Rust
codegen: this removes the need for an explicit lifetime annotation.
Bug: N/A
Test: atest aconfig.test
Change-Id: Ia37ff9f1238684ea31cda6be70acde54fdb04881
If the codegen mode is CodegenMode::Exported, the codegen should not
generate code including any non-exported flags. This change add a
function to filter the parsed flags before feeding to codegen.
Test: atest aconfig.test aconfig.test.java AconfigJavaHostTest
aconfig.test.cpp aconfig.test.cpp.test_mode aconfig.prod_mode.test.rust
Bug: 311152500
Change-Id: Ia88795bbd13774d02c76d8ab7ef20868149599b5
Add a new aconfig command called create-storage which takes a number
of aconfig cache files that belong to a specific container and produces
storage files.
Add a new module called storage (src/storage/mod.rs) as the entry point
of storage files generation. FlagPackage struct is defined as an
intermediate data structure that will be used to drive all storage files creation.
Add a unit test to lock down FlagPackage creation behaviors.
Bug: b/312243587
Test: atest aconfig.test
Change-Id: Ia7e9f68237ea903f295ac7891c923f6a39f3422d
FakeFeatureFlagsImpl still generated all flags in its mFlagMap field, but it should generate only exported flags in exported mode.
Test: atest aconfig.test.java
Bug: 311152507
Change-Id: I61843cd87b3bb5035772791a5869a91b07d574d8
The aconfig tests used to be implicitly run by Treehugger, but something
has changed and Treehugger no longer verifies aconfig uploads. Fix this
by explicitly listing all aconfig tests in the TEST_MAPPING file.
Treehugger does not allow new tests in presubmit before they have proven
themselves (in terms of flakiness and execution speed) in postsubmit.
For this reason this CL adds the tests to postsubmit; a follow-up CL
will move them to presubmit.
This has the added benefit of allowing developers to easily run all
tests locally, either by
$ atest
if current working directory is build/tools/aconfig or one of its
subdirectories, or
$ atest --test-mapping $(gettop)/build/tools/aconfig
from anywhere in the Android tree.
Also add all tests to "general-tests" to enable Treehugger to run them.
Move aconfig.test from "device-tests" to "general-tests"; the former
group is intended for tests that depend on device-specific
functionality. See [1] for more info.
1. https://source.android.com/docs/core/tests/development/test-mapping
Bug: N/A
Test: atest --test-mapping $(gettop)/build/tools/aconfig
Change-Id: If857733834c8ad43a16e6162e50e6b1f713f979d
The aconfig.test.cpp.test_mode test cases modify the local flag
overrides, but was not resetting the values between tests. This meant
that
$ atest 'aconfig.test.cpp.test_mode:AconfigTest#ResetFlagValue'
would succeed, but
$ atest aconfig.test.cpp.test_mode
would fail. Fix this by calling reset_flags() as part of the per-test
setup.
Bug: N/A
Test: atest aconfig.test.cpp.test_mode
Change-Id: Ic8cffff0deb279b7ae103c05642c67230afc040f
The issue was introduced in the last refactoring, but the logic using the function is currently not used so nothing is broken.
Bug: 303904827
Test: CIs
Change-Id: I428e5b8d525ec49d0d5f62b7fbcc54caf482ac59
Note a new cc_test target aconfig.test.cpp.test_mode is added instead of
reusing the old aconfig.test.cpp test target is becuase the test and
production version codegen flag lib has symbol conflict, one should only
link one at a a time.
Bug: b/291068147
Test: atest aconfig.test.cpp/aconfig.test.cpp.test_mode
Change-Id: Ifd52fd6eb7538fba90a13f0a6618a33a69b2358e
Consolidate the code generation sources into its own module. This is
done in preparation for when support for the new flag storage will be
added, which should also be placed in a separate module.
Bug: N/A
Test: atest aconfig.test aconfig.test.java
Change-Id: I8246729218ec60f2af4568c460e98329665a89fa
Add an extension trait to consolidate how the fully qualified package
name (<package>.<name>) is calculated and use this where possible.
This CL is a semantic change only. The intention of this CL is to reduce
the risk of future bugs.
Bug: N/A
Test: atest aconfig.test
Change-Id: Ibab6641dda3843337fbea02631c31a1fdd8fb4ab
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
Added a --vabc_cow_version flag to override cow version.
This enables testing on COW v3 without switching the android platform to
v3.
Test: th
Bug: 313962438
Change-Id: I9ff3ae6b6c7c8ef8c1423af6f25e420f94558d35