Improve dynamic inherit paths handling
Allow up to 150 inherited paths matching the pattern. When seeing `include $(BOARD_CONFIG_VENDOR_PATH)/BoardConfigVendor.mk`, search only vendor/google_devices Bug: 193566316 Test: internal Change-Id: Ic88cb116075512f87d5a5f7a7f32dabd09ff640c
This commit is contained in:
parent
3deb968aef
commit
90be8c5589
1 changed files with 11 additions and 5 deletions
|
@ -805,14 +805,20 @@ func (ctx *parseContext) handleSubConfig(
|
|||
matchingPaths = ctx.findMatchingPaths(pathPattern)
|
||||
} else {
|
||||
// Heuristics -- if pattern starts from top, restrict it to the directories where
|
||||
// we know inherit-product uses dynamically calculated path.
|
||||
for _, t := range []string{"vendor/qcom", "vendor/google_devices"} {
|
||||
pathPattern[0] = t
|
||||
matchingPaths = append(matchingPaths, ctx.findMatchingPaths(pathPattern)...)
|
||||
// we know inherit-product uses dynamically calculated path. Restrict it even further
|
||||
// for certain path which would yield too many useless matches
|
||||
if len(varPath.chunks) == 2 && varPath.chunks[1] == "/BoardConfigVendor.mk" {
|
||||
pathPattern[0] = "vendor/google_devices"
|
||||
matchingPaths = ctx.findMatchingPaths(pathPattern)
|
||||
} else {
|
||||
for _, t := range []string{"vendor/qcom", "vendor/google_devices"} {
|
||||
pathPattern[0] = t
|
||||
matchingPaths = append(matchingPaths, ctx.findMatchingPaths(pathPattern)...)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Safeguard against $(call inherit-product,$(PRODUCT_PATH))
|
||||
const maxMatchingFiles = 100
|
||||
const maxMatchingFiles = 150
|
||||
if len(matchingPaths) > maxMatchingFiles {
|
||||
ctx.errorf(v, "there are >%d files matching the pattern, please rewrite it", maxMatchingFiles)
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue