Merge "Extract handling of image variations from target loop"
This commit is contained in:
@@ -102,27 +102,65 @@ func (mt *librarySdkMemberType) AddDependencies(ctx android.SdkDependencyContext
|
|||||||
// Include the native bridge targets as well.
|
// Include the native bridge targets as well.
|
||||||
targets = includeNativeBridgeTargets
|
targets = includeNativeBridgeTargets
|
||||||
}
|
}
|
||||||
for _, target := range targets {
|
|
||||||
name, version := StubsLibNameAndVersion(lib)
|
// memberDependency encapsulates information about the dependencies to add for this member.
|
||||||
if version == "" {
|
type memberDependency struct {
|
||||||
version = "latest"
|
// The targets to depend upon.
|
||||||
}
|
targets []android.Target
|
||||||
variations := target.Variations()
|
|
||||||
if ctx.Device() {
|
// Additional image variations to depend upon, is either nil for no image variation or
|
||||||
variations = append(variations,
|
// contains a single image variation.
|
||||||
blueprint.Variation{Mutator: "image", Variation: android.CoreVariation})
|
imageVariations []blueprint.Variation
|
||||||
}
|
}
|
||||||
if mt.linkTypes == nil {
|
|
||||||
ctx.AddFarVariationDependencies(variations, dependencyTag, name)
|
// Extract the name and version from the module name.
|
||||||
} else {
|
name, version := StubsLibNameAndVersion(lib)
|
||||||
for _, linkType := range mt.linkTypes {
|
if version == "" {
|
||||||
libVariations := append(variations,
|
version = "latest"
|
||||||
blueprint.Variation{Mutator: "link", Variation: linkType})
|
}
|
||||||
if ctx.Device() && linkType == "shared" {
|
|
||||||
libVariations = append(libVariations,
|
// Compute the set of dependencies to add.
|
||||||
blueprint.Variation{Mutator: "version", Variation: version})
|
var memberDependencies []memberDependency
|
||||||
|
if ctx.Host() {
|
||||||
|
// Host does not support image variations so add a dependency without any.
|
||||||
|
memberDependencies = append(memberDependencies, memberDependency{
|
||||||
|
targets: targets,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// Otherwise, this is targeting the device so add a dependency on the core image variation
|
||||||
|
// (image:"").
|
||||||
|
memberDependencies = append(memberDependencies, memberDependency{
|
||||||
|
imageVariations: []blueprint.Variation{{Mutator: "image", Variation: android.CoreVariation}},
|
||||||
|
targets: targets,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// For each dependency in the list add dependencies on the targets with the correct variations.
|
||||||
|
for _, dependency := range memberDependencies {
|
||||||
|
// For each target add a dependency on the target with any additional dependencies.
|
||||||
|
for _, target := range dependency.targets {
|
||||||
|
// Get the variations for the target.
|
||||||
|
variations := target.Variations()
|
||||||
|
|
||||||
|
// Add any additional dependencies needed.
|
||||||
|
variations = append(variations, dependency.imageVariations...)
|
||||||
|
|
||||||
|
if mt.linkTypes == nil {
|
||||||
|
// No link types are supported so add a dependency directly.
|
||||||
|
ctx.AddFarVariationDependencies(variations, dependencyTag, name)
|
||||||
|
} else {
|
||||||
|
// Otherwise, add a dependency on each supported link type in turn.
|
||||||
|
for _, linkType := range mt.linkTypes {
|
||||||
|
libVariations := append(variations,
|
||||||
|
blueprint.Variation{Mutator: "link", Variation: linkType})
|
||||||
|
// If this is for the device and a shared link type then add a dependency onto the
|
||||||
|
// appropriate version specific variant of the module.
|
||||||
|
if ctx.Device() && linkType == "shared" {
|
||||||
|
libVariations = append(libVariations,
|
||||||
|
blueprint.Variation{Mutator: "version", Variation: version})
|
||||||
|
}
|
||||||
|
ctx.AddFarVariationDependencies(libVariations, dependencyTag, name)
|
||||||
}
|
}
|
||||||
ctx.AddFarVariationDependencies(libVariations, dependencyTag, name)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user