Commit Graph

337 Commits

Author SHA1 Message Date
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
Liz Kammer 4018a8d4d7 Refactor rust to use AndroidMkEntries
This is to facilitate consolidation of compatibility suite logic.

Test: go soong tests
Test: m nothing & compare soong Android mk files -- only diffs are
      elimination of duplicate LOCAL_UNINSTALLABLE_MODULE := true lines
Change-Id: I76211505b2b6afde5d0431586b77d799cf70c6b9
2020-11-24 09:44:51 -08:00
Colin Cross e5218b6be6 Merge "Annotate dependency tags for dependencies of installed files" 2020-11-24 16:01:35 +00:00
Colin Cross e9fe2949b8 Annotate dependency tags for dependencies of installed files
Relands Ic22603a5c0718b5a21686672a7471f952b4d1017 with a minor
change to track libc++ dependencies for python hosts and after
a fix to an internal genrule that depended on transitively
installed java libraries (ag/13068670).

Soong currently assumes that installed files should depend on
installed files of all transitive dependencies, which results
in extra installed file dependencies through genrules, static
libs, etc.

Annotate dependency tags for dependencies for which the
installed files are necessary such as shared libraries
and JNI libraries.

This avoids extra installed files, and is also a first step
towards genrules using their own copy of tools instead of
the installed copy.

Bug: 124313442
Test: m checkbuild
Test: java.TestBinary
Test: cc.TestInstallSharedLibs
Test: deptag_test.go
Change-Id: I725871249d561428e6f67bba6a7c65b580012b72
2020-11-23 18:06:08 -08:00
Thiébaud Weksteen 588ed66364 Add comments to {cc,rust}/strip.go
Bug: 173695621
Test: n/a
Change-Id: If3086aa711507c3be6db23e3691163cdd68710bf
2020-11-19 20:02:34 +01:00
Ivan Lozano 1010f9bd56 Merge "rust: Add header library support to rust_bindgen." 2020-11-18 14:06:09 +00:00
Dan Shi ebb51503a4 Merge "Add unit_test test option in test configs" 2020-11-18 04:40:37 +00:00
Ivan Lozano 9b44383788 rust: Add header library support to rust_bindgen.
Allow rust_bindgen modules to define dependencies that only provide
headers and may not necessarily need to be linked in.

Bug: 161141999
Test: Soong tests pass.
Test: Example module has appropriate include flags when compiling.
Change-Id: Ic9ce8b1204008ad8dcb18766c914e48bb292d485
2020-11-17 13:40:50 -05:00
Ivan Lozano d7ddf051d3 rust: Fix incorrect expected gcno file for dylibs
For Rust dylibs we generate a file suffix of .dylib.so. rustc seems to
split the output filename for the gcno file at the first '.', so instead
of libfoo.dylib.gcno (which our build system expects), it produces
libfoo.gcno.

This fixes the mismatch so the build system can find the gcno file that
gets produced for Rust dylibs.

Bug: 170983066
Test: CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS=external/rust/crates \
      m libandroid_log_sys
Change-Id: Icba48bf10ab06c255bd17053d57feb889b1f9ee5
2020-11-17 08:08:21 -05:00
Dan Shi d79572f73e Add unit_test test option in test configs
This change allows a test (native, java, rust or python) to be included
in host-unit-tests suite when test option `unit_test` is set to true.

Bug: 172006742
Test: m host-unit-tests
Change-Id: I69d3eb5b51198c549e2e6914ceac3a4fc33c3cf2
2020-11-16 11:05:00 -08:00
Colin Cross ae8600b507 Pass Config to NewTestContext instead of ctx.Register
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-12 10:07:49 -08:00
Ivan Lozano 45e0c95f85 Merge "rust: Fix absolute path OUT_DIR bug" 2020-11-12 15:23:39 +00:00
Zach Johnson c0ea1701cb Merge "rust_grpcio well known types support, default deps" 2020-11-11 23:22:27 +00:00
Zach Johnson 3df4e6364b rust_grpcio well known types support, default deps
The usage of the well known type Empty requires a hack in the module
above the grpc implementation, this is now the generated stem_mod.rs

