Commit Graph

68535 Commits

Author SHA1 Message Date
Vinh Tran
0059b69829 Use aidl_library in cc libraries
Introduce aidl.libs prop on cc libraries to pass in aidl_library. The goal is to eventually disallow aidl.include_dirs (a pattern for passing aidl headers dir for aidl compilation) and enforce aidl headers to be explicitly specified in Android.bp.

Bug: 278704136
Test: go test
(cherry picked from https://android-review.googlesource.com/q/commit:367d89da7887825f74b0c9554b2e1b9619d94f08)
Merged-In: Ia78bc11dfa12f47d2d1bb90dc65372ddb17f7e14
Change-Id: Ia78bc11dfa12f47d2d1bb90dc65372ddb17f7e14
2023-06-06 14:33:42 +00:00
Vinh Tran
4c43b2febc Implement bp2build converter for aidl_library
Test: go test
Bug: 278704136
(cherry picked from https://android-review.googlesource.com/q/commit:3d16990b29fe2a4a8deed9769908f8496755adde)
Merged-In: Ia9c3772257af58e1de9041ba465130740b555fe4
Change-Id: Ia9c3772257af58e1de9041ba465130740b555fe4
2023-06-06 14:27:46 +00:00
Vinh Tran
46004f1511 Implement aidl_library module type
We currently specifies aidl files directly to the srcs prop on a filegroup or other module types such as cc_library or java_library. We use aidl.include_dirs prop to specify paths to aidl headers. This include_dirs pattern isn't migratable to Bazel because Bazel requires explicit dependencies.

This CL introduces aidl_library to better map with Bazel's aidl_library rule and to enable aidl headers to be specified in a separate aidl_library or the hdrs prop. A follow-up CL will turn on inputs sandbox to enforce all aidl headers be explicitly specified in Android.bp

Test: go test
Bug: 278704136
(cherry picked from https://android-review.googlesource.com/q/commit:0e7fd8a14b5e1ebc2f2516639e9cea5dfdefce63)
Merged-In: I2c99af080525bf8a6c5724ed5ee2001842969098
Change-Id: I2c99af080525bf8a6c5724ed5ee2001842969098
2023-06-06 14:27:22 +00:00
Spandan Das
deaba3de51 Ignore test apexes from bp2build generated tags
Soong does not enforce apex_available on the contents of test apex. To
prevent special-casing test apexes in the apex validation aspect in
Bazel, drop the test apexes from the tags altogether.

( The core problem I am trying to solve is making sure that stub
libraries in Bazel have a single apex available. apex validation happens
to be a nice side benefit)

Bug: 277651159
Test: go test ./bp2build
(cherry picked from https://android-review.googlesource.com/q/commit:39b6cc53369a6ec132b58d99514cd7a2ea499efd)
Merged-In: Ibb3cfedb5c0f2cda0464bf3758c70b67cb5885d1
Change-Id: Ibb3cfedb5c0f2cda0464bf3758c70b67cb5885d1
2023-06-06 14:09:24 +00:00
Spandan Das
e5e07831eb Ignore test apexes from bp2build generated tags
The core problem I am trying to solve is making sure that stub
libraries in Bazel have a single apex available. In Soong, this will be
enforced using some graph walk which is not easy to port to Bazel.

However, we might need to revisit this when we build the enforcement
mechanism in Bazel. We likely need a `test_for` on the top level
apex_test Bazel rule so that the test apex is _allowed_ to link against impl
of the library it is trying to test.

(This CL retricts this to cc_library, I can expand this to other modules
if this is the right approach.)

Bug: 277651159
(cherry picked from https://android-review.googlesource.com/q/commit:f57a966b6694da970e99f519919f9b845b713163)
Merged-In: Iaeec22c5626df79a33785c766ed29102b1da403e
Change-Id: Iaeec22c5626df79a33785c766ed29102b1da403e
2023-06-06 14:09:18 +00:00
Anton Hansson
b878fac67a Merge "Allow Bluetooth to use privapp_allowlist" into udc-mainline-prod 2023-06-03 07:58:22 +00:00
Anton Hansson
a91268a690 Allow Bluetooth to use privapp_allowlist
Apparently there's some special case-code in package manager that
scans apps as privileged regardless of their location. BT is one
such app -- so allow it to specify a privapp allowlist even though
it isn't in priv-app.

Bug: 284500052
Test: use privapp_allowlist in Bluetooth and its overriddes
Change-Id: Ib9ac86ebc45087a176100fe8df07db7bf81a85a7
2023-06-02 09:30:08 +00:00
Anton Hansson
0a3bb7dc5e Change install name of privapp allowlists
Use the APK's filename as the on-device filename for the allowlist.
Previously the filename of the source xml file was used, which leads to
a problem when the same source file is used for different apps (even
if only one of those modules ends up being installed).

Bug: 284500052
Test: app_test.go & presubmit boot tests
(cherry picked from https://android-review.googlesource.com/q/commit:92d1f52790e83952bf305464f0083d8c05f4c557)
Merged-In: I0b43a35e3a310464d79d7f37e0900d639f4a479c
Change-Id: I0b43a35e3a310464d79d7f37e0900d639f4a479c
2023-06-02 08:25:33 +00:00
Sam Delmerico
022adb0b8c ensure that privapp_allowlist is installed before android_app
AndroidMk assumes that the app is the last file installed, and it uses
this assumption to populate the LOCAL_SOONG_INSTALLED_MODULE entry. This
CL moves the privapp_allowlist installation to before the app
installation to respect this assumption.

Bug: 242509786
Test: go test
Test: OUT_DIR=out.ref m nothing &&
  cp aosp/2562351 && OUT_DIR=out.change m nothing &&
  GOWORK=$PWD/build/bazel/mkcompare/go.work \
  go run android/bazel/mkcompare/cmd -json \
  <(sed -e "s/out\.ref/out/g" out.ref/soong/Android-aosp_cheetah.mk) \
  <(sed -e "s/out\.change/out/g" out.change/soong/Android-aosp_cheetah.mk)
  && verify manually that the only diffs are related to the removal of
  the prebuilt_etc module.
(cherry picked from https://android-review.googlesource.com/q/commit:b1daccdc97ae08603b0e2f5eafe97bd11238ee58)
Merged-In: I95ec27070f575e79fb976de68493a219717ed89a
Change-Id: I95ec27070f575e79fb976de68493a219717ed89a
2023-05-26 07:48:53 +00:00
Anton Hansson
ee475b4426 Merge "don't require package_name for non-override android_apps" into udc-mainline-prod 2023-05-25 08:58:35 +00:00
Treehugger Robot
ae636386d6 Merge "Enable referencing of aapt-generated proguard flags" into udc-mainline-prod 2023-05-24 21:43:23 +00:00
Yu Liu
da2da32211 Merge "Revert "Revert "mixed builds correctly reference stubs libs""" into udc-dev am: 98f13dd1a0
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23374491

Change-Id: I1341044bf6dc7163ba48ea1699d6e763c6c15852
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-24 17:57:55 +00:00
Yu Liu
03a8e38bf6 Merge "Fix a bug where CppFlags should have been Cppflags" into udc-dev am: 2b9f3f983b
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23353145

Change-Id: I61402d7e9a2cf55bd307ab96347646ba0638c377
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-24 17:57:01 +00:00
Yu Liu
98f13dd1a0 Merge "Revert "Revert "mixed builds correctly reference stubs libs""" into udc-dev 2023-05-24 17:15:05 +00:00
Yu Liu
2b9f3f983b Merge "Fix a bug where CppFlags should have been Cppflags" into udc-dev 2023-05-24 17:14:33 +00:00
Sam Delmerico
502d807ae9 don't require package_name for non-override android_apps
For a non-override android_app, we can assume that the privapp_allowlist
already contains the correct package_name, and so we don't need to
overwrite it in this case.

Bug: 242509786
Test: go test
Ignore-AOSP-First: need to submit here to update PermissionController in sync with internal version
Merged-In: I0f137e34cae3478dc8b9178d138121ff1d936f07
Change-Id: I0f137e34cae3478dc8b9178d138121ff1d936f07
2023-05-24 14:37:40 +00:00
Andrei Onea
c53cfd54d9 add privapp_allowlist property to android_app
This change allows override_android_app to use the same
privapp_allowlist as the non-override module so that they will always
remain in sync.

Test: go test ./java -v -run TestPrivappAllowlist
Test: go test ./apex -v -run TestApexWithApps
Test: m com.android.permission com.google.android.permission and verify
  manually that apex_payload.img contains correct privapp_allowlist
Test: m com.android.permission before and after change &&
  `diffoscope apex_payload_reference.img apex_payload_with_change.img`
  && verify that there are no semantic changes
Bug: 242509786
(cherry picked from https://android-review.googlesource.com/q/commit:580636bdd23171f31bfedd773c065e0861dd5c4a)
Merged-In: Ifdcb28af40763aed7a4aac9a7f681153554bc256
Change-Id: Ifdcb28af40763aed7a4aac9a7f681153554bc256
2023-05-24 13:58:09 +00:00
Andrei Onea
d87d22372b Add script for modifying privapp permission allowlists
This script will be used to change the package that is being allowed to
use privileged permissions.

Test: python scripts/modify_permissions_allowlist.py
Bug: 242509786
(cherry picked from https://android-review.googlesource.com/q/commit:580f7b0094bd98d3769b6cdeaaab6a9748621253)
Merged-In: I1d7cb3c906ad39aef42ad4394953251db40d1bf1
Change-Id: I1d7cb3c906ad39aef42ad4394953251db40d1bf1
2023-05-24 13:58:03 +00:00
Yu Liu
dadb5df509 Merge "Do not modify input in-place" into udc-dev am: 4f0c490ac9
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23374037

Change-Id: I93876a68797012cc2308e77a3649f64cd102ebc3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-24 00:16:06 +00:00
Treehugger Robot
4db1cf525a Merge "VSDK: etc snapshot may have sub_dir for relative_install_path" into udc-dev am: 66902d7ec0
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23275518

Change-Id: I4296718f795d02a39866c9448b18f2c7f9d6be69
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-24 00:15:38 +00:00
Yu Liu
4f0c490ac9 Merge "Do not modify input in-place" into udc-dev 2023-05-23 23:27:34 +00:00
Treehugger Robot
66902d7ec0 Merge "VSDK: etc snapshot may have sub_dir for relative_install_path" into udc-dev 2023-05-23 23:19:22 +00:00
Jared Duke
4c5da94fa4 Enable referencing of aapt-generated proguard flags
Some targets may implement classes declared elsewhere, e.g., system
server implements services defined in framework-res.apk's manifest.
Allow depending on the aapt-generated proguard flags for a given
target to support this.

Bug: 272495195
Test: m + reference ":framework-res{.aapt.proguardOptionsFile}"
(cherry picked from https://android-review.googlesource.com/q/commit:34b080ddcf7757bba3dcb938df46aa660b2564a0)
Merged-In: I2a16632ed6e5a9bddbe326bdb7ab0dd79b45e587
Change-Id: I2a16632ed6e5a9bddbe326bdb7ab0dd79b45e587
2023-05-23 21:06:18 +00:00
Yu Liu
554b3d7dbe Merge "Differentiate between empty and nil input" into udc-dev am: 267a137415
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23374038

Change-Id: I5868bb527c335bfef42016753d99dfc0c92be1de
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-23 20:20:02 +00:00
Yu Liu
e8a6c62b83 Merge "Revert "Make min_sdk overridable in override_apex"" into udc-dev am: e80e5d8531
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23374036

Change-Id: Iaf989167217e1911f5fd7ca6c13072b9208e4e2f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-23 20:19:30 +00:00
Yu Liu
67c131f75f Fix a bug where CppFlags should have been Cppflags
Bug: 284009449
Test: unit test and manual build
(cherry picked from https://android-review.googlesource.com/q/commit:93893ba061e774c30a647d42e011838822153511)

Merged-In: I9abb056e6b820414707247d1b19ba6aabffc26ea
Change-Id: I9abb056e6b820414707247d1b19ba6aabffc26ea
2023-05-23 19:49:43 +00:00
Yu Liu
267a137415 Merge "Differentiate between empty and nil input" into udc-dev 2023-05-23 19:42:30 +00:00
Yu Liu
e80e5d8531 Merge "Revert "Make min_sdk overridable in override_apex"" into udc-dev 2023-05-23 19:32:23 +00:00
Yi Kong
e695c84a4f Update clang version for Rust bindgen to clang-r487747c am: 3de0cb7b4d
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23385290

Change-Id: Iafd53b25ffac19f27fd41077d265ec8545985161
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-23 10:09:38 +00:00
Yi Kong
3de0cb7b4d Update clang version for Rust bindgen to clang-r487747c
Test: presubmit
Bug: 279955553
(cherry picked from https://android-review.googlesource.com/q/commit:6974c7ec725a948a56cd8e83bff4a2cc9cf909e3)
Merged-In: I9092263024b5b8dc7a1538b00f318ef0d5c29bb7
Change-Id: I9092263024b5b8dc7a1538b00f318ef0d5c29bb7
2023-05-23 07:27:03 +00:00
Sam Delmerico
db5d662663 Revert "Revert "mixed builds correctly reference stubs libs""
This reverts commit 1db4348734.

Changes from original:
  - extracted function to add the current version to stub
    versions for bp2build.
  - added libc++ to mixed builds denylist

Reason for revert: re-uploading with fix in topic

Bug: 270408757

(cherry picked from https://android-review.googlesource.com/q/commit:75dbca2eae78bb280b50828d3c2165bda5d87ba5)

Merged-In: Ifa0ed456bf8cb4a7f861d6826263adfedb4fdd9c
Change-Id: Ifa0ed456bf8cb4a7f861d6826263adfedb4fdd9c
2023-05-22 22:43:51 +00:00
Spandan Das
ee84727d95 Do not modify input in-place
SortedUniqueStrings and FirstUniqueStrings dedupes repeating elements
and returns the deduped list. Currently, it also modifies the input list
in-place, which causes non-determinisitc failures like b/275313114

Operate on a copy of the input so that the input remains untouched.

SortedUniqueStrings is O(NlogN) and FirstUniqueStrings is ~O(N), so
creating a copy (O(N)) should not result in major performance regressions.
Numbers for this single unit test:
```
go test . -run TestStubsForLibraryInMultipleApexes -v -count 1000
Before: 174s
After: 172s
```

Bug: 275313114
Test: go test ./android
Test: go test . -run TestStubsForLibraryInMultipleApexes -v -count 1000
(cherry picked from https://android-review.googlesource.com/q/commit:8a8714c781175f8f1a6c189d919ee8b0ee8c1e27)
Merged-In: Id859723b2c2ebdc0023876c4b6fabe75d870bad7
Change-Id: Id859723b2c2ebdc0023876c4b6fabe75d870bad7
2023-05-22 22:42:19 +00:00
Spandan Das
de41a698f1 Differentiate between empty and nil input
Previously, CopyOf on an empty list was returning nil. With the updates
to SortedUniqueStrings and FirstUniqueStrings, we need to differentiate
between empty lists and nil.

Bug: 275313114
Test: m nothing
(cherry picked from https://android-review.googlesource.com/q/commit:cc4da765113299fa11dcb1e651ec4ae33e6f8f9b)
Merged-In: I91063ebbe5013cbda5d8f70efde4683c66581599
Change-Id: I91063ebbe5013cbda5d8f70efde4683c66581599
2023-05-22 22:41:59 +00:00
Liz Kammer
9a65ff8d1f Revert "Make min_sdk overridable in override_apex"
This reverts commit 133c55b48a.

Reason for revert: change was untested and not working

Bug: 266945903

(cherry picked from https://android-review.googlesource.com/q/commit:bd58e746928bdfd618ba81e66a19dc42f7b15380)
Merged-In: I06d6e3c439ba541ae85dc148f91b184b9731b92d
Change-Id: I06d6e3c439ba541ae85dc148f91b184b9731b92d
2023-05-22 22:39:46 +00:00
Wei Li
3194f11503 Merge changes from topic "cherrypicker-L80700000960770298:N69600001370607907" into udc-dev am: dabeb50e32
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23337458

Change-Id: I2cd67a8fd15ceb097f7e825c818695c85606b278
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-19 22:25:00 +00:00
Wei Li
d5ec095a90 Export some make variables to Bazel through product variables. am: 5cfedc8062
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23337457

Change-Id: Id7c12ae3e13f659c5b3a87440139134942dd04c3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-19 22:24:55 +00:00
Wei Li
dabeb50e32 Merge changes from topic "cherrypicker-L80700000960770298:N69600001370607907" into udc-dev
* changes:
  Change bp2build converter of module "package".
  Export some make variables to Bazel through product variables.
2023-05-19 21:37:23 +00:00
Treehugger Robot
38bd9c1a63 Merge "Don't panic if no certificates found" into udc-dev am: 16ef197d6a
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23297153

Change-Id: I1afc85f7293183bd955511f9c26788c8d2ab31c3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-19 17:00:42 +00:00
Treehugger Robot
16ef197d6a Merge "Don't panic if no certificates found" into udc-dev 2023-05-19 16:18:34 +00:00
Wei Li
aff90c3f75 Allowlist SBOM generation tool so it can be used in Bazel. am: 9d307945be
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23305007

Change-Id: I86eebb5de030aeb56088c8fc794bb495ef3f2d09
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-19 01:02:14 +00:00
Wei Li
dff65b0114 Change bp2build converter of module "package".
1) Use attribute name "default_package_metadata" instead of
   "default_applicable_licenses" in packages to better describe its use.
2) Add a filegroup "default_metadata_file" in packages to search for
   METADATA file in each package.
3) Include "default_metadata_file" in each package's
   "default_package_metadata" attribute.

Bug: 275472038
Test: CIs
(cherry picked from https://android-review.googlesource.com/q/commit:2c9e8d612819840020b2d110d23fb2771b6c92f0)
Merged-In: I645c013c39e3190fd96c4a549d39a331aced16bd
Change-Id: I645c013c39e3190fd96c4a549d39a331aced16bd
2023-05-19 00:35:57 +00:00
Wei Li
5cfedc8062 Export some make variables to Bazel through product variables.
Bug: 275472038
Test: CIs
(cherry picked from https://android-review.googlesource.com/q/commit:c642d688d6a091766536f0e02696d43e393f93e0)
Merged-In: I4fdd0f989d75045644e8f2e32d1eb77543a3b9f3
Change-Id: I4fdd0f989d75045644e8f2e32d1eb77543a3b9f3
2023-05-19 00:35:50 +00:00
Wei Li
9d307945be Allowlist SBOM generation tool so it can be used in Bazel.
Bug: 275472038
Test: b build //build/make/tools/sbom:generate-sbom && bazel-out/aosp_cf_x86_64_phone-userdebug_linux_x86_64-opt/bin/build/make/tools/sbom/generate-sbom
(cherry picked from https://android-review.googlesource.com/q/commit:74e3e003148d202749cc79456e61f65ba1f4f25a)
Merged-In: I4ad68b0613410f40c79ee24d3eef779c2ad57815
Change-Id: I4ad68b0613410f40c79ee24d3eef779c2ad57815
2023-05-18 21:52:23 +00:00
Yi Kong
67735dccd6 Revert "Turn off stack protector check for noreturn calls" am: 79b9b94ea3
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23320905

Change-Id: I450e79911619fd477e35b42ae1d19958f80dcc81
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-18 21:13:05 +00:00
Yi Kong
79b9b94ea3 Revert "Turn off stack protector check for noreturn calls"
clang-r487747c contains upstream fix for the excessive stack protactor
checks (fc4494dffa54) and checks are no longer inserted for C only code
or C++ code built without exeception. The Android platform does not
enable C++ exception by default, thus turning on the check should not
have significant performance impact.

This reverts commit ecc18df6ff.

Test: presubmit
Bug: 277565884
Bug: 279955553
(cherry picked from https://android-review.googlesource.com/q/commit:e9850f81531f070ac5cd193fdcd767bc91605bfe)
Merged-In: I2fc5826048ba5d00cabcc8401ac40a6f54812a44
Change-Id: I2fc5826048ba5d00cabcc8401ac40a6f54812a44
2023-05-18 18:20:09 +00:00
Zyan Wu
d1f548a19d Don't panic if no certificates found
Getting the first certificate will panic if there are no certificates,
which can happen when AllowMissingDependencies is set and the
certificate property is a module reference to a missing module.
Only get the first certificate if the list is not nil.

Use mainCertificate since it handles the logic already.

Test: TestAppMissingCertificateAllowMissingDependencies
Bug: 283102635
Merged-In: : I8b27f65aa7d071041171ad45ac52bf47fa31bf2b
Change-Id: Icaaa45d48ca4edb876687c0813165d107d28ef8a
2023-05-18 15:58:20 +08:00
Treehugger Robot
b06258b83f Merge "Touch soong_build output at the end of main" into udc-dev am: 4020b810e9
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/23287178

Change-Id: If54423fd2c16ae56a721807d265eddc5cb7708ab
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-17 19:55:24 +00:00
Treehugger Robot
4020b810e9 Merge "Touch soong_build output at the end of main" into udc-dev 2023-05-17 19:14:54 +00:00
Chris Parsons
74ac376769 Touch soong_build output at the end of main
This fixes an incrementality bug that resulted in superfluous
build.ninja regeneration after a new glob definition is added.

(cherry picked from https://android-review.git.corp.google.com/c/platform/build/soong/+/2585669)
Fixes: 279674820
Test: Treehugger
Test; New integration test in this CL

Merged-In: Ifefe66a0eb1c125e9ad5373d60437a1cb1e6fdec
Change-Id: Ifefe66a0eb1c125e9ad5373d60437a1cb1e6fdec
2023-05-17 18:09:56 +00:00
Justin Yun
82283a3b4f VSDK: etc snapshot may have sub_dir for relative_install_path
prebuilt_etc may use sub_dir property to define a relative install
path. Use SubDir() to read either sub_dir or relative_install_path
property.

Bug: 282080219
Test: m vendor-image
Merged-In: I07a21c5aeb87b403854ed32976d26e70b046b8c1
Change-Id: I07a21c5aeb87b403854ed32976d26e70b046b8c1
(cherry picked from commit 8bd3afe68c)
2023-05-17 10:51:28 +09:00