aboutsummaryrefslogtreecommitdiff
path: root/bazel/configurability.go
Commit message (Collapse)AuthorAgeFilesLines
* Move platform constraints to bazel_common_rules.Jingwen Chen2023-10-111-29/+29
| | | | | | | | | This enables sharing of platform constraints between platform and kernel builds. Bug: 304594734 Test: treehugger Change-Id: I48091eeaf2e529c3f180ba056da3935911868b14
* Stub/Impl selection for sdk variantsSpandan Das2023-09-161-0/+2
| | | | | | | | | | | | | If a dependency has ndk stubs, then the sdk variant of the library should link against the ndk stub variant and not the impl/apex_stubs variant Unlike module-libapi, the depdendency does not go through an @api_surfaces external repo indirection. This indirection was created to support Multi-tree, and will likely be removed in the future Test: Added a unit test Bug: 298085502 Change-Id: Ie081e153fa586b6c22db0b8e42f91149fd8e5d9b
* Support memtag sanitizer.Yu Liu2023-08-281-2/+2
| | | | | | Bug: 295173102 Test: local unit tests Change-Id: Ib8cd82cd3989d9c120255e149473d8ec00f100f5
* bp2build for sanitizer blocklists long term fixTrevor Radcliffe2023-08-141-0/+23
| | | | | | | Bug: 286872909 Test: Unit tests Test: b build relevant targets Change-Id: I553091f76fca936006651b1ed22c8fe4d176e18f
* Make bp2build-generated selects() based on product config build settingsCole Faust2023-08-031-1/+1
| | | | | | | | ...instead of based on constraint settings. Bug: 269577299 Test: m nothing and ./build/bazel/ci/bp2build.sh Change-Id: Ib9caec79c92b8fd304e46be841de5612bd1637e3
* Make errorprone a configurable attribute for bazel conversionAlix2023-07-121-7/+24
| | | | | Change-Id: Icf2265e9f712c3255321456e977928163696dc22 Test: ./bp22build tests in child commit
* bp2build support for host_ldlibsSpandan Das2023-05-161-12/+12
| | | | | | | | | | | | | | host_ldlibs are used during linking. Set these in `linkopts` for now. Note that this CL does not do the `CheckBadHostLdLibs` validation of Soong. There are some different ways to do this, and these are being discussed in b/216626461. It is likely that we will need to create a new property `host_ldlibs` to do the validation. But for now, re-use `linkopts`. Bug: 216626461 Test: bp2build unit tests Change-Id: Id4c77e4460fb1fb003fa58ea27bab5b50ea8cefe
* Merge changes from topic "stub-impl-per-api-domain"Spandan Das2023-05-111-3/+3
|\ | | | | | | | | | | | | | | | | * changes: Special case platform variant of bootstrap libs Select stub/impl per apex variant For test apexes, base_apex_name is the api domain Broaden the granularity of config_setting from apex_name to api_domain Print default val if all vals in axis match default val
| * Select stub/impl per apex variantSpandan Das2023-05-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create a select statement for every api_domain a library could be included in. The stub/impl selection heuristics per apex domain are 1. If dep has stubs and the api domain appears in dep's apex_available, use impl 2. If dep has stubs and the api domain does not appear in dep's apex_available, use stubs (Category 3: If dep does not have stubs and the apex does not appear in dep's apex_available, then a separate apex_available validation in Bazel will emit an error). Platform variants have been special-cased for now to use equality of apex_available for stub/impl selection Test: go test ./bp2build Bug: 272378496 Change-Id: Ibd29efd763c8863c7e6d2a9af0da30bbde07175d
* | Bp2build support for soong config variables + osCole Faust2023-05-081-6/+5
|/ | | | | | | | | | | | | | | For converting the art plugins to pure soong, it would be useful to have a property that's qualified on both a soong config variable and the OS. Soong had very little-known support for this by saying your soong config variable changes the "target.android.cflags" property, and we didn't supporting bp2building that. Add the bp2build support. This cl also refactors product variable and soong variable bp2building so that they're separate from each other, which I think makes the code easier to understand. Test: go test Change-Id: Ic74dc75da8103fa2523da95c3560c9ce3c5e5672
* Create config_setting per apex_nameSpandan Das2023-04-281-4/+6
| | | | | | | | | | | | | | These are created by bp2build in /build/bazel/rules/apex. Eventually these config_settings should likely be colocated with the source apex definition. Another alternative was to make Bazel's apex a macro that generates a config_setting. I did not pursue this further for now since it requires the apex_available of every allowlisted cc_library to also be allowlisted. This might not always be true (e.g. com.android.runtime) Test: go test ./bp2build Change-Id: Ibbb14b0d9c1491b3c79b7634a18d9d35b03922c1
* Fix nondeterminism in bp2buildChris Parsons2023-01-301-3/+3
| | | | | | | | | | | | | | | | | | | | | This fixes two main sources of nondeterminism: 1. Fix a bug in the ConfigurationAxis comparator (which caused ConfigurationAxis sorting to be nondeterministic) 2. Process C++ dependencies using the sorted ConfigurationAxis order. In theory, the order in which dependencies are processed shouldn't matter (as they should end up in different select stanzas). However, in the case of InApex stubs, this is not the case; we now ensure that lists are concatenated in a predictable order. Added bonus: Some cleanup with SortConfigurationAxes which makes use of go generics (this made it easier to debug this issue). Will follow-up with regression tests. Test: Manually verified that build.ninja checksum and BUILD.bazel checksums do not change after running `m nothing` 6 times in AOSP (with comment-only Android.bp changes in between each run) Change-Id: I81168e45bdbbcd61ea95ff665cf6c4bc180aa4e0
* Use //build/bazel/platforms/os:linux_glibc for osLinuxColin Cross2022-12-201-2/+2
| | | | | | | | | | osLinux is implicitly glibc, use //build/bazel/platforms/os:linux_glibc for the configurability select key for it. Bug: 259266326 Test: build/bazel/ci/mixed_libc.sh Test: USE_HOST_MUSL=true build/bazel/ci/mixed_libc.sh Change-Id: Ifbd121ab3d943f3fdfbd3f6c3e982d1eaaaa9ec1
* Use excludes from OS axis for OsAndInApexLiz Kammer2022-11-231-0/+5
| | | | | | | | | | | The axis for OS and in APEX was previously ignoring the excludes from OS, which would result in excludes for non-Android OSes being incorrectly ignored. Test: go test Soong tests Test: b build //hardware/libhardware:all Bug: 260131489 Change-Id: Ie77f763bea0f473ac69a0c6b6bc3216e7359ad12
* Add riscv64-linux-android supportColin Cross2022-10-031-5/+9
| | | | | | | | | Add barebones riscv64-linux-android support. This should be enough to add riscv64-specific entries to Android.bp files, but can't actually compile anything until there are riscv64 toolchains. Test: arch_test.go Change-Id: I0dcc7e797d9352dd38243be908a7f19004ff3db1
* Support target.apex stanza in bp2buildVinh Tran2022-09-161-0/+19
| | | | | | | | Fix: 232544453 Test: go tests Test: b build //frameworks/av/media/module/foundation:libstagefright_foundation Test: b build //frameworks/av/media/module/foundation:libstagefright_foundation (with in-apex hardcoded to True, non-apex hardcoded to False) Change-Id: I7b5f356ff6ed31f89a9d9153396bc851d991c487
* product_variables srcs in prebuilt_etcAlix2022-09-091-1/+4
| | | | | | | | bp2build conversion handles product_variable srcs bug: 228353067 Test: prebuilt_etc_conversion_test.go Change-Id: I82d3a384ee14d4e981d502dd9eb824c87d5ae2c7
* Support arch features in bp2buildCole Faust2022-09-021-7/+68
| | | | | | Bug: 189972518 Test: New soong test Change-Id: I05d77c8f63ffe6697d8e0300226864658055e116
* Add bp2build converter for cc library stubs and use the stub library target ↵Wei Li2022-08-251-3/+22
| | | | | | | | | | | | | of a library while linking it in APEXs. Bug: 231322789 Test: with this CL on internal master, 1) b build --verbose_failures //vendor/google/modules/AdbdGoogle:com.google.android.adbd --config=android_x86_64 2) adb install bazel-bin/vendor/google/modules/AdbdGoogle/com.google.android.adbd.apex, and adbd is activated successfully on cuttlefish device. 3) m mts && mts-tradefed run mts-adbd, and there is no failure with cuttlefish device 4) packages/modules/adb/test_device.py, and there is no failure with cuttlefish device. Change-Id: I81b6f5336cacf35c68957ae2dac65f985b6eafb9
* Add linux_musl arm+arm64Colin Cross2022-06-241-0/+4
| | | | | | | | | Add toolchains to support cross compiling to aarch64-linux-musl and arm-linux-musleabihf. Bug: 236052820 Test: build arm and arm64 musl sysroots Change-Id: I47a9322929baff2492c6e8db989ece01fcbeb133
* Handle the 'enabled' property in bp2buildChris Parsons2021-12-211-0/+19
| | | | | | | | | | | Also fix some bugs pertaining to configurable attribute handling of bool attributes and label sttributes, so that they may support values across multiple different axes at the same time. Test: unit tests for bp2build Test: mixed_droid Change-Id: I411efcfddf02d55dbc0775962068a11348a8bb2c
* bp2build: add support for soong_config_module_type.Jingwen Chen2021-11-081-6/+7
| | | | | | Test: CI, go unit test Bug: 198556411 Change-Id: Idf862904d51d822f92af0c072341c31b7a02fc64
* Add Darwin+Arm64 toolchain supportDan Willemsen2021-11-011-0/+2
| | | | | | | | | | | | | | | This just sets up the toolchain and allows Darwin+Arm64 to be specified as a HostCross target. These variants will not be exported to Make, or be installed on a Soong-only build. A future CL will add support for universal binaries using these variants. This config is a bit stranger than the regular 64/32 multilib, as it's two primary 64-bit configs. And on a Darwin/X86 machine, the Arm64 versions are HostCross (doesn't work on the current machines), while a Darwin/Arm64 machine, either version works (if Rosetta is installed). Bug: 203607969 Change-Id: Iacaed77d267773672da027cd74917e33fb1c1e94
* bp2build: Handle target.linuxChris Parsons2021-10-011-15/+0
| | | | | | | | | | | Also refactor target.bionic to be handled not as its own configuration axis, but instead to be grouped into os selects handling. This allows us to remove libbase and its dependencies from the bp2build denylist. Test: mixed_droid.sh CI Change-Id: I92f30074d286306207653fe37589835ae3db16c4
* bp2build: handle system_shared_libsChris Parsons2021-08-091-30/+30
| | | | | | | | | | | | | | | | | | | | | | - If no system_shared_libs is specified, bp2build writes no attribute value. In this case, the bazel library macros determine the correct default behavior. - If any system_shared_libs is specified for any variant, then bp2build writes the value verbatim. This includes if an empty list is specified, as this should override defaulting behavior. Note this defaulting behavior is incomplete and will be incorrect in corner cases. For example, if, in an Android.bp, system_shared_libs is specified for os.linux_bionic but not for os.android, then the bazel default for os.android will be incorrect. However, there are no current modules in AOSP which fit this case. As a related fix, supports static struct for cc_library_static. Also, removes some elements from the bp2build denylist. Test: mixed_droid CI Change-Id: Iee5feeaaf05e8e7209c7a90c913173832ad7bf91
* Reland "Split the x86 host toolchain into glibc and musl variants"Colin Cross2021-07-231-0/+6
| | | | | | | | | | | | | | Split the x86 host toolchain into glibc and musl variants Create new musl toolchains that are based on the existing glibc toolchains, and add the necessary flags for musl compiles. This relands Ifc02f9e5afa61ff758be98b0c962f3a4b53d0546 with changes for I46672e3a096b6ea94ff4c10e1c31e8fd010a163c. Bug: 190084016 Change-Id: Iaa9f7a50ff601155ecd73acc5701a2c226be66dc Test: TestArchMutator
* Revert "Split the x86 host toolchain into glibc and musl variants"Colin Cross2021-07-231-6/+0
| | | | | | | | This reverts commit 4fb4ef22424162d73bb0473ff53dc557b3fec79f. Reason for revert: crossed with aosp/1775072 Change-Id: Ied922850b810d82627ba4f9ee42f672cfe286c91
* Split the x86 host toolchain into glibc and musl variantsColin Cross2021-07-231-0/+6
| | | | | | | | | Create new musl toolchains that are based on the existing glibc toolchains, and add the necessary flags for musl compiles. Bug: 190084016 Test: TestArchMutator Change-Id: Ifc02f9e5afa61ff758be98b0c962f3a4b53d0546
* Remove Fuchsia support from SoongColin Cross2021-07-211-6/+0
| | | | | | Bug: 194215932 Test: m checkbuild Change-Id: Id7d3964d9417f8b0938af9b168bb4c00cebe9390
* Handle target.bionic in bp2build.Liz Kammer2021-07-191-0/+15
| | | | | | | | | | Soong supports some hand-crafted target.<type> that match multiple os or arch types to simplify configuring for similar targets. target.bionic is used to match on both android and linux_bionic OSes for cases where they should be handled the same way. Test: build/bazel/ci/bp2build.sh Change-Id: I47b6aaf3279e4d242c4fd0e12f24117eb98e0665
* Extract function to handle configurable excludesLiz Kammer2021-06-041-5/+5
| | | | | | | | | This allows it to be used for other modules types and other properties (e.g. static_libs & exclude_static_libs). Test: go test soong tests Bug: 188497994 Change-Id: I40ab16e3b540ece0a6684558b32f7e8e25df6f24
* Use maps in bazel *attribute typesLiz Kammer2021-06-031-0/+213
This is to simplify the process of resolving label + exclude labels across the various configuration axes we have and across the various properties/modules that use this behavior. Test: ci/bp2build.sh && ci/mixed_droid.sh Change-Id: I8efae3e75ddb365384f5caaf5bb504a5206618d3