Commit Graph

8509 Commits

Author SHA1 Message Date
Treehugger Robot
975aac4d8c Merge "aconfig: restructure integration tests" into main am: dce1fabf80 am: e182021f83
Original change: https://android-review.googlesource.com/c/platform/build/+/2672875

Change-Id: Id0de20622d2d3d97e925fdae8e33f1ddb0022d0f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-24 15:05:15 +00:00
Mårten Kongstad
af3da9d1be aconfig: restructure integration tests
Consolidate integration tests under tests/. Rename build targets to
follow the same pattern.

The important aconfig build targets are:

  - aconfig           : the aconfig binary
  - aconfig.test      : the aconfig unit tests
  - aconfig.test.java : the Java integration tests
  - aconfig.test.cpp  : the C++ integration tests
  - aconfig.test.rust : the Rust integration tests (not implemented yet)

Note: the Rust integration tests are blocked until the build system has
added support for aconfig Rust libraries.

Note: the flags used in the integration are not set correctly. A
follow-up CL will fix this.

Bug: 283911467
Test: atest aconfig.test.java aconfig.test.cpp
Change-Id: Idb8dad4c38a49231c2e89228775bacf065ee1f57
2023-07-24 13:05:43 +02:00
Treehugger Robot
5815ece200 Merge "Make aconfig c++ generate only one header and only one .cc file" into main am: 289fdf213a am: c943f4c1e5
Original change: https://android-review.googlesource.com/c/platform/build/+/2662943

Change-Id: I36b282a8ad6a22c265fa061d914cf6b3601d0a87
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-21 20:02:19 +00:00
Joe Onorato
ac692c5eae Make aconfig c++ generate only one header and only one .cc file
Bug: 283479529
Test: m aconfig_hello_world_cc && adb push $TOP/out/target/product/panther/system/bin/aconfig_hello_world_cc /system/bin && adb shell aconfig_hello_world_cc
Change-Id: I1890aff70262343e18a62fb2efb2fd0e13a48fb2
2023-07-21 09:12:01 -07:00
Treehugger Robot
6887c24bf9 Merge changes from topic "aconfig-improve-dump-formats" into main am: 08cb169cbe am: b34658e2cb
Original change: https://android-review.googlesource.com/c/platform/build/+/2666957

Change-Id: I00393047fdb95d0f73e951db487bf09167e6545e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-20 13:53:43 +00:00
Treehugger Robot
72a31fb331 Merge "aconfig: fix broken auto-generated Rust code" into main am: 9726e805b3 am: 5c2a6b4c79
Original change: https://android-review.googlesource.com/c/platform/build/+/2664937

Change-Id: I8a990c74ec5a92b7f20bc00b4a48cfd5594bf393
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-20 13:53:03 +00:00
Treehugger Robot
08cb169cbe Merge changes from topic "aconfig-improve-dump-formats" into main
* changes:
  aconfig: add 'verbose' dump format
  aconfig: improve the 'text' dump format
  aconfig: remove the 'debug' dump format
2023-07-20 12:35:57 +00:00
Mårten Kongstad
2d5309cab1 aconfig: fix broken auto-generated Rust code
Fix syntax error in auto-generated Rust code that prevents the code from
compiling.

For reference, the error was:

---- 8< ----
error: expected `where`, `{`, `(`, or `;` after struct name, found keyword `impl`
 --> .../src/lib.rs:6:1
  |
