Fixed the issue of dependencyTag in prebuilt.go

Directly using blueprint.BaseDependencyTag might cause issues because
if other modules also use blueprint.BaseDependencyTag, the
different type of modules will be mixed when fetched based on Tag.

Test: m -j out/soong/build.ninja
Change-Id: I290ca2eea063e5daa4f572985b105b958fa1d0fd
This commit is contained in:
Nan Zhang 2017-03-09 18:43:01 -08:00
parent 0c3919e996
commit 2502e12ba9
1 changed files with 7 additions and 3 deletions

View File

@ -19,7 +19,11 @@ import "github.com/google/blueprint"
// This file implements common functionality for handling modules that may exist as prebuilts,
// source, or both.
var prebuiltDependencyTag blueprint.BaseDependencyTag
type prebuiltDependencyTag struct {
blueprint.BaseDependencyTag
}
var prebuiltDepTag prebuiltDependencyTag
type Prebuilt struct {
Properties struct {
@ -64,7 +68,7 @@ func prebuiltMutator(ctx BottomUpMutatorContext) {
p := m.Prebuilt()
name := m.base().BaseModuleName()
if ctx.OtherModuleExists(name) {
ctx.AddReverseDependency(ctx.Module(), prebuiltDependencyTag, name)
ctx.AddReverseDependency(ctx.Module(), prebuiltDepTag, name)
p.Properties.SourceExists = true
} else {
ctx.Rename(name)
@ -77,7 +81,7 @@ func prebuiltMutator(ctx BottomUpMutatorContext) {
func PrebuiltSelectModuleMutator(ctx TopDownMutatorContext) {
if s, ok := ctx.Module().(Module); ok {
ctx.VisitDirectDeps(func(m blueprint.Module) {
if ctx.OtherModuleDependencyTag(m) == prebuiltDependencyTag {
if ctx.OtherModuleDependencyTag(m) == prebuiltDepTag {
p := m.(PrebuiltInterface).Prebuilt()
if p.usePrebuilt(ctx, s) {
p.Properties.UsePrebuilt = true