Commit Graph

5788 Commits

Author SHA1 Message Date
Liz Kammer 25f369fdca Move cc_object tests to object_test.go
Test: go test cc tests
Change-Id: I6a138482f678b6168b06b523ddbfeb639bf70364
2021-04-19 12:44:51 -04:00
Chris Parsons bab4d7e3bc Add a denylist for specifically mixed builds
This allows us to, for certain modules, enable bp2build, but disable
mixed builds.
This facilitates easier iteration on these two features, as modules can
be incrementally "fixed" for bp2build, even if they are not ready for
mixed builds integration.

Test: USE_BAZEL_ANALYSIS=1 m libc
Test: Manually verified that note_* modules exist in bionic/libc/BUILD
Test: bazel build //bionic/....
Change-Id: I3462c8398680140cfc953443d96196143b8ad0a3
2021-04-19 12:30:02 -04:00
Treehugger Robot a211c218df Merge "Add LLNDK stubs and headers to VNDK snapshot" am: 266fcfb850 am: 04d916ba64 am: 2ed0d7346e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1677930

Change-Id: I3143fc53087f14939126db6af6595b3e1282211b
2021-04-17 15:00:59 +00:00
Treehugger Robot 266fcfb850 Merge "Add LLNDK stubs and headers to VNDK snapshot" 2021-04-17 13:46:32 +00:00
Treehugger Robot 33accf0115 Merge changes from topic "tvts-test-host-jni" am: aef14db78a am: 3640bc3f70 am: af25c6cab8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1560314

Change-Id: I1894a0a5bc90eba3a8151813834864344c881790
2021-04-17 05:53:34 +00:00
Treehugger Robot aef14db78a Merge changes from topic "tvts-test-host-jni"
* changes:
  Add jni_libs property to java tests
  Add Target to cc.SharedLibraryInfo
2021-04-17 04:35:24 +00:00
Pirama Arumuga Nainar 8428b29596 Merge "Switch to clang r416183b 12.0.5." am: 27b5e614c8 am: a455f80d4d am: e1f3386154
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1677305

Change-Id: If614f76a682029efe07d2b7e04138bc52f7935aa
2021-04-16 17:53:50 +00:00
Pirama Arumuga Nainar 27b5e614c8 Merge "Switch to clang r416183b 12.0.5." 2021-04-16 16:39:34 +00:00
Justin Yun 450ae72314 Add LLNDK stubs and headers to VNDK snapshot
LLNDK stubs and headers are required to build the vendor modules
against VNDK snapshot libraries. Add the LLNDK stubs and headers to
the VNDK snapshot prebuilt files.
The stub libraries will be included in shared/llndk-stub directory.

Bug: 181815415
Test: development/vndk/snapshot/build.sh --build-artifacts
Change-Id: If518f3e91080e69fa1da94af0aa27320d4e71a08
2021-04-16 23:02:04 +09:00
Treehugger Robot 3199760848 Merge "Document stubs in cc_library." am: 0b21bf60b6 am: f9851054b9 am: 22971e3562
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1538221

Change-Id: Ief99c6f0d4fdcf550d21c9d8756f4ed2bc966ed6
2021-04-16 13:08:16 +00:00
Treehugger Robot 0b21bf60b6 Merge "Document stubs in cc_library." 2021-04-16 11:57:32 +00:00
Jiyong Park cc7628c5fa Merge changes Ib07d4410,I0b306292 am: 7b4fb51919 am: 24f37728ee am: 08956ce9b5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1675766

Change-Id: If2a5d89e4e51b6a8813daf082a910f2dea91f604
2021-04-16 00:27:39 +00:00
Treehugger Robot 2619faa441 Merge "Remove draft API support." am: 7548b1ad05 am: 0ccb169046 am: c1499a90e2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1674968

Change-Id: I281cb957b9214fdd9d90c6ec6e95c5c69a4f5c96
2021-04-16 00:27:22 +00:00
Jiyong Park 7b4fb51919 Merge changes Ib07d4410,I0b306292
* changes:
  ApexInfo doesn't pass MinSdkVersion as string, but as ApiLevel
  Remove nativeApiLevelFromUserWithDefault
2021-04-15 23:21:55 +00:00
Treehugger Robot 7548b1ad05 Merge "Remove draft API support." 2021-04-15 22:58:15 +00:00
Pirama Arumuga Nainar 8a71786b52 Switch to clang r416183b 12.0.5.
Bug: http://b/182416735
Test: Treehugger

Change-Id: Ibc26561baaec925c2c05ae710de24aaaab18bef5
2021-04-15 20:22:01 +00:00
Treehugger Robot 3c58641466 Merge changes from topic "userdebug_plat_sepolicy.cil_Android.bp" am: 638830a5a0 am: d8a1386fba am: 7d5dc83e3b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1674328

Change-Id: Ic6146823d24ddbfcc7706d33ee2d17bad9471325
2021-04-15 07:20:23 +00:00
Jiyong Park 4eab21d5a2 ApexInfo doesn't pass MinSdkVersion as string, but as ApiLevel
ApexInfo is not part of the properties struct. It can handle structs
having private fields.

Bug: 1663140
Test: m
Change-Id: Ib07d4410f0ce187c9de347da34b84b814b2eb537
2021-04-15 15:17:54 +09:00
Treehugger Robot 507c35d88f Merge "Fix evaluation order of (Cfi|Memtag) exclude paths." am: d820c37425 am: 6ff0d4084e am: 4182f482f4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1672705

Change-Id: I4c10f9ccf8cbaae2dc0e3b953e7c4db0368f073a
2021-04-15 05:50:56 +00:00
Treehugger Robot 638830a5a0 Merge changes from topic "userdebug_plat_sepolicy.cil_Android.bp"
* changes:
  Add debug ramdisk variant
  Add path tests for ramdisk
2021-04-15 05:22:35 +00:00
Jiyong Park ee9b117038 Remove nativeApiLevelFromUserWithDefault
... in favor of proptools.StringDefault

Bug: 1663140
Test: m
Change-Id: I0b3062921b25179cd1bf53856973fb67fe5cfc05
2021-04-15 14:00:00 +09:00
Treehugger Robot d820c37425 Merge "Fix evaluation order of (Cfi|Memtag) exclude paths." 2021-04-15 03:49:38 +00:00
Inseob Kim f84e9c05e2 Add debug ramdisk variant
A module will be installed to debug_ramdisk (or
debug_ramdisk/first_stage_ramdisk if recovery as boot is true) if
debug_ramdisk is set to true.

Bug: 184004542
Test: soong test
Change-Id: Ic5a4d27407e506fffa462de2149e0785f11b2ac7
2021-04-15 00:56:30 +00:00
Ivan Lozano a522909a17 Merge changes from topic "rust_vendor_support" am: d466b4a1f5 am: f910744984 am: 7248ef0378
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1666565

Change-Id: Ieecd4422963df3e0350a12ec5603b6e8d637661d
2021-04-14 20:39:59 +00:00
Ivan Lozano 66d93ea7a0 Merge "cc: Create a common image mutator interface" am: e8dfbdfb59 am: fddd9f9214 am: b248e45583
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1666563

Change-Id: I63bd64f572497ac7076b266dfed43fbd6ebf000d
2021-04-14 20:39:29 +00:00
Ivan Lozano d466b4a1f5 Merge changes from topic "rust_vendor_support"
* changes:
  Add more Rust vendor image support.
  rust: Use new common image mutator interface.
2021-04-14 19:02:49 +00:00
Ivan Lozano e8dfbdfb59 Merge "cc: Create a common image mutator interface" 2021-04-14 18:53:18 +00:00
Inseob Kim 2fb95e0dc6 Merge changes from topic "reexport_vndk_from_vendor_snapshot" am: ff5cc064c2 am: 52be5348c7 am: 9295f870c5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1671539

Change-Id: I6aeedfc71cf76e16b0c6bf0b8a8a7f85a4c9c780
2021-04-14 02:37:03 +00:00
Inseob Kim 5f06f3b36e Add flag test for cfi snapshot am: f7aadf70d8 am: 15f5c18550 am: ba6af75d83
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1674225

Change-Id: I25ea400d3c331f60da288a01711da0445ae84eea
2021-04-14 02:36:59 +00:00
Inseob Kim 15f5c18550 Add flag test for cfi snapshot am: f7aadf70d8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1674225

