bp2build: disallow bp2build_available definition with neverallow.
..other than the specified directories. Test: CI Bug: 251197532 Fixes: 251197532 Change-Id: Iec6407c915d2554bbfb62aea4591783208c4f633
This commit is contained in:
@@ -58,6 +58,7 @@ func init() {
|
|||||||
AddNeverAllowRules(createMakefileGoalRules()...)
|
AddNeverAllowRules(createMakefileGoalRules()...)
|
||||||
AddNeverAllowRules(createInitFirstStageRules()...)
|
AddNeverAllowRules(createInitFirstStageRules()...)
|
||||||
AddNeverAllowRules(createProhibitFrameworkAccessRules()...)
|
AddNeverAllowRules(createProhibitFrameworkAccessRules()...)
|
||||||
|
AddNeverAllowRules(createBp2BuildRules()...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a NeverAllow rule to the set of rules to apply.
|
// Add a NeverAllow rule to the set of rules to apply.
|
||||||
@@ -65,6 +66,24 @@ func AddNeverAllowRules(rules ...Rule) {
|
|||||||
neverallows = append(neverallows, rules...)
|
neverallows = append(neverallows, rules...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func createBp2BuildRules() []Rule {
|
||||||
|
rules := []Rule{}
|
||||||
|
bp2buildAvailableAllowedDirs := []string{
|
||||||
|
// Can we just allowlist these modules in allowlists.go?
|
||||||
|
"bionic/libc",
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, dir := range bp2buildAvailableAllowedDirs {
|
||||||
|
rule := NeverAllow().
|
||||||
|
With("bazel_module.bp2build_available", "true").
|
||||||
|
NotIn(dir).
|
||||||
|
Because("disallowed usages of bp2build_available for custom conversion")
|
||||||
|
rules = append(rules, rule)
|
||||||
|
}
|
||||||
|
|
||||||
|
return rules
|
||||||
|
}
|
||||||
|
|
||||||
func createIncludeDirsRules() []Rule {
|
func createIncludeDirsRules() []Rule {
|
||||||
notInIncludeDir := []string{
|
notInIncludeDir := []string{
|
||||||
"art",
|
"art",
|
||||||
|
Reference in New Issue
Block a user