aboutsummaryrefslogtreecommitdiff
path: root/cmd/soong_build
AgeCommit message (Collapse)Author
2021-04-01Reorganize soong_build/main.go .Lukacs T. Berki
This makes it more easy to see what's happening under which modes. Modes are: - Regular builds - Mixed mode builds - bp2build - soong_docs Test: Presubmit + bootstrap_test.sh Change-Id: I06e3fcb84986b919be1cd9eb456531259ede1183
2021-03-24Merge "bp2build: add allowlist for package-level conversions."Jingwen Chen
2021-03-24Make null builds always be null builds.Lukacs T. Berki
Previously, soong.environment.used was written after build.ninja and if the amount of time that passed between the two was long enough, Ninja would decide that build.ninja is older than soong.environment.used and rebuild it. Test: test_null_build in bootstrap_test.sh in a loop. Change-Id: I5467da487e8e8f2646644b8a7fb9549b9ff18276
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-23Make GENERATE_BAZEL_FILES=true correct.Lukacs T. Berki
This is achieved by writing soong.environment.used in Main() instead of as a side effect of a singleton. This makes a difference because build actions are not generated when GENERATE_BAZEL_FILES=true is set, therefore the side effect did not happen. Arguably, Main() is made worse by this change, but I don't want to tackle the problem of readably determining which mode soong_build is running in in this change. Test: Presubmits + the additional test. Change-Id: I66af2429aedf008762173eaaa55b828b4cf4328b
2021-03-17Remove GeneratingPrimaryBuilder().Lukacs T. Berki
It's replaced with a flag in bootstrap.Args . Test: "m nothing" (presubmits take a full workday these days) Change-Id: Ia0bfa2091013e389890e583c559006077806af99
2021-03-17Embed minibp into soong_ui.Lukacs T. Berki
This requires linking Blueprint into soong_ui. It lets us avoid the complicated dance of Ninja files and shell scripts: now the information as to how soong_build is built is passed directly to Blueprint using a struct that contains all the information the command line arguments used to contain. The ability to run Blueprint from the command line is kept (for now). Some variables in bootstrap/command.go needed public accessor functions because soong_build reads them. This will be disentangled by moving the flag parsing to soong_build. The presence of the flag definitions in Blueprint means that soong_ui now also accepts them. This is not a problem in practice because they are ignored and because soong_ui itself is hidden behind a few layers of shell scripts. Test: Presubmits + the new bootstrap_test.sh . Change-Id: I6dca478f356f56a8aee1e457d71439272351390b
2021-03-17Merge "Remove global variables from Blueprint."Lukács T. Berki
2021-03-16Remove global variables from Blueprint.Lukacs T. Berki
The end goal of this exercise is to remove all mutable global state so that multiple Blueprint instances can be run in the same process. Test: Presubmit. Change-Id: Idb34b0920f2c7d92efb9328ce8a78b7306f89571
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-09Really fix queryview.Lukacs T. Berki
In addition, make the Ninja command nicer by using backticks instead of backslash-quoting double quotes. Test: Manual: "m queryview" Change-Id: I5d6e1d41424e0229bfe08e2e7eaf2fb025ed48c2
2021-03-08Make it possible to debug soong_ui.Lukacs T. Berki
This works by setting the SOONG_UI_DELVE= environment variable to the port on which soong_ui should accept a Delve connection on. This is achieved by reusing the Delve execution logic between soong_ui and soong_build. Test: Manual. Change-Id: Id2c1d4b6faac1a4a3918c91030ce2239f7daf54f
2021-03-03cd to / before running soong_build .Lukacs T. Berki
This lets one avoid any decisions as to when to chdir there during its execution and leads to better sandboxing because the pwd doesn't leak to init() functions anymore. Test: Manual. Change-Id: I1560da8ed3a621249426f9e8908aa890c21e13ba
2021-03-02Move environment staleness check to soong_ui.Lukacs T. Berki
Also delete the now-unnecessary soong_env binary. Test: Manually. Also checked what happens when a used environment variable changes. Change-Id: Ib393e7f444e94819198c6cce4bcd8719d9fd9441
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-10Merge "Add LOCAL_LICENSE_KINDS to build/soong"Treehugger Robot
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: fix BUILD file generation incrementality bug.Jingwen Chen
Before this change, changes to any Android.bp file would not trigger a re-run of bp2build/Soong, since the depfile for Soong's main output, the build.ninja file, didn't contain the list of Android.bp files. bp2build only reran when Soong itself changed, which happens regularly while developing bp2build, but not at all while modifying Android.bp files. This change correctly dumps the list of all Android.bp files in the tree to the depfile for out/soong/build.ninja, therefore correctly triggering a re-run of bp2build when any Android.bp file changes. Test: GENERATE_BAZEL_FILES=true m nothing; edit an Android.bp file; GENERATE_BAZEL_FILES=true m nothing -> successfully re-runs and regenerates out/soong/bp2build. Test: inspect out/soong/build.ninja.d manually Fixes: 179452534 Change-Id: Iad80c381b3afa38a4d4fafca035e46aa2a1f206a
2021-02-02bp2build: rename method for readability.Jingwen Chen
Rename GenerateSoongModuleTargets to GenerateBazelTargets to reflect its return type. Test: TH Change-Id: I5359c8f4365750790837a9d412946d0b7fae64b7
2021-01-29bp2build: fix running from clean checkout.Jingwen Chen
bp2build is a Soong mode that returns as soon as the BUILD files are generated. This causes it not generate the build.ninja file, which the Ninja process executing soong_build itself expects to produce as an output. If there isn't an existing build.ninja file generated from a previous build, GENERATE_BAZEL_FILES=true m nothing will fail. This CL generates the expected files as a workaround, and also makes GENERATE_BAZEL_FILES=true skip the Kati/Ninja steps in soong_ui since they aren't needed. Test: rm -rf out/ && GENERATE_BAZEL_FILES=true m nothing && m libc Fixes: 178683777 Change-Id: I2515ef7961682d2be5f096ed24831cc185165a67
2021-01-26bp2build: introduce CodegenMode.Jingwen Chen
The CodegenMode enum helps to differentiate between bp2build and queryview modes of generating BUILD files from the Soong module graph. bp2build is used for generating BUILD files from an unconfigured Soong module graph for Soong->Bazel conversion, whereas QueryView is a front-end for querying the existing Soong configured module graph with Bazel query. Test: go test Test: TH Change-Id: I5709f591f1ae08b2770adf272d8ce60c9ee1f46a
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
2021-01-19Implement code-generation step for bp2build.Jingwen Chen
Implement bp2build codegen as a discrete step that runs after an alternatively registered pipeline of mutators, instead of a presingleton. bp2build codegen requires a Context that supports VisitAllModules and PathContext, so this CL also makes a BpToBuildWrapperContext that conforms to PathContext by adding two method implementations. Test: GENERATE_BAZEL_FILES=true m nothing && bazel query //... --config=bp2build | wc -l # 31433 Test: m queryview && bazel query //... --config=queryview # 63638 Change-Id: I0dd359746584b228046d2d0ff00895f28f9bdfc3
2021-01-12Merge changes Ib29ede45,I1b2bfdfbColin Cross
* changes: Create LLNDK vendor variants when DeviceVndkVersion is not set Add a new SingletonModule type
2021-01-07Add a new SingletonModule typeColin Cross
A SingletonModule is halfway between a Singleton and a Module. It has access to visiting other modules via its GenerateSingletonBuildActions method, but must be defined in an Android.bp file and can also be depended on like a module. Bug: 176904285 Test: singleton_module_test.go Change-Id: I1b2bfdfb3927c1eabf431c53213cb7c581e33ca4
2021-01-07Refactor queryview.Liz Kammer
Splits queryview into queryview and bp2build. The latter runs as a presingleton (could be converted to a singleton). This prevents needing to run soong_ui a subsequent time to build the query. Queryview remains as a separate step to prevent increasing runtime due to this generation every time Soong runs. Currently this is running as a presingleton as this gives a translation of Android.bp files after only LoadHooks have run, no mutators. Test: go tests Test: m queryview && bazel query --config=queryview //... Change-Id: If2ba28c7ef60fbd41f43bda6623d41c8c7d23a1b
2020-12-07Merge "Add ranking in docs for exclude_srcs to follow srcs"Treehugger Robot
2020-12-07Merge "Add bp2build mode to soong_build."Jingwen Chen
2020-12-03Add bp2build mode to soong_build.Jingwen Chen
This CL adds a new CONVERT_TO_BAZEL env var, and a bp2build goal. It reuses the queryview architecture, but registers no mutators before converting to BUILD files. This gives us a blank slate of the module graph to work with, and create a shadow/alternate pipeline of mutators to converge the Bazel BUILD graph to be semantically equivalent with the Android.bp graph (after apply its current set of mutators). The command to do so is: $ CONVERT_TO_BAZEL=true m bp2build To not clobber with queryview, the generated files are in out/soong/bp2build. Test: CONVERT_TO_BAZEL=true m bp2build && bazel query --config=bp2build //... Test: m queryview && bazel query --config=queryview //.. Test: soong tests Test: TH presubmit Fixes: 174465461 Signed-off-by: Jingwen Chen <jingwen@google.com> Change-Id: I4dd0ccc73abc345d70a50ca2803d6f400cd8c863
2020-12-03Merge "Remove soong.config, FileConfigurableOptions, MegaDevice config."Jingwen Chen
2020-11-27Generalize the handling of dist tagsPaul Duffin
Previously in order to make use of dist entries with tag properties it was necessary for each module type to be modified to store the results of GenerateTaggedDistFiles(module) in the AndroidMkEntry.DistFiles property. This change generalizes that mechanism to work across all module types. This change does improve the behavior of a couple of tests where previously a dist with tag property was ignored because tagged dist files were not available now it is used correctly. Some module types do not implement OutputFileProducer interface and so they cannot handle dist with tag properties. This change makes it an error to attempt to do that. That necessitated adding OutputFiles(tag) method to customModule in queryview_test.go as some of the tests in that file used dist entries with tag properties. Follow up changes will remove the code that was made redundant by this. Test: m nothing m dist sdk - before and after this change, compare result to make sure that there are no significant differences. Bug: 174226317 Change-Id: Ifc54d67db10ce0d0fe8179c05b97a2be2113be4e
2020-11-24Remove soong.config, FileConfigurableOptions, MegaDevice config.Jingwen Chen
No current use cases for soong.config and user-editable local configuration options for Soong, so let's remove it to reduce the API surface. The MegaDevice configuration is used for building every module, for every cpu variant, for every architecture, but it apparently isn't used for a while now. Test: m nothing Test: TH Fixes: 174188200 Change-Id: I2550e70ff6f9c8b57e9a7cc517d6a119a032a27a
2020-11-18Refactor queryview templates into a different file.Jingwen Chen
Make queryview.go smaller. Test: m queryview && bazel query --config=queryview //... Change-Id: I3d3ba688eca6f05d33d1875076e3076ca1cac6ee
2020-11-14Merge "Pass Config to NewTestContext instead of ctx.Register"Treehugger Robot
2020-11-12Stop first pass of mixed bazel builds before writing ninjaChris Parsons
This shaves off ~20s, which is ~11%, of `m nothing` with mixed builds. Test: Manual verification with mixed builds of aosp_flame. Change-Id: Ief1bc56c92329e899c829fc1374eea9ee9b94fb7
2020-11-12Pass Config to NewTestContext instead of ctx.RegisterColin Cross
Prepare for using Config when adding singletons by passing Config to NewTestContext and NewContext instead of to ctx.Register. This will enable a followup change to store SingletonMakeVarsProviders registered on the Context in the Config, which is necessary to run multiple tests in parallel without data races. Test: all soong tests Change-Id: Id229629a4e42ff4487d317241673837726c075fc
2020-11-10Add ranking in docs for exclude_srcs to follow srcsLiz Kammer
Change-Id: I0c4aa568ed1fb82c116b18217043f19029632545
2020-11-05Rename bazel overlay to queryview.Jingwen Chen
Bazel overlay is an experimental feature. This renames the feature to 'queryview' to better describe its purpose, and also move away from the already overloaded 'overlay' term in Android. Test: m queryview && bazel query --package_path=out/soong/queryview //... Change-Id: I8b5068c7db46cb61a03a8e87af9c7c9077ebeff9
2020-11-05bazel overlay: fix regression to "list of string" bpdocs type.Jingwen Chen
A recent change to Blueprint [1] added the feature to infer the type of list elements to more than just "list of strings", but this also changed the text to "list of string" (without s). This CL fixes the bazel overlay, which uses "list of strings". Test: m bazel_overlay && bazel query //... --package_path=out/soong/bazel_overlay [1]: https://android.googlesource.com/platform/build/blueprint/+/764a77191737d68820082af40cf5ddc98dd264a3%5E%21/#F1 Change-Id: I7522d15b1ce751807e1881ce1e94f068d226b316
2020-10-19Bazel overlay: write all .bzl files in ↵Jingwen Chen
<bazel_overlay>/build/bazel/overlay_rules directory This keeps the top level directory clean, and leverages the new "build/bazel" repo location / package path. Test: m bazel_overlay && cd out/soong/bazel_overlay && bazel cquery //... Bug: 171180724 Fixes: 171180724 Signed-off-by: Jingwen Chen <jingwen@google.com> Change-Id: I151b8f3d2177167711e5974e5eabad8d6e910276
2020-10-14Stop hardcoding sdk/module_exports dynamic prop types for Bazel overlay.Jingwen Chen
These sdk/sdk_snapshot/module_exports/module_exports_snapshot properties are dynamically created using RegisterSdkMemberType [1] and eventually createDynamicSdkMemberType [2]. All dynamically created sdk member types are string list types. Instead of hardcoding the mapping, retrieve them from the registry instead. [1]: https://cs.android.com/android/platform/superproject/+/master:build/soong/android/sdk.go;l=489-497;drc=master [2]: https://cs.android.com/android/platform/superproject/+/master:build/soong/sdk/sdk.go;l=156;drc=master Bug: 166563303 Bug: 170798271 Fixes: 170798271 Test: m bazel_overlay && cd out/soong/bazel_overlay && bazel cquery //... Signed-off-by: Jingwen Chen <jingwen@google.com> Change-Id: Ib77f4e0cc14a7b4ec344a2de115682c234927c16
2020-10-09Revert "Make lots of tests run in parallel"Colin Cross
This reverts commit 323dc60712491c71ccdc5363c42df61f0a192487. Reason for revert: Possible cause of test instability Bug: 170513220 Test: soong tests Change-Id: Iee168e9fbb4210569e6cffcc23e60d111403abb8
2020-10-09Merge "Mixed bazel/soong build prototype for genrule"Christopher Parsons
2020-10-08Mixed bazel/soong build prototype for genruleChris Parsons
With this change, bazel_module is a specifiable property on genrule module definitions. With bazel-enabled mode, soong_build will defer to Bazel for information on these modules. source build/soong/bazelenv.sh to enter bazel-enabled mode. Test: Manually verified on bionic/libc genrules using aosp_cf_x86_phone-userdebug Change-Id: I3619848186d50be7273a5eba31c79989b981d408
2020-10-06Make lots of tests run in parallelColin Cross
Putting t.Parallel() in each test makes them run in parallel. Additional t.Parallel() could be added to each subtest, although that requires making a local copy of the loop variable for table driven tests. Test: m checkbuild Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
2020-09-09Generate .bzl rule definitions for every module type in Soong, andJingwen Chen
surface module properties as attributes. This CL maps int, bool, string and string_list module props from Soong modules into their respective Bazel targets. With this CL, you can now query modules based on their properties. For example: $ bazel query 'attr(nocrt, 1, //...)' $ bazel query 'attr(apex_available, //apex_available:platform, //...)' $ bazel query //art/dalvikvm:dalvikvm--linux_glibc_x86_64 --output=build | grep compile_multilib Test: m bazel_overlay && cd out/soong/bazel_overlay && bazel cquery 'attr(apex_available, com.android.runtime, //...)' Test: soong_build tests Fixes: 162720644 Fixes: 164320355 Change-Id: Iea8e594b952feccac3281f36dd6bdee8e7d62c3a
2020-08-25Bazel overlay: rename 'deps' to 'module_deps'.Jingwen Chen
'deps' is a module prop used by some module types, like prebuilt_build_tool: https://cs.android.com/android/platform/superproject/+/master:build/soong/android/prebuilt_build_tool.go;l=25-26;drc=751ae87ed29c67629f068a8590af80023a457294 Use `module_deps` to prevent conflicts in the generated overlay attributes. Bug: 162720644 Test: m bazel_overlay && cd out/soong/bazel_overlay && bazel cquery //... Test: soong_build tests Signed-off-by: Jingwen Chen <jingwen@google.com> Change-Id: Ia075a860983960b2d9121d30ead8f808be7e0c5b
2020-08-21Surface module properties as Bazel BUILD target attributes in the Bazel overlayJingwen Chen
This patchset changes bazel_overlay to generate soong_module as a macro, instead of a rule, and generate module properties in the BUILD files as kwargs to the soong_module macro. Here's a sample of the new BUILD files with module properties: bionic/libdl/BUILD.bazel: https://paste.googleplex.com/6484466996346880?raw art/build/apex/BUILD.bazel: https://paste.googleplex.com/5461276001042432?raw bionic/apex/BUILD.bazel: https://paste.googleplex.com/4932795173437440?raw soong_module is now a macro that conditionally expands to underlying soong_<module type> rules with statically defined attributes. In this CL, we are starting with a hardcoded filegroup rule definition to demonstrate the conditional rule loading within the soong_module macro. If the module_type matches an existing Bazel rule, soong_module forwards the entire **kwargs into the rule, which Bazel typechecks. Non-filegroup module types will be expanded into generic_soong_module, but with the kwargs dropped. This approach allows us to: 1) Programmtically generate soong_<module type> rules for all module types available in Soong, together with the statically defined attribute types in `attrs`. 2) Incrementally migrate and test individual module types from generic_soong_module to their module rule shims. 3) Swap out the module rule shims to the actual Bazel rules (e.g cc_library, java_library) and perform attribute manipulation in Starlark itself. Example of querying against the 'srcs' attribute in soong_filegroup: ``` $ bazel cquery 'kind(soong_filegroup, //...)' | wc -l 590 $ bazel cquery --output=build 'attr(srcs, "linker.cpp", kind(soong_filegroup, //bionic/...))' INFO: Analyzed 3907 targets (0 packages loaded, 0 targets configured). INFO: Found 3907 targets... /usr/local/google/home/jingwen/aosp/out/soong/bazel_overlay/bionic/linker/BUILD.bazel:4144:13 soong_filegroup( name = "linker_sources", generator_name = "linker_sources", generator_function = "soong_module", generator_location = "bionic/linker/BUILD.bazel:4144:13", srcs = ["dlfcn.cpp", "linker.cpp", "linker_block_allocator.cpp", "linker_dlwarning.cpp", "linker_cfi.cpp", "linker_config.cpp", "linker_debug.cpp", "linker_gdb_support.cpp", "linker_globals.cpp", "linker_libc_support.c", "linker_libcxx_support.cpp", "linker_namespaces.cpp", "linker_logger.cpp", "linker_mapped_file_fragment.cpp", "linker_phdr.cpp", "linker_relocate.cpp", "linker_sdk_versions.cpp", "linker_soinfo.cpp", "linker_tls.cpp", "linker_utils.cpp", "rt.cpp"], deps = [], ) /usr/local/google/home/jingwen/aosp/out/soong/bazel_overlay/soong_module.bzl:32:23 in <toplevel> ``` This CL is known to be lacking the following features, and will be looked at in follow up CLs: 1) Pretty printing reflect.Interface properties, like arch, multilib and dists. 2) Generating module Bazel rule shims for all module types, instead of hardcoding them like `soong_filegroup`. Bug: 162720644 Test: bazel_overlay_test.go (soong build test) Test: m bazel_overlay && cd out/soong/bazel_overlay && bazel cquery //... Signed-off-by: Jingwen Chen <jingwen@google.com> Change-Id: Ic1e448887eb540ed15a55bc4090cf75a4d832d41
2020-08-06Create a AOSP Bazel overlay workspace with SoongJingwen Chen
The Bazel overlay is a directory at out/soong/bazel_overlay that replicates the layout of the AOSP Soong module tree, but as a Bazel workspace. Each Soong module variant is represented as a BUILD target created with the `soong_module` rule. To create this overlay, run `m bazel_overlay`. A `soong_module` target can depend on other `soong_module` targets. These dependencies replicate each module's `directDeps` in the Blueprint graph, just before `PrepareBuildActions`. This enables users to use bazel query as a way to introspect the Soong module graph. For example, - Direct reverse dependencies of //bionic/libc:generated_android_ids in //bionic/libc/...: $ bazel query 'rdeps(//bionic/libc/..., //bionic/libc:generated_android_ids, 1)' //bionic/libc:libc_bionic_ndk--android_recovery_arm_armv7-a-neon_static //bionic/libc:libc_bionic_ndk--android_ramdisk_arm_armv7-a-neon_static //bionic/libc:libc_bionic_ndk--android_arm_armv7-a-neon_static_com.android.runtime //bionic/libc:libc_bionic_ndk--android_arm_armv7-a-neon_static //bionic/libc:generated_android_ids - Why does com.android.runtime depend on lzma? $ bazel query 'somepath(//bionic/apex:com.android.runtime--android_common_com.android.runtime_image, //external/lzma/...)' //bionic/apex:com.android.runtime--android_common_com.android.runtime_image //bionic/libc/malloc_debug:libc_malloc_debug--android_arm_armv7-a-neon_shared_com.android.runtime //system/core/libunwindstack:libunwindstack--android_arm_armv7-a-neon_shared_com.android.runtime //external/lzma/C:liblzma--android_arm_armv7-a-neon_shared_com.android.runtime - What does the dep graph of //bionic/libc:crtbegin_so look like? $ bazel query 'deps(//bionic/libc:crtbegin_so--android_arm_armv7-a-neon)' --output=graph > graph.in && dot -Tpng < graph.in > graph.png https://photos.app.goo.gl/DfsdoFRNsRjGwTmy8 Test: croot && m bazel_overlay && cd out/soong/bazel_overlay && bazel query //... && bazel query 'rdeps(//bionic/libc/..., //bionic/libc:generated_android_ids, 1)' Signed-off-by: Jingwen Chen <jingwen@google.com> Change-Id: I3bf40309bfb2d963bb8a688706385a57ee304c37#
2020-07-07Correct typo of defaults for docs property sortingLiz Kammer
Test: manual Change-Id: Iaca7ba51ca658529dacd2a324412964b2732c4b4