Commit graph

375 commits

Author SHA1 Message Date
Thiébaud Weksteen
d7e51e0891 Merge "Use 1.49.0 prebuilts" 2021-01-14 18:26:41 +00:00
Ivan Lozano
3968d8f678 Refactor CC to prep for Rust sanitizable modules.
Adds a PlatformSanitizable interface which both CC and Rust can
implement so that the sanitizer mutators in CC can sanitize Rust
shared/static libraries appropriately.

Bug: 147140513
Test: m nothing
Change-Id: Ib31103b6c4902a4d5df2565c0d7c981298d100a3
2021-01-08 08:53:46 -05:00
Thiébaud Weksteen
cb738204fa Use 1.49.0 prebuilts
Bug: 176888219
Test: build external/rust/crates
Change-Id: I979720ac75e8546058c23ac86b2b64ac518b115c
2021-01-08 14:20:04 +01:00
Treehugger Robot
86cc40a74c Merge "Do not read 'vendor_available: false'" 2021-01-08 00:57:35 +00:00
Peter Collingbourne
b143cd9482 Enable debug info in Rust modules.
This allows tombstones to be symbolized and is consistent with C/C++
where we pass -g.

Bug: 173723155
Change-Id: I597e2bf97517407b428277f1cf7aa19b73371efa
2021-01-07 12:05:04 -08:00
Justin Yun
c0d8c49224 Do not read 'vendor_available: false'
In case of VNDK, 'vendor_available: false' had a special meaning that
defines VNDK-private libraries. It is not trivial because not
defining a boolean property means 'false' normally. To avoid the
confusion replace it with the 'vndk.private: true' for VNDK-private
libraries and 'private: true' for LLNDK-private libraries.

All VNDK libraries must define 'vendor_available: true' and may have
'vndk.private: true' if they are VNDK-private.
With this change '(vendor|product)_available: false' is the same as
not defining the property.

LLNDK-private must define 'private: true' instead of
'vendor_available: false'.

Bug: 175768895
Test: build
Change-Id: I57fbca351be317257d95027f3cdcdbbe537eab23
2021-01-07 17:58:55 +09:00
Peter Collingbourne
9a868f1238 Allow the clang version used for bindgen to be configured.
This is useful when experimenting with new compiler flags that the
existing compiler does not support.

Change-Id: I45b8a2980b247d60a7f4e2ba55169267aeceef2b
2020-12-30 21:18:54 -08:00
Jaewoong Jung
e794b1e302 Merge "Remove unnecessary snake case variables." 2020-12-23 01:21:28 +00:00
Treehugger Robot
109d9ccdcb Merge "rust modules in APEX don't get installed to the system partition" 2020-12-23 00:42:20 +00:00
Jaewoong Jung
18aefc1977 Remove unnecessary snake case variables.
Test: m nothing + TreeHugger
Change-Id: I99f7162944daa6c57c6ae4763261e108bb5cb6b1
2020-12-22 12:38:35 -08:00
Jiyong Park
459feca5cc rust modules in APEX don't get installed to the system partition
Otherwise, we get duplicated build rules.

Bug: N/A
Test: OUT_DIR=out DIST_DIR=out/dist
build/soong/scripts/build-ndk-prebuilts.sh

Change-Id: I2be0695d284bd72a19e02c8b7509a7f39afade8b
2020-12-22 15:10:00 +09:00
Colin Cross
127bb8b9f6 Don't rewrite LLNDK dependencies with .llndk suffix
Rewriting LLNDK dependencies with .llndk suffix requries referencing
a global data structure to determine if a given library is an LLNDK
library and therefore needs the .llndk suffix.  References to
global data structures from mutators must be removed to support
incremental Soong analysis.  Instead, move the LLNDK stubs rules
into the vendor variant of the implementing cc_library so that
the original name can be used.

As an incremental step, the llndk_library modules are left in
place, and the properties are copied into the cc_library via
the dependency specified by the llndk_stub property.  A followup
will move the LLNDK properties directly into the cc_library and
delete the llndk_library modules.

The global list of LLNDK libraries is kept for now as it is used
to generate the vndk.libraries.txt file.

