Add tidy_disabled_srcs property.

Used as a supplement to C/C++ srcs to disable
clang-tidy for selected srcs, when a library
contains many files in srcs and only some of them
are too large to compile with clang-tidy.

Test: WITH_TIDY=1 TIDY_TIMEOUT=90 make tidy-soong
Bug: 198098397
Change-Id: Ib32eb0e46ddbc717999797717bfd8c57e182ee88
This commit is contained in:
Chih-Hung Hsieh
2021-09-17 17:18:39 -07:00
parent 80bb3164b9
commit 769a51cc6a
4 changed files with 25 additions and 11 deletions

View File

@@ -39,6 +39,9 @@ type BaseCompilerProperties struct {
// or filegroup using the syntax ":module".
Srcs []string `android:"path,arch_variant"`
// list of source files that should not be compiled with clang-tidy.
Tidy_disabled_srcs []string `android:"path,arch_variant"`
// list of source files that should not be used to build the C/C++ module.
// This is most useful in the arch/multilib variants to remove non-common files
Exclude_srcs []string `android:"path,arch_variant"`
@@ -663,7 +666,9 @@ func (compiler *baseCompiler) compile(ctx ModuleContext, flags Flags, deps PathD
compiler.srcs = srcs
// Compile files listed in c.Properties.Srcs into objects
objs := compileObjs(ctx, buildFlags, "", srcs, pathDeps, compiler.cFlagsDeps)
objs := compileObjs(ctx, buildFlags, "", srcs,
android.PathsForModuleSrc(ctx, compiler.Properties.Tidy_disabled_srcs),
pathDeps, compiler.cFlagsDeps)
if ctx.Failed() {
return Objects{}
@@ -673,10 +678,10 @@ func (compiler *baseCompiler) compile(ctx ModuleContext, flags Flags, deps PathD
}
// Compile a list of source files into objects a specified subdirectory
func compileObjs(ctx android.ModuleContext, flags builderFlags,
subdir string, srcFiles, pathDeps android.Paths, cFlagsDeps android.Paths) Objects {
func compileObjs(ctx android.ModuleContext, flags builderFlags, subdir string,
srcFiles, noTidySrcs, pathDeps android.Paths, cFlagsDeps android.Paths) Objects {
return transformSourceToObj(ctx, subdir, srcFiles, flags, pathDeps, cFlagsDeps)
return transformSourceToObj(ctx, subdir, srcFiles, noTidySrcs, flags, pathDeps, cFlagsDeps)
}
// Properties for rust_bindgen related to generating rust bindings.