Commit graph

123 commits

Author SHA1 Message Date
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
Yu Liu
f613da45db Merge "Handle the case where the release value set is a list." into main 2023-10-14 03:27:30 +00:00
Yu Liu
eebb259356 Handle the case where the release value set is a list.
Bug: 304814040
Test: CI, unit test,
b build build/make/tools/aconfig:aconfig.test.cpp
b test build/make/tools/aconfig:AconfigJavaHostTest

Change-Id: I9ca939348a063c39e9528f24e788f9757458d30c
2023-10-13 16:45:51 -07:00
Yu Liu
873ad35f87 Allowlist fake_device_config in order to build some java_aconfig_library for host.
Bug: 305255550
Test: CI
Change-Id: Ic073a5fef0acccb7fcbbacb93c9f42ea80e8e154
2023-10-13 20:50:56 +00:00
Zhi Dou
1b052b0078 Add UnsupportedAppUsage to java_aconfig_library dependency
Generated flag requires UnsupportedAppUsage annotation to expose the
flag to CTS tests.

Bug: 301272559
Test: presubit
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5e2c96a93b4c16b224c090570a10697400a42c0a)
Merged-In: I90c87596ca80766ece429ddee1b45723b01d2760
Change-Id: I90c87596ca80766ece429ddee1b45723b01d2760
2023-10-10 19:36:00 +00:00
Yu Liu
f2b94010c8 Convert java_aconfig_library to bazel.
Bug: 297357579
Test: Unit test and AconfigJavaHostTest
Change-Id: Icf944cc0b2a7382107923d49b2d2ff0eb4113638
2023-10-02 15:04:19 -07:00
Colin Cross
40c7bae1df Merge changes from topics "revert-2629131-sandbox-rust-inputs-JRFPQTIPEY", "revert-2758566-WBNIADIEXA" into main
* changes:
  Revert^3 "add rust_toolchain_rustc_prebuilt module type"
  Revert^3 "add crate_root property to rust modules"
  Revert^3 "allow Ninja variables in RuleBuilder API"
  Revert "conditionally escape rule builder command"
  Revert "support sandboxed rust rules"
  Revert "fix failing rust_aconfig_library test"
  Revert "rustSetToolchainSource to use linux-x86 srcs"
  Revert "remove rust deps on clang prebuilts"
2023-09-23 05:19:13 +00:00
Colin Cross
df0ed707a5 Revert "fix failing rust_aconfig_library test"
This reverts commit 521eb20dc2.

Reason for revert: b/301463284

Change-Id: I45f4793694654f3afd2dee6188e0bf58cfb48992
2023-09-22 22:05:39 +00:00
Yu Liu
855cfc2fac Convert cc_aconfig_library to bazel.
Bug: 297358249
Test: Unit test and CI
Change-Id: Ic84128b0df16efe4255b52b83670ec9902c09383
2023-09-20 17:46:46 -07:00
Sam Delmerico
521eb20dc2 fix failing rust_aconfig_library test
Bug: 301290764
Test: go test .
Change-Id: I4220738595067365be0c2236a05a365a2e90c734
2023-09-20 19:30:47 +00:00
Christopher Parsons
c331812a59 Merge "Have ConvertWBp2build use Bp2buildMutatorContext" into main 2023-09-20 17:56:24 +00:00
Chris Parsons
637458d326 Have ConvertWBp2build use Bp2buildMutatorContext
This no-op refactoring facilitates some upcoming functional changes for
"bp2build allowlist v2". The work requires that the bp2build conversion
mutator be changed from a TopDown mutator to a BottomUp mutator.
Refactoring all bp2build-related methods so that they use Bp2buildMutatorContext
makes it easier to make this functional change without touching tens of
files and multiple projects.

Bug: 285631638
Test: m bp2build
Change-Id: I3d1ef3064146e959c6f0dc315350fc9764bf2bd2
2023-09-20 14:49:35 +00: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
Joe Onorato
8f75585b37 Add aconfig annotations for java_aconfig_library
Test: m
Bug: 289087078
Change-Id: I860b91f984b2f2c596360490337fb25a4df7a988
2023-08-26 08:26:18 -07:00
Joe Onorato
4551ea1e30 Add missing dependency for cache files on the aconfig files
Bug: 293899028
Test: manual
Change-Id: I6399a2228cbe9a1b8d79383000dd30e43e73c603
2023-08-20 09:45:29 -07:00
Vinh Tran
a207d486e1 Merge "Add test mode support for rust_aconfig_library" into main 2023-08-17 14:48:37 +00:00
Zhi Dou
1f82aea323 Merge "Support default-permission in aconfig_declarations" into main 2023-08-14 14:12:27 +00:00
Vinh Tran
0ea4ffac9a Add test mode support for rust_aconfig_library
Test: atest aconfig.test_mode.test.rust
Change-Id: I3ef774bdc0f8b842106367c91221a2c227585c75
2023-08-11 17:38:14 -04: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
Treehugger Robot
8b8846ae1c Merge "Add aconfig flags and a generic generated library plugin module for cc" into main 2023-07-21 19:09:28 +00: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
Treehugger Robot
8bad43ad53 Merge "Track transitive usage of aconfig flags and add LOCAL_ACONFIG_FILES to Android-<product>.mk" into main 2023-07-21 14:34:44 +00:00
Joe Onorato
6fe59eb7f0 Track transitive usage of aconfig flags and add LOCAL_ACONFIG_FILES to Android-<product>.mk
Bug: 283910439
Test: m nothing (runs soong tests)
Change-Id: I59f9bef7b7c502565d531a5685c002a177e0a77c
2023-07-20 11:33:06 -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