Add GetPathString am: 1c7e962957
Change-Id: Iada405f160d8178ec90a1634f22a50cb18215938
This commit is contained in:
30
apex/apex.go
30
apex/apex.go
@@ -18,7 +18,6 @@ import (
|
||||
"fmt"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -1811,24 +1810,6 @@ func (a *apexBundle) minSdkVersion(ctx android.BaseModuleContext) int {
|
||||
return intVer
|
||||
}
|
||||
|
||||
// A regexp for removing boilerplate from BaseDependencyTag from the string representation of
|
||||
// a dependency tag.
|
||||
var tagCleaner = regexp.MustCompile(`\QBaseDependencyTag:blueprint.BaseDependencyTag{}\E(, )?`)
|
||||
|
||||
func PrettyPrintTag(tag blueprint.DependencyTag) string {
|
||||
// Use tag's custom String() method if available.
|
||||
if stringer, ok := tag.(fmt.Stringer); ok {
|
||||
return stringer.String()
|
||||
}
|
||||
|
||||
// Otherwise, get a default string representation of the tag's struct.
|
||||
tagString := fmt.Sprintf("%#v", tag)
|
||||
|
||||
// Remove the boilerplate from BaseDependencyTag as it adds no value.
|
||||
tagString = tagCleaner.ReplaceAllString(tagString, "")
|
||||
return tagString
|
||||
}
|
||||
|
||||
// Ensures that the dependencies are marked as available for this APEX
|
||||
func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) {
|
||||
// Let's be practical. Availability for test, host, and the VNDK apex isn't important
|
||||
@@ -1863,14 +1844,7 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) {
|
||||
if to.AvailableFor(apexName) || whitelistedApexAvailable(apexName, toName) {
|
||||
return true
|
||||
}
|
||||
message := ""
|
||||
tagPath := ctx.GetTagPath()
|
||||
// Skip the first module as that will be added at the start of the error message by ctx.ModuleErrorf().
|
||||
walkPath := ctx.GetWalkPath()[1:]
|
||||
for i, m := range walkPath {
|
||||
message = fmt.Sprintf("%s\n via tag %s\n -> %s", message, PrettyPrintTag(tagPath[i]), m.String())
|
||||
}
|
||||
ctx.ModuleErrorf("%q requires %q that is not available for the APEX. Dependency path:%s", fromName, toName, message)
|
||||
ctx.ModuleErrorf("%q requires %q that is not available for the APEX. Dependency path:%s", fromName, toName, ctx.GetPathString(true))
|
||||
// Visit this module's dependencies to check and report any issues with their availability.
|
||||
return true
|
||||
})
|
||||
@@ -2134,7 +2108,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
filesInfo = append(filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, depName))
|
||||
}
|
||||
} else if am.CanHaveApexVariants() && am.IsInstallableToApex() {
|
||||
ctx.ModuleErrorf("unexpected tag %s for indirect dependency %q", PrettyPrintTag(depTag), depName)
|
||||
ctx.ModuleErrorf("unexpected tag %s for indirect dependency %q", android.PrettyPrintTag(depTag), depName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user