summaryrefslogtreecommitdiff
path: root/rust/compiler.go
diff options
context:
space:
mode:
authorIvan Lozano <ivanlozano@google.com>2020-07-31 13:40:31 -0400
committerIvan Lozano <ivanlozano@google.com>2020-08-04 08:13:24 -0400
commit26ecd6c5974fcd3ec09792394e7b9cdf32f5f64f (patch)
tree19a888dd32d382a9a26abea71e5965fc9ab19154 /rust/compiler.go
parentd118b1c2b74a1028f86f570db602a3b39e2009e1 (diff)
[rust] Add SourceProviders as crates support.
This allows SourceProvider modules to create rust_library variants so that generated source can be referenced as an external crate rather than via an include macro. This is done by including rust_bindgen modules like any other library, as a dependency in either rlibs, dylibs, or rustlibs. This renames the stem and flags properties for rust_bindgen modules to source_stem and bindgen_flags, respectively. This deconflicts with the usage in baseCompiler. This also removes 'subName' from the Module struct and moves it over to SourceProvider, which was the only user. This allows us to set it in baseSourceProvider's AndroidMk; setting it in Module's AndroidMk was causing problems finding NOTICE files for bindgen library variants. Bug: 159064919 Test: New Soong tests pass. Test: Local test rust_binary can use rust_bindgen module as a crate. Change-Id: Ieb2cb614c2dd0b5aa7120541d77f6f822a6a1806
Diffstat (limited to 'rust/compiler.go')
-rw-r--r--rust/compiler.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/rust/compiler.go b/rust/compiler.go
index 040219dc4..ec059c37c 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -81,7 +81,10 @@ type BaseCompilerProperties struct {
// list of C static library dependencies
Static_libs []string `android:"arch_variant"`
- // crate name, required for libraries. This must be the expected extern crate name used in source
+ // crate name, required for modules which produce Rust libraries: rust_library, rust_ffi and SourceProvider
+ // modules which create library variants (rust_bindgen). This must be the expected extern crate name used in
+ // source, and is required to conform to an enforced format matching library output files (if the output file is
+ // lib<someName><suffix>, the crate_name property must be <someName>).
Crate_name string `android:"arch_variant"`
// list of features to enable for this crate
@@ -120,6 +123,14 @@ type baseCompiler struct {
distFile android.OptionalPath
}
+func (compiler *baseCompiler) Disabled() bool {
+ return false
+}
+
+func (compiler *baseCompiler) SetDisabled() {
+ panic("baseCompiler does not implement SetDisabled()")
+}
+
func (compiler *baseCompiler) coverageOutputZipPath() android.OptionalPath {
panic("baseCompiler does not implement coverageOutputZipPath()")
}