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/rust/library.go b/rust/library.go
index 2d62dcf..9912c94 100644
--- a/rust/library.go
+++ b/rust/library.go
@@ -277,6 +277,71 @@
var _ compiler = (*libraryDecorator)(nil)
var _ libraryInterface = (*libraryDecorator)(nil)
var _ exportedFlagsProducer = (*libraryDecorator)(nil)
+var _ cc.VersionedInterface = (*libraryDecorator)(nil)
+
+func (library *libraryDecorator) HasLLNDKStubs() bool {
+ // Rust does not support LLNDK yet.
+ return false
+}
+
+func (library *libraryDecorator) HasVendorPublicLibrary() bool {
+ // Rust does not support vendor public library.
+ return false
+}
+
+func (library *libraryDecorator) HasLLNDKHeaders() bool {
+ // Rust does not support LLNDK yet.
+ return false
+}
+
+func (library *libraryDecorator) HasStubsVariants() bool {
+ return false
+}
+
+func (library *libraryDecorator) IsStubsImplementationRequired() bool {
+ return false
+}
+
+func (library *libraryDecorator) GetAPIListCoverageXMLPath() android.ModuleOutPath {
+ panic(fmt.Errorf("GetAPIListCoverageXMLPath called on unsupported Rust module"))
+}
+
+func (library *libraryDecorator) AllStubsVersions() []string {
+ panic(fmt.Errorf("AllStubsVersions called on unsupported Rust module"))
+}
+
+func (library *libraryDecorator) SetAllStubsVersions(versions []string) {
+ panic(fmt.Errorf("ApexSdkVersion called on unsupported Rust module"))
+}
+
+func (library *libraryDecorator) SetStubsVersion(version string) {
+ panic(fmt.Errorf("SetStubsVersion called on unsupported Rust module"))
+}
+
+func (library *libraryDecorator) SetBuildStubs(isLatest bool) {
+ panic(fmt.Errorf("SetBuildStubs called on unsupported Rust module"))
+}
+
+func (library *libraryDecorator) BuildStubs() bool {
+ return false
+}
+
+func (library *libraryDecorator) ImplementationModuleName(name string) string {
+ panic(fmt.Errorf("ImplementationModuleName called on unsupported Rust module"))
+}
+
+func (library *libraryDecorator) IsLLNDKMovedToApex() bool {
+ // Rust does not support LLNDK.
+ return false
+}
+
+func (library *libraryDecorator) StubsVersions(ctx android.BaseModuleContext) []string {
+ panic(fmt.Errorf("StubsVersions called on unsupported Rust module"))
+}
+
+func (library *libraryDecorator) StubsVersion() string {
+ panic(fmt.Errorf("StubsVersions called on unsupported Rust module"))
+}
// rust_library produces all Rust variants (rust_library_dylib and
// rust_library_rlib).