This reverts commit e7c71c344d.
The intermediates created by the separated rust compile steps are very
large, on the order of 60GB. This is more than CI can support for now,
revert the split into compile and link phases. This comes at the expense
of incremental build time, especially when modifying C/C++ sources that
are dependencies of rust modules.
Bug: 293349612
Test: builds
Change-Id: I81169e7d0727330c8de5e7688dcdc87fe7b8d3b5
rust_protobuf were unable to import protos from other rust_protobuf
modules. This CL adds support for that. rust_protobuf modules which are
listed in rustlibs will have their modules imported into the generated
protobuf stub. Additionally, rust_protobuf modules which define
"exported_include_dirs" will export those include paths to dependent
rust_protobuf modules.
Bug: 301266700
Test: m rust
Change-Id: I132edffa4d77e0ac80a7ac934f873374c8e94c1b
We only supported bp2build for rust_protobuf_host because the non-host toolchain for rust is not checked in yet. aosp/2759750 changed a converted module from rust_protobuf_host to rust_protobuf and broke CI.
This CL adds bp2build support for rust_protobuf but makes the target incompatible with android os for now untilnon-host rust toolchain is checked in.
Bug: 301956497
Test: b build //build/make/tools/aconfig:all --config=android
Change-Id: I739896c79f32674000c2603e394f16860a6fc57d
Prebuilt modules for some clang tools were created in aosp/2746469, but they do not exist for darwin builds. Adding the same modules in prebuilts/clang/host/darwin-x86/Android.bp results in duplicate module names. Instead we can just get a path to these files directly in Soong.
Test: CI
Test: https://android-build.googleplex.com/builds/abtd/run/L90700000963131594
Change-Id: I620cfd7b1ab34bd0959feea562d599b963717198
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
This commit adds support for compiling rust rules inside the sbox
sandbox. To compile a rust module with sandboxing enabled, the entry
point to the crate must be specified via the `crate_root` property, and
all input sources and compile-time data must be specified via the `srcs`
and `compile_data` properties.
Bug: 286077158
Change-Id: I8c9dc5cf7578037a583b4be2e2f73cf20ffd4408
Rust modules are different from C++ modules in that they will install
their transitive shared libs alongside a binary. C++ modules don't
do this, you have to install the transitive shared lib manually. (but
they do install direct shared libs)
It does this by using InstallDepNeeded, a mechanism that adds
dependencies from installed files to the installed copies of
dependencies if InstallDepNeeded() returns true. This mechanism does
not end up tracking the installed files all the way to
FULL_SYSTEMIMAGE_DEPS.
We're attempting to make FULL_SYSTEMIMAGE_DEPS more accurate so that
we can track the files that should be installed properly, and remove
the need for `m installclean`.
Listing the libraries a binary uses in LOCAL_SHARED_LIBRARIES does
properly track them and end up listing them in FULL_SYSTEMIMAGE_DEPS.
Bug: 205632228
Test: Building the systemimage with a change to delete anything not in FULL_SYSTEMIMAGE_DEPS
Change-Id: I4ba75b40b3ac77250297209a851bc9ba377782f5
- Hide universal binary dependency for rust
Without a darwin_arm64 libstd prebuilt, many rust binaries are not
possible to build as a universal binary anyway. This fixes an
intermediate error with compiling rust FFI targets, where C++ shared
library dependencies for both architectures were combined into the same
linker command.
There is still an outstanding problem with C++ executable targets that
include rust FFI library targets, as the rust FFI library targets
fail to find a proper libstd to build the arm64 side of the universal
executable.
- Use dynamic_lib instead of soname
This matches similar logic in cc/library.go : linkerFlags for including
shared libraries.
Bug: 291830024
Test: m libkmr_cf_ffi (when enabled for darwin)
Change-Id: I1d6b6a7855c6649b93ab6592ea43b17c6e37b3a3
Register a missing dependency when a dependency returns an invalid
OptionalPath.
Fixes: 294070048
Test: rust_test.go
Change-Id: Ibccfc30d59c706308e99f11e372f7c9b60d9dc74
Adds dylib support for vendor and recovery images.
This changes the default linkage for vendor and recovery images to
dylib, which matches the platform default linkage. This also means that
by default, dylib-std variants are used for rlib dependencies.
Bug: 204303985
Test: Soong tests.
Test: m dist vendor-snapshot
Test: RECOVERY_SNAPSHOT_VERSION=current m dist recovery-snapshot
Change-Id: If84074b8615a70c45e7e162abeb853dc8c34d49a
Rust shared library dependencies are not always bundled in cc_fuzz or
rust_fuzz modules, which can lead to difficult to debug runtime errors
when running these fuzzers. It can also be hard to determine which
dependencies need to be explicitly declared.
This CL makes sure that we bundle the appropriate transitive
dependencies for our fuzzers.
Bug: 249551848
Test: Soong tests
Test: m <fuzzer> # check data/fuzz/<arch>/lib dir contents
Change-Id: I957ca8898079b61e2ff20d750f8c92bf61ac394f
Some device specific prebuilts have a suffix that varies depending on the lunch target.
The resulting install dependency binary has the suffix.
The fuzzer build expects the presubmit binary without the suffix.
This change is to drop the suffix.
Test: make haiku
Change-Id: I8eadd84bf5797659b17bc428dca47b7c3f382aff
Teach rustc to generate object files instead of a linked executable
for binary and shared library crates. This lets us skip the lengthy
Rust compilation phase when only the C++ dependencies of these crates
have changed.
This works using a Python script that replaces the linker invoked by
rustc and converts the linker command line into a rspfile that can be
used during the link phase. The script makes certain assumptions about
how rustc invokes the linker, but since we control the version of Rust
we use, we can update the script if those assumptions ever break. I've
asked the Rust developers about adding an official way to do this so
hopefully we won't need to rely on this hack in the future.
The rustc rule for Kythe has been altered to pass linker=true, somewhat
consistent with the main rustc rule, which now doesn't invoke the actual
linker either. `m xref_rust` still succeeds, but hopefully we can find
someone who knows more about the rest of the Kythe pipeline who can let
us know whether it should still work. Otherwise, let's use this CL as
an opportunity to find out whether the rest of the pipeline is happy
with linker=true, since otherwise we will find it hard to maintain the
Kythe rule in the future.
Change-Id: Ifb9c8689c1bd78c0afcf6fdfd111140d20377536
Ignore-AOSP-First: The parent CL is internal
Bug: 267229065
Test: go test
Change-Id: Ia14679285b92f3f14ff269392a61f978c71311b2
Merged-In: Ia14679285b92f3f14ff269392a61f978c71311b2
We must pass pointer of pointer to correctly cash snapshotInfo and
register provider only once.
Bug: 271215084
Test: build
Change-Id: Ia7b43c7b97a8fcabd3b4d6ac8b990c622b6ceb6e
The library file for a cc_shared_library dependency is added to the linkFlags of the rustc compilation action, but no explicit dependency was made on it from a Ninja perspective if a TOC was also present. This change adds the explicit dependency on the library file whether or not a TOC is present.
Test: m crosvm
Bug: 275416061
Change-Id: I625b62762d9ba7b4fd2b8362285528e47f728dd4
Previously, rust libs in platform would build against stubs even if the
dependency was part of platform. Port the correct logic from the
recently implemented aosp/2421967
Test: TH
Change-Id: I7f6a0ca24654b4424d2f4cfcef2d15e15b1298fc
Rust snapshot must have proper suffix for androidmk to avoid conflict
with the existing modules.
Bug: 230780263
Bug: 235895567
Test: m nothing
Change-Id: I35794196553621cd722c067d7965b2a61aa351bd
Coverage builds for no_std crates currently fail because
profiler_builtins are part of libstd and therefore do not get included.
When calculating the dependencies for coverage enabled targets, check if
the stdlib is being included, and if it is not then pull the
profiler_builtins sysroot.
Bug: 249551848
Test: CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS='*' make libtinyvec_nostd.rlib-std
Change-Id: I73f89bddcb2d4d9c704cb3962ee39b73888c7f3f
Fix an issue where rust_fuzz modules were
not correctly packaging and copying their
dependencies.
This is done by extending the CC fuzz packager
to simply handle both Rust and CC modules,
ensuring this doesn't get out of sync again.
Fuzzer related functions are added to the
Linkable interface to facilitate this.
There was a bug where the Make definitions for
Rust fuzzers were not being created as well,
and that is addressed here.
Bug: 249551848
Test: m android_log_fuzzer #check $OUT/data/fuzz/arm64/libs
Change-Id: I9b41153e0cf08ab510476b75003c3a3baccc3858
Context
- Android-<target>.mk currently does not contain information about partition for its dependent unembedded jni libraries, but only lists the name of the unembedded jni libraries.
- If an android_app module depends on an unembedded jni library that is located in a different partition, make cannot find the library.
Implementation
- Create a string field partition in jniLib struct.
- Add variable "LOCAL_SOONG_JNI_LIBS_PARTITION_<target>", an array of mappings of the name of the jni library to its partition.
Bug: 154162945
Test: m
Change-Id: I6b8e1272ff59dc70e3dd6ce8c6c8e4686dad76df
customBindgenTag is used to describe a particular host tool - don't
propagate apex dependency across it.
Bug: 249849807
Test: Adding rusqlite to apex no longer requires bindgen allowed
Change-Id: Ifcb2a94c577c72558f757bf10e975212558fe790
Introduce cc_api_library, which reflects imported API from other
inner-tree. This cc_api_library module type will later refer from
the other ninja module which generates stub library from the interface
description.
Tested environment :
* original libc definition has been removed temporarily, to ensure that
imported api stub library is being used from build
* Added new definition of libc as below
cc_api_library {
name: "libc",
arch: {
x86: {
src: "libs/x86/libc.so",
},
x86_64: {
src: "libs/x86_64/libc.so",
},
},
header_libs: [
"libc_headers",
],
export_header_lib_headers: ["libc_headers"],
min_sdk_version: "9",
vendor_available: true,
}
Bug: 236087698
Test: `ALLOW_MISSING_DEPENDENCIES=true m vendorimage` succeeded
Change-Id: I67070b0f3561aa2afd73b6c1c0fdf4255218baac
Rust is now approved for general platform use without project-specific
review.
Bug: 240501326
Test: m
Change-Id: I6fd4c22ba2c6a3a5bac6f91fd087fe5cffe46c01
Allow listing rust_ffi_shared modules as a jni_libs dependency
in conjunction with platform_api: true. This allows inclusion by
android_app modules.
Bug: 237304791
Test: android_app module builds with a rust_ffi_shared dependency.
Change-Id: I3a28e1baa522ad8f9c2aa86f1d23b19ce9f967e1
Rust vendor-only modules would have the '.vendor' subname appended to
them, which meant that 'm <vendor_module>' would not work -- instead
you would need to call 'm <vendor_module>.vendor', which leads to some
confusion.
This CL fixes the behavior by using the same SubName logic as the cc
module.
Bug: 205577906
Test: m <vendor_module> # works without .vendor suffix
Change-Id: I6ba18ce1d7281a1f8342ed6014644b48009d78e0
Allow adding rlib-only libraries to rustlibs by having it fallback to
selecting the rlib variant if a dylib variant is requested but not
available.
Bug: 224771894
Test: m nothing
Test: New Soong test
Change-Id: I47b19ec9dbf3da90a2b090aeda04556a0400c7d1
Adds support for capturing rust_proc_macros as part of the host
snapshot. Proc macros target the host and can be thought of as compiler
plugins. Because of this, they don't have vendor image variants and
can't be easily captured as part of the vendor snapshot. Instead we
capture them as part of the host snapshot.
This adds a rust_prebuilt_proc_macro module type.
Bug: 204304380
Test: m HOST_FAKE_SNAPSHOT_ENABLE=true host-fake-snapshot dist
Test: python3 development/vendor_snapshot/update.py --image=host
--install-dir=vendor/vendor_name/ 31 --local out/dist
Test: Checked Android.bp for rust_prebuilt_proc_macro modules.
Change-Id: I4a8c4d9c41b7ca361b5b97d3f74973918c2a5fe3