diff options
Diffstat (limited to 'rust/library.go')
-rw-r--r-- | rust/library.go | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/rust/library.go b/rust/library.go index 77280d959..94f5730ea 100644 --- a/rust/library.go +++ b/rust/library.go @@ -202,6 +202,9 @@ type libraryInterface interface { } func (library *libraryDecorator) nativeCoverage() bool { + if library.BuildStubs() { + return false + } return true } @@ -671,7 +674,10 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa flags.RustFlags = append(flags.RustFlags, deps.depFlags...) flags.LinkFlags = append(flags.LinkFlags, deps.depLinkFlags...) - flags.LinkFlags = append(flags.LinkFlags, deps.linkObjects...) + flags.LinkFlags = append(flags.LinkFlags, deps.rustLibObjects...) + flags.LinkFlags = append(flags.LinkFlags, deps.sharedLibObjects...) + flags.LinkFlags = append(flags.LinkFlags, deps.staticLibObjects...) + flags.LinkFlags = append(flags.LinkFlags, deps.wholeStaticLibObjects...) if String(library.Properties.Version_script) != "" { if String(library.Properties.Extra_exported_symbols) != "" { @@ -719,9 +725,17 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa ret.kytheFile = TransformSrctoShared(ctx, crateRootPath, deps, flags, outputFile).kytheFile } + // rlibs and dylibs propagate their shared, whole static, and rustlib dependencies if library.rlib() || library.dylib() { library.flagExporter.exportLinkDirs(deps.linkDirs...) - library.flagExporter.exportLinkObjects(deps.linkObjects...) + library.flagExporter.exportRustLibs(deps.rustLibObjects...) + library.flagExporter.exportSharedLibs(deps.sharedLibObjects...) + library.flagExporter.exportWholeStaticLibs(deps.wholeStaticLibObjects...) + } + + // rlibs also propagate their staticlibs dependencies + if library.rlib() { + library.flagExporter.exportStaticLibs(deps.staticLibObjects...) } // Since we have FFI rlibs, we need to collect their includes as well @@ -756,6 +770,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa } cc.AddStubDependencyProviders(ctx) + // Set our flagexporter provider to export relevant Rust flags library.flagExporter.setProvider(ctx) return ret @@ -858,6 +873,20 @@ func (library *libraryDecorator) SetDisabled() { library.MutatedProperties.VariantIsDisabled = true } +func (library *libraryDecorator) moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *android.ModuleInfoJSON) { + library.baseCompiler.moduleInfoJSON(ctx, moduleInfoJSON) + + if library.rlib() { + moduleInfoJSON.Class = []string{"RLIB_LIBRARIES"} + } else if library.dylib() { + moduleInfoJSON.Class = []string{"DYLIB_LIBRARIES"} + } else if library.static() { + moduleInfoJSON.Class = []string{"STATIC_LIBRARIES"} + } else if library.shared() { + moduleInfoJSON.Class = []string{"SHARED_LIBRARIES"} + } +} + var validCrateName = regexp.MustCompile("[^a-zA-Z0-9_]+") func validateLibraryStem(ctx BaseModuleContext, filename string, crate_name string) { |