Commit graph

80 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
Zhi Dou
e11319d466 enable exportable check
If a library is built to mode exported, the flag declaration has to be
set with exportable true. The reason for this requirement is only flags
in the exportabel declarations will be repackaged. To prevent forgetting
adding this attribute, this exportable attribute is required to be set
for all exportable declarations.

Test: m
Bug: 310504781
Change-Id: I3ddafe0b212dabe86aa5000b1b76c7c412acc93c
2024-03-05 22:21:03 +00:00
Mårten Kongstad
c61353222c Include all_aconfig_declarations in droid dist
Include all_aconfig_declarations in the droid dist directory
(identically to how it is already included in the sdk dist).

For local builds, `printflags` is still the recommended way to read
all_aconfig_declarations; the dist-ed files are intended as a way to
inspect remote builds, such as CI builds.

Bug: 324281288
Test: lunch aosp_oriole-trunk-eng && m droid dist && test -e out/dist/flags.pb && test -e out/dist/flags.textproto
Change-Id: Ic29d69ab5014593a3f9213f8a5b55e0569922cc9
2024-02-23 09:22:56 +01: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
Zi Wang
0e5d16c6f0 Add property Exportable to aconfig_declarations
Only when aconfig_declarations explicitly set this property true,
its flags will be repackaged.

If a java_aconfig_library has mode "exported", its corresponding
aconfig_declarations must have exportable prop set to true.

Test: Added unit tests and CI

Bug: 310504781

Ignore-AOSP-First: this change will be cherry picked to aosp
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:e4527f3010b3fd6f33948a15a9b4fdc944da34f0)
Merged-In: Ie9526e3755a6e7d142b377d5dd85a1bc60ffabc5
Change-Id: Ie9526e3755a6e7d142b377d5dd85a1bc60ffabc5
2024-02-08 06:19:34 +00:00
Joe Onorato
349ae8dd6b Automatically propagate jarjar rules for aconfig libraries
Test: treehugger
Bug: 310504781
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:97c03a6dc659102ff40793759fb3f0f18164a85b)
Merged-In: I639d12ff33175b7bed7e7d0595a40dd9b0d99367
Change-Id: I639d12ff33175b7bed7e7d0595a40dd9b0d99367
2024-02-05 22:46:00 +00:00
LaMont Jones
b509938e4f Propagate AconfigFiles in ModuleBase.
Aconfig file dependencies are module-independent, and properly part of
ModuleBase.

Bug: b/308625757
Test: manual

Change-Id: I38c5907d1671cc69bb198345201316ae781fdc9f
2024-01-24 23:45:12 +00:00
LaMont Jones
15b031e10e Merge changes Iaf6d45a4,Ic56e8ef3,I11f0a0b5 into main
* changes:
  Propagate aconfig providers for more modules.
  move SetAconfigFileMkEntries to android
  aconfig: harden dependency collection
2024-01-10 18:54:30 +00:00
Dennis Shen
c6dc551097 do not include sever_configurable_flags dependency when in
force-read-only-mode

Bug: b/316932568
Test: m --no-skip-soong-tests nothing
Change-Id: I02a7925dd6b5b33107dae1507447f8e7a1991795
2024-01-10 14:07:35 +00:00
LaMont Jones
acae2d7656 move SetAconfigFileMkEntries to android
This will need to be called by some modules handled in android.

Bug: 308625757
Test: manual
Change-Id: Ic56e8ef3a453c59866aab6d39a21108cf8536b56
2024-01-10 14:03:29 +00:00
Dennis Shen
4e7773d81e Enforce one aconfig_declaration per aconfig package
Bug: b/319121098
Change-Id: Ibe3f1587ed7754f00f464cf385ce51ee9a142412
2024-01-10 01:53:49 +00:00
Kiyoung Kim
6284e0a935 Merge "Generate image variation without version" into main 2024-01-05 04:57:26 +00:00
Kiyoung Kim
b5fdb2e966 Generate image variation without version
Current CC/Rust Image variations are generated with target VNDK version.
However, this is no longer valid if VNDK is deprecated. This change
generates image variation without version ("vendor", "product") if VNDK
is deprecated.

