Merge "Add tidy_disabled_srcs property."
This commit is contained in:
@@ -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)
|
||||
|
||||
|
@@ -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.
|
||||
|
@@ -143,6 +143,8 @@ type SharedProperties struct {
|
||||
type StaticOrSharedProperties struct {
|
||||
Srcs []string `android:"path,arch_variant"`
|
||||
|
||||
Tidy_disabled_srcs []string `android:"path,arch_variant"`
|
||||
|
||||
Sanitized Sanitized `android:"arch_variant"`
|
||||
|
||||
Cflags []string `android:"arch_variant"`
|
||||
@@ -989,12 +991,14 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
|
||||
|
||||
if library.static() {
|
||||
srcs := android.PathsForModuleSrc(ctx, library.StaticProperties.Static.Srcs)
|
||||
objs = objs.Append(compileObjs(ctx, buildFlags, android.DeviceStaticLibrary,
|
||||
srcs, library.baseCompiler.pathDeps, library.baseCompiler.cFlagsDeps))
|
||||
objs = objs.Append(compileObjs(ctx, buildFlags, android.DeviceStaticLibrary, srcs,
|
||||
android.PathsForModuleSrc(ctx, library.StaticProperties.Static.Tidy_disabled_srcs),
|
||||
library.baseCompiler.pathDeps, library.baseCompiler.cFlagsDeps))
|
||||
} else if library.shared() {
|
||||
srcs := android.PathsForModuleSrc(ctx, library.SharedProperties.Shared.Srcs)
|
||||
objs = objs.Append(compileObjs(ctx, buildFlags, android.DeviceSharedLibrary,
|
||||
srcs, library.baseCompiler.pathDeps, library.baseCompiler.cFlagsDeps))
|
||||
objs = objs.Append(compileObjs(ctx, buildFlags, android.DeviceSharedLibrary, srcs,
|
||||
android.PathsForModuleSrc(ctx, library.SharedProperties.Shared.Tidy_disabled_srcs),
|
||||
library.baseCompiler.pathDeps, library.baseCompiler.cFlagsDeps))
|
||||
}
|
||||
|
||||
return objs
|
||||
|
@@ -272,7 +272,7 @@ func parseNativeAbiDefinition(ctx ModuleContext, symbolFile string,
|
||||
|
||||
func compileStubLibrary(ctx ModuleContext, flags Flags, src android.Path) Objects {
|
||||
return compileObjs(ctx, flagsToBuilderFlags(flags), "",
|
||||
android.Paths{src}, nil, nil)
|
||||
android.Paths{src}, nil, nil, nil)
|
||||
}
|
||||
|
||||
func (this *stubDecorator) findImplementationLibrary(ctx ModuleContext) android.Path {
|
||||
|
Reference in New Issue
Block a user