6 | impl FlagProvider {
  | ^^^^ expected `where`, `{`, `(`, or `;` after struct name
---- >8 ----

Bug: 292052163
Test: manual: create sample based on auto-generated Rust lib
Change-Id: I4c029c0ee16ea3849e7bbe381717a10402c9cb81
2023-07-20 11:33:19 +02:00
Mårten Kongstad
ea4981407b aconfig: add 'verbose' dump format
Add a new --format=verbose dump output format. This is identical to the
default 'text' format but includes the source files from which the flag
declaration and values were read, and is intended to help debug why a
flag isn't set to some expected value.

Bug: 283910447
Test: atest aconfig.test
Test: printflags --format=verbose # manually inspect output
Change-Id: I03a1c8d940e7a0c6f91e986c5bafa4aa6cd1125a
2023-07-20 11:07:35 +02:00
Mårten Kongstad
76275e213e Merge "Aconfig: sort the parsed flag order in create-cache" into main am: 9c3502d4b4 am: dbdc5d2265
Original change: https://android-review.googlesource.com/c/platform/build/+/2665656

Change-Id: I177f1be6fd2bfaee467596f0e0c720c5a4660fa0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-20 08:05:41 +00:00
Mårten Kongstad
3fa2f078ff aconfig: improve the 'text' dump format
Standardize the flag values as '<permission> + <state>', e.g.
'READ_ONLY + ENABLED'.

Bug: 283910447
Test: atest aconfig.test
Test: printflags # manually inspect output
Change-Id: I60f74196816327613bd8165a688f8b36da5bdac7
2023-07-20 09:35:05 +02:00
Mårten Kongstad
9338007cff aconfig: remove the 'debug' dump format
The --format=debug dump output format is largely superseded by the
textproto format now that aconfig doesn't use hand-written wrappers
around the auto-generated proto struct anymore. Remove the format to
reduce the risk of code rot.

Bug: 283910447
Test: atest aconfig.test
Change-Id: I6700fc4eafd3fa3a63952109c0105d34c7ffd98b
2023-07-20 09:25:56 +02:00
Zhi Dou
92cf0ec232 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
2023-07-20 02:32:00 +00:00
Dennis Shen
da94a6cf48 Merge "aconfig: Rust codegen 2nd iteration" into main am: dca368be45 am: 83ec2fc8a6
Original change: https://android-review.googlesource.com/c/platform/build/+/2660115

Change-Id: Ia271de0bb9f4be0765db89db83d0c652ad0f1f31
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-18 21:49:49 +00:00
Dennis Shen
3cfbcf5384 aconfig: Rust codegen 2nd iteration
Introduce rust codegen 2nd iteration with unit test support. The design
is described in detail in the design doc (go/aconfig_rust_codegen). The general idea is to generate
different code with the same signature for production and test build
targets, just like java/c/cpp codegen.

We will have a FlagProvider struct that has flag methods implementation.
This flag provider instance can then be used in injection pattern. In
additon, we also generate top level functions that wraps around flag
provider call so it can be used in static function style.

Things to be decided later:

should we just generate one set of code, and use cfg! as compile
time marco to compile the right code for the right targets.

Bug: b/279483360
Test: atest aconfig.test
Change-Id: Ic75cedbd0d27b5242014c3ac7fc80692d2ab4589
2023-07-18 20:14:46 +00:00
Dennis Shen
f146939ac5 Merge "Minor c/c++ codegen update" into main am: 01332169f3 am: 4222b4f0b5
Original change: https://android-review.googlesource.com/c/platform/build/+/2657598

Change-Id: Icbc6b5a081b7c95561c632788f282a244b28df0b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 14:14:54 +00:00
Dennis Shen
01332169f3 Merge "Minor c/c++ codegen update" into main 2023-07-17 12:58:23 +00:00
Treehugger Robot
ba0228c9c0 Merge "Disable copying images for target_files.zip" into main am: f1f3e38b64 am: ddd017226a
Original change: https://android-review.googlesource.com/c/platform/build/+/2658156

Change-Id: Ibf02cdf1da9866a4a159e3a0bf05ad5a204973f6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 01:05:04 +00:00
Justin Yun
22ce9479be Disable copying images for target_files.zip
For the OTA build, target_files.zip requires setting fixed timestamp
for images. However, it caused regression on 'adb sync'.
Restoring image build process for target_files.zip instead of copying
them from the PRODUCT_OUT, only the images in target_files.zip set the
fixed timestamp.
By setting COPY_IMAGES_FOR_TARGET_FILES_ZIP flag, we still may copy
the images for target_files.zip for future use.

Bug: 287534409
Test: m; flashall; adb sync
Test: m dist; flash images from target_files.zip and check the timestamp
Change-Id: I4135eb721c33581f191621847e6595833263d707
2023-07-17 07:46:48 +09:00
Dennis Shen
5c2421394c Minor c/c++ codegen update
1, Moved "#include <string>" from exported header to test flag provider
header file.

2, For production target and read only flags, the generated c
api should just return default value instead of calling into c++ api

3, Remove using namespace server_configurable_flags from header, instead
of just having the namespace to be spelled out in each api call. Having
using namespace xxx in header is not a c++ best practice.

4, Replace #ifdef #def #endif with #pragma once

Bug: b/279483801
Test: atest aconfig.test
Change-Id: I3e55a7b14301f3de419795467f33e2dc889d371e
2023-07-14 16:09:35 +00:00
Dennis Shen
c3d0c4834c Merge "aconfig: update c/c++ codegen" into main am: 21380611d4 am: 13f12e639a
Original change: https://android-review.googlesource.com/c/platform/build/+/2657839

Change-Id: I42400aab2e18ac48bc4147da6ea06dc30f9b543c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-14 15:03:19 +00:00
Dennis Shen
17a08eeca0 aconfig: update c/c++ codegen
Two major changes to c/c++ codegen

(1) explicit setter for each flag instead of a generic flag setter
void override_flag(std::string name, bool val) is replaced with

void <flag name>(bool val) for each flag name

This has several advantages:
  (a) generated code is more c++ idomatic
  (b) no longer need to create flag name string constants
  (c) any typo in the code is caught early in the build time

(2) remove flag setter and flag override reset methods/functions when
generating code targets for production. If developers want to update
their main function to take command line arg for flag overrides, they
can use compile time macros to decide if the flag override code should
be included.

Bug: b/279483801
Test: atest aconfig.test
Change-Id: I6141f7f979b32fe0426154d578edeb997ae5ff7c
2023-07-14 11:40:49 +00:00
Dennis Shen
008d729b86 Merge "aconfig: add c codegen" into main am: afd8b2d75b am: 24ecb48d89 am: f91df0cd73
Original change: https://android-review.googlesource.com/c/platform/build/+/2653700

Change-Id: I973f5fd0d11a97d92fa795b074ff9a922b6065dc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-13 16:05:32 +00:00
Dennis Shen
7321f4f6f1 aconfig: add c codegen
c codegen can be done at the same time with cpp codegen, the idea is to
create a c compatible header that defines the flag apis, including flag
override apis for test. then in the corresponding cpp file, the
implementation simply calls into cpp api.

c header supports static method interface, and unit test override, but
it does not support injection pattern compared to cpp header

Bug: b/279483801
Test: atest aconfig.test
Change-Id: Ie62b76d6524e443de5d3c2f9000f7f66623ab571
2023-07-13 13:55:06 +00:00
Tiffany Yang
20dbd142b6 Merge "Make common signature system property definitions optional" into main am: b8306086d3 am: e728051f12 am: 13ba580f9f
Original change: https://android-review.googlesource.com/c/platform/build/+/2609473

Change-Id: I5014024fae5b0c896aa0898d2c71faea453677e4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-12 20:23:18 +00:00
Tiffany Yang
b8306086d3 Merge "Make common signature system property definitions optional" into main 2023-07-12 18:35:37 +00:00
Cole Faust
ef48661524 Merge "Remove BOARD_BPT* variables and the bpt parition table image" into main am: f5350e965b am: 735fe49732 am: 9aa95a1fb0
Original change: https://android-review.googlesource.com/c/platform/build/+/2654584

Change-Id: Idf53f15a27c874b1a3f628a6213da5f37a15ebbe
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-12 03:41:38 +00:00
Cole Faust
f5350e965b Merge "Remove BOARD_BPT* variables and the bpt parition table image" into main 2023-07-12 01:26:51 +00:00
Cole Faust
4f3dc8759f Remove BOARD_BPT* variables and the bpt parition table image
These variables appear to never be set.

Test: Presubmits
Change-Id: If4b89376f73204ad5780dff421f1216da255c3eb
2023-07-11 16:58:06 -07:00
Tiffany Yang
19450e3a0b Make common signature system property definitions optional
This change allows ARC to define ARC-specific system properties in
Android build without changing these property definitions for other
Android builds. Please see go/arc-sigprop-changes and
go/arc-android-sigprop-sync for additional details.

Bug: 195609932
Test: built bertha_x86_64 with forward declarations
Change-Id: I22bd9d60c2491506fe5c633dbbb9e7516f529b35
2023-07-11 22:40:19 +00:00
Kelvin Zhang
73825c069b Merge "Mark extracted files as executable" into main am: f3f6d0569b am: 64f1b4f339 am: 80f171b4dc
Original change: https://android-review.googlesource.com/c/platform/build/+/2650068

Change-Id: I28d7ffb55385a5c5b5a87b6311c3b9a77a70d320
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-11 19:39:42 +00:00
Elliott Hughes
7a75419a51 Merge "Switch from minigzip to gzip." into main am: c1577ff58b am: f94ff9146d am: d9cdcba928
Original change: https://android-review.googlesource.com/c/platform/build/+/2632009

Change-Id: I9e0fe8aff864b5423a0a9c066838e76c1cea98a7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-11 18:25:43 +00:00
Kelvin Zhang
f3f6d0569b Merge "Mark extracted files as executable" into main 2023-07-11 17:39:31 +00:00
Elliott Hughes
c1577ff58b Merge "Switch from minigzip to gzip." into main 2023-07-11 15:52:27 +00:00
Treehugger Robot
32c45b78da Merge "aconfig: cpp codegen update: Move server_configurable_flags header include" into main am: db2c2d2377 am: a89218087e am: 3eccd72fa3
Original change: https://android-review.googlesource.com/c/platform/build/+/2652484

Change-Id: Ief5bc225f7fcb1be7f921a7e327fc30dc4530c22
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-11 10:38:49 +00:00
Kelvin Zhang
4cb28f6f80 Mark extracted files as executable
Python's zipfile doens't restore file permission by default, so we need
to manually restore permission.

Test: th
Bug: 290643514
Change-Id: I89c1e2ee178b534fa7e3f02afd04d170100d37e7
2023-07-10 13:03:07 -07:00
Dennis Shen
e398144643 aconfig: cpp codegen update: Move server_configurable_flags header include
Move server_configurable_flags header include away from exported header,
instead put it in the flag provider headers. Otherwise, it can cause
compilation error if the source code who wants to use the generated c flag lib has
not added dependency on server_configurable_flags yet.

Bug: b/279483801
Test: atest aconfig.test
Change-Id: Ib75877ee88f995caf72b3fd2554c3da195032c14
2023-07-10 18:19:44 +00:00
Treehugger Robot
c1b660cb76 Merge "aconfig: improve duplicate flags error message: include paths" into main am: 4fb5cb01f1 am: a41c49f15f am: 7753deff07
Original change: https://android-review.googlesource.com/c/platform/build/+/2650121

Change-Id: I0ead33b5508e075fcc35b55b24ec61b875063344
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-07 15:26:41 +00:00
Mårten Kongstad
206a382d4e aconfig: improve duplicate flags error message: include paths
Improve the error message returned when `aconfig dump` is fed multiple
declarations of the same flag: include the paths to the declaration
files.

In general all error messages from the protos::*::verify_* functions
should include paths to the offending files. This will be handled in a
follow-up CL.

Bug: 290300657
Test: atest aconfig.test
Test: manual: add duplicate flag and run `m all_aconfig_declarations`, inspect error message
Change-Id: I46dc23f7128dd5c68ced9f2e8518cfa89d81c2df
2023-07-07 08:52:52 +02:00
Wenshan Fu
8def391348 Merge "aconfig: create java libraries for aconfig proto" am: a2d93ae1eb am: c522f116cb am: 80fd7410de
Original change: https://android-review.googlesource.com/c/platform/build/+/2648125

Change-Id: I65004e5d600271caa42b011e122384f1fea07314
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-06 04:40:03 +00:00
Wenshan Fu
a2d93ae1eb Merge "aconfig: create java libraries for aconfig proto" 2023-07-06 01:51:08 +00:00
Dennis Shen
e9eb13602e Merge "cpp codegen redesign, unit test support" am: 99d4a49d68 am: 6f1c3fe881 am: 06aefcba67
Original change: https://android-review.googlesource.com/c/platform/build/+/2642133

Change-Id: Ibc32b6ac8f7e4897545cdee7c6ddb9556bceaa1d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-05 21:04:41 +00:00
Dennis Shen
8d544f7439 cpp codegen redesign, unit test support
cpp codegen iteration 2, based on discussions with three internal teams
that use c++. Refer to the design doc "aconfig c++ codegen" for detailed
design. At a high level, we generate two sets of code artifacts with the
same signatured api: one for production that without any local flag
override capability, one for unit test that allows local flag overrides.
It supports static methods style interface as well as injection pattern.

Refer to the test points in the codegen_cpp.rs for examples of generated
code.

for production target codegen: aconfig create-cpp-lib --cache <cache> --out <out dir>
for test target codegen: aconfig create-cpp-lib --cache <cache> --out
<out dir> --mode test

Bug: b/279483801
Test: atest aconfig.test
Change-Id: I92fefb9623d5435525339a74f57bbd36d0afef08
2023-07-05 14:05:44 +00:00
Wenshan Fu
89467c3109 aconfig: create java libraries for aconfig proto
Host side test infra needs the library to consume the dumped flags info
generated by aconfig.

Test: m libaconfig_java_proto_lite libaconfig_java_proto_full
Bug: 289906970
Change-Id: I9891cb8445b90f7269e0c679ceaae6bc102bbb0c
2023-07-05 13:57:19 +00:00
Wenshan Fu
7ce48d4db2 Merge "Create the TEST_MAPPING file" am: e0b709b9a6 am: 5a80e2617d am: a49ad1b8df
Original change: https://android-review.googlesource.com/c/platform/build/+/2643392

Change-Id: Icbefbf1f0a16c839653bc9b1473a7731ac9bf72c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-04 02:45:52 +00:00
Wenshan Fu
e0b709b9a6 Merge "Create the TEST_MAPPING file" 2023-07-04 00:44:05 +00:00
Zhi Dou
91e1613e28 Merge changes I4bf1d3ba,I33605054 am: 7734879e69 am: e911b7cf7c am: 45842104d2
Original change: https://android-review.googlesource.com/c/platform/build/+/2643057

Change-Id: I2eb9f781050cb95871928e308ef35ea3967ead6d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-30 15:35:38 +00:00
Zhi Dou
7734879e69 Merge changes I4bf1d3ba,I33605054
* changes:
  aconfig: Add resetAll method to test mode FeatureFlagsImpl
  aconfig: remove extra new lines and spaces in generated java code
2023-06-30 13:23:28 +00:00
Treehugger Robot
4c9218ea79 Merge "Add --classes optional flag in list_files" am: 32efc846f5 am: 46c121d2a7 am: 4c589c7216
Original change: https://android-review.googlesource.com/c/platform/build/+/2635796

Change-Id: Ia909f185c3152d6c473b9b4b2772edbd2cbfc5f1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-30 11:45:13 +00:00
Treehugger Robot
32efc846f5 Merge "Add --classes optional flag in list_files" 2023-06-30 09:36:42 +00:00