summaryrefslogtreecommitdiff
path: root/tools/aconfig/src/codegen
AgeCommit message (Collapse)Author
2024-01-24Restructure aconfig repo to be a cargo workspace with many crates Dennis Shen
This is cherry pick of aosp/2924191 to avoid merge conflict in git main Previously, aconfig repo is the root directory of aconfig binary crate, but it also hosts printflags crate inside, and there is no cargo support for printflags binary crate. In addition, with more aconfig development, more crates are being added to this repo. Thus this repo should be configured as a Cargo workspace with multiple crates rather than a single crate. Note the top level Cargo.toml file specifies the crates this workspace carries: (1) aconfig_protos: the proto library crate that will be used by many other crates such as aconfig binary crate and printflags binary crate (2) aconfig: the aconfig binary crate (3) printflags: the printflags binary crate (1) aconfig_protos crate setup: Inside aconfig_protos dir we set up the aconfig_protos crate, the previously src/proto.rs is now aconfig_protos/src/lib.rs, the build.rs is carried over to this crate. (2) aconfig binary crate setup: Notice its Cargo.toml file claims package dependency on aconfig_protos crate. It no longer carries proto related module and build.rs file. (3) printflags binary crate setup: Similary, notice that in its Cargo.toml file, it claims package dependency on aconfig_protos crate. With this setup, we can Cargo build/test each crate individually when inside a specific crate dir. But we can also run Cargo build/test at repo root level, which will build/test all the crates in this workplace. This is the structuring cl. The next cl is to move storage modules into its own library crate. This storage file library crate will be used by both aconfig binary crate as well as flag read library crate (to be created as another new crate here). Bug: b/321984352 Test: top and individual crate dir level Cargo build/test, m each individual targets Ignore-AOSP-First: cherrypick to git main to resolve merge conflict Change-Id: I75833f4997f7ee554ff6c1557df9ac87f62b2732
2024-01-08Merge "aconfig: simplify is_valid_container" into main Treehugger Robot
2024-01-08aconfig: simplify is_valid_container Mårten Kongstad
str::split always returns at least one item (the entire string) if the delimiter is not found. Simplify the implementation of is_valid_container accordingly. Bug: N/A Test: atest aconfig.test Change-Id: I3e92035309a7b019912710e42e69f9bdfa538795
2024-01-08aconfig: remove trailing whitespace in test input Mårten Kongstad
Bug: N/A Test: atest aconfig.test Change-Id: I248acae172fdeeb9ab9c4bb922f36b560cb44787
2024-01-03Merge "aconfig: add ForceReadOnly mode to aconfig c/c++ codegen" into main Zhi Dou
2024-01-03Merge "aconfig: add ForceReadOnly mode to aconfig rust codegen" into main Zhi Dou
2024-01-03aconfig: add ForceReadOnly mode to aconfig rust codegen Zhi Dou
This commit adds ForceReadOnly mode to rust codegen. Bug: 316357759 Test: atest aconfig.test aconfig.prod_mode.test.rust aconfig.test_mode.test.rust aconfig.exported_mode.test.rust aconfig.force_read_only_mode.test.rust Change-Id: I4cf98a6e9fc908fc372d4e68098a516808718c57
2024-01-03aconfig: add ForceReadOnly mode to aconfig java codegen Zhi Dou
This commit adds ForceReadOnly mode to java codegen. Bug: 316357759 Test: atest aconfig.test aconfig.test.java Change-Id: I10cd60def9ea20f7d56d87d18f680afeac61dc9d
2024-01-03aconfig: add ForceReadOnly mode to aconfig c/c++ codegen Zhi Dou
This commit adds ForceReadOnly mode to c/c++ codegen. Bug: 316357759 Test: atest aconfig.test aconfig.test.cpp aconfig.test.cpp.test_mode aconfig.test.cpp.exported_mode aconfig.test.cpp.force_read_only_mode Change-Id: I4842dd69993fe4fc1f504358f59513cf064919d9
2024-01-03aconfig: add new codegen mode force_read_only Zhi Dou
The "force_read_only" mode is designed for libraries shared among multiple containers for the following two scenarios where: 1. The library must be built with read_only flags or 2. Different containers requires different values for the same flags. In this mode, the library includes only non-exported flags, adhering to the concept that exported flags should maintain consistent values across containers. Additionally, regardless of their original permissions, all flags within this mode will be set to read_only. Bug: 316357759 Test: atest aconfig.test Change-Id: I65df39416c96404d84044a46bbcfe1bc8ce9ba8f
2023-12-19aconfig: modify and filter flags before passing into java codegen Zhi Dou
Before this change java codegen filter flags for exported mode in the template. This change move the filter process to commands as other codegen. Thus the codegen code will only generate code based on the passed in flags. Bug: 311152507 Test: atest aconfig.test aconfig.test.java AconfigJavaHostTest Change-Id: I74045709cde19e6c687c3eb0d94050ea40cf5042
2023-12-19aconfig: modify_parsed_flags_based_on_mode return Result Zhi Dou
This commit changes modify_parsed_flags_based_on_mode to return Result instead of vector. This change will have two consequences. 1. Error will be thrown if no flags fit into the current codegen mode 2. Error will be thrown if the flag declaration is empty Bug: 311152507 Test: atest aconfig.test Change-Id: I69b9a84312faed9f757bf3974b3cea49c5c5e285
2023-12-19aconfig: move CodegenMode to codegen crate Zhi Dou
This change moves CodegenMode to codegen crate. Bug: 311152507 Test: ateset aconfig.test Change-Id: I4f64cdbdc3d1b419412012560bfe03344b2b8faf
2023-12-19aconfig: add exported mode in rust codegen Zhi Dou
This commit adds exported mode to rust codegen. When the codegen mode is exported 1. only flags with exported: true will be generated 2. the generated getter should be in a read_write format and with default value as false, regardless the original permission and state of the flag This commit adds integration test for rust codegen exported mode. Bug: 316357104 Test: atest aconfig.test aconfig.test_mode.test.rust aconfig.exported_mode.test.rust Change-Id: Ib7dae666e13eb8898289b06d42a4f89326e175c4
2023-12-19aconfig: add new testing flag enabled_fixed_ro_exported Zhi Dou
This commit adds a new testing flag enabled_fixed_ro_exported to test the case of a exported and fixed_read_only flag. Test: atest aconfig.test aconfig.test.java AconfigJavaHostTest aconfig.test.cpp aconfig.test.cpp.test_mode aconfig.prod_mode.test.rust Bug: 316357680 Change-Id: Iaedb8a6875166c6a6d24c7c3deee701a496b4964
2023-12-19aconfig: add exported mode in c/c++ codegen Zhi Dou
This commit adds exported mode to c/c++ codegen. When the codegen mode is exported 1. only flags with exported: true will be generated 2. the generated getter should be in a read_write format and with default value as false, regardless the original permission and state of the flag This change moves process parsed_flags funciton into codegen crate. The process function is used to process parsed_flags based on the codegen mode. The template has also modified to keep readability. Bug: 316357680 Test: atest aconfig.test aconfig.test.cpp aconfig.test.cpp.test_mode Change-Id: I511e05ab93b07a04236055d956d1926f4ed89f36
2023-12-18aconfig: update c/c++ codegen Dennis Shen
1, Current codegen would still include an empty flag value cache even if there are no read write flags. This is important as the flag value cache is a std::vector. Thus adding this cache would automatically pull in libc++ dependency which we should not. 2, There lacks of c/c++ codegen unit tests to lock down the generated code when a flag package contains only read only flags. It should not include server_configurable_flags header. And it should not include the flag cache. Bug: b/316614694 Test: atest aconfig.test Change-Id: Iee4366672932ee507694f5fc73b526c66fcf0e9b
2023-12-14aconfig: pass ownership of ProtoParsedFlag items to Java codegen Mårten Kongstad
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
2023-12-14aconfig: pass ownership of ProtoParsedFlag items to C++ codegen Mårten Kongstad
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
2023-12-14aconfig: pass ownership of ProtoParsedFlag items to Rust codegen Mårten Kongstad
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
2023-12-12aconfig: fix template bug in exported mode. Ted Bauer
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
2023-12-11aconfig: Respect flag naming convention on test flags Oriol Prieto Gasco
Test: atest aconfig.test Bug: 311152507 Change-Id: I960867d32415007db5dacab57e97b813cbbee650
2023-12-08aconfig: move codegen into separate module Mårten Kongstad
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