Commit graph

6332 commits

Author SHA1 Message Date
Liz Kammer
222bdcff5c bp2build: Improve handling of generated_sources
Test: build/bazel/ci/bp2build.sh
Change-Id: Id5f8b6ae9bbf1e90d72854daafb8b1f86f7241ea
2021-10-11 14:15:51 -04:00
Jingwen Chen
97b8531492 Add bp2build support for cpp_std.
This converts cpp_std and gnu_extensions into a -std copt, if cpp_std is
specified or gnu_extensions is false if cpp_std is not specified.

I chose to go with this copts approach because the tradeoff is a much
simpler setting than adding a new attr(s) everywhere that uses features
to set the flag.

This approach limits the number of user-configurable knobs (since users
would then be able to set std in _both_ copts and the new attr). But it
does rely on the user copt overriding the toolchain's default gnu++17
version, which can mean a `-std` flag showing up twice in the action.

Fixes: b/202462232
Test: b build //system/libziparchive:libziparchive
Change-Id: I81dad029059461739b91f318d662e089edb46b84
2021-10-08 11:16:20 +00:00
Xin Li
800112b97f Merge "Merge Android 12" 2021-10-07 23:50:21 +00:00
Jingwen Chen
6ada589f6e Add support for nocrt by translating it to link_crt in bp2build.
If nocrt is true, then the compilation for cc_shared_library,
cc_binary (shared or static binaries) will _not_ link against their
respective crtbegin and crtend libraries.

nocrt is true only for the Bionic libraries themselves. For everything
else that links against the Bionic runtime, crtbegin and crtend
libraries are used. This makes the "nocrt: false" case the majority.
Hence, if nocrt is explicitly false, we omit the generating attribute in
bp2build.

If nocrt is explicitly true (link_crt is false), the Starlark macro will
disable the link_crt cc_toolchain feature.

Test: new tests
Test: CI
Fixes: 187928070
Fixes: 197946668
Change-Id: I8947789930e599dc802d8eae440859257d044475
2021-10-07 14:04:39 +00:00
Treehugger Robot
3e745e63f3 Merge "Bp2Build common properties auto-handling" am: d905146590
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1815376

Change-Id: I38f1063302ea90583a51e625076e6232b4364ab7
2021-10-04 19:20:28 +00:00
Treehugger Robot
d905146590 Merge "Bp2Build common properties auto-handling" 2021-10-04 19:02:07 +00:00
Colin Cross
fec737d6fe Merge "Export SOONG_CC_API_XML to Make outside androidmk" am: f79f4c3199
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1842574

