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

@@ -454,15 +454,19 @@ func escapeSingleQuotes(s string) string {
}
// Generate rules for compiling multiple .c, .cpp, or .S files to individual .o files
func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles android.Paths,
func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles, noTidySrcs android.Paths,
flags builderFlags, pathDeps android.Paths, cFlagsDeps android.Paths) Objects {
// Source files are one-to-one with tidy, coverage, or kythe files, if enabled.
objFiles := make(android.Paths, len(srcFiles))
var tidyFiles android.Paths
noTidySrcsMap := make(map[android.Path]bool)
var tidyVars string
if flags.tidy {
tidyFiles = make(android.Paths, 0, len(srcFiles))
for _, path := range noTidySrcs {
noTidySrcsMap[path] = true
}
tidyTimeout := ctx.Config().Getenv("TIDY_TIMEOUT")
if len(tidyTimeout) > 0 {
tidyVars += "TIDY_TIMEOUT=" + tidyTimeout
@@ -673,7 +677,8 @@ func transformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
kytheFiles = append(kytheFiles, kytheFile)
}
if tidy {
// Even with tidy, some src file could be skipped by noTidySrcsMap.
if tidy && !noTidySrcsMap[srcFile] {
tidyFile := android.ObjPathWithExt(ctx, subdir, srcFile, "tidy")
tidyFiles = append(tidyFiles, tidyFile)