diff --git a/cc/builder.go b/cc/builder.go index 7d207b0b9..be63fd735 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -150,12 +150,10 @@ var ( }, "crossCompile") - _ = pctx.SourcePathVariable("tidyPath", "build/soong/scripts/clang-tidy.sh") - clangTidy = pctx.AndroidStaticRule("clangTidy", blueprint.RuleParams{ - Command: "rm -f $out && CLANG_TIDY=${config.ClangBin}/clang-tidy $tidyPath $tidyFlags $in -- $cFlags && touch $out", - CommandDeps: []string{"${config.ClangBin}/clang-tidy", "$tidyPath"}, + Command: "rm -f $out && CLANG_TIDY=${config.ClangBin}/clang-tidy ${config.ClangTidyShellPath} $tidyFlags $in -- $cFlags && touch $out", + CommandDeps: []string{"${config.ClangBin}/clang-tidy", "${config.ClangTidyShellPath}"}, }, "cFlags", "tidyFlags") diff --git a/cc/config/global.go b/cc/config/global.go index a49e50930..8b02f0271 100644 --- a/cc/config/global.go +++ b/cc/config/global.go @@ -209,6 +209,7 @@ func init() { }) pctx.StaticVariable("ClangPath", "${ClangBase}/${HostPrebuiltTag}/${ClangVersion}") pctx.StaticVariable("ClangBin", "${ClangPath}/bin") + pctx.StaticVariable("ClangTidyShellPath", "build/soong/scripts/clang-tidy.sh") pctx.VariableFunc("ClangShortVersion", func(ctx android.PackageVarContext) string { if override := ctx.Config().Getenv("LLVM_RELEASE_VERSION"); override != "" { diff --git a/cc/makevars.go b/cc/makevars.go index c3ff4ce45..5b9ac1dc6 100644 --- a/cc/makevars.go +++ b/cc/makevars.go @@ -75,6 +75,7 @@ func makeVarsProvider(ctx android.MakeVarsContext) { ctx.Strict("LLVM_OBJCOPY", "${config.ClangBin}/llvm-objcopy") ctx.Strict("LLVM_STRIP", "${config.ClangBin}/llvm-strip") ctx.Strict("PATH_TO_CLANG_TIDY", "${config.ClangBin}/clang-tidy") + ctx.Strict("PATH_TO_CLANG_TIDY_SHELL", "${config.ClangTidyShellPath}") ctx.StrictSorted("CLANG_CONFIG_UNKNOWN_CFLAGS", strings.Join(config.ClangUnknownCflags, " ")) ctx.Strict("RS_LLVM_PREBUILTS_VERSION", "${config.RSClangVersion}")