Change-Id: I10650f69e17beb616eadc45c7ae7f5de02b4ff85
2021-04-14 00:31:34 +00:00
Inseob Kim ff5cc064c2 Merge changes from topic "reexport_vndk_from_vendor_snapshot"
* changes:
  Support reexporting vndk from vendor snapshot
  Add flag test for cfi snapshot
2021-04-13 23:46:13 +00:00
Dan Albert d05ba00415 Remove draft API support.
This is unused and doesn't work with our current API review process
anyway (un-drafting an API won't be flagged for API council review).

Test: treehugger
Bug: None
Change-Id: I6d8fcc9885b82dac5ada7772d9e3fb9101524ece
2021-04-13 15:55:47 -07:00
Treehugger Robot 44a782d019 Merge "Add tests for request_type ParseResult functions." am: 6bd0a19b9d am: e41f177874 am: e236eb6394
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1672428

Change-Id: I519f147c9db2e60582a7e3537b724d2f39131900
2021-04-13 21:12:59 +00:00
Liz Kammer 3c05ed947b Merge "Consolidate cc-specific cqueries." am: 41cca851d9 am: b50de53589 am: 3b3c5a1a12
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1672347

Change-Id: Ice69a3d4523b9cdc0cbc17cb59e6c27791d51dd1
2021-04-13 19:12:15 +00:00
Treehugger Robot 6bd0a19b9d Merge "Add tests for request_type ParseResult functions." 2021-04-13 19:08:11 +00:00
Evgenii Stepanov 779b64ec5d Fix evaluation order of (Cfi|Memtag) exclude paths.
Before this change, exclude paths disabled sanitization of targets that
would otherwise be enabled by SanitizeDevice product variable (aka
SANITIZE_TARGET).

With this change, in addition to the above logic, exclude path disables
sanitization of targets that would otherwise be enabled by the
corresponding include path.

Effectively, this change disables sanitization of targets that are
covered by *both* include and exclude paths.

Test: build/soong/cc/cc_test.go
Bug: b/184976817
Change-Id: I96f1e2a808d88b352b92b7490fa1df5c010314c3
2021-04-13 10:29:15 -07:00
Ivan Lozano c08897c1e4 Add more Rust vendor image support.
This adds Rust vendor image support for all module types except
Rust prebuilts.

Bug: 184042776
Test: New Soong tests.
Test: Example cc_library vendor module can depend on rust_ffi_shared.
Test: Example rust_library vendor-only module compiles.

Change-Id: Iaa30ad51fdaedcbf14687da5472581f6af62ff59
2021-04-13 13:17:12 -04:00
Liz Kammer 41cca851d9 Merge "Consolidate cc-specific cqueries." 2021-04-13 17:11:34 +00:00
Ivan Lozano 3a7d000d12 cc: Create a common image mutator interface
As part of adding Vendor support to Rust, refactor the image mutator in
CC to a new common image mutator interface so this logic can be reused
across both CC and Rust.

Bug: 184042776
Test: m nothing
Change-Id: Ia55d5ad840db7cf1a64d6c65ed86487230cb8742
2021-04-13 11:04:44 -04:00
Inseob Kim dd0295d774 Support reexporting vndk from vendor snapshot
Bug: 184795475
Test: soong test
Change-Id: I0146de55e2ef54c1c8abd42f0f4d8b4db7444350
2021-04-13 10:16:49 +09:00
Inseob Kim f7aadf70d8 Add flag test for cfi snapshot
Test: soong test
Change-Id: I651120b11f5b80c4b5f04172170afc533f24c54d
2021-04-13 10:15:31 +09:00
Treehugger Robot f6a7a92384 Merge "Add a test to check the intall partitions" am: 4a39669a27 am: 68336c71aa am: 274e65dd7a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1671530

Change-Id: I17f8dade5ffe4bffeb5b2a6e97b576f18b3d1753
2021-04-13 00:54:39 +00:00
Treehugger Robot b1b535cfce Merge "Install device_specific cc_prebuilt to ODM" am: dff81fa7d8 am: 7f0ceb9440 am: 0e0bd37556
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1672246

Change-Id: I6ab9896ecc259c87bb8b002042f5c3d768867060
2021-04-13 00:54:33 +00:00
Treehugger Robot b15d86a8bf Merge "cpp output of an AIDL file is together with the headers" am: 3bc51dfc72 am: 8ac5437359 am: eacc8eaf1d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1666828

Change-Id: I2892cce913870b9e10fbd4fa32937ecc6d1b70db
2021-04-13 00:54:25 +00:00
Treehugger Robot 4a39669a27 Merge "Add a test to check the intall partitions" 2021-04-13 00:15:38 +00:00
Treehugger Robot dff81fa7d8 Merge "Install device_specific cc_prebuilt to ODM" 2021-04-13 00:14:40 +00:00
Treehugger Robot 3bc51dfc72 Merge "cpp output of an AIDL file is together with the headers" 2021-04-12 23:42:29 +00:00
Treehugger Robot 05067de372 Merge "Add test for building cc_object with Bazel." am: c8c4bf4c98 am: 9b8e4d6b26 am: 432139a416
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1670172

Change-Id: Id0561e0a5a18a80aac4a8770411a6c4169550c8c
2021-04-12 20:59:57 +00:00
Liz Kammer fe23bf3eb0 Add tests for request_type ParseResult functions.
Test: go test request_type_test
Test: bp2build generate & sync; mixed build libc
Change-Id: Id0b813e9de4d02d8625e42549999659ccb005c6d
2021-04-12 16:23:53 -04:00
Liz Kammer b71794d8e6 Consolidate cc-specific cqueries.
There is little overlap at this point, but we expect these to converge
more over time, to handle exported includes, libs, etc., this will allow
those changes to be handled in one place and allow more consolidation of
code.

Test: bp2build generate & sync; mixed build libc
Change-Id: I51685dad9f4fc11a634965a3c9e84f4a0e279ecb
2021-04-12 15:59:08 -04:00
Treehugger Robot c8c4bf4c98 Merge "Add test for building cc_object with Bazel." 2021-04-12 19:40:47 +00:00
Treehugger Robot be66aca8e1 Merge "bp2build: refactor compiler/linker prop function." am: 02e40d0589 am: 39c14f4112 am: e865be2ee1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1671525

Change-Id: I7021083f52dcfec26408a036028d079dab7e5bac
2021-04-12 10:38:46 +00:00
Treehugger Robot 02e40d0589 Merge "bp2build: refactor compiler/linker prop function." 2021-04-12 09:22:30 +00:00
Jingwen Chen cbb95c8c3c Merge "bp2build: cc_library converter for //bionic/libdl:libdl_android" am: a42c707572 am: 361061f817 am: b0441fb8ed
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1652408

Change-Id: I2ff24f1aa862cbd9e84e9d2b7a8f69681d032b94
2021-04-12 06:18:01 +00:00
Jingwen Chen a42c707572 Merge "bp2build: cc_library converter for //bionic/libdl:libdl_android" 2021-04-12 04:30:27 +00:00
Justin Yun 7f99ec7c1f Add a test to check the intall partitions
cc modules have complex image variant settings. To avoid setting
wrong partitions to modules, add a test to check the install
partition.

Bug: 184885453
Test: m nothing
Change-Id: I080661335f2da7281d6e6a0d2fedd1fcecb4b2cb
2021-04-12 13:19:28 +09:00
Robin Lee 33db5cbf6e Install device_specific cc_prebuilt to ODM
In aosp/531337 support for installing prebuilts to vendor and odm
partitions was introduced.

Since aosp/1542687 allowed installing vendor variants to odm, we
started to see device_specific cc_prebuilts not installed to odm
at all.

The reason for this is the InVendor condition is true for the
device_specific module and VendorVariantToOdm is false in cases
outside the one it was designed for, so SocSpecific returns true and
the module gets installed to vendor instead of odm.

We need to check if we're specifically building a vendor variant
before triggering this VendorVariantToOdm logic.

Bug: 184885453
Change-Id: I05be06a61c5fc3f2f72599eb4746c9c0523b956e
2021-04-12 13:12:45 +09:00
Tri Vo 481890dbe2 Merge changes I46e851c8,I2c9eb248 am: eed4716def am: 77bf9bd71a am: ec0d17a613
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1662661

Change-Id: I20d8ee08433e88ec2b55fc59a170e9f48a54fd9c
2021-04-10 01:19:53 +00:00
Tri Vo eed4716def Merge changes I46e851c8,I2c9eb248
* changes:
  rust: Add HWASan build support
  Export CC HWASan sanitizer type
2021-04-09 22:31:09 +00:00
Liz Kammer 07bc5f9c4e Add test for building cc_object with Bazel.
Test: go test cc tests
Change-Id: I45a341d09c92f57769d1c3b686f8abac113b3548
2021-04-09 11:50:38 -04:00
Treehugger Robot 2a35da912e Merge "Handle simple prebuilt static libraries from bazel" am: 76579e0e9a am: 70a88424ba am: 8d77e0b2fd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1664542

Change-Id: Ib330bfb45d699a0541c12362939ad780f4057a01
2021-04-09 15:23:32 +00:00
David Srbecky 2211320bf8 Merge "Revert^2 "[strip.sh] Move remaining GNU binutils usage to llvm binutils"" am: 2af7a1b5ff am: dadf9c4fc7 am: c842453fa5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1670068

Change-Id: I254f26a009ee3f54445b2ecaa9e9229d0f47ade3
2021-04-09 13:55:18 +00:00
Treehugger Robot 76579e0e9a Merge "Handle simple prebuilt static libraries from bazel" 2021-04-09 13:38:59 +00:00
David Srbecky 2af7a1b5ff Merge "Revert^2 "[strip.sh] Move remaining GNU binutils usage to llvm binutils"" 2021-04-09 11:58:00 +00:00
Jingwen Chen 107c0de80e bp2build: refactor compiler/linker prop function.
This changes the return value into a compiler/linker attr struct to
standardize callsites and make it easier to retrieve the parsed attrs.

Test: TH
Change-Id: I1e3956e7cb5d924ce8472ece940faea459beef37
2021-04-09 10:45:48 +00:00
Jingwen Chen 6393098ecf bp2build: cc_library converter for //bionic/libdl:libdl_android
This CL contains the converter for libdl_android, a cc_library that
expands into a cc_shared_library and a regular cc_library.

Test: TH
Test: bp2build; bazel test //build/bazel/tests/...

Change-Id: If70641a538211b0d6b2aac0e4d0d06912318304d
2021-04-09 09:42:53 +00:00
Treehugger Robot ab11387b28 Merge changes I86d0600b,Id77f1ce9 am: 2198adce8f am: 4808948409 am: ac244e2b14
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1669726

Change-Id: I40a338803f4afe9f9138a905bc076092ae291502
2021-04-09 01:30:42 +00:00
Treehugger Robot 2198adce8f Merge changes I86d0600b,Id77f1ce9
* changes:
  Use old unwinder for R cc modules
  Redirect memtag libraries to snapshot
2021-04-09 01:12:12 +00:00
Tri Vo 6eafc36e60 Export CC HWASan sanitizer type
We need this so that HWASan sanitizer mutator in CC can sanitize Rust.

Bug: 180495975
Test: m nothing
Change-Id: I2c9eb248df4e55a33f5d45083e91588f4c8e3e94
2021-04-08 14:24:06 -07:00
Rupert Shuttleworth 99f726e28b Merge "Be more explicit about headers in cc_library_static targets." am: a18b3b66cd am: d970597f59 am: fd415679bf
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1664504

Change-Id: I4e5ab5575583bb869f790d447190d939fb07183d
2021-04-08 18:43:24 +00:00
David Srbecky 789fe0fdeb Revert^2 "[strip.sh] Move remaining GNU binutils usage to llvm binutils"
This reverts commit 33dfba1d9c.

Bug: 141010852
Test: art/test.py -t 137-cfi
Test: llvm-objcopy --dump-section=.gnu_debugdata=mdi.xz libhwui.so && \
      unxz -fk mdi.xz && readelf -a mdi | less
Change-Id: I751b51274a961194647ec11fd3fd49886df1e1b3
2021-04-08 18:31:46 +01:00
Inseob Kim d4c9f55468 Use old unwinder for R cc modules
Modules linking against VNDK R have been using libgcc_stripped and
libunwind_llvm as their unwinder. This change uses those old unwinder
libraries if current module's VNDK version is R.

Bug: 178470649
Test: soong test
Change-Id: I86d0600b2fb09cd9828c0a5b1157558711b0ec86
2021-04-08 19:28:28 +09:00
Rupert Shuttleworth c58d3d214e Be more explicit about headers in cc_library_static targets.
Test: bp2build-sync.py write; bazel build //bionic/...
Change-Id: I253b55f4d3cbe76805691b32e761016950871601
2021-04-08 09:43:04 +00:00
Inseob Kim 253f521dbc Redirect memtag libraries to snapshot
memtag sanitizer libraries are vendor available and can be captured as
snapshots. This change adds a redirection logic for memtag libraries.

This is just a workaround, just like other SnapshotInfoProvider calls.
In the future we need to refactor these codes. So TODO is added to
remind refactoring.

Bug: 178470649
Test: soong test
Change-Id: Id77f1ce94255b56a68f3e1d7446a68189c45ac54
2021-04-08 17:10:31 +09:00
Rupert Shuttleworth 2e845e53af Merge "Support arch variations for export_system_include_dirs in cc_library_headers bp2build converter." am: 64a90286c4 am: 197a03958b am: 4f95eb9f95
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1665920

Change-Id: I81dd1f49fabd9ca42fd0faaa4aef213551c052e5
2021-04-08 07:46:05 +00:00
Jose "Pepe" Galmes 93362b658e Merge changes from topic "vendor_snapshot_remove_suffix" am: 37ab310920 am: a490d18c10 am: d8440291d4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1666002

Change-Id: I1536b75d199114c3ff8c5971bd8a41e221aeeb8f
2021-04-08 07:45:57 +00:00
Inseob Kim e06620c33a Automatically set Androidmk suffix of snapshot am: 1b6fb87654 am: 12cdfcba72 am: defa512778
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1664300

Change-Id: I79fd78a8ac7903295ea6fe731a3a25f8c7699078
2021-04-08 07:45:56 +00:00
Rupert Shuttleworth 64a90286c4 Merge "Support arch variations for export_system_include_dirs in cc_library_headers bp2build converter." 2021-04-08 00:54:47 +00:00
Rupert Shuttleworth b815168474 Support arch variations for export_system_include_dirs in cc_library_headers bp2build converter.
Test: Added unit test
Test: bp2build-sync.py write; bazel build //bionic/... works for more cc_library_static targets (in a parent CL)
Change-Id: Ib487216a4bcbc52958ff948722dae347b0d8b606
2021-04-07 16:05:44 +00:00
Liz Kammer 3f9e155f83 Handle simple prebuilt static libraries from bazel
Test: generate & sync BUILD files via bp2build && mixed build droid
Bug: 184192619
Change-Id: I27f0d76c88cbff25f3c7a805f3dfbb1eeaf8e771
2021-04-07 11:07:36 -04:00
Jiyong Park c7e592cdef cpp output of an AIDL file is together with the headers
For an AIDL file, five files are generated for the CPP backend: cpp
output, depfile, and three headers. Previously, the cpp output and the
dep file were created at <module_out>/gen/<abs_path_to_input_aidl>.cpp,
while the headers were at <module_out>/gen/aidl/<package_name>/*.h.

This not only looks inconsistent, but more critically makes it difficult
for the aidl compiler to infer the path to the headers that the build
system registered as implicit outputs. Inferring the implicit outputs
by the aidl compiler is needed because otherwise users will see the
error message from sbox just saying that some of the expected files are
not created. This can happen when the input AIDL file is put directly
into the srcs property without specifying the base directory, e.g.
some/subdir/android/foo/IFoo.aidl where the pacakge is actually
android.foo.

In order to make it easy for developers to fix such an error,
I0f23b6027ba3a4755cc2901f4a7f7fc70bffd0ef introduces a check in the aidl
compiler which is triggered earlier than the sbox error. The compiler
now enforces that the cpp output is at
<out_dir>/<package_name>/<type>.app. When the check fails, it suggests
to fix that by correctly feeding the AIDL file via filegroup and the
path property.

This change in Soong is required to satisfy aidl compiler when the base
directory is correctly set. The cpp output is now at
<module_out>/gen/aidl/<pacakge_name>/<type>.cpp.

Bug: 184586092
Test: aidl_unittests
Change-Id: I172180a40bded4f6c08679a2d862b086998be1e1
2021-04-07 21:49:34 +09:00
Jose Galmes f9523ed579 Fix arch in snapshot DepsMutator.
Suffixes attached to snapshot modules are based on the main architecture
(e.g. "arm64" for aosp_cf_x86_64_phone-userdebug), not the architecture
of arch variants.

Bug: 184588077
Bug: 184695066
Test: Run unit tests using:
Test: source build/envsetup.sh
Test: m -j nothing
Change-Id: Id8d002d45864a6fb12d642b60011e7a9eaf29e07
2021-04-07 11:45:25 +00:00
Inseob Kim 1b6fb87654 Automatically set Androidmk suffix of snapshot
Androidmk_suffix has been captured with "m vendor-snapshot". But the
suffix is to avoid collision with core variants, so the suffix should be
based on the existence of core variants. This change sets the suffix by
using OtherModuleDependencyVariantExists. This way we can also avoid
mutators and global states.

Bug: 179665538
Test: m nothing (soong test)
Change-Id: I35343aa2c4c07782057b82e6dd0e705a786e55fc
2021-04-07 17:24:08 +09:00
Ryan Prichard a467ea4870 Merge "Remove libgcc toolchain libs for Android" am: 3f3bb83f81 am: f72c6f2e44 am: a5934e3408
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1663859

Change-Id: Ia4b0f7de3bac88ab90a3ca0a6dd647117275aa7c
2021-04-07 00:15:50 +00:00
Ryan Prichard 3f3bb83f81 Merge "Remove libgcc toolchain libs for Android" 2021-04-06 21:43:33 +00:00
Christopher Parsons 6c025c3929 Merge "Fix note_memtag bionic libraries in mixed builds" am: b7c6a7ef36 am: 27798cb5d6 am: ff2a9c6ada
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1663541

Change-Id: I0d248d953a3a9463c5eb87ed37e5c9e4dd156c7b
2021-04-06 19:54:54 +00:00
Christopher Parsons b7c6a7ef36 Merge "Fix note_memtag bionic libraries in mixed builds" 2021-04-06 17:57:59 +00:00
Jingwen Chen 14ac490b34 Merge "Add target/os configurable string_list attrs." am: 8f8029a92b am: 695b00f3fc am: c72347401b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1664303

Change-Id: I6775cb20a8e62c98591ba18fb8c2870236eef9b5
2021-04-06 11:48:35 +00:00
Jingwen Chen 8f8029a92b Merge "Add target/os configurable string_list attrs." 2021-04-06 09:47:24 +00:00
Treehugger Robot dd62393313 Merge changes Id33bf640,I4d67b9b9 am: 8c56183fb7 am: b17e061ae9 am: a7fe23c458
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1663139

Change-Id: Ic1434fc150e802f3a6e8b58a9a6f3e16e93da146
2021-04-06 05:29:49 +00:00
Treehugger Robot 8c56183fb7 Merge changes Id33bf640,I4d67b9b9
* changes:
  Don't use incorrect version names like VER or BOARD even in tests
  SdkSpec = Scope + ApiLevel
2021-04-06 03:18:16 +00:00
Chris Parsons eefc9e6a62 Fix note_memtag bionic libraries in mixed builds
Required fixes:
  - Set MakeLinkType for libraries, even in mixed build mode.
  - Set snapshot header information to empty list, which passes
        validation logic for depending modules

Fixing these libraries also requires a Starlark change to
cc_library_static.bzl, which will be submitted separately.

Additionally, this adds better error messaging in the event that
output files are missing from a mixed-build library.

Test: USE_BAZEL_ANALYSIS=1 m libc
Test: USE_BAZEL_ANALYSIS=1 m runtime-module-sdk
Change-Id: Iad2c4d46359986fb0a43263292a15ed45fabbac7
2021-04-05 15:27:55 -04:00
Liz Kammer fe562e4749 Merge "Add bazel_module properties to cc_defaults" am: 9962daec01 am: b54a6c4457 am: 2fde0e00cf
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1660764

Change-Id: If1a59dfce1534d3de561c7f6aea136dbf43fa4c4
2021-04-05 14:27:58 +00:00
Liz Kammer 9962daec01 Merge "Add bazel_module properties to cc_defaults" 2021-04-05 12:33:21 +00:00
Jingwen Chen c1c2650532 Add target/os configurable string_list attrs.
Starting with copts for cc_object, with an extracted function that can
be shared with other cc_* module types.

Test: TH
Change-Id: I9025232e83a3dcd0ca243387486fafbdbd3e2d9b
2021-04-05 11:27:19 +00:00
Jingwen Chen f69daeccb5 Merge "Add os/target configurable selects for label list attributes." am: 1a6bbbd990 am: 16795963e9 am: 13c099f82d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1652048

Change-Id: I1ad467167b89e94aacb82db3acfa044135743b62
2021-04-05 09:09:58 +00:00
Jingwen Chen 1a6bbbd990 Merge "Add os/target configurable selects for label list attributes." 2021-04-05 07:09:48 +00:00
Jiyong Park f58c46e36f Don't use incorrect version names like VER or BOARD even in tests
All version names will go through ApiLevelFromUser which triggers an
error when the name is not a valid one.

Bug: 175678607
Test: m
Change-Id: Id33bf64085603914d45ad7942cb8908a4734493f
2021-04-05 09:32:06 +09:00
Ryan Prichard c2018e2ed4 Remove libgcc toolchain libs for Android
Remove Android-targeting gcc toolchain libraries -- libgcc,
libgcc_stripped, libatomic, and libgcov. Also remove libunwind_llvm,
which is replaced with a libunwind toolchain prebuilt.

The __atomic_* library functions are now part of the compiler-rt
builtins library:

https://android-review.googlesource.com/c/toolchain/llvm_android/+/1625025

Bug: http://b/153025717
Test: treehugger
Change-Id: I971d0a4a49f1aaeb3546e80b6d94208277a171ac
2021-04-02 21:07:35 -07:00
Steven Moreland 889dc32103 Merge "Export header check allows WholeStaticLibs" am: f42daa716c am: 3f34589233 am: ed06f3b55e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1662670

Change-Id: I74ff6ad6a2b4aaff4fb1e01dcd896a9b543c8a76
2021-04-02 17:37:44 +00:00
Steven Moreland f42daa716c Merge "Export header check allows WholeStaticLibs" 2021-04-02 16:03:59 +00:00
Liz Kammer 3cf5211890 Add bazel_module properties to cc_defaults
Test: go soong tests
Test: add bazel_module to Android.bp file and m nothing
Change-Id: I13c3e8d59536dbea88f3495309f4f64e849ede9f
2021-04-02 08:44:31 -04:00
Jingwen Chen 91220d7334 Add os/target configurable selects for label list attributes.
This CL is pretty large, so I recommend starting with reading the newly
added tests for the expected behavior.

This change works in conjunction with the linked CLs in the Gerrit topic.
Those CLs add support for new platform() definitions for OS targets
specified in Soong's arch.go, which are configurable through
Android.bp's `target {}` property. It works similary to previous CLs
adding support for the `arch {}` property.

These configurable props are keyed by the OS: android, linux_bionic,
windows, and so on. They map to `select` statements in label list
attributes, which this CL enables for cc_library_headers' header_libs
and export_header_lib_headers props.

This enables //bionic/libc:libc_headers to be generated correctly, from:

    cc_library_headers {
        name: "libc_headers",
        target: {
            android: {
                header_libs: ["libc_headers_arch"],
                export_header_lib_headers: ["libc_headers_arch"],
            },
            linux_bionic: {
                header_libs: ["libc_headers_arch"],
                export_header_lib_headers: ["libc_headers_arch"],
            },
        },
        // omitted props
    }

to:

    cc_library_headers(
        name = "libc_headers",
        deps = [] + select({
            "//build/bazel/platforms/os:android": [
                ":libc_headers_arch",
            ],
            "//build/bazel/platforms/os:linux_bionic": [
                ":libc_headers_arch",
            ],
            "//conditions:default": [],
        }),
    )

Test: TH
Test: Verify generated //bionic/libc:libc_headers
Fixes: 183597786

Change-Id: I01016cc2cc9a71449f02300d747f01decebf3f6e
2021-04-02 08:17:34 +00:00
Yi Kong fc31228715 Merge "Move toc.sh to use LLVM binutils" am: 948205699b am: 115fc28122 am: 84c6d3c48d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1661823

Change-Id: Ic6df699e0f25b1ce952317b0b8e6520f01cd24bb
2021-04-02 04:50:08 +00:00
Yi Kong 948205699b Merge "Move toc.sh to use LLVM binutils" 2021-04-02 02:38:16 +00:00
Ryan Prichard 9110bde59d Merge "Revert^2 "Switch platform-NDK unwinder to LLVM libunwind.a prebuilt"" am: 252831b03a am: a9cf131c22 am: 81d7a5336d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1661300

Change-Id: I1cd443d4fb6715458477a130803c4f94e5fbeb40
2021-04-02 00:58:03 +00:00
Steven Moreland ba407c8afa Export header check allows WholeStaticLibs
cc/linker.go code assumes that export_static_lib_headers can apply
regardless of whether a library is a regular or 'whole' static lib.
However, this check prevents that code from working.

Bug: 183654927
Test: use export_static_lib_headers like this
Change-Id: I680f90514e41224a7077630167ab4e481909d89c
2021-04-02 00:03:44 +00:00
Ryan Prichard 252831b03a Merge "Revert^2 "Switch platform-NDK unwinder to LLVM libunwind.a prebuilt"" 2021-04-01 22:42:33 +00:00
Yi Kong 4ad44e713b Move toc.sh to use LLVM binutils
Test: build
Change-Id: Ib965b6ea3fba6ae007135ac7e167cc50f0f6e3de
2021-04-01 17:45:42 +08:00
Treehugger Robot 7349652925 Merge ""current" is implicitly added to stubs.versions" am: 25c47a43a5 am: 4ce23de995 am: cab9b4b25c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1641782

Change-Id: Ibc0b6e3fdd98b59900f9998f5c11c417d5d4a20a
2021-04-01 06:57:10 +00:00
Yi Kong 44208d77df Merge "Move gen_sorted_bss_symbols.sh to use LLVM binutils" am: 9d9e053964 am: dd19e029a5 am: 3ef89b207a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1659997

Change-Id: Ia30bce0b8866cbc5078f2c7fb8b4b8a8c930077f
2021-04-01 05:34:55 +00:00
Treehugger Robot 25c47a43a5 Merge ""current" is implicitly added to stubs.versions" 2021-04-01 04:53:55 +00:00
Yi Kong 9d9e053964 Merge "Move gen_sorted_bss_symbols.sh to use LLVM binutils" 2021-04-01 03:10:08 +00:00
Jiyong Park d4a3a137ed "current" is implicitly added to stubs.versions
So far, when a library `libfoo` has `stubs.versions: ["10", "11"]`, then
`shared_libs: ["libfoo"]` is linked to the version 11 of the stub.

This requires the author of `libfoo` to manually update the property
whenever a new version is introduced. Otherwise, clients are not able
to use the newly added APIs because the latest stub is for an old
version.

This change eliminates the need for manual updating. "current" version
is always implicitly added to `stubs.versions`. It is added even when
nothing is set on the property, if `stubs.symbol_file` is set. i.e.

```
cc_library {
    name: "libfoo",
    stubs: {
        symbol_file: "libfoo.map.txt",
	// no versions: [...] needed
    },
}

cc_library {
    name: "a_client",
    shared_libs: ["libfoo"],
    apex_available: ["myapex"],
    min_sdk_version: "29",
}

apex {
    name: "myapex",
    native_shared_libraries: ["a_client"],
    min_sdk_version: "29",
}
```

`a_client` links to the "current" stub of `libfoo` that has all symbols
shown in the map file.

Note that, above doesn't mean that the client has unlimited access to
APIs that are introduced even after the min_sdk_version of the client
(29 in this example). The use of such APIs still has to be guarded with
`__builtin_available` check.

Bug: N/A
Test: m
Change-Id: I70bb1600c18e74d36c6b24c3569d2149f02aaf96
2021-04-01 09:58:53 +09:00
Ryan Prichard 4ccd490ae5 Revert^2 "Switch platform-NDK unwinder to LLVM libunwind.a prebuilt"
This reverts commit 74bdc28817.

Bug: http://b/153025717
Test: treehugger
Change-Id: I11410f213732c52755a3bd3d4d0769570354484e
2021-03-31 15:33:44 -07:00
Liz Kammer fc8bc62d2a Merge "Handle product_variable asflag for cc_object." am: acacbc1166 am: 2cc845060d am: 263bdc570c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1652787

Change-Id: I6f9fd6727fd3eb0a5fdf3b0ccd324fed24a05be6
2021-03-31 21:17:47 +00:00
Liz Kammer 9af11134ff Merge "Don't use custom mixed build logic for cc_object" am: 7dfaa3a732 am: 227e8e9493 am: 8ac144c6e6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1615643

Change-Id: Iff33eedc973c18eb99ee0de60548c8272b525104
2021-03-31 21:17:42 +00:00
Liz Kammer acacbc1166 Merge "Handle product_variable asflag for cc_object." 2021-03-31 18:43:55 +00:00
Liz Kammer 7dfaa3a732 Merge "Don't use custom mixed build logic for cc_object" 2021-03-31 18:43:55 +00:00
Paul Duffin 2303174d95 Merge changes Ia3e93b8a,I964af3cb am: 4f6d15465b am: 18674bc4a8 am: 4d7fd01c00
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1655215

Change-Id: Ic22d20d0e3618ccacea62beb01a91117f5a56bc8
2021-03-31 16:28:16 +00:00
Paul Duffin 4eca3c04fc Merge "Extract prepareForCcTest" am: d11d199ba6 am: 3b56761441 am: 0dcfdfd118
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1655213

Change-Id: I7f0bc0e5600ff5dbe95319fa1c2f74c592398c66
2021-03-31 16:27:16 +00:00
Paul Duffin 4f6d15465b Merge changes Ia3e93b8a,I964af3cb
* changes:
  Remove ccFixtureFactory
  Remove buildDir from cc package
2021-03-31 14:26:03 +00:00
Paul Duffin d11d199ba6 Merge "Extract prepareForCcTest" 2021-03-31 14:25:19 +00:00
Paul Duffin 4b2ff1652c Merge "Rename OptionalPath.RelativeToPath -> RelativeToTop" am: 32eccae1ac am: 4ac8cd6582 am: d188fa7de2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1658072

Change-Id: I1ad2710e2439861542f01a976b185bb4084b02dd
2021-03-31 10:45:46 +00:00
Yi Kong bf1db7b149 Move gen_sorted_bss_symbols.sh to use LLVM binutils
Test: build
Change-Id: I496b92d963d127087daef405dafa24377d6bac97
2021-03-31 17:13:43 +08:00
Paul Duffin 32eccae1ac Merge "Rename OptionalPath.RelativeToPath -> RelativeToTop" 2021-03-31 08:57:43 +00:00
Ryan Prichard 9de87e4487 Merge "Revert "Switch platform-NDK unwinder to LLVM libunwind.a prebuilt"" am: ae4246488f am: 1a454d987c am: ffec4fb0b4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1658930

Change-Id: Ic19ef4205284bb64ead303bc004667ce22d725f5
2021-03-31 05:59:10 +00:00
Jose "Pepe" Galmes 99e56981b1 Merge "Fix missing snapshot headers." am: 9d54139763 am: db27fa0986 am: 9c3fe4daa8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1658921

Change-Id: I13a5641d55b8df4225bf7154154e69eb47a2eed6
2021-03-31 05:58:57 +00:00
Ryan Prichard ae4246488f Merge "Revert "Switch platform-NDK unwinder to LLVM libunwind.a prebuilt"" 2021-03-31 05:29:51 +00:00
Jose "Pepe" Galmes 9d54139763 Merge "Fix missing snapshot headers." 2021-03-31 04:45:43 +00:00
Ryan Prichard 74bdc28817 Revert "Switch platform-NDK unwinder to LLVM libunwind.a prebuilt"
This reverts commit 29b9de083e.

Reason for revert: b/184095989

Change-Id: I11d90562e0703631258a5e9f1b2dc36f1702289a
2021-03-31 03:25:57 +00:00
Jose Galmes 0d736917e6 Fix missing snapshot headers.
Bug: 184057288
Test: Run unit tests using:
Test: source build/envsetup.sh
Test: m -j nothing
Change-Id: If7402be9199313f9f03627cad662405b03b5d0fe
2021-03-30 17:27:45 -07:00
Dan Albert 667fd9bdae Merge "Switch platform-NDK unwinder to LLVM libunwind.a prebuilt" am: 368b7e6a13 am: 1ef79d5171 am: 6f23a7332e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1554719

Change-Id: Ie4987e20fcbf288817a3ad5c401929a89d6aa727
2021-03-31 00:20:17 +00:00
Paul Duffin b4c0f11cb7 Automatically call TestingBuildParams.RelativeToTop() am: e8366da1f6 am: fe53b7a2df am: 53325362e9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1655208

Change-Id: I2260f4020c4631310626f77ec7480f106e4c7c3b
2021-03-30 23:14:01 +00:00
Paul Duffin 8567f226e4 Remove ccFixtureFactory
Bug: 182885307
Test: m nothing
Change-Id: Ia3e93b8ab70a7a6a986debd837bd2df84b234847
2021-03-30 23:44:43 +01:00
Paul Duffin 2e6f90e0d0 Extract prepareForCcTest
Bug: 182885307
Test: m nothing
Change-Id: Ica17d20775c6dae00978f0f84f768fdaaf55e031
2021-03-30 23:44:43 +01:00
Paul Duffin c3e6ce04d9 Remove buildDir from cc package
Bug: 182885307
Test: m nothing
Change-Id: I964af3cb9a3e7a1dfbd9d5176a702591f6b19f16
2021-03-30 23:44:43 +01:00
Dan Albert 368b7e6a13 Merge "Switch platform-NDK unwinder to LLVM libunwind.a prebuilt" 2021-03-30 21:44:35 +00:00
Liz Kammer a060c4521e Handle product_variable asflag for cc_object.
cc_object crtbrand sets product_variable.platform_sdk_version.asflag
and will not compile correctly within mixed builds without it.

Only handles product_variables that expand product variables.

Bug: 181794963
Test: ~/aosp/build/bazel/scripts/milestone-2/demo.sh full
Change-Id: I293fcb18032aa51f63bb7b3de94abd6d1ec38180
2021-03-30 15:16:43 -04:00
Paul Duffin afdd4061ee Rename OptionalPath.RelativeToPath -> RelativeToTop
Bug: 183650682
Test: m nothing
Change-Id: I95239c2273e715e8c4c15a4a02967e01f6913234
2021-03-30 20:06:22 +01:00
Paul Duffin e8366da1f6 Automatically call TestingBuildParams.RelativeToTop()
Fixes the few tests that break due to this and which cannot easily be
separated into their own changes.

Bug: 183650682
Test: m nothing
Change-Id: Ia2f31213a1f114a78e66a81d89279ecde9f4c465
2021-03-30 19:35:35 +01:00
Jingwen Chen 2f9549fece bp2build: arch-configurable selects for label list attrs. am: 0702791a99 am: ca0664d2fe am: b1fb88681b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1635579

Change-Id: Ic633ddfe15248d31833d62f71b081512d31c06d7
2021-03-30 16:41:16 +00:00
Jingwen Chen 0702791a99 bp2build: arch-configurable selects for label list attrs.
This CL adds the configurable LabelListAttribute support to bp2build.

Test: go test
Change-Id: I2ef9e385d9cf1b1845988128eca1d8cda1ecb5e8
2021-03-30 13:22:48 +00:00
Martin Stjernholm 2f1e93ef36 Merge changes Iaa6411b5,I2118b8a2,Ibbdd3cbd,I2d1bbda2 am: 38e9f0b82f am: 99f29d244a am: c5c5d80d30
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1652620

Change-Id: I09a93351bcae2c27531fd258ddacdd8bc5ddd474
2021-03-30 12:42:38 +00:00
Martin Stjernholm 38e9f0b82f Merge changes Iaa6411b5,I2118b8a2,Ibbdd3cbd,I2d1bbda2
* changes:
  Make test_for arch variant.
  Don't use APEX stubs between internal libs in the same APEX when building test_for modules.
  Add FilterListPred.
  Don't panic on "go test" invocations from the command line.
2021-03-30 09:26:36 +00:00
Treehugger Robot 83c426a3fe Merge "Append ".static" to ubsan runtime for static binaries" am: e2f39b038d am: c1f3f6acbc am: 8b81b2b528
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1655969

Change-Id: Iaa8cd1979d5dd6b551175a6b898922098ec2472e
2021-03-30 04:58:02 +00:00
Treehugger Robot e2f39b038d Merge "Append ".static" to ubsan runtime for static binaries" 2021-03-30 03:07:27 +00:00
Colin Cross 32f1de3327 Append ".static" to ubsan runtime for static binaries
Bug: 183611452
Test: m BUILD_HOST_static=1 tinyplay2
Change-Id: I8d8ef762781f0583c8b9337ce5876c7d3140f665
2021-03-29 16:47:56 -07:00
Martin Stjernholm 855e90b57c Make test_for arch variant.
To be able to avoid registering dependencies on nonexistent host APEXes
in host builds.

Test: art/tools/buildbot-build.sh --host
  with http://r.android.com/q/topic:libdexfile-noext applied
Bug: 183217299
Change-Id: Iaa6411b511b6f50da01827b49852607ae825bc83
2021-03-28 22:06:34 +01:00
Martin Stjernholm 4e6c269de5 Don't use APEX stubs between internal libs in the same APEX when
building test_for modules.

This extends the current approach where test modules always depend on
the platform variants of the APEX libs, and only skips the stubs on
them. It still has the limitation that the internal libs must have the
exact same apex_available lists.

Also some improvement of the test accuracy in TestTestFor.

Test: m libartagent-target
  with http://r.android.com/q/topic:libdexfile-noext applied
Bug: 183217299
Change-Id: I2118b8a22c887077867a3ddbbe73437b4a29a6ad
2021-03-28 22:06:34 +01:00
Ivan Lozano 3f62a868e8 Merge "rust: Add whole_static_libs, revert static_lib" am: 352bdf29b3 am: f34d6487ae am: 04edf27ef6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1652928

Change-Id: I170a6291d8f2f92abe1104f90a8f14037015a9da
2021-03-26 14:57:22 +00:00
Ivan Lozano 352bdf29b3 Merge "rust: Add whole_static_libs, revert static_lib" 2021-03-26 13:01:14 +00:00
Treehugger Robot 1b2236a225 Merge changes from topic "min_sdk_version" am: 10906f5cc6 am: 22d43c0676 am: b62df79d53
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1646949

Change-Id: Ie7f1d9752a2db369d73a6e2a006f63cf78f5b4e6
2021-03-26 10:17:36 +00:00
Treehugger Robot 10906f5cc6 Merge changes from topic "min_sdk_version"
* changes:
  Versioned CRT objects are built with correct __ANDROID_API__
  Always respect min_sdk_version
2021-03-26 08:07:28 +00:00
Rupert Shuttleworth b8ba92912b Merge "Add bp2build support for cc_library_static." am: 0f256ff07d am: 5b5f675f48 am: 14a2686d7d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1652835

Change-Id: I6594ee7d4490bacf553f43431fef64219900b74f
2021-03-25 23:03:12 +00:00
Colin Cross 8a63fa9fd2 Merge changes Ie8721dcd,If1827b9d,Iec250a2d,I3f46f611,Idf136919, ... am: ba5fff85a7 am: 0b0fcae3ca am: defc5c9f8a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1651847

Change-Id: Ifc60075b65f4f27134aaab9315e4c0ffe90f2481
2021-03-25 23:03:02 +00:00
Rupert Shuttleworth 0f256ff07d Merge "Add bp2build support for cc_library_static." 2021-03-25 21:01:29 +00:00
Colin Cross ba5fff85a7 Merge changes Ie8721dcd,If1827b9d,Iec250a2d,I3f46f611,Idf136919, ...
* changes:
  Replace ANDROID_SDK_HOME with ANDROID_PREFS_ROOT for metalava
  Simplify lint rules using improved RuleBuilder rsp support
  Support multiple rsp files in RuleBuilder
  Pass rsp files into sbox and rewrapper
  Add test for sbox input sandboxing
  Support multiple rsp files in REParams
  Move response file handling to a separate package
2021-03-25 20:55:56 +00:00
Paul Duffin c5296cd586 Merge "Disallow non-existent paths in sdk package" am: 863ecfb7ba am: a48aed59ee am: 146b43cc63
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647171

Change-Id: Ic3aa5af880a293457d5303b362c38421591f55e2
2021-03-25 19:47:49 +00:00
Pirama Arumuga Nainar b418b98eee Merge "[pgo] Do not explicitly link profile runtime" am: 4c0b11a16e am: a65c8e8172 am: bf56f6b1f6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1651751

Change-Id: I36e663461bbd27e23cde64287526fc50ba5fcc97
2021-03-25 19:47:08 +00:00
Paul Duffin 863ecfb7ba Merge "Disallow non-existent paths in sdk package" 2021-03-25 18:09:06 +00:00
Colin Cross a4eafddc41 Support multiple rsp files in REParams
rewrapper supports a comma separate list of rsp files, replace
REParams.RSPFile with REParmas.RSPFiles.

Test: remoteexec_test.go
Change-Id: I7850c071c23d368d6fad4480dd527d146c13c6d3
2021-03-25 11:06:45 -07:00
Pirama Arumuga Nainar 4c0b11a16e Merge "[pgo] Do not explicitly link profile runtime" 2021-03-25 17:57:49 +00:00
Ivan Lozano 63bb7680c9 rust: Add whole_static_libs, revert static_lib
Revert the static_lib behavior to the previous behavior (pass static
libs to the linker rather than via to rustc using `-lstatic=<lib>`). To
bundle static libraries into libraries, provide the whole_static_libs
property which retains the current static_libs behavior.

Passing all static libraries via -lstatic was resulting in odd bloat
where in some cases static symbols were duplicated in binaries and
libraries. This split makes it possible to be explicit about when static
libraries should be bundled.

Bug: 183182230
Test: mma system/bt; mma system/security/keystore2; mma external/rust

Change-Id: Ic2dde5d1542dca5ce145aa3a3fbd9ea54440d991
2021-03-25 13:50:17 -04:00
Liz Kammer 8206d4ff98 Don't use custom mixed build logic for cc_object
Starlark implementation of cc_object now performs partial linking, which
better matches Soong's implementation of cc_object.

Bug: 181794963
Test: generate build files with bp2build, mixed build droid
Change-Id: I5a325aa1c608981deaee3671ac28c6014e6cbf08
2021-03-25 12:00:30 -04:00
Rupert Shuttleworth 095081c6d7 Add bp2build support for cc_library_static.
Also refactor bp2build-related code for cc_library_headers.

(Retry of previous CL after the presubmit failed to detect a merge conflict)

Test: Added unit test.

Test: bp2build-sync.py write; bazel build //bionic/... still works (but bp2build is disabled for most cc_library_static targets for other reasons)
Change-Id: I2f4405c2fea305623bbc6daaaf62808b0c074216
2021-03-25 15:16:11 +00:00
Paul Duffin db462dd987 Disallow non-existent paths in sdk package
Test behavior was changed a while ago so that tests by default ignore
non-existent source paths (unless they explicitly check for/rely on
them). Prior to that CheckSnapshot() could detect when files were
missing from the snapshot but it no longer can.

This change disallows non-existent source files in all the sdk tests
which means that they are disallowed when processing the snapshots as
they use the same preparers as were used to process the sources.

This caused a test failure which has been temporarily ignored and has
a TODO and bug associated with it.

Bug: 183184375
Test: m nothing
Change-Id: I969d8515d20ef5ae515f2b5f93d8ed4e4f8ede75
2021-03-25 12:53:22 +00:00
Treehugger Robot 9cacf2e311 Merge "Enable safe ICF for all devices" am: f7e79a591c am: 660e778db6 am: ef42232afb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1649333

Change-Id: I1e1eb1e3b82b2ff1f59f01fac59049cdf6e581cf
2021-03-25 10:52:47 +00:00
Treehugger Robot f7e79a591c Merge "Enable safe ICF for all devices" 2021-03-25 08:59:00 +00:00
Jingwen Chen 7c8de8545d Merge "Revert "Add bp2build support for cc_library_static."" am: 8b086655cd am: 1763a4add1 am: 8729dfc636
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1652233

Change-Id: I6e5d18b5ec499179cbe167bce7702bb0d51b2c5d
2021-03-25 08:08:45 +00:00
Rupert Shuttleworth 1b5200cb4f Merge "Add bp2build support for cc_library_static." am: d3e10104b0 am: 76d01a0522 am: ce8062d357
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1594371

Change-Id: I36cb39f43847e2a4a56bce6920a2f304ebf2df0a
2021-03-25 08:08:31 +00:00
Jingwen Chen 8b086655cd Merge "Revert "Add bp2build support for cc_library_static."" 2021-03-25 06:14:03 +00:00
Jingwen Chen f9410540a8 Revert "Add bp2build support for cc_library_static."
Revert submission 1594391-bp2build-cc_library_static

Reason for revert: Broke the build on aosp-master
Reverted Changes:
Ib16ccf31a:Add cc_library_static macro to help with bp2build ...
I37c856be2:Add bp2build support for cc_library_static.

Change-Id: Ie94d5bc6da81758cd4e0461c08a810a29643c971
2021-03-25 06:11:59 +00:00
Rupert Shuttleworth d3e10104b0 Merge "Add bp2build support for cc_library_static." 2021-03-25 05:39:39 +00:00
Jingwen Chen a6a6d1acb6 Merge "bp2build: add allowlist for package-level conversions." am: 95c6eb3959 am: cf615d8640 am: a7b2d95cf6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1625820

Change-Id: I57f618c5c3b7e4524c44e29c61a6de2547a225b7
2021-03-24 23:51:18 +00:00
Rupert Shuttleworth 21e743df41 Add bp2build support for cc_library_static.
Also refactor bp2build-related code for cc_library_headers.

Test: Added unit test.

Test: bp2build-sync.py write; bazel build //bionic/... still works (but bp2build is disabled for most cc_library_static targets for other reasons)

Change-Id: I37c856be20a47b154909338a22a7dba1ab55693f
2021-03-24 13:56:44 +00:00
Jingwen Chen 12b4c2706d bp2build: add allowlist for package-level conversions.
This CL adds the support for specifying lists of directories in
build/soong/android/bazel.go, which are then written into
out/soong/bp2build/MANIFEST. Using this configuration,
modules/directories can either default to bp2build_available: true or
false, while still retaining the ability to opt-in or out at the module level.

It also ensures that ConvertWithBp2Build returns true iff the module
type has a registered bp2build converter.

Test: go tests
Test: demo.sh full
Test: TreeHugger presubmits for bp2build and mixed builds.

Change-Id: I0e0f6f4b1b2ec045f2f1c338f7084defc5d23a55
2021-03-24 02:27:19 -04:00
Ryo Hashimoto 5818b9344f Enable safe ICF for all devices
--icf=safe has been enabled for arm and arm64.
Do the same thing for all devices.

On bertha_x86_64, this CL makes system.raw.img 4.4MB smaller.

Bug: 182446785
Test: build

Change-Id: Ifd597cd8496c49b55df269f22e01b1c50dc8f6e8
2021-03-24 13:00:32 +09:00
Pirama Arumuga Nainar bedca74471 [pgo] Do not explicitly link profile runtime
Bug: http://b/181740505

Explicitly adding dependency to profile runtime causes apex dependency
errors.  We're already passing -fprofile-instr-generate to the linker so
depending on the profile runtimes is unnecessary.

Test: pgo-coral-config1 on internal release branch and run tests on
      APCT.
Change-Id: Ie54785726c7ac044e5a5a2299073d02d45d5e0a7
2021-03-23 18:07:30 -07:00
Treehugger Robot 41cfa60853 Merge "Handle include_build_directory prop in bp2build" am: dca349a782 am: a5be000743 am: 421020e361
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1646268

Change-Id: I1e3dd722eb55d03feaba5a273dd55c750c8c099f
2021-03-23 16:36:28 +00:00
Treehugger Robot dca349a782 Merge "Handle include_build_directory prop in bp2build" 2021-03-23 14:39:19 +00:00
Ryan Prichard 29b9de083e Switch platform-NDK unwinder to LLVM libunwind.a prebuilt
Link against the libunwind.a shipped with the NDK so it matches what's
linked into the NDK's libc++_shared.so.

Bug: http://b/153025717
Test: device boots, manually inspect some linker command lines
Change-Id: Icc79844f5e70f0eaa97ea758449c30fbddd030d2
2021-03-22 13:46:54 -07:00
Pirama Arumuga Nainar e7c30b32c0 Merge "Switch to clang r416183 12.0.4." am: 679d5308ec am: 042fce9dfd am: 59fed69211
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1640559

Change-Id: I301bb50687a8f8a613b30ae9af11c193465de1f9
2021-03-22 20:37:26 +00:00
Pirama Arumuga Nainar 679d5308ec Merge "Switch to clang r416183 12.0.4." 2021-03-22 16:26:13 +00:00
Jiyong Park fdaa5f7164 Versioned CRT objects are built with correct __ANDROID_API__
Background: `min_sdk_version` of a crt object is the oldest SDK version
that the crt object supports. When it's set to for example 16, Soong
creates a number of versioned variants of the crt object starting from
16 to the latest version. The variant for version X is provided to NDK
clients having `min_sdk_version` set to X.

Problem: all versioned variants of a crt object were built with `-target
<arch>-linux-android16`. Therefore they all have been with `#define __ANDROID_API__
16`.  This is because the mutated variants still have the same
min_sdk_version property and the clang triple follows min_sdk_version,
not sdk_version. This is too conservative and against our intention to
provide the latest crt object that matches with the min_sdk_version of
the client.

In the other hand, the platform(non-sdk) variant of the crt object
doesn't have such a problem. min_sdk_version is completely ignored.
However, this is a bug and will be fixed by aosp/1640364. As a side
effect of the fixing, the platform variant will begin to built with a
very old __ANDROID_API__ which unnecessarily turns off the new platform
features like the TLS segment over-alignment.

This change fixes the problems:

* For the versioned variants of crt objects, we set both
`min_sdk_version` and `sdk_versio` to the version that the variant is
created for.

* For the platform variant of crt objects, `min_sdk_version` is force
reset to "current".

Bug: 183191008
Test: m

Change-Id: I8c9d0fcea816de8cd1532dac4a47eee4f726c037
2021-03-23 01:18:31 +09:00
Jiyong Park a008fb08cf Always respect min_sdk_version
Background:
When compiling cc_* modules, min_sdk_version determines the "version"
part of the clang triple: -target <arch>-linux-android<version>. The
version part is used to make sure that calls to the APIs that are added
after the version are guarded with a runtime check (i.e.
__builtin_available).

Previously, min_sdk_version was used as the version part only when the
cc_* module is unbundled (e.g. built for an APEX or built with SDK). In
other words, min_sdk_version has been ignored for the platform variants.
They were built with the version number 10000.

This was problematic for Mainline module tests. Since they are neither
part of an APEX nor built with SDK (because they need to have access to
some of the module-only APIs), they are built with the version number
10000. As a side effect, __builtin_available macro are expanded to 1 at
build time - because 10000 is higher than any API versions. When such a
test built in the latest platform source tree runs on a device running
an old platform, it tries to call an API that might not be available on
the platform and experience a crash, due to the lack of the runtime
check.

This change fixes the problem by using min_sdk_version as the "version"
part of the clang triple, regardless of the module's variant. Then
__builtin_available macro in the tests doesn't expand to 1, but to a
function call to the libclang_rt.builtin library which checks the system
property ro.build.version.sdk.

Bug: N/A
Test: run resolv_stress_test

Change-Id: I88f64c5a35f1b5276c3350e177b116932011a940
2021-03-23 01:18:31 +09:00
Treehugger Robot 8de6291424 Merge "Revert "[strip.sh] Move remaining GNU binutils usage to llvm binutils"" am: f2be52c4dc am: 7ce29d53bf am: 62701ff807
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1647203

Change-Id: I421b4ee552ec335a363c0393100352982b1161a1
2021-03-20 21:24:27 +00:00
Treehugger Robot f2be52c4dc Merge "Revert "[strip.sh] Move remaining GNU binutils usage to llvm binutils"" 2021-03-20 19:25:23 +00:00
David Srbecky 33dfba1d9c Revert "[strip.sh] Move remaining GNU binutils usage to llvm binutils"
This reverts commit ad50ce8349.

Bug: 183237575
Reason for revert: Breaks stack unwinding

Change-Id: I256dc77525687fb3e670355587b1eac72158b274
2021-03-20 14:46:15 +00:00
Colin Cross 6dee49ca7f Merge changes Iab4e09d9,Icf2f24dd,I15be5ef1,Ic0db9619 am: d2db7953a0 am: fa5bd82ef0 am: 5c2afde7f1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1634812

Change-Id: Ic4b43962a5ac32605216fec53a1b2e5803874191
2021-03-19 19:20:57 +00:00
Yi Kong d28df8630d Merge "[strip.sh] Move remaining GNU binutils usage to llvm binutils" am: 00d54280d0 am: dd3494b8e4 am: 55163399f5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1235781

Change-Id: I04470e88b6848c10137368d6b8d7d91c99f1fd01
2021-03-19 17:25:14 +00:00
Colin Cross d2db7953a0 Merge changes Iab4e09d9,Icf2f24dd,I15be5ef1,Ic0db9619
* changes:
  Run lint actions in sbox
  Support sbox-in-RBE
  Move android package on top of remotexec
  Support sandboxing inputs in RuleBuilder
2021-03-19 17:25:14 +00:00
Liz Kammer a4aa43072b Handle include_build_directory prop in bp2build
Test: go test cc tests
Test: generate bp2build, sync bp2build, bazel build //bionic/...
Bug: 181794963
Change-Id: I8dcef585e3025ef6f44d22430ed67b1e0429dca0
2021-03-19 12:33:34 -04:00
Yi Kong 00d54280d0 Merge "[strip.sh] Move remaining GNU binutils usage to llvm binutils" 2021-03-19 15:32:49 +00:00
Jingwen Chen eafb095afe Merge "bp2build: cc_library_headers converter should only include that module type" am: b1672af5d2 am: 5d622ec767 am: b1ab70742c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1645006

Change-Id: I269f513856d3b1a4bd1d83ea1fce7a550220a507
2021-03-19 11:31:25 +00:00
Jingwen Chen b1672af5d2 Merge "bp2build: cc_library_headers converter should only include that module type" 2021-03-19 09:18:15 +00:00
Yi Kong ad50ce8349 [strip.sh] Move remaining GNU binutils usage to llvm binutils
With clang r377782, llvm binutils implements all the necessary
funtionaility for strip.sh. We can finally get rid of all the fallback
GNU binutils usage.

Test: m
Bug: 141010852
Bug: 135627985
Change-Id: I110f6028dab7f599decf59a5cb1b927b35e11857
2021-03-19 12:28:44 +08:00
Justin Yun 43ad83767b Merge "Define __ANDROID_VENDOR__ and __ANDROID_PRODUCT__" am: b1d5479783 am: 2d0020dbbd am: 76e4387707
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1620648

Change-Id: I507c493b93fc1fdfefe7f2d01e50e2c22e036368
2021-03-19 01:50:55 +00:00
Pirama Arumuga Nainar c7d23478e1 Switch to clang r416183 12.0.4.
Bug: http://b/181927912

Test: go/android-llvm-testing-dashboard tag: test_clang_r416183
      go/android-llvm-windows-testing
      go/ab/P20855845 sdk_phone_armv7-sdk_mac build on Forrest
      Forrest run L21700000838126631 for CtsNNAPITestCases

Change-Id: If677b57616348ae52704494f40c7b1ed470bb5f4
2021-03-19 01:14:20 +00:00
Justin Yun b1d5479783 Merge "Define __ANDROID_VENDOR__ and __ANDROID_PRODUCT__" 2021-03-18 23:33:43 +00:00