Refactor cc/rust to prep for Rust stubs
This CL largely handles this refactoring in preparation for Rust stubs
support.
Rust modules need to be able to communicate stubs information to cc, and
certain bits of cc needs to be exported so rust can reuse them.
A new VersionedLinkableInterface is added to capture most of the
stubs-related interface definitions.
Bug: 203478530
Test: m blueprint_tests
Change-Id: I380225402fa85a3c39e7b18deb657054b3a52fbe
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index 96a07bc..70ee5e3 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -114,10 +114,10 @@
// TODO(ccross): verify shared library dependencies
srcs := p.prebuiltSrcs(ctx)
- stubInfo := addStubDependencyProviders(ctx)
+ stubInfo := AddStubDependencyProviders(ctx)
// Stub variants will create a stub .so file from stub .c files
- if p.buildStubs() && objs.objFiles != nil {
+ if p.BuildStubs() && objs.objFiles != nil {
// TODO (b/275273834): Make objs.objFiles == nil a hard error when the symbol files have been added to module sdk.
return p.linkShared(ctx, flags, deps, objs)
}
@@ -204,7 +204,7 @@
Target: ctx.Target(),
TableOfContents: p.tocFile,
- IsStubs: p.buildStubs(),
+ IsStubs: p.BuildStubs(),
})
return outputFile
@@ -268,7 +268,7 @@
}
// Implements versionedInterface
-func (p *prebuiltLibraryLinker) implementationModuleName(name string) string {
+func (p *prebuiltLibraryLinker) ImplementationModuleName(name string) string {
return android.RemoveOptionalPrebuiltPrefix(name)
}
@@ -298,7 +298,7 @@
}
func (p *prebuiltLibraryLinker) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
- if p.buildStubs() && p.stubsVersion() != "" {
+ if p.BuildStubs() && p.StubsVersion() != "" {
return p.compileModuleLibApiStubs(ctx, flags, deps)
}
return Objects{}