summaryrefslogtreecommitdiff
path: root/bazel
AgeCommit message (Collapse)Author
2021-05-05Refactor how bp2build gets arch-specific props.Lukacs T. Berki
Then plumb them to LabelAttribute. This refactoring is required because the previous implementation did not handle properties in shards other than the first one (e.g. version_script) well. In addition, it also makes the code paths between bp2build and analysis more similar. Bug: 186650430 Test: Presubmits. Change-Id: Ic4393e8ae47f4e88816bf45c89399efd61494d22
2021-04-30Handle the version_script property.Lukacs T. Berki
Doesn't work when depends on arch/target/etc., but good enough for libdl_android. Bug: 186650430 Test: Presubmits. Change-Id: Ib0facb41a89454717c74663e5e078aedd33d1b9c
2021-04-27bp2build: arch-specific exclude_srcs and srcs.Jingwen Chen
OS-specific exclude_srcs and srcs will be done in a follow-up, due to complexities from merging multiple select statements together. Test: TH Bug: 186153868 Change-Id: I01b881e9a5a7cd41b4a507f8be7e9e65eab37bdc
2021-04-27bp2build: remove header globs in generated srcs.Jingwen Chen
Not needed anymore for bp2build-incremental since https://android-review.googlesource.com/q/topic:no-include-check. Not needed for mixed builds either, since cc compile actions aren't sandboxed. Fixes: 186488830 Test: treehugger and go tests Change-Id: Ib5d4908dcce6bf910a653c457bb251d726e717d4
2021-04-23Incorporate cc_library_headers into mixed buildsLiz Kammer
Test: go soong tests Test: bp2build generate & sync; mixed build libc; mixed build su (su is an Android.mk target that relies on converted a cc_library_headers) Bug: 181552740 Change-Id: I9efd587970551fd41f642a208f0aa0a80e8694e0
2021-04-22bp2build: refactor/standardize cc_* bp2build convertersJingwen Chen
This CL refactors the cc* bp2build converters to use the common attribute extractors in cc/bp2build.go. This also adds include_build_directory to be handled by the compiler attr extractor to generate recursive headers as inputs. This also turns include_dirs and local_include_dirs into the execroot-relative -I flags. e.g. if a module in bionic/libc has "private" in local_include_dirs, the "-Ibionic/libc/private" copt is generated for it. Fixes: 185139955 Test: TH Test: Forrest for mixed_clean-droid Change-Id: Ib67056482227e62068fbbea0455035bdf5d56319
2021-04-21Add various test files as testSrcs, so that they run on CI.Rupert Shuttleworth
Test: go test Test: TH (now that these are hooked up to TH) Change-Id: Ia199794ef1a64074f3f9159f8c160ba3e45fd181
2021-04-20Rename Label.Bp_text to OriginalModuleName.Jingwen Chen
OriginalModuleName is a clearer name for what the field represents. Also document it. Follow-up from aosp/1675466. Test: TH Change-Id: Ie1152b5ae63f388164582be70e193a91ef96c89c
2021-04-13Add test case for too many splitsLiz Kammer
Test: go soong tests Change-Id: Iabce699e24c5ed71c2400e364e5395c042814824
2021-04-12Add tests for request_type ParseResult functions.Liz Kammer
Test: go test request_type_test Test: bp2build generate & sync; mixed build libc Change-Id: Id0b813e9de4d02d8625e42549999659ccb005c6d
2021-04-12Consolidate cc-specific cqueries.Liz Kammer
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-12Merge "bp2build: cc_library converter for //bionic/libdl:libdl_android"Jingwen Chen
2021-04-09Merge "Handle simple prebuilt static libraries from bazel"Treehugger Robot
2021-04-09bp2build: cc_library converter for //bionic/libdl:libdl_androidJingwen Chen
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-08Merge "Move cquery RequestType interface to bazel_handler"Treehugger Robot
2021-04-08Merge "Support arch variations for export_system_include_dirs in ↵Rupert Shuttleworth
cc_library_headers bp2build converter."
2021-04-07Support arch variations for export_system_include_dirs in cc_library_headers ↵Rupert Shuttleworth
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-07Handle simple prebuilt static libraries from bazelLiz Kammer
Test: generate & sync BUILD files via bp2build && mixed build droid Bug: 184192619 Change-Id: I27f0d76c88cbff25f3c7a805f3dfbb1eeaf8e771
2021-04-07Move cquery RequestType interface to bazel_handlerLiz Kammer
go idiom is to define the interface where it is used rather than where it is defined. This makes it obvious that ParseResult is not a used part of the interface, removing the need to return an interface{} and cast results. Test: go test soong tests Test: generate & sync bp2build; mixed build libc Change-Id: I0d8d99c1d8d0125588522cc86502286b83c91bf7
2021-04-06Merge "Fix note_memtag bionic libraries in mixed builds"Christopher Parsons
2021-04-06Merge "Only include used requests in cquery starlark"Treehugger Robot
2021-04-05Fix note_memtag bionic libraries in mixed buildsChris Parsons
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-05Only include used requests in cquery starlarkLiz Kammer
Test: go test soong tests Test: generate & sync bp2build, mixed build libc Change-Id: I1fbf854cf31f40b7721788956d0f08da3bda2cba
2021-04-05Add target/os configurable string_list attrs.Jingwen Chen
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-05Merge "Add os/target configurable selects for label list attributes."Jingwen Chen
2021-04-02Merge "Remove unused cquery requests."Treehugger Robot
2021-04-02Merge "Add depfile handling for bazel_handler."Liz Kammer
2021-04-02Remove unused cquery requests.Liz Kammer
Test: go test soong tests Change-Id: Ie7a72bc73ccf4d9b8aa2a0b20c1674d3a5b499de
2021-04-02Add os/target configurable selects for label list attributes.Jingwen Chen
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-03-31Merge "Handle product_variable asflag for cc_object."Liz Kammer
2021-03-30Add depfile handling for bazel_handler.Liz Kammer
Test: go test soong tests Test: TODO mixed build change header, mixed build Change-Id: I7c51faf2d5b1a8717cbab6bb0b3eb75c307fcd85
2021-03-30Handle product_variable asflag for cc_object.Liz Kammer
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-30bp2build: arch-configurable selects for label list attrs.Jingwen Chen
This CL adds the configurable LabelListAttribute support to bp2build. Test: go test Change-Id: I2ef9e385d9cf1b1845988128eca1d8cda1ecb5e8
2021-03-16Merge changes from topic "mixed-bp2build"Liz Kammer
* changes: Support autoconverted modules in mixed builds Use handcrafted build targets in bp2build
2021-03-16Merge "Refactor and cleanup of cquery processing"Christopher Parsons
2021-03-16Refactor and cleanup of cquery processingChris Parsons
Test: USE_BAZEL_ANALYSIS=1 m libc Change-Id: Iaf9a92e84d39c132e2444a8aaafd79505a12b8ec
2021-03-15Use handcrafted build targets in bp2buildLiz Kammer
If both bp2build_available and label are specified, label will be preferred. Initially, we copy the entire BUILD.bazel file. Eventually we may move this to use bazel query for a more accurate result. Test: go test * Test: build/bazel/scripts/milestone-2/demo.sh full Test: GENERATE_BAZEL_FILES=true m nothing edit bionic/libc/tools/BUILD.bazel GENERATE_BAZEL_FILES=true m nothing and verify changes picked up Bug: 180516554 Change-Id: I43025583300e6b10d2c18032cd4a76237b578d59
2021-03-15Add a way to remove duplicates from Bazel label lists, to e.g. avoid ↵Rupert Shuttleworth
duplicate deps. Test: Added unit tests, and also resolves bp2build error. Change-Id: I6e01d9e233ec21dbb244e5682cbeebbc3a1ac0c4
2021-03-01Support cc_object modules in mixed buildsChris Parsons
Test: With a handwritten conversion of crtbegin_so1, USE_BAZEL_ANALYSIS=1 m crtbegin_so1 Change-Id: I7c777d7f46b37aa1827cc04205e2014f9293bf35
2021-02-26bp2build: add configurable attribute (select) support.Jingwen Chen
This CL adds a basic framework to support configurable string_list attributes, selecting on the Arch variant (x86, x86_64, arm, arm64). It offers fine-grained controls to map individual configurable properties (arch_variant) to configurable Bazel attributes, starting with the string_list type for the copts property for cc_object. This design is primarily motivated to have minimal boilerplate in bp2build mutators, allowing anyone to opt-in configurable attributes, and modify intermediate states before passing them on into the CreateBazelTargetModule instantiator. Fixes: 178130668 Test: go tests Test: build/bazel/scripts/milestone-2/demo.sh Change-Id: Id6f04d7c560312a93e193d7ca4e1b7ceb6062260
2021-02-23Refactor BazelTargetModuleLiz Kammer
This eliminates the need to remove quotes, delete attributes, and re-checking that name has correct prefix. Additionally, this allows assignment directly to the BazelTargetModuleProperties struct, which allows defaulting unused fields and clarity of which field is being set. Test: go test soong tests Test: ran ./build/bazel/scripts/milestone-2/demo.sh Change-Id: Ia9bfcce76234c793a4ddd5f29a661150f83341c9
2021-02-10Merge "Add LOCAL_LICENSE_KINDS to build/soong"Treehugger Robot
2021-02-08bp2build: refactor BazelTargetModule naming boilerplate.Jingwen Chen
This CL replaces the "__bp2build__" name prefix boilerplate with a props creation function, and centralizes the prefixing in there. Test: TH Test: soong tests Change-Id: Ic963199ab60dcce0d3361abff111cfa9acd4c21b
2021-02-06Add LOCAL_LICENSE_KINDS to build/soongBob Badour
Added SPDX-license-identifier-Apache-2.0 to: Android.bp android/Android.bp android/soongconfig/Android.bp androidmk/Android.bp apex/Android.bp bazel/Android.bp bp2build/Android.bp bpf/Android.bp bpfix/Android.bp cc/Android.bp cc/config/Android.bp cc/libbuildversion/Android.bp cc/libbuildversion/tests/Android.bp cc/ndk_api_coverage_parser/Android.bp cc/ndkstubgen/Android.bp cc/symbolfile/Android.bp cmd/dep_fixer/Android.bp cmd/diff_target_files/Android.bp cmd/extract_apks/Android.bp cmd/extract_jar_packages/Android.bp cmd/extract_linker/Android.bp cmd/fileslist/Android.bp cmd/host_bionic_inject/Android.bp cmd/javac_wrapper/Android.bp cmd/merge_zips/Android.bp cmd/multiproduct_kati/Android.bp cmd/path_interposer/Android.bp cmd/pom2bp/Android.bp cmd/pom2mk/Android.bp cmd/sbox/Android.bp cmd/soong_build/Android.bp cmd/soong_env/Android.bp cmd/soong_ui/Android.bp cmd/zip2zip/Android.bp cmd/zipsync/Android.bp cuj/Android.bp dexpreopt/Android.bp dexpreopt/dexpreopt_gen/Android.bp env/Android.bp etc/Android.bp filesystem/Android.bp finder/Android.bp finder/cmd/Android.bp genrule/Android.bp jar/Android.bp java/Android.bp java/config/Android.bp kernel/Android.bp linkerconfig/Android.bp linkerconfig/proto/Android.bp makedeps/Android.bp partner/Android.bp phony/Android.bp python/Android.bp python/tests/Android.bp remoteexec/Android.bp rust/Android.bp rust/config/Android.bp scripts/Android.bp sdk/Android.bp sh/Android.bp shared/Android.bp symbol_inject/Android.bp symbol_inject/cmd/Android.bp sysprop/Android.bp tradefed/Android.bp ui/build/Android.bp ui/logger/Android.bp ui/metrics/Android.bp ui/metrics/proc/Android.bp ui/status/Android.bp ui/terminal/Android.bp ui/tracer/Android.bp xml/Android.bp zip/Android.bp zip/cmd/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: finder/fs/Android.bp third_party/zip/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Ia47ca14f16b8c9f84f9d533a07e5b00e2c04e8d4
2021-02-05bp2build: add bazel_module: { bp2build_available } prop.Jingwen Chen
This CL adds a per-target allowlist to instruct bp2build on which modules it should generate Bazel targets for. Test: soong tests Change-Id: I869e66fce405c2c6689b381569b8cc0118cbcf76
2021-02-05bp2build: Refactor CreateBazelTargetModule API.Jingwen Chen
This CL refactors the CreateBazelTargetModule API to minimize boilerplate, and to establish a well defined function signature for the expected metadata about a BazelTargetModule. Test: soong tests Test: TH Change-Id: I474ff5a2b0db8deeed49ba4ca73b416ccb494fdd
2021-02-04bp2build: convert paths/module refs to Bazel labelLiz Kammer
This currently expands all globs, still need to support converting glob syntax. Test: go build_conversion_test Test: GENERATE_BAZEL_FILES=true m nothing Test: m nothing Bug: 165114590 Change-Id: If7b26e8e663d17566fad9614ca87a8da1f095284
2021-01-26bp2build: support Starlark rules and load statements.Jingwen Chen
This CL adds support to bp2build for declaring the location of the Starlark rule definition when creating BazelTargetModules. This is needed for non-native rules that needs to be loaded from .bzl files somewhere in the tree. Since load statements are aggregated at the top of the BUILD file, away from the targets that actually use them, this CL also introduces an abstraction to group BazelTargets together and compute their load statements and target string representations separately, allowing load statements to be decoupled and written into a BUILD file before the targets themselves. Test: soong tests Test: TH Test: GENERATE_BAZEL_FILES=true m nothing && build/bazel/scripts/bp2build-sync.sh write && bazel cquery //bionic/... Fixes: 178531760 Test: TH Change-Id: Ie5f793a00006eb024eaef07ddd9fde7aaefc054e
2021-01-25Merge "Support aquery depsets with depth"Christopher Parsons
2021-01-21bp2build: framework for generating BazelTargetModules.Jingwen Chen
This CL creates the framework necessary for generating BazelTargetModules from regular Soong Android modules. BazelTargetModules are code-generated into Bazel targets in BUILD files. See the follow-up CL for examples of creating filegroup/genrule BazelTargetModules. Test: GENERATE_BAZEL_FILES=true m nothing # creates out/soong/bp2build with no BUILD files, because there are no BazelTargetModules in the module graph. Change-Id: I33a96365bd439043b13af6db9e439592e9983188