Commit graph

30 commits

Author SHA1 Message Date
Yu Liu
eeff222655 Pass "--container" to aconfig create-cache
Bug: 328823994
Test: unit tests and manual tests locally.

Ignore-AOSP-First: It is easier to detect all the mismatch in internal
master.
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:b75ed0f2d8c4d13924573fd065c9706475aac17b)
Merged-In: I096877015b78786639376b279a9be5d07594d92e
Change-Id: I096877015b78786639376b279a9be5d07594d92e
2024-03-19 23:07:34 +00:00
Yu Liu
67a28425a7 Validate aconfig libs are built with the correct modes.
Bug: 323071835
Test: Unit tests and manual tests.
Change-Id: I32de90826c7c8bb4d8495608e959d554820ab9a2
2024-03-07 18:51:16 +00:00
Yu Liu
864fd2f1f5 Merge "Support aconfig stoage files for apex." into main 2024-02-21 17:42:58 +00:00
Mårten Kongstad
2a1adcc63a Include all_aconfig_declarations in sdk dist
Include all_aconfig_declarations in the sdk dist directory, in both
binary protobuf (for machine consumption) and text protobuf (for human
consumption) format.

Bug: 324281288
Test: m sdk dist && test -e out/dist/flags.pb && test -e out/dist/flags.textproto
Change-Id: Icfb4841c3fe6478ddc233ef6d092ca700a8acb20
2024-02-20 12:51:25 +01:00
Yu Liu
bba555ee31 Support aconfig stoage files for apex.
Bug: 323071835
Test: unit tests and manual build test.
Change-Id: I4a1a05b3afdf88058a970040b3f176f36c5c8037
2024-02-17 00:36:42 +00:00
Jihoon Kang
2a43e56b5f Introduce module type aconfig_declarations_group
In order to easily manage aconfig_declarations modules and their
corresponding codegen modules, this change introduces a new module type
`aconfig_declarations_group`. The module enables listing codegen modules
by language, and correctly depend on the desired output files using
appropriate tags.

e.g. for an aconfig_declarations_group module "some_group", the rdeps of
the module can:
- gather all intermediates cache files of the aconfig_declarations with
  ":some_group" tag.
- gather generated srcjar files of the listed java_aconfig_library
  modules with ":some_group{.srcjars}" tag.

Output tag support for cc modules and rust modules will be added in
future changes.

Test: m nothing --no-skip-soong-tests
Bug: 320492079
Change-Id: I93d737577f8d00198ed91048dd6e81ef238193cb
2024-02-14 18:52:31 +00:00
Yu Liu
748ade2f85 Add dedup flag to aconfig dump-cache calls.
Bug: None
Test: CI
Change-Id: I34a73576a7a7ea43178895049a0f7dbcd9e329bc
2024-02-08 19:11:39 +00:00
Mårten Kongstad
c479c026f1 Change aconfig dump to aconfig dump-cache
Update the calls to dump aconfig caches; the new canonical name is
`dump-cache`, though `dump` is still an accepted alias (for now).

Bug: N/A
Test: m all_aconfig_declarations && printflags
Change-Id: I9f82d31666ced6bbd0f195f1422590547114e0f0
2023-12-21 16:49:11 +01:00
Mårten Kongstad
26d2c67339 Merge "Replace aconfig dump --format=bool with explicit format string" into main 2023-12-21 07:03:38 +00:00
LaMont Jones
aa005ae080 move CollectDependencyAconfigFiles to android
This needs to be called by some modules in android.

Bug: 308625757
Test: manual
Change-Id: I389fcfd88a3f4bd85a9218fdd4dd66d8a239bb67
2023-12-19 19:34:00 +00:00
Mårten Kongstad
b3fa1cfca9 Replace aconfig dump --format=bool with explicit format string
aconfig will remove its support for format aliases in an attempt to make
future maintenance easier. Update soong accordingly.