Bug: 316829758
Test: m nothing --no-skip-soong-tests passed
Test: aosp_cf_x86_64_phone build succeeded
Change-Id: I2387ed8a2632bfd9462621f882a947695ae1653d
2024-01-05 11:15:23 +09:00
Zhi Dou
f80405a5e5 Merge "Add "force-read-only" mode to xx_aconfig_library build rules" into main 2024-01-03 23:00:33 +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
Zhi Dou
70e2124c88 Add "force-read-only" mode to xx_aconfig_library build rules
Test: added unit tests and CI
Bug: 317115655
Change-Id: Ia72159ffe072f9b4997f0d4d55a7b3db5356f5ed
2023-12-21 03:41:02 +00:00
LaMont Jones
4daed5a026 Merge "move CollectDependencyAconfigFiles to android" into main 2023-12-19 23:07:50 +00:00
Victor Chang
a9d3293bf4 Merge "Avoid circular dependency for the aconfig usage in libcore" into main 2023-12-19 20:39:03 +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
Victor Chang
bf0175ee6a Avoid circular dependency for the aconfig usage in libcore
Bug: 316554963
Test: m droid
Change-Id: I6f45e585b8b656ef7ce1d51bbde0a44898198907
2023-12-19 14:22:07 +00: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
Yu Liu
4c27146e4c Merge "Properly package aconfig files for product and system_ext partitions" into main 2023-12-19 00:40:03 +00:00
Yu Liu
22e32f1b0b Properly package aconfig files for product and system_ext partitions
Bug: 311173471
Test: Unit tests
Change-Id: Iac60695beb6529139965e4bb24024df6ce278fb2
2023-12-18 14:44:34 -08:00
Colin Cross
51428c451a Merge changes I6f116385,Id77f514d,I73479de1,If58f4b53 into main
* changes:
  Convert ModuleProvder to generic providers API
  Convert OtherModuleProvider to generic providers API
  Convert Provider to generic providers API
  Convert SetProvider to generic providers API
2023-12-18 22:43:45 +00:00
Mårten Kongstad
8070c4b457 Merge "Only include exported flags in android-flags.jar" into main 2023-12-18 20:31:31 +00: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
Colin Cross
5a37718c95 Convert ModuleProvder to generic providers API
Convert all of the callers of ModuleProvider/ModuleHasProvider to use the
type-safe android.SingletonModuleProvider API.

Bug: 316410648
Test: builds
Change-Id: I6f11638546b64749e451cebbf33140248dc1d193
2023-12-14 16:12:22 -08:00
Colin Cross
313aa5475f Convert OtherModuleProvider to generic providers API
Convert all of the callers of OtherModuleProvider/OtherModuleHasProvider
to use the type-safe android.OtherModuleProvider API.

Bug: 316410648
Test: builds
Change-Id: Id77f514d68761a262d9ea830a601dbed804bbbe5
2023-12-14 16:12:22 -08:00
Colin Cross
bc7d76cca2 Convert NewProvider/NewMutatorProvider to generic providers API
Convert all of the callers to NewProvider and NewMutatorProvider
to use a generic type parameter instead of an example object.

Bug: 316410648
Test: builds
Change-Id: Ic9cdafc87336e26730d3fd596df05de0e7267542
2023-12-14 16:12:20 -08:00
Colin Cross
402130276c Convert SetProvider to generic providers API
Convert all of the callers of SetProvider to use the type-safe
android.SetProvider API.

Bug: 316410648
Test: builds
Change-Id: If58f4b5355264ddab2045bc3591a4eac19cd58fc
2023-12-14 16:12:20 -08:00
Yu Liu
6dc93f9a09 Properly package aconfig files for vendor partition
Bug: 311173471
Test: Unit tests
Change-Id: Ibb857b69c3f83326a9ff5732e11dd09887e4ba6e
2023-12-14 01:19:35 +00:00
Mårten Kongstad
18c95ecab9 Merge "Add exported_java_aconfig_library" into main 2023-12-12 09:46:05 +00:00
Yu Liu
cec0e410cd Support rust modules when packaging aconfig files in apex.
Also remove the code to package aconfig files for transitive
dependencies since those files should have already been included in the
direct dependencies.

Bug: 311173471
Test: Unit tests
Change-Id: I25637af9381f71a78b70a8de9894618188c9735d
2023-12-11 17:43:07 -08: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
Colin Cross
8ff105860d Remove ConvertWithBp2build implementations
Remove the ConvertWithBp2build implementations from all the module
types, along with the related code.

Bug: 315353489
Test: m blueprint_tests
Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
2023-12-08 13:51:05 -08: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
Zi Wang
d72e2dbbff Remove "Test" prop from xx_aconfig_library build rules
Test: CI

Bug: 309990433
Change-Id: Id78f65d4083571f310686589a18cabe13bbd5d62
2023-11-13 16:01:13 -08:00
Zi Wang
275f654a2e Add "exported" mode to xx_aconfig_library build rules
Test: added unit tests and CI

Bug: 309990433
Change-Id: Iae1b85265d9780bde7d41ec2ec6e8e441c2b3814
2023-11-13 10:23:55 -08:00
Dennis Shen
ba6ed2d62a Add dependency of liblazy_static
Bug: b/307336730
Change-Id: I2c89b0f73787649408e2a23f3f308b3e0eb0c9ea
2023-11-09 15:07:04 +00:00
Yu Liu
f11b7c3093 Support a few more attrs in cc_aconfig_library.
More might be added later when we have an allowlist.

Bug: 305998969
Test: b build with the change in ag/25094394
Change-Id: I92df843ac81f4e33ce7506db61c989a380015975
2023-10-20 19:17:53 +00:00