Switch PackageContext functions to take a ctx
So that the Path and similar functions can be used directly, without
manually adding something like configErrorWrapper (it just uses it all
the time now).
Test: out/soong/build.ninja is identical
Change-Id: I8cb524b09a84d0b8357d7c3501c71270af411e17
diff --git a/cc/config/tidy.go b/cc/config/tidy.go
index 76a5f9e..a20d556 100644
--- a/cc/config/tidy.go
+++ b/cc/config/tidy.go
@@ -15,9 +15,8 @@
package config
import (
- "strings"
-
"android/soong/android"
+ "strings"
)
func init() {
@@ -25,9 +24,9 @@
// Global tidy checks include only google*, performance*,
// and misc-macro-parentheses, but not google-readability*
// or google-runtime-references.
- pctx.VariableFunc("TidyDefaultGlobalChecks", func(config android.Config) (string, error) {
- if override := config.Getenv("DEFAULT_GLOBAL_TIDY_CHECKS"); override != "" {
- return override, nil
+ pctx.VariableFunc("TidyDefaultGlobalChecks", func(ctx android.PackageVarContext) string {
+ if override := ctx.Config().Getenv("DEFAULT_GLOBAL_TIDY_CHECKS"); override != "" {
+ return override
}
return strings.Join([]string{
"-*",
@@ -36,14 +35,14 @@
"performance*",
"-google-readability*",
"-google-runtime-references",
- }, ","), nil
+ }, ",")
})
// There are too many clang-tidy warnings in external and vendor projects.
// Enable only some google checks for these projects.
- pctx.VariableFunc("TidyExternalVendorChecks", func(config android.Config) (string, error) {
- if override := config.Getenv("DEFAULT_EXTERNAL_VENDOR_TIDY_CHECKS"); override != "" {
- return override, nil
+ pctx.VariableFunc("TidyExternalVendorChecks", func(ctx android.PackageVarContext) string {
+ if override := ctx.Config().Getenv("DEFAULT_EXTERNAL_VENDOR_TIDY_CHECKS"); override != "" {
+ return override
}
return strings.Join([]string{
"-*",
@@ -54,7 +53,7 @@
"-google-readability*",
"-google-runtime-int",
"-google-runtime-references",
- }, ","), nil
+ }, ",")
})
// Give warnings to header files only in selected directories.