This also adds additional implicit dependencies that are required by
the grpc protobuf generated code. This includes the addition of a
'header_libs' property for library dependencies which export include
paths required by protos.

We also now include both the protos and the grpcio in the library
variant via the mod_stem.rs.

Bug: 172592789
Bug: 171504899
Test: m nothing
Test: Example rust_grpcio module build command includes dependencies,
      include paths.
Change-Id: I187a13cd5cdea991828a1020314de16727e4f74e
2020-11-11 12:09:26 -08:00
Ivan Lozano 1776a2ac6f rust: Fix absolute path OUT_DIR bug
The OUT_DIR for rustc is incorrectly calculated when Soong's OUT_DIR
is set to an absolute path through OUT_DIR_COMMON_BASE. This breaks
compilation when rustc is unable to find files that have beein included
through the include! macro.

Bug: 172952634
Test: OUT_DIR_COMMON_BASE=/some/abs/path m
Change-Id: Id447630a7774c1dec655f65dd227c144a159e1b1
2020-11-11 11:25:48 -05:00
Stephen Hines a3faafa377 Rust bindgen should use r399163b.
Bug: http://b/155835175
Test: m
Change-Id: Iedccd3c2258fab5f9fb1034aace7d07da833a0ec
2020-11-09 16:28:23 -08:00
Matthew Maurer 40c9798e92 Merge "rust: Fix GRPC generator invocation" 2020-11-06 19:04:16 +00:00
Thiébaud Weksteen 567f46fe63 Merge changes from topic "roll-rust-1.47.0"
* changes:
  Use Rust 1.47.0 prebuilts
  rust: set STD_ENV_ARCH
2020-11-06 07:28:42 +00:00
Matthew Maurer 5819e58fdc rust: Fix GRPC generator invocation
When using the grpc generator, the plugin expects to also have access to
the protobuf generator. This patch ensures that aprotoc will use the
Soong copy of the protobuf generator, rather than trying to use a
locally installed version from PATH.

Test: m nothing
Change-Id: I26da4d18c97017da7d8cd9515a07a2b7b2575342
2020-11-06 01:40:41 +00:00
Treehugger Robot f5b2a5feb7 Merge "rust_bindgen: respect custom OUT_DIR" 2020-11-05 19:54:46 +00:00
Ivan Lozano 86a1db7baf Merge "Add rust_grpcio module type." 2020-11-05 17:47:11 +00:00
Thiébaud Weksteen 3e0d3f6ef5 Use Rust 1.47.0 prebuilts
Bug: 171280890
Test: cd external/rust; mm
Change-Id: I61097821a73a28a383a07b1fdcfe867872397b43
2020-11-05 17:35:34 +01:00
Thiébaud Weksteen 71512f3265 rust: set STD_ENV_ARCH
In 1.47.0, std::env requires the STD_ENV_ARCH environment variable to be
set to the target architecture [1].

[1] 8e8939b804/library/std/src/env.rs (L866)

Bug: 171280890
Test: cd external/rust; mm
Change-Id: If4ddf4b9bad2a1a7518a358a5fb597170a97c67e
2020-11-05 17:35:17 +01:00
Shao-Chuan Lee aa3231cd6b rust_bindgen: respect custom OUT_DIR
Bug: 172551033
Test: m
Change-Id: I1f760de7cb03ec0bcad5c66ac08bb88ca77c26cd
2020-11-06 00:12:02 +09:00
Ivan Lozano 6a3d1e9831 Add rust_grpcio module type.
Adds a new SourceProvider type to generate grpcio code from protos.
Since it's so similar to protobuf, it's basically just a different type
of rust_protobuf.

