Merge "Add tidy_timeout_srcs property"
This commit is contained in:
@@ -459,7 +459,7 @@ func (a Objects) Append(b Objects) Objects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate rules for compiling multiple .c, .cpp, or .S files to individual .o files
|
// Generate rules for compiling multiple .c, .cpp, or .S files to individual .o files
|
||||||
func transformSourceToObj(ctx ModuleContext, subdir string, srcFiles, noTidySrcs android.Paths,
|
func transformSourceToObj(ctx ModuleContext, subdir string, srcFiles, noTidySrcs, timeoutTidySrcs android.Paths,
|
||||||
flags builderFlags, pathDeps android.Paths, cFlagsDeps android.Paths) Objects {
|
flags builderFlags, pathDeps android.Paths, cFlagsDeps android.Paths) Objects {
|
||||||
// Source files are one-to-one with tidy, coverage, or kythe files, if enabled.
|
// Source files are one-to-one with tidy, coverage, or kythe files, if enabled.
|
||||||
objFiles := make(android.Paths, len(srcFiles))
|
objFiles := make(android.Paths, len(srcFiles))
|
||||||
@@ -474,6 +474,10 @@ func transformSourceToObj(ctx ModuleContext, subdir string, srcFiles, noTidySrcs
|
|||||||
tidyTimeout := ctx.Config().Getenv("TIDY_TIMEOUT")
|
tidyTimeout := ctx.Config().Getenv("TIDY_TIMEOUT")
|
||||||
if len(tidyTimeout) > 0 {
|
if len(tidyTimeout) > 0 {
|
||||||
tidyVars += "TIDY_TIMEOUT=" + tidyTimeout + " "
|
tidyVars += "TIDY_TIMEOUT=" + tidyTimeout + " "
|
||||||
|
// add timeoutTidySrcs into noTidySrcsMap if TIDY_TIMEOUT is set
|
||||||
|
for _, path := range timeoutTidySrcs {
|
||||||
|
noTidySrcsMap[path.String()] = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var coverageFiles android.Paths
|
var coverageFiles android.Paths
|
||||||
|
@@ -42,6 +42,9 @@ type BaseCompilerProperties struct {
|
|||||||
// list of source files that should not be compiled with clang-tidy.
|
// list of source files that should not be compiled with clang-tidy.
|
||||||
Tidy_disabled_srcs []string `android:"path,arch_variant"`
|
Tidy_disabled_srcs []string `android:"path,arch_variant"`
|
||||||
|
|
||||||
|
// list of source files that should not be compiled by clang-tidy when TIDY_TIMEOUT is set.
|
||||||
|
Tidy_timeout_srcs []string `android:"path,arch_variant"`
|
||||||
|
|
||||||
// list of source files that should not be used to build the C/C++ module.
|
// 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
|
// This is most useful in the arch/multilib variants to remove non-common files
|
||||||
Exclude_srcs []string `android:"path,arch_variant"`
|
Exclude_srcs []string `android:"path,arch_variant"`
|
||||||
@@ -663,6 +666,7 @@ func (compiler *baseCompiler) compile(ctx ModuleContext, flags Flags, deps PathD
|
|||||||
// Compile files listed in c.Properties.Srcs into objects
|
// Compile files listed in c.Properties.Srcs into objects
|
||||||
objs := compileObjs(ctx, buildFlags, "", srcs,
|
objs := compileObjs(ctx, buildFlags, "", srcs,
|
||||||
android.PathsForModuleSrc(ctx, compiler.Properties.Tidy_disabled_srcs),
|
android.PathsForModuleSrc(ctx, compiler.Properties.Tidy_disabled_srcs),
|
||||||
|
android.PathsForModuleSrc(ctx, compiler.Properties.Tidy_timeout_srcs),
|
||||||
pathDeps, compiler.cFlagsDeps)
|
pathDeps, compiler.cFlagsDeps)
|
||||||
|
|
||||||
if ctx.Failed() {
|
if ctx.Failed() {
|
||||||
@@ -674,9 +678,9 @@ func (compiler *baseCompiler) compile(ctx ModuleContext, flags Flags, deps PathD
|
|||||||
|
|
||||||
// Compile a list of source files into objects a specified subdirectory
|
// Compile a list of source files into objects a specified subdirectory
|
||||||
func compileObjs(ctx ModuleContext, flags builderFlags, subdir string,
|
func compileObjs(ctx ModuleContext, flags builderFlags, subdir string,
|
||||||
srcFiles, noTidySrcs, pathDeps android.Paths, cFlagsDeps android.Paths) Objects {
|
srcFiles, noTidySrcs, timeoutTidySrcs, pathDeps android.Paths, cFlagsDeps android.Paths) Objects {
|
||||||
|
|
||||||
return transformSourceToObj(ctx, subdir, srcFiles, noTidySrcs, flags, pathDeps, cFlagsDeps)
|
return transformSourceToObj(ctx, subdir, srcFiles, noTidySrcs, timeoutTidySrcs, flags, pathDeps, cFlagsDeps)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Properties for rust_bindgen related to generating rust bindings.
|
// Properties for rust_bindgen related to generating rust bindings.
|
||||||
|
@@ -145,6 +145,8 @@ type StaticOrSharedProperties struct {
|
|||||||
|
|
||||||
Tidy_disabled_srcs []string `android:"path,arch_variant"`
|
Tidy_disabled_srcs []string `android:"path,arch_variant"`
|
||||||
|
|
||||||
|
Tidy_timeout_srcs []string `android:"path,arch_variant"`
|
||||||
|
|
||||||
Sanitized Sanitized `android:"arch_variant"`
|
Sanitized Sanitized `android:"arch_variant"`
|
||||||
|
|
||||||
Cflags []string `android:"arch_variant"`
|
Cflags []string `android:"arch_variant"`
|
||||||
@@ -1079,11 +1081,13 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
|
|||||||
srcs := android.PathsForModuleSrc(ctx, library.StaticProperties.Static.Srcs)
|
srcs := android.PathsForModuleSrc(ctx, library.StaticProperties.Static.Srcs)
|
||||||
objs = objs.Append(compileObjs(ctx, buildFlags, android.DeviceStaticLibrary, srcs,
|
objs = objs.Append(compileObjs(ctx, buildFlags, android.DeviceStaticLibrary, srcs,
|
||||||
android.PathsForModuleSrc(ctx, library.StaticProperties.Static.Tidy_disabled_srcs),
|
android.PathsForModuleSrc(ctx, library.StaticProperties.Static.Tidy_disabled_srcs),
|
||||||
|
android.PathsForModuleSrc(ctx, library.StaticProperties.Static.Tidy_timeout_srcs),
|
||||||
library.baseCompiler.pathDeps, library.baseCompiler.cFlagsDeps))
|
library.baseCompiler.pathDeps, library.baseCompiler.cFlagsDeps))
|
||||||
} else if library.shared() {
|
} else if library.shared() {
|
||||||
srcs := android.PathsForModuleSrc(ctx, library.SharedProperties.Shared.Srcs)
|
srcs := android.PathsForModuleSrc(ctx, library.SharedProperties.Shared.Srcs)
|
||||||
objs = objs.Append(compileObjs(ctx, buildFlags, android.DeviceSharedLibrary, srcs,
|
objs = objs.Append(compileObjs(ctx, buildFlags, android.DeviceSharedLibrary, srcs,
|
||||||
android.PathsForModuleSrc(ctx, library.SharedProperties.Shared.Tidy_disabled_srcs),
|
android.PathsForModuleSrc(ctx, library.SharedProperties.Shared.Tidy_disabled_srcs),
|
||||||
|
android.PathsForModuleSrc(ctx, library.SharedProperties.Shared.Tidy_timeout_srcs),
|
||||||
library.baseCompiler.pathDeps, library.baseCompiler.cFlagsDeps))
|
library.baseCompiler.pathDeps, library.baseCompiler.cFlagsDeps))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -279,7 +279,7 @@ func parseNativeAbiDefinition(ctx ModuleContext, symbolFile string,
|
|||||||
|
|
||||||
func compileStubLibrary(ctx ModuleContext, flags Flags, src android.Path) Objects {
|
func compileStubLibrary(ctx ModuleContext, flags Flags, src android.Path) Objects {
|
||||||
return compileObjs(ctx, flagsToBuilderFlags(flags), "",
|
return compileObjs(ctx, flagsToBuilderFlags(flags), "",
|
||||||
android.Paths{src}, nil, nil, nil)
|
android.Paths{src}, nil, nil, nil, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *stubDecorator) findImplementationLibrary(ctx ModuleContext) android.Path {
|
func (this *stubDecorator) findImplementationLibrary(ctx ModuleContext) android.Path {
|
||||||
|
10
docs/tidy.md
10
docs/tidy.md
@@ -225,6 +225,16 @@ This 90-second limit is actually the default time limit
|
|||||||
in several Android continuous builds where `WITH_TIDY=1` and
|
in several Android continuous builds where `WITH_TIDY=1` and
|
||||||
`CLANG_ANALYZER_CHECKS=1` are set.
|
`CLANG_ANALYZER_CHECKS=1` are set.
|
||||||
|
|
||||||
|
Similar to `tidy_disabled_srcs` a `tidy_timeout_srcs` list
|
||||||
|
can be used to include all source files that took too much time to compile
|
||||||
|
with clang-tidy. Files listed in `tidy_timeout_srcs` will not
|
||||||
|
be compiled by clang-tidy when `TIDY_TIMEOUT` is defined.
|
||||||
|
This can save global build time, when it is necessary to set some
|
||||||
|
time limit globally to finish in an acceptable time.
|
||||||
|
For developers who want to find all clang-tidy warnings and
|
||||||
|
are willing to spend more time on all files in a project,
|
||||||
|
they should not define `TIDY_TIMEOUT` and build only the wanted project directories.
|
||||||
|
|
||||||
## Capabilities for Android.bp and Android.mk
|
## Capabilities for Android.bp and Android.mk
|
||||||
|
|
||||||
Some of the previously mentioned features are defined only
|
Some of the previously mentioned features are defined only
|
||||||
|
Reference in New Issue
Block a user