This CL is scoped to cc_* module types. With trunk stable, we will have
multiple prebuilts of the cc modules in
prebuilts/module_sdk/art/<v>/host-exports/, and this CL introduces a
mechanism to use apex_contributions to select a specific versioned
prebuilt when building.
If a soong module is selected using apex_contributions, all rdeps will
get that soong module, which includes
- rdep soong modules which might be depending on it via Android.bp
- Soong's rule builder HostToolPath API
Implementation details: Create a new source_module_name property to
identify the root module. rdeps referring to the root module will get
redirected if necessary. This property also
becomes the stem, if `stem` is not set explicitly.
Bug: 322175508
Test: Added a unit test
Change-Id: Ic8725602c81999621fcb33ce2a57fe4b9751baa8
Convert all of the callers of SetProvider to use the type-safe
android.SetProvider API.
Bug: 316410648
Test: builds
Change-Id: If58f4b5355264ddab2045bc3591a4eac19cd58fc
Remove the ConvertWithBp2build implementations from all the module
types, along with the related code.
Bug: 315353489
Test: m blueprint_tests
Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
This no-op refactoring facilitates some upcoming functional changes for
"bp2build allowlist v2". The work requires that the bp2build conversion
mutator be changed from a TopDown mutator to a BottomUp mutator.
Refactoring all bp2build-related methods so that they use Bp2buildMutatorContext
makes it easier to make this functional change without touching tens of
files and multiple projects.
Bug: 285631638
Test: m bp2build
Change-Id: I3d1ef3064146e959c6f0dc315350fc9764bf2bd2
Use Go's generics for DepSets so they don't require a type-specific
wrapper and reflection.
Test: depsets_test.go
Change-Id: I22ba0b7d680d37d2cd05230b0f560d166c4dd20b
Soong does not enforce apex_available on the contents of test apex. To
prevent special-casing test apexes in the apex validation aspect in
Bazel, drop the test apexes from the tags altogether.
( The core problem I am trying to solve is making sure that stub
libraries in Bazel have a single apex available. apex validation happens
to be a nice side benefit)
Bug: 277651159
Test: go test ./bp2build
Change-Id: Ibb3cfedb5c0f2cda0464bf3758c70b67cb5885d1
This is a rework of commit 5bdf2d589c
which made implementation variant of prebuilts with stubs as not
installable except libclangrt. This change narrows the affected modules
to prebuilts/module_sdk because cc_prebuilt_library_shared with stub
implementation is a special case only used there. It's typical for
cc_prebuilt_library_shared to have implementation, not stub.
Bug: 220898484
Test: ART_MODULE_BUILD_FROM_SOURCE=false m nothing
Change-Id: I99e5213da8cc473901e23942b50f06c023d91f60
This reverts commit 502da3987a.
Reason for revert: b/274195633
```
In file included from out/soong/installs-aosp_cf_x86_pasan.mk:134984:
In file included from out/soong/Android-aosp_cf_x86_pasan.mk:981696:
In file included from build/make/core/soong_cc_rust_prebuilt.mk:76:
build/make/core/base_rules.mk:342: error: packages/modules/Uwb/service/uci/jni: MODULE.TARGET.SHARED_LIBRARIES.libuwb_uci_jni_rust already defined by packages/modules/Uwb/service/uci/jni.
```
Change-Id: Ic1ea6969e54c23a7d126eb0fb47ab6f2e44ee965
Currently, non-apex variants of modules that are in apexes are not
exported to make unless they're apex_available to the platform. This
means that you can't `m` those modules directly.
However, there is a workaround in the apex androidmk implementation that
emits make rules for the removed modules, but just redirects them to
build the apex itself. We want to remove that, but one of the problems
with doing so is that you can no longer `m` many modules afterwards.
To fix that, unhide the apex's dependencies from make. To ensure they're
not installed, call SkipInstall() on them, and update SkipInstall() to
be more strict by setting `LOCAL_UNINSTALLABLE_MODULE := true`.
Bug: 254205429
Test: Presubmits
Change-Id: Ib971981559f3b642ce6be8890679e994e1b44be0
Currently, non-apex variants of modules that are in apexes are not
exported to make unless they're apex_available to the platform. This
means that you can't `m` those modules directly.
However, there is a workaround in the apex androidmk implementation that
emits make rules for the removed modules, but just redirects them to
build the apex itself. We want to remove that, but one of the problems
with doing so is that you can no longer `m` many modules afterwards.
To fix that, unhide the apex's dependencies from make. To ensure they're
not installed, call SkipInstall() on them, and update SkipInstall() to
be more strict by setting `LOCAL_UNINSTALLABLE_MODULE := true`.
Bug: 254205429
Test: Presubmits
Change-Id: Ib094feb2c437ad50d8319c58caa997759e7ce32f
Add Alwayslink to bazelPrebuiltLibraryStaticAttributes
Also adjust the corresponding tests to espect these new targets.
Test: m libc
Test: b build --config=android //prebuilts/clang/host/linux-x86:libunwind-exported_alwayslink
Test: bp2build.sh
Bug: 267214124
Change-Id: I4d996aef55321f1827947f00b0eaa52d0a14413e
Bug: 240424572
Test: Manual tests:
1. m --dev-mode-staging com.android.adbd com.android.media.swcodec.
2. verify the DCLA libs from the two apexes have the same size and
sha1sum, and also match the libs in bazel-out.
3. empty the DCLA libs list in allowlist.go and repeat step 1
4. repeat step 2 and verify the opposite result
5. build git_master: mainline_modules_bundles-userdebug in ABTD
with the cl, then follow go/build-sideload-dcla-locally to
download the adbd and swcodec aab files, run the DCLA trimming
workflow locally, and verify the symlinks in the two trimmed
apexes are identical and also match the lib path in the DCLA
apex that was created by the workflow.
Change-Id: Ib2f8a29126a54829c0e10eba17b256a79930fd70
Previously in mixed builds, only the tidy files for the boundary module
were built, whereas all of its transitive dependencies' tidy files were
not being built. Instead we should export the list of transitive tidy
files for a module so that we can run clang-tidy for the boundary module
as well as its dependencies.
Bug: 195029134
Test: WITH_TIDY=1 DISABLE_ARTIFACT_PATH_REQUIREMENTS=true mss tidy-packages-modules-NeuralNetworks --bazel-mode-dev
Change-Id: I463646d2ae1fc4aa075a54c264e1c34571c3fd5c
Add bp2build support for cc_prebuilt_object to allow buiiding
musl crt objects that use prebuilt clang_rt.crtbegin and
clang_rt.crtend.
Bug: 259266326
Test: //extenral/musl:libc_musl builds
Change-Id: Ic2b0375bc6e7336d31c9e2cf51bdc2ea894185aa
The tags will then be read by an aspect applied from apex attributes to
validate that the deps are explicitly opt-in to the appropriate apex.
The semantics of this is the same as the Soong apex_available property.
This also adds the "base_apex_name" attr to override_apex conversion so
that apex_available checks continue to work on the non-Google and non-Go
apex names.
Test: presubmits
Fixes: 218841706
Change-Id: I19b3637da9aa47573b252d74f62b601fbdc3784d
Enable cc_prebuilt_binary to also take part in mixed builds.
Bug: 241415823
Test: TestPrebuiltBinaryWithBazel
Test: mixed_droid yields stats-log-api-gen under bazel-out/
Change-Id: I18b2906c91ea90370ab851a1287c2890546d633f
Add support for prefix_symbols from binary and object targets to allow
rules to prefix symbols from a checked-in library before linking against
it, namespacing the resulting symbols and avoiding potential clashes.
Bug: 237371962
Test: Android.bp with cc_prebuilt_library_static::prefix_symbols
Change-Id: Iaf9cdd12637d5a259ae4c4827ff20e4f911699a4
This change provides support for mixed builds for
cc_prebuilt_library modules and allowlists some such modules.
Fixes: 225938765
Test: Unit tests, run mixed builds and verify correctness
Change-Id: I04396c79661df6b9a43907859e4f96d0191e8e1b
This is a far better approach for ensuring that bazel handlers implement
the BazelHandler interface, as it causes a compile error if they do not
implement the appropriate interface methods.
Test: Manually verified no change in ninja file
Change-Id: I63a4f8b57e3aedd4c0915c2fd2eb7029e9a993aa
This large refactoring has both immense performance implications and
improves mixed builds complexity / usability. Summary:
1. Queueing calls to Bazel is done in a new mutator instead of a full
soong_build pass. Normal soong_build flow is interrupted (via a
functional hook in blueprint) to invoke bazel and parse its response.
2. Implementing mixed build support for additional modules is as simple
as implementing MixedBuildsBuildable. In this interface, define the
request that must be queued to Bazel, and then subsequently define
how to handle the returned bazel cquery metadata.
3. Mixed builds consists of only a single pass. This greatly
improves mixed build performance.
Result:
A 33% runtime improvement on soong analysis phase with mixed builds.
Caveats:
C++ BazelHandler handling still remains a bit of a mess; I did what
I could within this CL's scope, but this may require additional cleanup.
Test: Treehugger
Test: Verified that aosp_arm ninja file is bit-for-bit identical with or
without this change.
Change-Id: I412d9c94d429105f4ebfafc84100d546069e6621
It is unused and removing it allows us to use the same function for
prebuilt/not libraries.
Test: bp2build.sh
Change-Id: I92ac56496cff2c2e55d6eb9f261fe75a1b232856
Copy prebuilt objects to the intermediate directory so that their
output file name matches the module name. This simplifies using
the clang crt objects, whose input names vary by architecture,
in the musl sysroot genrule.
Bug: 216192129
Test: m checkbuild
Change-Id: I467d699f718e2cc5c6bf0a5c35820dedd51c5930
while cc_prebuilt_library_(shared|static) were already supported,
the raw cc_prebuilt_library module type was not supported by
bp2build. This CL provides that functionality.
Also did a little bit of refactoring and cleaning.
Bug: 225938765
Test: Confirm output BUILD.bazel files look as expected. Confirm
that build succeeds.
Change-Id: Ic004f88febc0e5b527f2ef420dbd96ecc55d2e09
This is necessary to avoid installing them. Previously, when install
dependencies were resolved in make, they weren't installed because they
got a .bootstrap suffix in their mk modules. However when that logic
moved into Soong by resolving transitive dependencies in
computeInstallDeps, they started to get dependencies and hence their
stubs could get installed, e.g. system/lib{,64}/libdexfile.so from
prebuilt_libdexfile.
Test: m nothing
Test: env NINJA_ARGS="-t path droid out/target/product/vsoc_x86_64/system/lib64/libdexfile.so" \
m SOONG_CONFIG_art_module_source_build=false nothing
verify that ninja reports no dependency path
Bug: 211770050
Bug: 220898484
Change-Id: Ifbfe31a15428926ce57b9e91b535b7ae79038fbd
These do not have a conversion process yet, do not convert them. Add
more protection against using the wrong conversion for prebuilts in cc.
Test: allowlist project with prebuilt objs/binaries and verify BUILD
files
Change-Id: Ib26689fa19d6fbb1f5c73ded3b5836165977e987
Each conversion required defining a separate mutator, which will each
operate on _all_ modules and requires each to repeat checks whether the
mutator should operator. Instead, we introduce a single mutator and
modules can define a ConvertWithBp2build to implement bp2build
conversion for that module.
Test: bp2build.sh
Bug: 183079158
Change-Id: I99d4b51f441c2903879092c5b56313d606d4338d
Necessary for modules that depend on headers through
LOCAL_HEADER_LIBRARIES in legacy Android.mk files.
Test: m nothing
Test: m nothing SOONG_CONFIG_art_module_source_build=false
on internal master
Test: m droid checkbuild SOONG_CONFIG_art_module_source_build=false
Test: m SOONG_CONFIG_art_module_source_build=false \
out/soong/.intermediates/prebuilts/module_sdk/art/current/sdk/prebuilt_jni_headers/linux_glibc_x86_64/prebuilt_jni_headers.a
ar t out/soong/.intermediates/prebuilts/module_sdk/art/current/sdk/prebuilt_jni_headers/linux_glibc_x86_64/prebuilt_jni_headers.a \
&& echo ok
Bug: 202192894
Change-Id: Ied267053d1fc3563870a3faaf41d79983a22815a
Unlike other prebuilt modules it doesn't have a srcs property of any
kind, so android.Prebuilt cannot defer to the source module just
because its srcsSupplier would return nil.
Test: m nothing
Bug: 202192894
Change-Id: Iafcf165569bad6eae37820cf71aa0fcacb720e02
Write toc files that list the exported symbols so dependents are
only rebuilt if the exported symbols change.
This exports the CC function TransformSharedObjectToToc, and also
removes an unused arg from its signature.
Bug: 178185435
Test: New Soong test passes.
Test: m <toc file path>
Change-Id: I7ab69bf7e7f32f25eb4c7ca9d18d877dac1511db
This also removes the special-case filegroup from mixed builds
buildroot; no special handling is required. Since we're currently
hardcoding linux_x86_64 as our host platform, it should be fine
to continue assumping that hardcoded host for now.
Test: USE_BAZEL_ANALYSIS=1 m adbd
Change-Id: I35509f4eb33ba7a243fab4c34b35958f6f2fceab
Because it's commonly useful and not cc/ specific
Also export GenerateBazelBuildActions and update uses
Test: Existing tests pass
Change-Id: Ibc6858bb1129afba181a7686dda432defe33b00d