Bug: 171504899
Test: Example module compiles.
Change-Id: I9882f3ac4d4aeaae0191f2b557e9612b5c7a9ac9
2020-11-05 08:53:52 -05:00
Treehugger Robot 20cf20ba1c Merge changes I0289d866,Ie7363524
* changes:
  Move stubs related methods out of LinkableInterface
  Don't create stubs variants of static libraries
2020-11-02 21:31:11 +00:00
Colin Cross 31076b3185 Move stubs related methods out of LinkableInterface
The stubs methods are very specific to cc for now, move them out
of LinkableInterface so they are not shared with rust.  Instead,
create a cc.Module.library field that contains the libraryInterface
to simplify calling libraryInterface methods on cc modules.

Test: all Soong tests
Test: no change to Soong outputs
Change-Id: I0289d866ce1f7a765631fe3101a62b1b4988ba1c
2020-10-29 14:17:54 -07:00
Qasim Javed d271ada0c9 Add system/bt to Rust allowed paths.
Test: m nothing

Change-Id: Ie467a622dfdb8aea94a06f5fe20183dc9d149254
2020-10-29 11:18:08 -07:00
Yifan Hong b646bc183a Merge changes from topic "vendor_ramdisk_soong"
* changes:
  Vendor ramdisk modules install to correct location
  Add vendor-ramdisk image to Soong.
2020-10-24 01:08:16 +00:00
Yifan Hong 60e0cfb5cb Add vendor-ramdisk image to Soong.
Add vendor_ramdisk_available and vendor_ramdisk attribute to
various rules. When a vendor_ramdisk variant of a module is
generated, it is installed to $OUT/vendor-ramdisk.

It is similar to a ramdisk image.
Test: m nothing -j

Change-Id: Ib2d16459f3094dbe21c3bdb7c016cb4b2bf62765
2020-10-22 10:26:26 -07:00
Alistair Delva 6b07ff2d9d Merge "Add external/vm_tools/p9 to rust allowed paths" 2020-10-22 17:17:03 +00:00
Alistair Delva ebb2901bb0 Merge "Alpha sort rust allowed_list.go" 2020-10-21 17:00:50 +00:00
Ivan Lozano d90bd4a1ed Merge "rust: Add cflag checks against -xc++ and -std." 2020-10-21 14:37:40 +00:00
Alistair Delva ea2974c8b3 Add external/vm_tools/p9 to rust allowed paths
Change-Id: Ifccb7b94a6655524b99d669168c54cf93eed5f89
2020-10-21 06:57:00 -07:00
Alistair Delva e172eaf67b Alpha sort rust allowed_list.go
Change-Id: If0e9938bb776f42037b57680505de19b9cd88771
2020-10-21 06:56:20 -07:00
Ivan Lozano 0a2a115457 rust: Add cflag checks against -xc++ and -std.
If -x c++ is passed through a modules cflags, it will be overridden by a
-x c and -std flag added by the build system if the extension is not
.hpp/.hh and cpp_std is not set. This leads to confusing behavior.

Instead, add a helpful error message to guide developers towards the
correct way to specify when a header is  a C++ header and which std
version should be used.

Bug: 171011490
Test: m nothing
Change-Id: I7e7cba504798d47ce1c753ba8699d7475a95095b
2020-10-16 10:52:46 -04:00
Chih-hung Hsieh f4155dc551 Merge "Use protobuf-codegen default and add mod_stem.rs" 2020-10-15 05:46:18 +00:00
Andrew Scull 251b517222 Merge changes from topic "rust4virt"
* changes:
  Update rustfmt preupload example reference
  Allow packages/modules/Virtualization to use rust
2020-10-14 07:15:02 +00:00
Andrew Scull 5a58bca1f4 Update rustfmt preupload example reference
The arguments passed to rustfmt have changed from those used in the
previously referenced CL so update the comment to reference a CL using
the new arguments.

Bug: 164111102
Test: None
Change-Id: I962d56ed36422709a1fcd07ca95f1c015daa6339
2020-10-13 13:52:37 +01:00