aboutsummaryrefslogtreecommitdiff
path: root/bp2build
AgeCommit message (Collapse)Author
2021-04-01bp2build: don't generate a WORKSPACE.Jingwen Chen
bp2build doesn't need to generate a WORKSPACE file. Also cleanup conversion_test.go. Test: TH Change-Id: Iba2f4b2f71d72ccf8b148cd11d78c190f93560c4
2021-03-31Merge "Handle product_variable asflag for cc_object."Liz Kammer
2021-03-30Merge "bp2build/queryview: codegen control sequences literally."Jingwen Chen
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-30bp2build/queryview: codegen control sequences literally.Jingwen Chen
See b/184026959 for an instance where a genrule's cmd contains \n, and the codegenerator generates an applied newline. It should be the original newline control sequence literal. Test: TH, bp2build unit test Fixes: 184026959 Change-Id: Idb99ea87c75dfa4cb3ae679f98d8f61cb5a5ab09
2021-03-30Merge "bp2build code generator: pretty print zero values"Treehugger Robot
2021-03-30bp2build code generator: pretty print zero valuesJingwen Chen
e.g for zero slices, return the empty list, instead of an empty string. Test: TH Change-Id: I7c89d7b0f6ac28d1aa1a76d604173bc99c841a02
2021-03-29Remove comment about gitignore for BUILD files.Jingwen Chen
Change-Id: Ic1c795d9d961b309d269b1bc4bccb7522f288e9b Rationale: we haven't modified any gitignore file. lberki has a new proposal to steer this in a new direction, so let's reflect the comment to the current reality.
2021-03-25Add bp2build support for cc_library_static.Rupert Shuttleworth
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-25Merge "Revert "Add bp2build support for cc_library_static.""Jingwen Chen
2021-03-25Revert "Add bp2build support for cc_library_static."Jingwen Chen
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-25Merge "Add bp2build support for cc_library_static."Rupert Shuttleworth
2021-03-24Add bp2build support for cc_library_static.Rupert Shuttleworth
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-24bp2build: add allowlist for package-level conversions.Jingwen Chen
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-19Handle include_build_directory prop in bp2buildLiz Kammer
Test: go test cc tests Test: generate bp2build, sync bp2build, bazel build //bionic/... Bug: 181794963 Change-Id: I8dcef585e3025ef6f44d22430ed67b1e0429dca0
2021-03-16Support autoconverted modules in mixed buildsLiz Kammer
modules converted with bp2build_available are will also be available to be used in mixed builds. Test: build/bazel/scripts/milestone-2/demo.sh full Test: go tests Change-Id: I49f16ec3ba5bb11dfed8066af069c27eb04371fb
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-09bp2build: add python_binary_host converter.Jingwen Chen
This CL adds a simple python_binary_host to native py_binary converter for standalone modules that don't depend on libs. It also adds support for the conditional py2/py3 build target based on the version prop. Test: milestone-2/demo.sh full Test: bazel query 'kind("py_binary rule", //bionic/...)' Test: bazel run //bionic/libc/tools:genfunctosyscallnrs Test: bazel run //bionic/libc/tools:genseccomp Test: go tests Fixes: 182236395 Change-Id: Ibe5ec6cd0dc12a61b3a449a8c723d80b891fae42
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-25Merge "bp2build: add support for cc_object's objs and exclude_srcs properties."Jingwen Chen
2021-02-24queryview: add "size" to ignored prop.Jingwen Chen
Test: m queryview && bazel query //... --config=queryview Change-Id: Ia84be6e2fc5b302b4a147f94bfa219a729b67be1
2021-02-24bp2build: add support for cc_object's objs and exclude_srcs properties.Jingwen Chen
objs contains module references to other cc_objects that will be used for linking later. This maps to cc_library deps. Also support exclude_srcs, and added tests. Test: bp2build generate, sync, bazel build //bionic/... Change-Id: I21200ff73f24bcf5357d9df8dcb5519cde532a77
2021-02-24Merge "Move bazel.Properties to a BazelModuleBase"Treehugger Robot
2021-02-23Move bazel.Properties to a BazelModuleBaseLiz Kammer
This allows more direct access to the bazel label and whether the module is bp2build available. Test: go test * Change-Id: I23375835d20fa53d7d94127b2dc2d5bb20487bfb
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-22bp2build: Unexport GenerateBazelTargetsForDir.Jingwen Chen
Resolving a comment from aosp/1595678 Test: build/bazel/scripts/milestone-2/demo.sh Change-Id: Ia7aba2b149fc09615fbafee67838632c71320f1b
2021-02-19bp2build: add a simple UI to report migration progress.Jingwen Chen
Sample output: [bp2build] cc_library_headers: 5 targets [bp2build] cc_object: 5 targets [bp2build] filegroup: 4 targets [bp2build] genrule: 4 targets [bp2build] sh_binary: 1 targets [bp2build] Generated 19 total BUILD targets from 39270 Android.bp modules. This CL adds an additional CodegenMetrics return value to GenerateBazelTargets calls, which are called from bp2build, queryview, and their tests. For this UI, we only want to use it for bp2build, and not queryview or tests, since it's not useful for the former, and can pollute the CLI for the latter. Test: build/bazel/scripts/milestone-2/demo.sh Change-Id: Ic84307a1ed1a25e360c9b23459e5449d932bc2e7
2021-02-18bp2build: cc_object converter.Jingwen Chen
This CL introduces a basic bp2build converter for cc_object modules. cc_objects maps cleanly to cc_library targets, but with -fnoaddrsig. This CL also demonstrates generating include deps within a macro to allow the cc_object compilation to depend on a relative-include header within an include dir. e.g. if "foo.cc" includes "android/log.h" and the latter is located at "include/android/log.h", the autogenerated header deps would export "android/log.h" correctly to the foo.cc upstream target. Test: GENERATE_BAZEL_FILES=true m nothing && bp2build-sync write && bazel build //bionic/libc:crtbegin_so1 Change-Id: Ifd9e097051ec184ab0a1929d07918f0ff4f24d98
2021-02-17Merge "Add cc_library_headers support to bp2build."Rupert Shuttleworth
2021-02-16Add cc_library_headers support to bp2build.Rupert Shuttleworth
Test: Added cc_conversion_test.go. Change-Id: Id4459d2c2fa02687a374cd9fb25d687e9678218c
2021-02-16Omit bazel.LabelList attrs if no path is specifiedLiz Kammer
Test: go test build_conversion_test.go Change-Id: Ibcd81049788e99422569fe74e5f3834df4a05122
2021-02-11Move sh_binary tests for bp2build into their own file.Rupert Shuttleworth
Test: go test passes for refactored tests. Change-Id: Ie094031f4b1f190aa711a37d40bacb182e277b26
2021-02-10Merge "Add LOCAL_LICENSE_KINDS to build/soong"Treehugger Robot
2021-02-09Merge "Add sh_binary support to bp2build converter."Treehugger Robot
2021-02-09Add sh_binary support to bp2build converter.Rupert Shuttleworth
Test: Added a unit test in this CL. Change-Id: I6e9b3c833a257414daf82e603b733e459535d206
2021-02-09bp2build: rename generated files to BUILDJingwen Chen
The checked in files are named BUILD.bazel, while bp2build files are named BUILD. Test: GENERATE_BAZEL_FILES=true m nothing Change-Id: If226f581b5075088f774dc4f5f9ee88259821835
2021-02-09Merge "bp2build: refactor BazelTargetModule naming boilerplate."Treehugger Robot
2021-02-09Merge "bp2build: make generated BUILD files publicly visible."Jingwen Chen
2021-02-08Merge "bp2build: add bazel_module: { bp2build_available } prop."Treehugger Robot
2021-02-08Merge "queryview: blocklist package module type."Jingwen Chen
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-08queryview: blocklist package module type.Jingwen Chen
The package module type was recently introduced, and its module name is the full package path. queryview uses the module name as the eventual target name in the generated BUILD files, so this causes a crash as seen in b/179605762. Workaround this by not generating package modules in the queryview directory. Test: m queryview && bazel query --config=queryview //... Fixes: 179605762 Change-Id: Iac2bd79d02bec47d6271583d106c184fb2f16e68
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: make generated BUILD files publicly visible.Jingwen Chen
This is obviously not good build hygiene, but since Soong modules are in a global namespace, making BUILD files fully public will increase our velocity during the initial migration phases. We'd want to lock visibility down to private by default as soon as possible, but for the purposes of migration, these will be public. Test: bazel build //bionic/... Change-Id: I99d62f3f8826712240decd325928435333870352
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-02-02bp2build: rename method for readability.Jingwen Chen
Rename GenerateSoongModuleTargets to GenerateBazelTargets to reflect its return type. Test: TH Change-Id: I5359c8f4365750790837a9d412946d0b7fae64b7
2021-02-01bp2build: flatten *_defaults properties.Jingwen Chen
This CL brings the defaults mutators into bp2build, reusing the implementation of flattening defaults from *_defaults module deps into the modules themselves. This is an approach to converge defaults semantics with Bazel, which doesn't have existing equivalent abstractions, other than macros, which require more infrastructure to be built. Test: TH Test: build_conversion_test.go Change-Id: Ia1443f8e6c3eb277fa861bb96625425a22cfc6d7