Commit Graph

6123 Commits

Author SHA1 Message Date
Chris Parsons
484e50aa7c bp2build: support generated sources and hdrs
There are two pieces to make this work:
1. Local include paths must include $(BINDIR)-relative paths, to support
generated headers in those directories.
2. The srcs that bp2build outputs for BUILD targets must include labels
for targets given in generated_hdrs and generated_srcs.

Support for exported_generated_hdrs intentionally deferred.

This allows us to remove several targets from the bp2build denylist.
Some are moved to the mixed build denylist, because genreated headers are
still unsupported in mixed builds.
Test: bp2build.sh CI script

Change-Id: Ib4f9dac20f6445487b8dad53b91eac01f437a590
2021-05-17 14:30:07 -04:00
Elliott Hughes
0e9cdb04df cc/linker.go: check min_sdk_version.
Checking sdk_version broke mainline code that compiles against a current
API level but needs to be able to run on an older API level.

Bug: http://b/187907243
Test: treehugger
Change-Id: If1192ef2809e39b043f0a384775b6c9e3a8bd619
2021-05-17 17:52:26 +00:00
Lukács T. Berki
99fff81379 Merge "Refactor GetTargetProperties()." am: 33ebde3bce am: b6198a93ee
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1709413

Change-Id: I08bd8defd36534edac7f2e49e319f315bfe770d4
2021-05-17 14:38:59 +00:00
Lukacs T. Berki
5f51839d0d Refactor GetTargetProperties().
This is so that its implementation is more amenable to implementing
`target: { android_arm: { ... } }` and the like.

In addition, add a Boolean return value to getChildPropertyStruct() and
use it at every call site so that we only merge property structs when it
makes sense.

Bug: 187530594
Test: Presubmits.
Change-Id: I1b441c14b3d90a12b84dc89f82dd053978e89c7e
2021-05-17 14:04:04 +02:00
Justin Yun
9876ffa7b3 Define vsr_min_shipping_api_level to cc_test
test_options in cc_test can have vsr_min_shipping_api_level to define
the minimum shipping api level that checks vendor api level in
addition to the device shipping api level. It can be used for the
tests that have dependency on the vendor api level.
vsr stands for the vendor software requirements.

Bug: 181284704
Test: manual test
Change-Id: I7f2cecd2818d35d86f7c08cb220e0c9db71fe0a8
Merged-In: I7f2cecd2818d35d86f7c08cb220e0c9db71fe0a8
(cherry picked from commit a364cfb69d)
2021-05-17 09:30:10 +09:00
Elliott Hughes
6f95aa43be Merge "cc/linker.go: check min_sdk_version." am: 11bc0eef0c am: 9318bd1437
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1708947

Change-Id: I84b556c9ea49418f383405c544a3cc7a76dda320
2021-05-15 01:01:01 +00:00
Treehugger Robot
daa904286d Merge "Define vsr_min_shipping_api_level to cc_test" am: 32ef4e25b8 am: 874ee0df2b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1706525

Change-Id: I4fae4ee53934202a81e3ad77d38abeb12ef8637e
2021-05-15 01:00:48 +00:00
Elliott Hughes
11bc0eef0c Merge "cc/linker.go: check min_sdk_version." 2021-05-15 00:35:21 +00:00
Treehugger Robot
32ef4e25b8 Merge "Define vsr_min_shipping_api_level to cc_test" 2021-05-15 00:21:11 +00:00
Elliott Hughes
852edc147a cc/linker.go: check min_sdk_version.
Checking sdk_version broke mainline code that compiles against a current
API level but needs to be able to run on an older API level.

Bug: http://b/187907243
Test: treehugger
Change-Id: If1192ef2809e39b043f0a384775b6c9e3a8bd619
2021-05-14 14:03:53 -07:00
Bill Peckham
a7eec840cc Merge "Fix missing headers for vndk snapshotted libc" am: 054619d198 am: a1ae5530cb am: 94f308c04a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1708168

Change-Id: I7aa49e3be1ca027ef6a16c8cd3c1b378eb512575
2021-05-14 18:21:23 +00:00
Colin Cross
25c60df217 Merge "Add order-only dependency on shared libraries" am: 9debc21ca3 am: 78894a5ab0 am: 690de6069b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1707986

