Add (obj|tidy)-*_os, and (obj|tidy)-*_subset targets
* The obj-* targets only call clang or clang++ to compile
C/C++ files, like the tidy-* targets only call clang-tidy.
* Add (obj|tidy)-dir_os and module_os-(obj|tidy) phony targets
to include only targets of the specified OS.
* Add (obj|tidy)-dir_os_subset and module_os_subset-(obj|tidy) phony targets
to include only a subset of that OS target group.
* Most clang-tidy runs produce the same warnings for all variants
of an OS. The *_subset targets reduce runs over multiple variants.
* The obj-*subset targets are useful for a quick test to compile
at least one variant of every C/C++ file for each OS.
* The (obj|tidy)-soong phony target is changed to include only
(obj|tidy)-top_level_directory targets instead of ALL
module-(obj|tidy) targets in all subdirectories.
* For aosp_arm64-eng make tidy-* targets; count NINJA commands:
tidy-soong 381K
tidy-soong_subset 106K
tidy-soong_android 294K
tidy-soong_android_subset 73K
tidy-soong_linux_glibc 84K
tidy-soong_windows 12K
tidy-bionic 12K
tidy-bionic_subset 2.4K
tidy-bionic_android 11.5K
tidy-bionic_android_subset 2.1K
tidy-bionic_linux_glibc 1K
tidy-device_android 7K
tidy-device_android_subset 5K
tidy-hardware_android 3K
tidy-hardware_android_subset 9K
libfec_rs-tidy 33
libfec_rs_subset-tidy 9
libfec_rs_android-tidy 18
libfec_rs_android_subset-tidy 3
* For aosp_arm64-eng make obj-* targets; count NINJA commands:
obj-soong 399K
obj-soong_subset 112K
obj-soong_android 305K
obj-soong_android_subset 75K
obj-soong_linux_glibc 90K
obj-soong_linux_glibc_subset 38K
obj-soong_windows 12K
obj-bionic 15K
obj-bionic_subset 3K
obj-bionic_android 14K
obj-bionic_android_subset 2.3K
obj-bionic_linux_glibc 1.3K
obj-system-core 6K
obj-system-core_subset 3K
obj-frameworks-base 16K
obj-frameworks-base_subset 6K
libfec_rs-obj 33
libfec_rs_subset-obj 9
libfec_rs_android-obj 18
libfec_rs_android_subset-obj 3
Test: NINJA_ARGS="-n" WITH_TIDY=1 make some_obj_tidy_target;
compare output commands from various phony targets
Bug: 199169329
Bug: 202769240
Change-Id: I186c45dc07c5884888c1063dfc09cf212ffb0ebf
diff --git a/cc/builder.go b/cc/builder.go
index 72c2fa5..7161ccf 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -413,7 +413,7 @@
// Objects is a collection of file paths corresponding to outputs for C++ related build statements.
type Objects struct {
objFiles android.Paths
- tidyFiles android.WritablePaths
+ tidyFiles android.Paths
coverageFiles android.Paths
sAbiDumpFiles android.Paths
kytheFiles android.Paths
@@ -422,7 +422,7 @@
func (a Objects) Copy() Objects {
return Objects{
objFiles: append(android.Paths{}, a.objFiles...),
- tidyFiles: append(android.WritablePaths{}, a.tidyFiles...),
+ tidyFiles: append(android.Paths{}, a.tidyFiles...),
coverageFiles: append(android.Paths{}, a.coverageFiles...),
sAbiDumpFiles: append(android.Paths{}, a.sAbiDumpFiles...),
kytheFiles: append(android.Paths{}, a.kytheFiles...),
@@ -451,11 +451,11 @@
// Source files are one-to-one with tidy, coverage, or kythe files, if enabled.
objFiles := make(android.Paths, len(srcFiles))
- var tidyFiles android.WritablePaths
+ var tidyFiles android.Paths
noTidySrcsMap := make(map[android.Path]bool)
var tidyVars string
if flags.tidy {
- tidyFiles = make(android.WritablePaths, 0, len(srcFiles))
+ tidyFiles = make(android.Paths, 0, len(srcFiles))
for _, path := range noTidySrcs {
noTidySrcsMap[path] = true
}
@@ -665,7 +665,6 @@
rule = clangTidyRE
}
- ctx.TidyFile(tidyFile)
ctx.Build(pctx, android.BuildParams{
Rule: rule,
Description: "clang-tidy " + srcFile.Rel(),
@@ -719,7 +718,7 @@
// Generate a rule for compiling multiple .o files to a static library (.a)
func transformObjToStaticLib(ctx android.ModuleContext,
objFiles android.Paths, wholeStaticLibs android.Paths,
- flags builderFlags, outputFile android.ModuleOutPath, deps android.Paths, validations android.WritablePaths) {
+ flags builderFlags, outputFile android.ModuleOutPath, deps android.Paths, validations android.Paths) {
arCmd := "${config.ClangBin}/llvm-ar"
arFlags := ""
@@ -734,7 +733,7 @@
Output: outputFile,
Inputs: objFiles,
Implicits: deps,
- Validations: validations.Paths(),
+ Validations: validations,
Args: map[string]string{
"arFlags": "crsPD" + arFlags,
"arCmd": arCmd,
@@ -764,7 +763,7 @@
func transformObjToDynamicBinary(ctx android.ModuleContext,
objFiles, sharedLibs, staticLibs, lateStaticLibs, wholeStaticLibs, deps, crtBegin, crtEnd android.Paths,
groupLate bool, flags builderFlags, outputFile android.WritablePath,
- implicitOutputs android.WritablePaths, validations android.WritablePaths) {
+ implicitOutputs android.WritablePaths, validations android.Paths) {
ldCmd := "${config.ClangBin}/clang++"
@@ -831,7 +830,7 @@
Inputs: objFiles,
Implicits: deps,
OrderOnly: sharedLibs,
- Validations: validations.Paths(),
+ Validations: validations,
Args: args,
})
}