summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2021-04-26 18:37:44 -0700
committer Colin Cross <ccross@android.com> 2021-04-26 18:37:44 -0700
commit1f3f130e29a37898b8fbd279d6a334bb7933b129 (patch)
treed33ae29af79fc539cdaf7e3e59562f47acbf0231
parentbe763f7b16ba0da0f085302fd3e96c3512871c2b (diff)
Add support for cc_library_headers to replace llndk_headers
Set llndk.llndk_headers: true to allow a cc_library_headers module to be used by a cc_library module with llndk.symbol_file set. Bug: 170784825 Test: TestLlndkHeaders Change-Id: Ib65a4b70717dc9a54ae30f2991485bb1bb9b8409
-rw-r--r--cc/cc.go4
-rw-r--r--cc/image.go4
-rw-r--r--cc/library.go7
-rw-r--r--cc/linkable.go4
-rw-r--r--cc/llndk_library.go4
-rw-r--r--rust/rust.go2
6 files changed, 18 insertions, 7 deletions
diff --git a/cc/cc.go b/cc/cc.go
index 260fcf1d5..4d8f4e1a1 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1135,9 +1135,9 @@ func (c *Module) IsLlndkLibrary() bool {
return false
}
-func (m *Module) HasLlndkStubs() bool {
+func (m *Module) NeedsLlndkVariants() bool {
lib := moduleLibraryInterface(m)
- return lib != nil && lib.hasLLNDKStubs()
+ return lib != nil && (lib.hasLLNDKStubs() || lib.hasLLNDKHeaders())
}
// isImplementationForLLNDKPublic returns true for any variant of a cc_library that has LLNDK stubs
diff --git a/cc/image.go b/cc/image.go
index c1e5dfeec..6265b132e 100644
--- a/cc/image.go
+++ b/cc/image.go
@@ -437,13 +437,13 @@ func MutateImage(mctx android.BaseModuleContext, m ImageMutatableModule) {
productVndkVersion = platformVndkVersion
}
- if m.IsLlndkLibrary() || m.IsLlndkHeaders() || m.HasLlndkStubs() {
+ if m.IsLlndkLibrary() || m.IsLlndkHeaders() || m.NeedsLlndkVariants() {
// This is an LLNDK library. The implementation of the library will be on /system,
// and vendor and product variants will be created with LLNDK stubs.
// The LLNDK libraries need vendor variants even if there is no VNDK.
// The obsolete llndk_library and llndk_headers modules also need the vendor variants
// so the cc_library LLNDK stubs can depend on them.
- if m.HasLlndkStubs() {
+ if m.NeedsLlndkVariants() {
coreVariantNeeded = true
}
if platformVndkVersion != "" {
diff --git a/cc/library.go b/cc/library.go
index af92b24b7..8f2127ee1 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -869,6 +869,7 @@ type versionedInterface interface {
implementationModuleName(name string) string
hasLLNDKStubs() bool
+ hasLLNDKHeaders() bool
}
var _ libraryInterface = (*libraryDecorator)(nil)
@@ -1683,6 +1684,12 @@ func (library *libraryDecorator) hasVestigialLLNDKLibrary() bool {
return String(library.Properties.Llndk_stubs) != ""
}
+// hasLLNDKHeaders returns true if this cc_library module has a variant that provides headers
+// to a module that sets llndk.symbol_file.
+func (library *libraryDecorator) hasLLNDKHeaders() bool {
+ return Bool(library.Properties.Llndk.Llndk_headers)
+}
+
func (library *libraryDecorator) implementationModuleName(name string) string {
return name
}
diff --git a/cc/linkable.go b/cc/linkable.go
index 2fa12f61c..8fe0b4a9d 100644
--- a/cc/linkable.go
+++ b/cc/linkable.go
@@ -112,8 +112,8 @@ type LinkableInterface interface {
// IsLlndkLibrary returns true if this module is an LLNDK library module.
IsLlndkLibrary() bool
- // HasLlndkStubs returns true if this module has LLNDK stubs.
- HasLlndkStubs() bool
+ // NeedsLlndkVariants returns true if this module has LLNDK stubs or provides LLNDK headers.
+ NeedsLlndkVariants() bool
UseVndk() bool
MustUseVendorVariant() bool
diff --git a/cc/llndk_library.go b/cc/llndk_library.go
index d05dbce4c..ad19e47f3 100644
--- a/cc/llndk_library.go
+++ b/cc/llndk_library.go
@@ -69,6 +69,10 @@ type llndkLibraryProperties struct {
// vendor nor product libraries. This effectively hides this module from
// non-system modules. Default value is false.
Private *bool
+
+ // if true, make this module available to provide headers to other modules that set
+ // llndk.symbol_file.
+ Llndk_headers *bool
}
type llndkStubDecorator struct {
diff --git a/rust/rust.go b/rust/rust.go
index 78a793de9..e1a69c047 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -274,7 +274,7 @@ func (mod *Module) KernelHeadersDecorator() bool {
return false
}
-func (m *Module) HasLlndkStubs() bool {
+func (m *Module) NeedsLlndkVariants() bool {
return false
}