Bug: 317044915
Test: m
Change-Id: I20157ea8c7b441d4e416967d29fc7768c917e688
2023-12-19 16:55:32 +01:00
Mårten Kongstad
0a0ea26c60 Fix broken sdk build (/bin/sh: 1: [[: not found)
The CL aosp/2878135 introduced a new shell command to be executed as
part of `m sdk dist` builds. The new command incorrectly used bash
syntax for conditionals, i.e. `if [[ ... ]]` (double [[]]) instead of
the POSIX compliant `if [ ... ]` (single []).

This broke the sdk build on systems where /bin/sh is not a symlink to
/bin/bash:

  /bin/sh: 1: [[: not found
  error: lstat out/soong/.intermediates/exported_java_aconfig_library.jar.tmp: file does not exist

Fix the breakage by using POSIX shell syntax instead.

Bug: 316933458
Bug: 311151343
Test: m sdk dist
Change-Id: I7de53261674a8f54c4ecacf0e27aecbafcfa4048
2023-12-19 08:20:51 +01:00
Mårten Kongstad
1258acfed3 Only include exported flags in android-flags.jar
The android-flags.jar file is consumed by apps built outside the
platform. These apps should only have access to exported flags (as
defined by the flag_declaration `is_exported` field).

Teach soong to filter out non-exported flags when generating
android-flags.jar.

Bug: 311151343
Test: m sdk dist # manually verify that $(gettop)/out/dist/android-flags.jar only contains exported flags
Change-Id: If66321fcffd920040dae3d99bd7ef69ff6925b18
2023-12-18 13:47:57 +01:00
Mårten Kongstad
c82f118d23 Add exported_java_aconfig_library
Add a rule to generate a JAR file containing code for all aconfig flags
in all packages. This is intended for apps compiled outside the
platform.

Also add a rule to include the new JAR file among the SDK artifacts.

Note: a future CL will refine the aconfig command line options used, or
filter the aconfig output: right now the JAR really contains *all*
flags; we want it to include only *exported* flags.

Bug: 311151343
Test: m sdk dist # manually verify that this generates $(gettop)/out/dist/android-flags.jar
Change-Id: I73481a9f723a0e5487cfcd2ee697873ecc4e8275
2023-12-11 09:51:42 +01:00
Jihoon Kang
cca3e0c4b5 Add aconfig flag value text file in aconfig_declarations provider
Alongside with the generated proto file, the aconfig_declaration now
also outputs a text file that lists aconfig flags and values of its
corresponding proto file, in the format as shown below:
```
my.flag1=true
my.flag2=false
...
```

To prevent confusion between the preexisting proto file and the newly
introduced text file, the change also renames the variables of the proto
file from `intermediatePath` to `intermediateCacheOutputPath` and
likewise.

The utilization of the generated text file will be done in the child
changes.

Test: m out/soong/.intermediates/build/make/tools/aconfig/aconfig.test.flags/intermediate.txt && inspect output
Bug: 306024510
Change-Id: Iee16ad57bb87e992a477fc96502f79e971d01233
2023-12-07 22:36:08 +00:00
Colin Cross
d788b3e6cb Merge aconfig files per-module
Passing the list of all transitive aconfig files to Make causes extra
Kati analysis runs when dependencies are changed in Android.bp files.
Since Make is going to merge them anyways, merge them per-module and
pass a single aconfig file to Make for each module.

Fixes: 313698230
Test: m out/target/product/vsoc_x86_64/system/etc/aconfig_flags.pb
Change-Id: Ifde4826bc93bc06e40338f72b4cb39eed26ca08d
2023-12-07 04:17:37 +00:00
Yu Liu
eae7b36699 Add container property to aconfig_declarations.
Bug: 311155208
Test: Unit test
Change-Id: I7b187138856d0144203961e82b6dad5e2f8eed9d
2023-11-28 12:37:02 -08:00
Mårten Kongstad
facb8d67b5 aconfig/init.go: fix copy and paste mistakes
Correct comments. Remove unnecessary dependency on soong_zip from
cc_aconfig_library and rust_aconfig_library.

Bug: N/A
Test: m nothing
Change-Id: Ifabeed537d596ec879bf8c7dfb8a68824464f6dd
2023-11-20 16:21:36 +01:00
Dennis Shen
c5e39f521b build system implementation for c/cpp test mode codegen
Bug: b/300488560
Test: added unit test and tested with AconfigDemoActivity app
Change-Id: I6ad71cc2dada8feb53662ec47c8acad5bc43d5ce
2023-09-20 14:27:18 +00:00
Yu Liu
2cc802a442 Support aconfig_declarations, aconfig_values and aconfig_value_set
Bug: 297356603
Test: Unit tests
Change-Id: I2f797578a35322440db0f281b4d46b6652512e00
2023-09-09 12:33:40 -07:00
Zhi Dou
1f82aea323 Merge "Support default-permission in aconfig_declarations" into main 2023-08-14 14:12:27 +00:00
Zhi Dou
3f65a416b8 Support default-permission in aconfig_declarations
Aconfig provides new argument, default-permission, for create-cache.
When buld aconfig_declarations, aconfig_declarations will read the value
from release configuration to pass this value to aconfig.

Bug: 294417368
Test: presubmit
Change-Id: Id55dab1d757e2366a62449c73e2497cc958c5e78
2023-08-10 21:54:59 +00:00
Dennis Shen
1988ccf5bf Merge "Implement rust_aconfig_library" into main 2023-08-10 17:10:29 +00:00
Vinh Tran
457ddef28e Implement rust_aconfig_library
rust_aconfig_library generates src/lib.rs and uses it to build library variants (dylib, rlib-rlib_std, and rlib-dylib_std) as of what `rust_library` produces

Test: go test
Change-Id: I6c4603691d4306c463c2e9521f5c11c30765b1e3
2023-08-08 17:30:52 -04:00
Zhi Dou
9dc2451339 Compare generated cache file with existing cache file
Bug: b/292128421
Test: Create a aconfig declartion file with only package name
but no flags. Then build the corresponding java library.

Change-Id: I7e9d09d5488eb9c95784fd486d3a9107539412a4
2023-07-28 19:52:35 +00:00
Joe Onorato
b7c294a17e Add test mode for java config modules
Test: soong unit tests, verify output files are correct
Bug: 288632682
Change-Id: If5a6c916104e60e3688f5614b7420138e1a6323e
2023-07-28 05:30:25 -07:00
Joe Onorato
37f900ca7f Add aconfig flags and a generic generated library plugin module for cc
The generated module lets us keep the aconfig code in its own pacakge
and not infect all of the cc package with aconfig. It's also closer
to what bazel is going to do

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: I2fb9e419939c7ca77b111da9c376af077e2348a9
2023-07-21 09:04:42 -07:00
Zhi Dou
8a35a6fa71 Pass declarations as separate arguments
Aconfig take declarations as separate arguments if there are multiple
declaration files.

Bug: 291926035
Test: build flags
Change-Id: Ic0d069184f48ceaf8947acc5b951eecff7c308f9
2023-07-19 18:04:24 +00:00
Joe Onorato
2f99c47a87 Add aconfig dump of all aconfig_declarations modules.
Bug: 283910439
Test: m dist ; m all_aconfig_declarations ; gqui from all_aconfig_declarations.pb proto /source/aosp-master-with-phones/build/make/tools/aconfig/protos/aconfig.proto:android.aconfig.parsed_flags
Change-Id: Ia89c7f9c53fa1600fa2f9c8ea01319e949e09f58
2023-06-23 15:21:42 -07:00
Joe Onorato
981c926269 Rename device_config --> aconfig and definitions --> declarations
Bug: 285303012
Test: for x in next trunk trunk_food trunk_staging ; do lunch aosp_panther-$x-eng ; m nothing ; done
Change-Id: I3375f46b3ecbbc516d1bee6ab3f80725fcccde8f
2023-06-21 15:16:23 -07:00
Renamed from device_config/init.go (Browse further)