Allow overriding tidy configs using environment variables am: 318af8be27
am: 568be82106
am: e249494552
Change-Id: I0ad2bead52cdd7588e6f611f19f6c0644688de56
This commit is contained in:
commit
ed7f45c224
1 changed files with 30 additions and 18 deletions
|
@ -16,6 +16,8 @@ package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -23,27 +25,37 @@ func init() {
|
||||||
// Global tidy checks include only google*, performance*,
|
// Global tidy checks include only google*, performance*,
|
||||||
// and misc-macro-parentheses, but not google-readability*
|
// and misc-macro-parentheses, but not google-readability*
|
||||||
// or google-runtime-references.
|
// or google-runtime-references.
|
||||||
pctx.StaticVariable("TidyDefaultGlobalChecks", strings.Join([]string{
|
pctx.VariableFunc("TidyDefaultGlobalChecks", func(config interface{}) (string, error) {
|
||||||
"-*",
|
if override := config.(android.Config).Getenv("DEFAULT_GLOBAL_TIDY_CHECKS"); override != "" {
|
||||||
"google*",
|
return override, nil
|
||||||
"misc-macro-parentheses",
|
}
|
||||||
"performance*",
|
return strings.Join([]string{
|
||||||
"-google-readability*",
|
"-*",
|
||||||
"-google-runtime-references",
|
"google*",
|
||||||
}, ","))
|
"misc-macro-parentheses",
|
||||||
|
"performance*",
|
||||||
|
"-google-readability*",
|
||||||
|
"-google-runtime-references",
|
||||||
|
}, ","), nil
|
||||||
|
})
|
||||||
|
|
||||||
// There are too many clang-tidy warnings in external and vendor projects.
|
// There are too many clang-tidy warnings in external and vendor projects.
|
||||||
// Enable only some google checks for these projects.
|
// Enable only some google checks for these projects.
|
||||||
pctx.StaticVariable("TidyExternalVendorChecks", strings.Join([]string{
|
pctx.VariableFunc("TidyExternalVendorChecks", func(config interface{}) (string, error) {
|
||||||
"-*",
|
if override := config.(android.Config).Getenv("DEFAULT_EXTERNAL_VENDOR_TIDY_CHECKS"); override != "" {
|
||||||
"google*",
|
return override, nil
|
||||||
"-google-build-using-namespace",
|
}
|
||||||
"-google-default-arguments",
|
return strings.Join([]string{
|
||||||
"-google-explicit-constructor",
|
"-*",
|
||||||
"-google-readability*",
|
"google*",
|
||||||
"-google-runtime-int",
|
"-google-build-using-namespace",
|
||||||
"-google-runtime-references",
|
"-google-default-arguments",
|
||||||
}, ","))
|
"-google-explicit-constructor",
|
||||||
|
"-google-readability*",
|
||||||
|
"-google-runtime-int",
|
||||||
|
"-google-runtime-references",
|
||||||
|
}, ","), nil
|
||||||
|
})
|
||||||
|
|
||||||
// Give warnings to header files only in selected directories.
|
// Give warnings to header files only in selected directories.
|
||||||
// Do not give warnings to external or vendor header files, which contain too
|
// Do not give warnings to external or vendor header files, which contain too
|
||||||
|
|
Loading…
Reference in a new issue