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")
|
"crossCompile", "format")
|
||||||
|
|
||||||
clangTidy = pctx.AndroidStaticRule("clangTidy",
|
clangTidy, clangTidyRE = remoteexec.StaticRules(pctx, "clangTidy",
|
||||||
blueprint.RuleParams{
|
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"},
|
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")
|
_ = 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")
|
tidyFile := android.ObjPathWithExt(ctx, subdir, srcFile, "tidy")
|
||||||
tidyFiles = append(tidyFiles, tidyFile)
|
tidyFiles = append(tidyFiles, tidyFile)
|
||||||
|
|
||||||
|
rule := clangTidy
|
||||||
|
if ctx.Config().IsEnvTrue("RBE_CLANG_TIDY") {
|
||||||
|
rule = clangTidyRE
|
||||||
|
}
|
||||||
|
|
||||||
ctx.Build(pctx, android.BuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: clangTidy,
|
Rule: rule,
|
||||||
Description: "clang-tidy " + srcFile.Rel(),
|
Description: "clang-tidy " + srcFile.Rel(),
|
||||||
Output: tidyFile,
|
Output: tidyFile,
|
||||||
Input: srcFile,
|
Input: srcFile,
|
||||||
|
@@ -259,7 +259,9 @@ func init() {
|
|||||||
|
|
||||||
pctx.VariableFunc("RECXXPool", remoteexec.EnvOverrideFunc("RBE_CXX_POOL", remoteexec.DefaultPool))
|
pctx.VariableFunc("RECXXPool", remoteexec.EnvOverrideFunc("RBE_CXX_POOL", remoteexec.DefaultPool))
|
||||||
pctx.VariableFunc("RECXXLinksPool", remoteexec.EnvOverrideFunc("RBE_CXX_LINKS_POOL", remoteexec.DefaultPool))
|
pctx.VariableFunc("RECXXLinksPool", remoteexec.EnvOverrideFunc("RBE_CXX_LINKS_POOL", remoteexec.DefaultPool))
|
||||||
|
pctx.VariableFunc("REClangTidyPool", remoteexec.EnvOverrideFunc("RBE_CLANG_TIDY_POOL", remoteexec.DefaultPool))
|
||||||
pctx.VariableFunc("RECXXLinksExecStrategy", remoteexec.EnvOverrideFunc("RBE_CXX_LINKS_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
|
pctx.VariableFunc("RECXXLinksExecStrategy", remoteexec.EnvOverrideFunc("RBE_CXX_LINKS_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
|
||||||
|
pctx.VariableFunc("REClangTidyExecStrategy", remoteexec.EnvOverrideFunc("RBE_CLANG_TIDY_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
|
||||||
pctx.VariableFunc("REAbiDumperExecStrategy", remoteexec.EnvOverrideFunc("RBE_ABI_DUMPER_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
|
pctx.VariableFunc("REAbiDumperExecStrategy", remoteexec.EnvOverrideFunc("RBE_ABI_DUMPER_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
|
||||||
pctx.VariableFunc("REAbiLinkerExecStrategy", remoteexec.EnvOverrideFunc("RBE_ABI_LINKER_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
|
pctx.VariableFunc("REAbiLinkerExecStrategy", remoteexec.EnvOverrideFunc("RBE_ABI_LINKER_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user