Add llndk_stubs property
Prepare for making the relationship between an llndk_library stubs
module and the cc_library implementation module explicit by
adding an llndk_stubs property. Each cc_library will be updated
to point to its llndk_library, and the llndk_library name will
be changed to make the .llndk suffix explicit. Then the implicit
connection and suffix can be removed.
Bug: 170784825
Test: m checkbuild
Change-Id: I6b0482a3f286ec29b2e928551aa4317749f2b499
diff --git a/cc/library.go b/cc/library.go
index 090abf9..c2ebc49 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -110,6 +110,9 @@
// Inject boringssl hash into the shared library. This is only intended for use by external/boringssl.
Inject_bssl_hash *bool `android:"arch_variant"`
+
+ // If this is an LLNDK library, the name of the equivalent llndk_library module.
+ Llndk_stubs *string
}
type StaticProperties struct {
@@ -695,6 +698,8 @@
stubsVersions(ctx android.BaseMutatorContext) []string
setAllStubsVersions([]string)
allStubsVersions() []string
+
+ implementationModuleName(name string) string
}
var _ libraryInterface = (*libraryDecorator)(nil)
@@ -1205,7 +1210,7 @@
}
if library.buildStubs() && !library.skipAPIDefine {
- library.reexportFlags("-D" + versioningMacroName(ctx.baseModuleName()) + "=" + library.stubsVersion())
+ library.reexportFlags("-D" + versioningMacroName(ctx.Module().(*Module).ImplementationModuleName(ctx)) + "=" + library.stubsVersion())
}
library.flagExporter.setProvider(ctx)
@@ -1358,6 +1363,10 @@
library.MutatedProperties.BuildStatic = false
}
+func (library *libraryDecorator) implementationModuleName(name string) string {
+ return name
+}
+
func (library *libraryDecorator) buildStubs() bool {
return library.MutatedProperties.BuildStubs
}