Remove cflag_artifacts.go
The artifacts it produces are no longer used.
Bug: 262629589
Test: m nothing
Change-Id: Ie9a23310bd6468cfc0b692424f43bf5c16577aee
diff --git a/cc/Android.bp b/cc/Android.bp
index 8860f78..5fd9afe 100644
--- a/cc/Android.bp
+++ b/cc/Android.bp
@@ -52,7 +52,6 @@
"vndk.go",
"vndk_prebuilt.go",
- "cflag_artifacts.go",
"cmakelists.go",
"compdb.go",
"compiler.go",
diff --git a/cc/cflag_artifacts.go b/cc/cflag_artifacts.go
deleted file mode 100644
index 25a7a43..0000000
--- a/cc/cflag_artifacts.go
+++ /dev/null
@@ -1,101 +0,0 @@
-package cc
-
-import (
- "fmt"
- "sort"
- "strings"
-
- "android/soong/android"
-)
-
-func init() {
- android.RegisterSingletonType("cflag_artifacts_text", cflagArtifactsTextFactory)
-}
-
-func cflagArtifactsTextFactory() android.Singleton {
- return &cflagArtifactsText{}
-}
-
-var (
- TrackedCFlags = []string{
- "-Wall",
- "-Werror",
- "-Wextra",
- "-Wthread-safety",
- "-O3",
- }
-
- TrackedCFlagsDir = []string{
- "device/google/",
- "vendor/google/",
- }
-)
-
-// Stores output files.
-type cflagArtifactsText struct {
- outputs android.WritablePaths
-}
-
-// allowedDir verifies if the directory/project is part of the TrackedCFlagsDir
-// filter.
-func allowedDir(subdir string) bool {
- subdir += "/"
- return android.HasAnyPrefix(subdir, TrackedCFlagsDir)
-}
-
-// GenCFlagArtifact is used to generate the build rules which produce a file
-// that contains a list of all modules using/not using a particular cflag
-func (s *cflagArtifactsText) GenCFlagArtifact(ctx android.SingletonContext,
- flag string, modulesUsing, modulesNotUsing []string) {
-
- filename := "module_cflags" + flag + ".txt"
- filepath := android.PathForOutput(ctx, "cflags", filename)
-
- lines := make([]string, 0, 2+len(modulesUsing)+len(modulesNotUsing))
- lines = append(lines, "# Modules using "+flag)
- lines = append(lines, modulesUsing...)
- lines = append(lines, "# Modules not using "+flag)
- lines = append(lines, modulesNotUsing...)
-
- android.WriteFileRule(ctx, filepath, strings.Join(lines, "\n"))
- s.outputs = append(s.outputs, filepath)
-}
-
-func (s *cflagArtifactsText) GenerateBuildActions(ctx android.SingletonContext) {
- modulesWithCFlag := make(map[string][]string)
-
- // Scan through all modules, selecting the ones that are part of the filter,
- // and then storing into a map which tracks whether or not tracked C flag is
- // used or not.
- ctx.VisitAllModules(func(module android.Module) {
- if ccModule, ok := module.(*Module); ok {
- if allowedDir(ctx.ModuleDir(ccModule)) {
- cflags := ccModule.flags.Local.CFlags
- cppflags := ccModule.flags.Local.CppFlags
- module := fmt.Sprintf("%s:%s (%s)",
- ctx.BlueprintFile(ccModule),
- ctx.ModuleName(ccModule),
- ctx.ModuleSubDir(ccModule))
- for _, flag := range TrackedCFlags {
- if inList(flag, cflags) || inList(flag, cppflags) {
- modulesWithCFlag[flag] = append(modulesWithCFlag[flag], module)
- } else {
- modulesWithCFlag["!"+flag] = append(modulesWithCFlag["!"+flag], module)
- }
- }
- }
- }
- })
-
- // Traversing map and setting up rules to produce intermediary files which
- // contain parts of each expected C Flag artifact.
- for _, flag := range TrackedCFlags {
- sort.Strings(modulesWithCFlag[flag])
- sort.Strings(modulesWithCFlag["!"+flag])
- s.GenCFlagArtifact(ctx, flag, modulesWithCFlag[flag], modulesWithCFlag["!"+flag])
- }
-}
-
-func (s *cflagArtifactsText) MakeVars(ctx android.MakeVarsContext) {
- ctx.Strict("SOONG_MODULES_CFLAG_ARTIFACTS", strings.Join(s.outputs.Strings(), " "))
-}