Allow stubs implementation to be omitted
When defining a stubs library, allow specifying that the implementation library does not need to be installed. This allows for cases where the implementation is deployed in some non-standard way - e.g. inside a Microdroid virtual machine. Without this, we get build errors like: "TARGET module com.android.compos requires non-existent TARGET module: libvm_payload". Default behavior is unchanged. The change is protected by an allowlist to limit usage to the immediate use case. Bug: 243512108 Test: builds; soong tests pass Test: Remove allowlist, see build failure Change-Id: Iaae75f2e93b842f5944a7518cc95069d62c5a638
This commit is contained in:
@@ -71,6 +71,12 @@ type LibraryProperties struct {
|
||||
// List versions to generate stubs libs for. The version name "current" is always
|
||||
// implicitly added.
|
||||
Versions []string
|
||||
|
||||
// Whether to not require the implementation of the library to be installed if a
|
||||
// client of the stubs is installed. Defaults to true; set to false if the
|
||||
// implementation is made available by some other means, e.g. in a Microdroid
|
||||
// virtual machine.
|
||||
Implementation_installable *bool
|
||||
}
|
||||
|
||||
// set the name of the output
|
||||
@@ -1339,6 +1345,7 @@ type versionedInterface interface {
|
||||
buildStubs() bool
|
||||
setBuildStubs(isLatest bool)
|
||||
hasStubsVariants() bool
|
||||
isStubsImplementationRequired() bool
|
||||
setStubsVersion(string)
|
||||
stubsVersion() string
|
||||
|
||||
@@ -2298,6 +2305,10 @@ func (library *libraryDecorator) hasStubsVariants() bool {
|
||||
len(library.Properties.Stubs.Versions) > 0
|
||||
}
|
||||
|
||||
func (library *libraryDecorator) isStubsImplementationRequired() bool {
|
||||
return BoolDefault(library.Properties.Stubs.Implementation_installable, true)
|
||||
}
|
||||
|
||||
func (library *libraryDecorator) stubsVersions(ctx android.BaseMutatorContext) []string {
|
||||
if !library.hasStubsVariants() {
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user