Bug: 170784825
Test: m checkbuild
Test: compare Soong outputs
Test: all Soong tests
Change-Id: I2a942b21c162541a49e27b2e5833c9aebccff1d0
2020-12-21 17:53:30 -08:00
Colin Cross
97a1be6e7b Merge changes from topic "sbox_tools"
* changes:
  Sandbox genrule tools
  Call ctx.InstallFile for uninstallable cc modules
  Don't copy uninstallable variants of NDK libraries to sysroot
2020-12-17 22:01:06 +00:00
Colin Cross
a9c8c9f145 Call ctx.InstallFile for uninstallable cc modules
SkipInstall is actually primarily used to prevent making a module
visible to Make, rename it and add new SkipInstall that actually
skips installation without affecting Make.

Call c.SkipInstall() for uninstallable cc modules to allow calling
c.installer.install, which will collect PackagingSpecs for
uninstallable cc modules, allowing them to be used by genrules.

Bug: 124313442
Test: m checkbuild
Change-Id: I8038ed5c6f05c989ac21ec06c4552fb3136b9a7a
2020-12-17 10:02:18 -08:00
Treehugger Robot
1a74be780b Merge "Assert android.ApexModule interface for types having ApexModuleBase" 2020-12-17 04:14:35 +00:00
Treehugger Robot
4d24e65bbf Merge "Put external/libchromeos-rs in the Rust allowlist" 2020-12-15 23:28:19 +00:00
Jiyong Park
45bf82e953 Assert android.ApexModule interface for types having ApexModuleBase
Bug: 173472337
Test: m nothing
Change-Id: Idf1c6cb9fff6c18e34c4636e38a662ba4ff7d538
2020-12-15 14:31:27 +00:00
Ivan Lozano
6eff900b67 Merge rust_protobuf and rust_grpcio module types.
To allow grpc protobufs to include non-grpc protos in a singular
library, we need to allow them to be defined as part of the same module.

This CL merges the two previously distinct module types into
rust_protobuf, and adds a new property for declaring which protos
contain grpc definitions.

Bug: 172952239
Test: rust_grpcio modules converted to rust_protobuf modules and build.
Test: Example rust_protobuf module with both proto types builds.
Change-Id: I0e627fd97bc6f74de89d309e3344694a1e76586d
2020-12-11 16:19:02 -05:00
Ivan Lozano
30530a9e34 Merge "Rust: WriteFileRule instead of printf for protos" 2020-12-11 19:14:29 +00:00
Ivan Lozano
90f5c1d5d6 Merge "Rust: Vendor support for Rust static libraries." 2020-12-11 13:44:31 +00:00
Ivan Lozano
f48c89cd39 Merge "Refactor for preliminary Rust vendor image support" 2020-12-11 13:40:20 +00:00
Jiyong Park
0d399b5915 Merge "Add min_sdk_version to Rust modules." 2020-12-10 23:54:34 +00:00
Ivan Lozano
9d74a52706 Rust: WriteFileRule instead of printf for protos
Use WriteFileRule instead of a rule that calls printf for generating the
module source file for rust_protobuf.

Bug: 171361369
Test: rust_protobuf modules compile
Change-Id: Ie83a30e19d7d09875f3d209662526783862d8ea0
2020-12-10 15:35:05 -05:00
Ivan Lozano
6a88443089 Rust: Vendor support for Rust static libraries.
We don't have Rust VNDK support yet, but static linkage can be
supported in the interim. This adds support for making rust_ffi_static
libraries available to CC vendor modules.

Since rust_ffi_static modules will link against rlibs, we allow rlib
linkage into vendor as well, but only for the variants which use the
rlib libstd.

Bug: 172525289
Test: New Soong tests pass
Test: Example vendor cc_binary links against rust_ffi_static module.
Change-Id: Idf3aeb51e32293866f1ad965e329aa6b9e0bf2ef
2020-12-10 10:29:54 -05:00
Ivan Lozano
f9e2172aec Refactor for preliminary Rust vendor image support
Refactors parts of CC to prepare for preliminary support for using Rust
static libraries in vendor images. Some previously private functions are
made public, and additional functions are added to LinkableInterface so
GetMakeLinkType can be passed a LinkableInterface.

