Add remote execution support for clang-tidy actions
Test: Ran with the following command and it succeeded RBE_CLANG_TIDY="true" RBE_CLANG_TIDY_EXEC_STRATEGY="remote" RBE_CXX_EXEC_STRATEGY="remote_local_fallback" RBE_METALAVA="true" RBE_METALAVA_EXEC_STRATEGY="local" RBE_ABI_LINKER="true" RBE_ABI_LINKER_EXEC_STRATEGY="remote_local_fallback" RBE_CXX_LINKS="true" RBE_CXX_LINKS_EXEC_STRATEGY="remote" use_rbe m out/soong/.intermediates/external/android-clat/clatd/android_arm_armv7-a-neon/obj/external/android-clat/icmp.tidy Bug: b/157147559 Change-Id: I110b6157fc090abd14ac32330fc59a3d76cdfa82
This commit is contained in:
@@ -174,12 +174,21 @@ var (
|
||||
},
|
||||
"crossCompile", "format")
|
||||
|
||||
clangTidy = pctx.AndroidStaticRule("clangTidy",
|
||||
clangTidy, clangTidyRE = remoteexec.StaticRules(pctx, "clangTidy",
|
||||
blueprint.RuleParams{
|
||||
Command: "rm -f $out && ${config.ClangBin}/clang-tidy $tidyFlags $in -- $cFlags && touch $out",
|
||||
Command: "rm -f $out && $reTemplate${config.ClangBin}/clang-tidy $tidyFlags $in -- $cFlags && touch $out",
|
||||
CommandDeps: []string{"${config.ClangBin}/clang-tidy"},
|
||||
},
|
||||
"cFlags", "tidyFlags")
|
||||
&remoteexec.REParams{
|
||||
Labels: map[string]string{"type": "lint", "tool": "clang-tidy", "lang": "cpp"},
|
||||
ExecStrategy: "${config.REClangTidyExecStrategy}",
|
||||
Inputs: []string{"$in"},
|
||||
// OutputFile here is $in for remote-execution since its possible that
|
||||
// clang-tidy modifies the given input file itself and $out refers to the
|
||||
// ".tidy" file generated for ninja-dependency reasons.
|
||||
OutputFiles: []string{"$in"},
|
||||
Platform: map[string]string{remoteexec.PoolKey: "${config.REClangTidyPool}"},
|
||||
}, []string{"cFlags", "tidyFlags"}, []string{})
|
||||
|
||||
_ = pctx.SourcePathVariable("yasmCmd", "prebuilts/misc/${config.HostPrebuiltTag}/yasm/yasm")
|
||||
|
||||
@@ -569,8 +578,13 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
||||
tidyFile := android.ObjPathWithExt(ctx, subdir, srcFile, "tidy")
|
||||
tidyFiles = append(tidyFiles, tidyFile)
|
||||
|
||||
rule := clangTidy
|
||||
if ctx.Config().IsEnvTrue("RBE_CLANG_TIDY") {
|
||||
rule = clangTidyRE
|
||||
}
|
||||
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: clangTidy,
|
||||
Rule: rule,
|
||||
Description: "clang-tidy " + srcFile.Rel(),
|
||||
Output: tidyFile,
|
||||
Input: srcFile,
|
||||
|
Reference in New Issue
Block a user