Change-Id: Ie7312e0928bfe7692454f8d9a074c10f90fa3f2e
2021-10-04 18:44:31 +00:00
Colin Cross
f79f4c3199 Merge "Export SOONG_CC_API_XML to Make outside androidmk" 2021-10-04 18:32:15 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
447f6c99c9 Bp2Build common properties auto-handling
Introduce `commonAttributes` & `fillCommonBp2BuildModuleAttrs used in
CreateBazelTargetModule

Adapt `bp2BuildInfo` to use `commonAttrs` instead of `Name`.
And thus also all downstream users of `CreateBazelTargetModule`.

As initial user, the Soong `required` property will be
translated to Bazel's `data`.

Bug: 198146582, 196091467
Test: build_converstion_test.go:TestCommonBp2BuildModuleAttrs
Test: go test
Test: mixed_{libc,droid}.sh
Change-Id: Ib500e40f7e2cb48c459f1ebe3188962fc41ec124
2021-10-04 14:43:04 +00:00
Colin Cross
10ef62ea67 Merge changes from topics "bp-bionic-cts-tests", "cts-per-testcase-directory" am: 2df9ebf9ca
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1838375

Change-Id: I9fd93be8154f2f1372ccde1eb9a37690738692b7
2021-10-01 16:46:26 +00:00
Colin Cross
2df9ebf9ca Merge changes from topics "bp-bionic-cts-tests", "cts-per-testcase-directory"
* changes:
  Add data_bins property
  Support per-testcase directories in all test suites
  Add environment variables to cc_genrule commands
2021-10-01 16:27:55 +00:00
Colin Cross
ceaa5328f0 Export SOONG_CC_API_XML to Make outside androidmk
This relands Ie0a945d879de4f99ce76d005aea8041719c244f7 with a fix
to prevent building XMl files for multiple variants of a library.

The SOONG_CC_API_XML values are needed for modules that are not
exported to Make, export them from a singleton that covers all
modules instead of an AndroidMkProvider that may not be called
for some modules.

Bug: 193819970
Test: forrest
Change-Id: I54710c00901976a736e88126f406e02b1f3c3586
2021-09-30 13:11:48 -07:00
Chris Parsons
486b80a0d5 Support building libcrypto via mixed builds am: a37e195182
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1839353

Change-Id: I34a5ec794874856a415e2c5415ef8b08ef3a7e21
2021-09-30 20:10:15 +00:00
Chris Parsons
a37e195182 Support building libcrypto via mixed builds
This required the following fixes to bp2build:
  - Correctly handle Bionic_* and Linux_* targets
  - Correctly handle cc_object's selects
  - Generate linker_script, stl, and system_dynamic_deps for cc_object in bp2build

Test: USE_BAZEL_ANALYSIS=1 m adbd
Change-Id: I753fd18df8ae551fb69df07e4174527c5388f289
2021-09-30 12:30:36 -04:00
Treehugger Robot
d758c9bccd Merge "Add unit tests for cpp/assembly flags." am: 4352a8e696
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1841793

Change-Id: Iea9755567590efb6fcd161a5e92182386b2fff47
2021-09-30 15:24:35 +00:00
Liz Kammer
08572c6d45 Add unit tests for cpp/assembly flags.
Test: go test soong tests
Change-Id: Idd4b8d558b9bccf92b63c80abff19792ea3ff766
2021-09-30 10:11:04 -04:00
Colin Cross
59f957abbf Merge "Revert "Export SOONG_CC_API_XML to Make outside androidmk"" am: 6f37dba455
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1841188

Change-Id: I84b0b1e723313f4749e6d37a989b1e3c88b140d8
2021-09-30 03:39:08 +00:00
Colin Cross
2cec05d37b Revert "Export SOONG_CC_API_XML to Make outside androidmk"
This reverts commit ebb32c486a.

Reason for revert: breaks coverage build (b/201600003)
Bug: 193819970
Bug: 201600003

Change-Id: I65969c4a62165c40dded2794b757469909bf8ca6
2021-09-30 03:14:40 +00:00
Colin Cross
7dddc5adb5 Merge "Export SOONG_CC_API_XML to Make outside androidmk" am: 1cd6d8e25e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1838396

Change-Id: Id1d458966726c4fda22f0558bb54e9f07738aab1
2021-09-29 23:30:29 +00:00
Colin Cross
ebb32c486a Export SOONG_CC_API_XML to Make outside androidmk
The SOONG_CC_API_XML values are needed for modules that are not
exported to Make, export them from a singleton that covers all
modules instead of an AndroidMkProvider that may not be called
for some modules.

Bug: 193819970
Test: manual
Change-Id: Ie0a945d879de4f99ce76d005aea8041719c244f7
2021-09-28 16:39:13 -07:00
Colin Cross
c8caa06a36 Add data_bins property
data_bins is similar to data_libs but copies helper binaries alongside
the test.

Bug: 200872604
Test: atest CtsBionicTestCases
Change-Id: I4f9df5f82816cfd30a0a19808fda220cf77c50a7
2021-09-27 15:56:26 -07:00
Colin Cross
cfb0f5e102 Support per-testcase directories in all test suites
There are cases where two modules try to install the same test data
into CTS, which results in collisions when CTS puts the data for all
tests in the same directory.  Add a flag that allows enabling a
per-testcase directory for an individual test for all test suites.

Bug: 193168159
Test: cts-tradefed run commandAndExit CtsBionicTestCases
Change-Id: If034723e8fe937ca71d3e2d39b7d46702e41bc8c
2021-09-27 15:56:26 -07:00
Colin Cross
f3bfd02aa9 Add environment variables to cc_genrule commands
Pass the architecture, mulitlib type and native bridge state to
each variant of a cc_genrule rule as environment variables.

Bug: 200872604
Test: TestCmdPrefix
Change-Id: I39c4c2d5bbd4f4cc72a4777715db1df049345b37
2021-09-27 15:56:23 -07:00
Paul Duffin
4bf3db6c1f Add ramdisk image sdk trait to cc_library_headers am: 12a0a310a7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1834876

Change-Id: I722497159725cd4e8b913357aed161ea69357a28
2021-09-25 09:30:55 +00:00
Paul Duffin
e0778ba120 Merge "Add recovery image sdk trait to cc_library_headers" am: a02157a4b7
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1834875

Change-Id: I60e4ae35cd9807501abd2a0a009a5efc9de62211
2021-09-25 09:30:06 +00:00
Paul Duffin
fbca36d0c6 Merge "Extract handling of image variations from target loop" am: 7af6b7062b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1834873

Change-Id: Ic16405a43a524784ff29e23c45567faaadc6cedd
2021-09-25 09:29:45 +00:00
Paul Duffin
12a0a310a7 Add ramdisk image sdk trait to cc_library_headers
Allows an sdk to require that a cc_library_headers module provides a
ramdisk image variant for the prebuilt.

Previously, "ramdisk_available: true" would be set in the generated
prebuilt snapshot for any sdk member that specified
"ramdisk_available: true" in the source module. This change will only
add that setting to the snapshot if the ramdisk image variant trait
was explicitly requested for a member.

Bug: 195754365
Test: m nothing
Change-Id: I21e0dd02d380beabf228a72c463fcc603c77d87f
2021-09-25 10:17:31 +01:00
Paul Duffin
a02157a4b7 Merge "Add recovery image sdk trait to cc_library_headers" 2021-09-25 09:14:21 +00:00
Paul Duffin
7af6b7062b Merge "Extract handling of image variations from target loop" 2021-09-25 09:11:44 +00:00
Christopher Parsons
a64586fb74 Merge "Add stl property support for bp2build" am: 0bb4ac55d6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1834858

Change-Id: I9c45eab96c5e62667bd78d0fa48601ab140357a0
2021-09-24 20:08:41 +00:00
Christopher Parsons
0bb4ac55d6 Merge "Add stl property support for bp2build" 2021-09-24 20:01:12 +00:00
Chris Parsons
a967f253e6 Add stl property support for bp2build
Test: mixed_libc
Test: USE_BAZEL_ANALYSIS=1 m libbase
Change-Id: If56d4a728de3ae4022cc9dadadc9bf8b952f9eaf
2021-09-24 13:51:56 -04:00
Liz Kammer
137044cac4 Merge "Refactor code for partitions c srcs" am: 46f8dbe06a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1831493

Change-Id: Ib366e45228edca439c6dd41021945e0c62a7c127
2021-09-24 17:51:11 +00:00
Liz Kammer
46f8dbe06a Merge "Refactor code for partitions c srcs" 2021-09-24 17:35:16 +00:00
Paul Duffin
6369622f8d Add recovery image sdk trait to cc_library_headers
Allows an sdk to require that a cc_library_headers module provides a
recovery image variant for the prebuilt.

Previously, "recovery_available: true" would be set in the generated
prebuilt snapshot for any sdk member that specified
"recovery_available: true" in the source module. This change will only
add that setting to the snapshot if the recovery image variant trait
was explicitly requested for a member.

Bug: 195754365
Test: m nothing
Change-Id: I7d79ccdec843127f7852d82b4b163021e30a79a7
2021-09-24 17:44:37 +01:00
Paul Duffin
b1f0f2aa80 Extract handling of image variations from target loop
This separates the selection of the image variations to depend upon
from the main target loop. Follow up changes will add additional
image variations.

Bug: 195754365
Test: m nothing
Change-Id: Ia1a61b1efbc96d92cb2faf1e2c4d1c5c752b8083
2021-09-24 17:15:40 +01:00
Liz Kammer
6fe2d9a3aa Merge "bp2build: Add support for export_.*headers props" am: 6244df2a24
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1835374

Change-Id: I10252c15de0bbc6691a69fb214461f6d56d000ff
2021-09-24 13:29:34 +00:00
Liz Kammer
57e2e7a78f Refactor code for partitions c srcs
To support protos (and other srcs that generate sources), we need to
partition further. Separate out into a separate common function.

Bug: 200601772
Test: build/bazel/ci/bp2build.sh
Change-Id: I7bf4cd96fd9a9fca4ccb3c96f21a04303201f891
2021-09-23 18:28:24 -04:00
Liz Kammer
7a210ac233 bp2build: Add support for export_.*headers props
Soong supports export_.*_headers properties, the libraries contained in
this list must also be within a shared/static/whole_static/header libs
property. For bp2build, we eliminate this duplication. The libraries
not listed in an export_.*_headers property will migrate to an attribute
prepended with implementation_, those in export_.*_headers will not have
a prefix.

Test: build/bazel/ci/bp2build.sh
Test: build/bazel/ci/mixed_libc.sh
Bug: 198241472
Change-Id: I3eb84c983ec5d241c8a568e411dfd5619d3184a7
2021-09-23 16:07:45 -04:00
Christopher Parsons
f75a32998e Merge "Disable mixed builds for non-device OS" am: 4ea6052650
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1834999

Change-Id: I7bdd47462db00faeaa85917d47f310c17b134aae
2021-09-23 20:02:36 +00:00
Wei Li
0e504d7dc9 Merge "Add bp2build converter for cc_genrule." am: a06db33ebd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1829492

Change-Id: I73b0abd1f86d7dfc17a683595585aff4b5ffb91e
2021-09-23 18:17:04 +00:00
Chris Parsons
1826621bdd Disable mixed builds for non-device OS
We don't currently support propagation of OS in mixed builds, and our
host toolchains are not properly configured.

This allows us to continue to make progress on device OS until host is
supported.

Test: mixed_libc CI
Test: USE_BAZEL_ANALYSI=1 m adbd
Change-Id: I2bf8b3f9ca7928dd33bf2fb3d4fa067da0f593f3
2021-09-23 14:11:42 -04:00
Wei Li
a06db33ebd Merge "Add bp2build converter for cc_genrule." 2021-09-23 18:04:03 +00:00
Sarah Chin
1c0557ea82 Merge "Add IRadio modules to VNDK" 2021-09-23 16:35:42 +00:00
Paul Duffin
8aae014264 Merge "Add support for native bridge trait" am: 15e92388bb
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1827878

Change-Id: I286209ee993de44cc508ca9449e73a55846dac33
2021-09-23 13:03:35 +00:00
Paul Duffin
93b750e2a0 Add support for native bridge trait
Adds a native bridge trait that if required will cause a
cc_library_header module to generate a cc_prebuilt_library_headers with
native_bridge_supported: true. It will fail if the cc_library_header's
native bridge variant would produce native bridge specific properties,
distinct from the other architecture variants, in the generated
cc_prebuilt_library_headers.

Bug: 195754365
Test: m nothing
Change-Id: I282fbb9095de6c6af57cca4eb4260e2c6c2da8cc
2021-09-23 11:37:57 +01:00
Wei Li
bcd399479a Add bp2build converter for cc_genrule.
Test: cc_genrule_conversion_test.go

Change-Id: I19290b417d6336020a15ba7fa772ee0c76c58225
2021-09-23 05:41:20 +00:00
Sarah Chin
0322af503a Add IRadio modules to VNDK
Test: build
Bug: 198331451
Change-Id: Ia468b563c6485464db56b3c9cdbae80de6b3f165
Merged-In: Ia468b563c6485464db56b3c9cdbae80de6b3f165
2021-09-23 03:54:58 +00:00
Sarah Chin
ef3dd96890 Merge "Add IRadio modules to VNDK" into stage-aosp-master 2021-09-23 02:58:32 +00:00
Treehugger Robot
dfcb3ff691 Merge "Revert "update build rules to use /data/local/tests/unrestricted"" am: 512ec3f4fe
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1832958

Change-Id: I1f99bcbca475bd29e165f735706cd2b3d913c113
2021-09-22 06:45:42 +00:00