Change-Id: Id03071cc3809d0c4212839f6be3fec547ae3a61c
2021-05-14 18:19:52 +00:00
Bill Peckham
054619d198 Merge "Fix missing headers for vndk snapshotted libc" 2021-05-14 16:52:11 +00:00
Colin Cross
9debc21ca3 Merge "Add order-only dependency on shared libraries" 2021-05-14 16:48:57 +00:00
Inseob Kim
cc12d90753 Fix missing headers for vndk snapshotted libc
VNDK snapshot depends on addExportedGeneratedHeaders to grab generated
headers. This change adds a missing addExportedGeneratedHeaders call to
make libc's headers captured correctly.

Bug: 181326838
Test: VNDK_SNAPSHOT_BUILD_ARTIFACTS=true m dist vndk && unzip -l
out/dist/*.zip

Change-Id: Iaa89b5255c836761a26c77bb27f35f768f49039e
2021-05-14 20:15:55 +09:00
Justin Yun
a364cfb69d Define vsr_min_shipping_api_level to cc_test
test_options in cc_test can have vsr_min_shipping_api_level to define
the minimum shipping api level that checks vendor api level in
addition to the device shipping api level. It can be used for the
tests that have dependency on the vendor api level.
vsr stands for the vendor software requirements.

Bug: 181284704
Test: manual test
Change-Id: I7f2cecd2818d35d86f7c08cb220e0c9db71fe0a8
2021-05-14 12:47:18 +09:00
Colin Cross
af98f58242 Don't propagate ASAN through shared library dependencies
Propagating enabling ASAN through shared library dependencies
doesn't make much sense, because only the non-ASAN variant is exposed
to Make, leading to an non-installed dependency.

Bug: 186487510
Test: TestAsan
Change-Id: I7d3f20f2d10beac09c66c6b6dcb7a34a513ff3b8
2021-05-13 18:02:57 -07:00
Colin Cross
58dd6a92e5 Add order-only dependency on shared libraries
Improve the dependency accuracy by adding an order-only dependency
on the shared library alongside the existing depenency on the
table of contents file.  The dependency won't cause the module
to be rebuilt when the the shared library changes, but will allow
anything using the ninja graph for sandboxing to know the dependency
exists.

Test: manual
Change-Id: I3accbcabee62fa0ad3eb3d1aaedc5a4bffe27308
2021-05-13 18:01:24 -07:00
Treehugger Robot
0290f6e772 Merge "Soong: check if lndk is needed for apex build" am: ef0439d969 am: 2a4deaaf6d am: 7a89365bc1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1705069

Change-Id: Iaf8d854ab9548591698c1e8240a26124d904a268
2021-05-13 23:23:58 +00:00
Zhijun He
ec2858799b Soong: check if lndk is needed for apex build
This is to fix the unnecessary dependencies inclusion
when building apex modules.

Test: Build
Bug: 186306595
Change-Id: I1f3bbdb0a1f97a8338b45ca29c92acf9b20eadd3
2021-05-13 14:04:45 -07:00
Jingwen Chen
8e27e6c226 Merge "bp2build: build //external/scudo/..." am: ccfd7fc939 am: 58344f0391 am: 1c7591cfb9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1704771

Change-Id: I3665975d656141f7919cce5d80eff25ea7edc9d4
2021-05-13 13:23:04 +00:00
Jingwen Chen
ccfd7fc939 Merge "bp2build: build //external/scudo/..." 2021-05-13 12:19:43 +00:00
Jingwen Chen
d17bb43fe1 Merge "bp2build: export some cc toolchain flags into Starlark." am: 1d35a87072 am: 138b60595c am: a7e79646d3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1698426

Change-Id: Iac3a24bb6a528b1281465ed4a354c95ea01e4a59
2021-05-13 11:29:09 +00:00
Jingwen Chen
1d35a87072 Merge "bp2build: export some cc toolchain flags into Starlark." 2021-05-13 10:31:54 +00:00
Paul Duffin
b964b24a51 Merge "Allow module types to force creation of a default APEX variant" am: 9896b3424b am: 05ca6f6919 am: 5c45498964
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1705263

Change-Id: I4365d9d1dfbfcd8bf9aa3f6381ec9470b7ff9921
2021-05-13 09:06:26 +00:00
Paul Duffin
9896b3424b Merge "Allow module types to force creation of a default APEX variant" 2021-05-13 08:07:19 +00:00
Jingwen Chen
75be1cae8f bp2build: build //external/scudo/...
Test: TH
Fixes: 187158841
Change-Id: I73c1d8fe075d2534c2389973b9381405d9389044
2021-05-13 06:25:49 +00:00
Jingwen Chen
bf61afb7f7 bp2build: export some cc toolchain flags into Starlark.
This CL exports common/global/device/host clang/ld/ldd flags
from their Ninja variable initialization locations in
cc/config/global.go and cc/config/clang.go to make Bazel's cc_toolchain
and Soong's cc actions more consistent with each other.

This does not handle env-dependent or arch-specific toolchain flags
yet (logic in compiler.go and linker.go).

Test: TH
Bug: 187086342
Bug: 187084737
Bug: 186628704
Bug: 187857770
Change-Id: Ie403d7cd23f35160897b9dd902c799cbf1bd7f0c
2021-05-13 06:25:47 +00:00
Ivan Lozano
a072c5ae56 Merge "Refactor vendor snapshot to use LinkableInterface." am: 7ce2dee09e am: 61c475060a am: 001c11e93a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1680606

Change-Id: Ifff15886dba6bda0754d086456a1db3b7524e4ed
2021-05-12 21:13:41 +00:00
Ivan Lozano
d7586b6526 Refactor vendor snapshot to use LinkableInterface.
Refactors the vendor snapshot support to use the LinkableInterface
so that support can be extended to Rust. This CL does not add
vendor snapshot support for Rust; that is left for a follow-on CL.

Bug: 184042776
Test: m nothing
Change-Id: Id0c4970ca00053484a52677d182153cbc454c301
2021-05-12 14:01:10 -04:00
Paul Duffin
b5769c15a3 Allow module types to force creation of a default APEX variant
Bug: 187910671
Test: m droid
Change-Id: I797d4ab60d15b526744fe6e4df1b55c8b75b0310
2021-05-12 16:16:51 +01:00
Jingwen Chen
0bf1dcc16a bp2build: remove libc_tzcode from denylist. am: 3950cd6ed4 am: 2700ace254 am: 19c563ed78
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1704770

Change-Id: I2c0f87fb73c124d54db0e4a36c9c8e7b8841ee88
2021-05-12 13:18:56 +00:00
Jingwen Chen
3950cd6ed4 bp2build: remove libc_tzcode from denylist.
This now works with --features no_copts_tokenization. With tokenization,
the escaped empty string '\"\"' became an actual empty string '' on the
command line, setting -DWILDABBR to the wrong value.

However, no_copts_tokenization unveiled other problems with Android.bp
flags, such as spaces in existing cflags like
https://cs.android.com/android/platform/superproject/+/master:bionic/libc/Android.bp;l=288;drc=a0a4a6c2967b5b3c02c951ea1145f32ed5564ab9
- this trips up Bazel's copts when generated literally, so the
fix (other than splitting on space and making Soong accept strings that
don't start with dashes as cflags) is to make bp2build split cflags on
spaces before generating them as copts.

Test: bp2build, build bionic/...
Fixes: 186822591
Change-Id: Icf10bd20f6fb81db0b719ca0555fc70c75b91a79
2021-05-12 10:46:15 +00:00
Elliott Hughes
113f08a93f Merge "Use SHT_RELR relocations where possible." am: 4dac3874f1 am: 41f7037e90 am: 52fc6ab060
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1673945

Change-Id: Ia5331b1ec1ebff548a6acc97e8b5c86643c0f336
2021-05-11 22:33:50 +00:00
Elliott Hughes
4dac3874f1 Merge "Use SHT_RELR relocations where possible." 2021-05-11 17:29:39 +00:00
Lukács T. Berki
dea80a9701 Merge "Fix typo caused by incorrect git merge." am: 9c9a069ae6 am: 3baab77119 am: e5d18cae1e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1701987

Change-Id: Icaee6dee420654185bef5bb96099a3b4b3555bf7
2021-05-11 07:00:09 +00:00
Lukács T. Berki
9c9a069ae6 Merge "Fix typo caused by incorrect git merge." 2021-05-11 06:01:30 +00:00
Chris Parsons
c701d7af75 Handle cc_library shared/static only properties am: 0864831019 am: 6dfc0bbe94 am: ef3ec1f018
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1699029

Change-Id: Ic2b4bec306d57a4348e86574bcb34795305b7589
2021-05-10 23:38:40 +00:00
Rupert Shuttleworth
3b413d35a4 Fix typo caused by incorrect git merge.
Test: bazel build //bionic/...
Test: cd cc; go test
Test: cd bp2build; go test
Change-Id: I334e02609203f332384256e990f2c40a016fc9e5
2021-05-10 18:41:51 -04:00
Chris Parsons
0864831019 Handle cc_library shared/static only properties
Also handle whole_static_libs via a different attribute
(whole_archive_deps), separating these dependencies from regular static
deps.

Test: Build //bionic/libdl with bazel in conjunction with bzl
changes

Change-Id: I45019b6127a0d2731592ec35537ca15e77001cc2
2021-05-10 14:06:47 -04:00
Rupert Shuttleworth
9fe8434127 Merge "Add temporary workaround for pack_relocations linker flag conversion for bp2build." am: e8f13bbb04 am: b68f7c11d3 am: 7f8a21cf3e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1700745

Change-Id: Iacaeb308f21318eb085ff1e110fcd8d727bfe928
2021-05-10 11:34:05 +00:00
Rupert Shuttleworth
7d46a4455a Add support for shared_libs in cc_library targets. am: c50fa8dd05 am: b28a33ceca am: 91200c1649
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1697794

Change-Id: I800f7fdd859a36b01d458e979e563defc6022d87
2021-05-10 09:55:07 +00:00
Rupert Shuttleworth
143be94016 Add temporary workaround for pack_relocations linker flag conversion for bp2build.
Test: added unit test
Test: bazel build //bionic/...
Change-Id: I28217026f5846820ea2cc32cf8790948a54a9365
2021-05-10 05:17:42 -04:00
Rupert Shuttleworth
c50fa8dd05 Add support for shared_libs in cc_library targets.
Test: cd bp2build; go test

Test: bazel build //bionic/...

Test: ./build/bazel/scripts/run_presubmits.sh

Change-Id: I71e279470a0d69b243dd0a2b53ce31842fd36ee4
2021-05-10 03:35:32 -04:00
Elliott Hughes
98004216d9 Merge "Remove most of the remaining references to gccCmd." am: aa4c712989 am: a09ee94843 am: 2aa090f638
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1696319

Change-Id: Ia79aab6e3900694a02e896ddf543e4b194f46027
2021-05-07 19:13:45 +00:00
Elliott Hughes
7d52df4f87 Merge "Remove unused parts of the strip implementation." am: 2e0436c7af am: e21f8f645c am: 9fb4c1bbac
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1697656

Change-Id: I893a9e2c01e7f96e5f3712b0611aa69760e58af0
2021-05-07 19:13:35 +00:00
Elliott Hughes
cd9ff091df Use "${config.ClangBin}/llvm-" for TOOLS_PREFIX.
We're removing GNU binutils in Android T, so lets redirect any last
remaining users to the LLVM equivalents sooner rather than later.

(This won't "just work" for ld versus lld, but it's likely that anyone
using TOOLS_PREFIX will need a few other tweaks anyway, and including
the "llvm-" prefix seems like it will cover most other cases.)

Bug: http://b/185257607
Test: treehugger
Change-Id: Ibb5efbbef801419e7d8258d6d8b67572df66e7d0
2021-05-07 11:55:30 -07:00
Elliott Hughes
8df4b3dc6b Use SHT_RELR relocations where possible.
Ideally we'll want to move this logic to the toolchain itself, but right
now the linker doesn't even know it's targeting Android, let alone which
API level.

Bug: http://b/147452927
Test: treehugger
Change-Id: I6c5c822d0767e789fa0e2c8e5668fddfd90680bb
2021-05-07 11:35:19 -07:00
Elliott Hughes
aa4c712989 Merge "Remove most of the remaining references to gccCmd." 2021-05-07 18:15:42 +00:00
Elliott Hughes
2e0436c7af Merge "Remove unused parts of the strip implementation." 2021-05-07 18:15:17 +00:00