Add support for cc_library_headers in sdk/module_exports

Bug: 148933848
Test: m nothing
Change-Id: Ife6ee0f736238727a11b4421532eaeb29d46c1b7
This commit is contained in:
Paul Duffin
2020-02-21 16:29:57 +00:00
parent a78f3a7360
commit 91756d2498
3 changed files with 135 additions and 6 deletions

View File

@@ -65,12 +65,19 @@ func (mt *librarySdkMemberType) AddDependencies(mctx android.BottomUpMutatorCont
if version == "" {
version = LatestStubsVersionFor(mctx.Config(), name)
}
for _, linkType := range mt.linkTypes {
if mt.linkTypes == nil {
mctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
{Mutator: "image", Variation: android.CoreVariation},
{Mutator: "link", Variation: linkType},
{Mutator: "version", Variation: version},
}...), dependencyTag, name)
} else {
for _, linkType := range mt.linkTypes {
mctx.AddFarVariationDependencies(append(target.Variations(), []blueprint.Variation{
{Mutator: "image", Variation: android.CoreVariation},
{Mutator: "link", Variation: linkType},
{Mutator: "version", Variation: version},
}...), dependencyTag, name)
}
}
}
}
@@ -207,10 +214,14 @@ func (info *nativeLibInfo) generatePrebuiltLibrary(sdkModuleContext android.Modu
for _, av := range info.archVariantProperties {
archTypeProperties := archProperties.AddPropertySet(av.archType)
// Copy the generated library to the snapshot and add a reference to it in the .bp module.
nativeLibraryPath := nativeLibraryPathFor(av)
builder.CopyToSnapshot(av.outputFile, nativeLibraryPath)
archTypeProperties.AddProperty("srcs", []string{nativeLibraryPath})
// If the library has some link types then it produces an output binary file, otherwise it
// is header only.
if info.memberType.linkTypes != nil {
// Copy the generated library to the snapshot and add a reference to it in the .bp module.
nativeLibraryPath := nativeLibraryPathFor(av)
builder.CopyToSnapshot(av.outputFile, nativeLibraryPath)
archTypeProperties.AddProperty("srcs", []string{nativeLibraryPath})
}
// Add any arch specific properties inside the appropriate arch: {<arch>: {...}} block
addPossiblyArchSpecificProperties(sdkModuleContext, builder, av, archTypeProperties)