Bug: 172525289
Test: m
Change-Id: I5fda48e79532fe9ceab255e18d910af58048a123
2020-12-10 10:29:48 -05:00
Ivan Lozano
366cb49b9f Merge "Move prefer_rlib from binary to base compiler." 2020-12-09 23:02:53 +00:00
Ivan Lozano
3e9f9e47cf Add min_sdk_version to Rust modules.
Add the min_sdk_version property to Rust modules so they can declare
a minimum SDK version they support for use with APEX modules.

Test: New Soong test passes.
Bug: 174862583
Change-Id: I2829053a320f50c218783dee5adbeff9cef81e8e
2020-12-09 11:30:44 -05:00
Ivan Lozano
ea08613dd3 Move prefer_rlib from binary to base compiler.
Moves the prefer_rlib property out from being exclusively a binary
property to one thats part of the base compiler properties. This
provides a little more control over the libstd linkage in our libraries.
Specifically, this enables a usecase where rust_ffi_shared needs to link
against libstd statically rather than dynamically.

Bug: 175121262
Test: New Soong tests pass.
Change-Id: If68014c684a75ba70e9d7dacbb01c7d360dc25a1
2020-12-09 09:55:12 -05:00
Ivan Lozano
78b340f375 Merge "Add LinuxBionic toolchain to Rust" 2020-12-08 22:04:49 +00:00
Ivan Lozano
bf3b6e9b8d Add LinuxBionic toolchain to Rust
The LinuxBionic toolchain wasn't defined for Rust.

This would lead to build breakage if a CC module that targeted Linux
Bionic linked against a Rust FFI module.

Bug: 174873186
Test: Build breakage no longer occurs if CC module with Rust dependency
      is built for the Linux Bionic target.
Change-Id: I39df7b9a29372986c9beeb1fe5602140d805d731
2020-12-08 09:04:21 -05:00
Thiébaud Weksteen
fa5feae43c Add dependencies for source-generated crates
When using SourceProviders, the dependency tree does not include
directly the source variant, only the built variant. For instance:

  liba --> libbingena_rlib --> libbingena_source

However, libbindgena_rlib did not have a source associated with the
module, and was therefore not added as a dependency. Modify the logic so
that a SourceProvider library will find the right variant and always
have a source defined.

Adds display_name fields to the crate description to ease debugging.

Test: rust-analyzer analysis-stats .
Bug: 174158339
Change-Id: Id65708d57cd176f7e1da353f4a5f7ad65b003090
2020-12-07 14:45:09 +01:00
Victor Hsieh
274597b951 Put external/libchromeos-rs in the Rust allowlist
Bug: 174797066
Test: m
Change-Id: Ieef7df3c17e6d6b1223769cfd07301dfe7d91363
2020-12-04 11:21:06 -08:00
Bernie Innocenti
3a710d6bbb Allow rust code in packages/modules/DnsResolver
Test: m com.android.resolv.apex
Change-Id: I6cb5234f51ac6c31440e7cd5aeca4655629a35d6
2020-12-05 02:55:53 +09:00
Thiébaud Weksteen
4bfb2b99f8 Merge "Includes rust_binary in rust-project.json" 2020-12-04 14:37:14 +00:00
Thiébaud Weksteen
064f6e957e Includes rust_binary in rust-project.json
Until now, only rust_library (and their derivatives such as
rust_library_host) were reported in rust-project.json. Adds support for
rust_binary and rust_tests.

Bug: 174743191
Test: Validate auto-completion in keystore2_main.rs
Change-Id: I17b3ec29e233f29b7abd16dc771070ada48d17fb
2020-12-03 20:58:32 +01:00
Colin Cross
f1a035e6be Pass pctx and ctx to NewRuleBuilder
Enable the RuleBuilder and RuleBuilderCommand methods to access
the BuilderContext by passing it to NewRuleBuilder instead of
RuleBuilder.Build.

