diff options
Diffstat (limited to 'rust/compiler.go')
-rw-r--r-- | rust/compiler.go | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/rust/compiler.go b/rust/compiler.go index 200af9061..41b73719a 100644 --- a/rust/compiler.go +++ b/rust/compiler.go @@ -97,13 +97,25 @@ type BaseCompilerProperties struct { // list of C shared library dependencies Shared_libs []string `android:"arch_variant"` - // list of C static library dependencies. Note, static libraries prefixed by "lib" will be passed to rustc - // along with "-lstatic=<name>". This will bundle the static library into rlib/static libraries so dependents do - // not need to also declare the static library as a dependency. Static libraries which are not prefixed by "lib" - // cannot be passed to rustc with this flag and will not be bundled into rlib/static libraries, and thus must - // be redeclared in dependents. + // list of C static library dependencies. These dependencies do not normally propagate to dependents + // and may need to be redeclared. See whole_static_libs for bundling static dependencies into a library. Static_libs []string `android:"arch_variant"` + // Similar to static_libs, but will bundle the static library dependency into a library. This is helpful + // to avoid having to redeclare the dependency for dependents of this library, but in some cases may also + // result in bloat if multiple dependencies all include the same static library whole. + // + // The common use case for this is when the static library is unlikely to be a dependency of other modules to avoid + // having to redeclare the static library dependency for every dependent module. + // If you are not sure what to, for rust_library modules most static dependencies should go in static_libraries, + // and for rust_ffi modules most static dependencies should go into whole_static_libraries. + // + // For rust_ffi static variants, these libraries will be included in the resulting static library archive. + // + // For rust_library rlib variants, these libraries will be bundled into the resulting rlib library. This will + // include all of the static libraries symbols in any dylibs or binaries which use this rlib as well. + Whole_static_libs []string `android:"arch_variant"` + // 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 @@ -266,6 +278,7 @@ func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps { deps.Rustlibs = append(deps.Rustlibs, compiler.Properties.Rustlibs...) deps.ProcMacros = append(deps.ProcMacros, compiler.Properties.Proc_macros...) deps.StaticLibs = append(deps.StaticLibs, compiler.Properties.Static_libs...) + deps.WholeStaticLibs = append(deps.WholeStaticLibs, compiler.Properties.Whole_static_libs...) deps.SharedLibs = append(deps.SharedLibs, compiler.Properties.Shared_libs...) if !Bool(compiler.Properties.No_stdlibs) { |