summaryrefslogtreecommitdiff
path: root/rust/source_provider.go
diff options
context:
space:
mode:
author Matthew Maurer <mmaurer@google.com> 2022-07-26 14:26:33 -0700
committer Matthew Maurer <mmaurer@google.com> 2022-08-01 16:28:51 +0000
commit53a452d1ff172fba9060f2997fec006a70e44c8d (patch)
tree56c025bc93ec205ca8f4041069faf622bd0f02d7 /rust/source_provider.go
parent0bb7f0494ead02d94946c2ded3bf6bb147d81437 (diff)
rust: Only allow bindgen to produce `rlib`s.
Generated bindings are intended to be slim translation layers, usually consisting of nothing more than type signatures and constants. Generally, they should also be used in exactly one location by the safe wrapper for these bindings. By preventing them from building as `dylib`s, we avoid the per-library overhead of these non-reused pieces of code. Additionally, default visibility restrict all bindgen modules to their subpackages. This is being done both: * to encourage use of a single safe bindings crate * to avoid diamond dependency graphs with mixed rlib/dylib dependencies Bug: 166332519 Test: m; Make sample module use dylib bindgen dependency, see build failure. Change-Id: I8e9d9cb851c2ec99f4ed63e6e18c4ba26b29721c
Diffstat (limited to 'rust/source_provider.go')
-rw-r--r--rust/source_provider.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/rust/source_provider.go b/rust/source_provider.go
index 7719611d5..4f8d22b1f 100644
--- a/rust/source_provider.go
+++ b/rust/source_provider.go
@@ -65,9 +65,12 @@ func NewSourceProvider() *BaseSourceProvider {
}
}
-func NewSourceProviderModule(hod android.HostOrDeviceSupported, sourceProvider SourceProvider, enableLints bool) *Module {
+func NewSourceProviderModule(hod android.HostOrDeviceSupported, sourceProvider SourceProvider, enableLints bool, rlibOnly bool) *Module {
_, library := NewRustLibrary(hod)
library.BuildOnlyRust()
+ if rlibOnly {
+ library.BuildOnlyRlib()
+ }
library.sourceProvider = sourceProvider
module := newModule(hod, android.MultilibBoth)