Test: genrule_test.go
Test: rule_builder_test.go
Test: m checkbuild
Change-Id: I63e6597e19167393876dc2259d6f521363b7dabc
2020-12-01 16:22:16 -08:00
Treehugger Robot
464e6c71df Merge "Add test suite handling to central androidmk code" 2020-12-01 22:19:26 +00:00
Liz Kammer
57f5b33ad3 Add test suite handling to central androidmk code
MTS is introducing partial MTS test suites that are per-module, with
names of the format: mts-${MODULE}. By centralizing the code for test
suites, we can automatically add "mts" test suite when an
"mts-${MODULE}" test suite is specified, reducing duplication.

Test: m mts
Bug: 170318013
Change-Id: I8ce9d3c252fcc0a937bb5f2826d21cb6c6932d82
2020-12-01 12:23:56 -08:00
Ivan Lozano
9c3f653207 Merge "rust: Add support for multiple protos per module." 2020-12-01 13:11:57 +00:00
Jiyong Park
493e7ec3ee Merge "Clients of PackagingBase can customize dependency tag to use" 2020-12-01 03:44:38 +00:00
Jiyong Park
65b6224471 Clients of PackagingBase can customize dependency tag to use
Previously, the dep tag used by PackagingBase was fixed, which prevented
some of its clients (e.g. cvd-host-package) from opting in to
android.InstallAlwaysNeededDependencyTag. Now, PackagingBase.AddDeps
accepts the dependency tag to use.

Also, dependencies toward rust dylib, rlib, and proc_macro are
configured to return true on InstallDepNeeded. This is required to
install shared_lib dependencies of the rust modules when they are
depended on by a rust binary.

Exempt-From-Owner-Approval: a trivial change after +2 from the owner.
This has to land ASAP as many users are affected by acloud being
unavailable.

Bug: N/A
Test: m
Test: acloud create --local-instance --local-image
Change-Id: If22aee7c6f314fcb03b9d4fe6901a2557f1e899c
2020-12-01 03:43:05 +00:00
Treehugger Robot
93bfe6bf76 Merge "Allow rust code in device/google/cuttlefish" 2020-12-01 00:16:41 +00:00
Jiyong Park
fdea25781f Merge "rust modules can be included in apex" 2020-11-30 15:41:28 +00:00
Jiyong Park
99644e92c8 rust modules can be included in apex
We will have some APEXes having rust binaries and libraries. So, adding
the support for the types of modules.

rust.Module now inherits from android.ApexModuleBase and implements
the android.ApexModule interface.

Bug: 172414324
Test: m

Exempt-From-Owner-Approval: rebased after +2 from the owner
Change-Id: I356ef4c45f782a6460f001e83af96d1710642d80
2020-11-30 15:40:48 +00:00
Ivan Lozano
57f434e858 rust: Add support for multiple protos per module.
This further emulates the rust-protobuf gen_mod_rs flag by providing
support for generating a single module containing multiple protobuf
definitions.

Bug: 171361369
Test: New Soong tests.
Test: Example module containing multiple protos works.
Change-Id: I815f9628a8289ae512758073dac49bc4535abf01
2020-11-30 14:55:00 +00:00
Thiébaud Weksteen
c6fe19d637 Use 1.48.0 prebuilts
Bug: 173721343
Test: build external/rust/ and crosvm
Change-Id: Ifde24640fc262c5eebdcd623556e925e7d78ae85
2020-11-27 14:42:57 +01:00
Thiébaud Weksteen
463ab7a27e Merge "Ignore variant dependencies in rust-project.json" 2020-11-26 09:15:09 +00:00
A. Cody Schuffelen
4e5fc3b422 Allow rust code in device/google/cuttlefish
Test: TreeHugger
Change-Id: If7bce48e101bd49389d952556bfdf95d7899f01b
2020-11-25 18:29:39 -08:00
Liz Kammer
0fd0e95e1b Merge "Refactor rust to use AndroidMkEntries" 2020-11-26 00:06:03 +00:00
Thiébaud Weksteen
3c5905b0cb Ignore variant dependencies in rust-project.json
Source-generated library modules will have a dependency on the source
variant. This creates a cycle in the dependency graph which triggers a
warning from rust-analyzer. Ignore this type of dependency.

Test: m nothing
Change-Id: I13365093ebb88b00f6a72734b01114ec3e9a320e
2020-11-25 16:11:49 +01:00