Merge "Simple refactoring of prefix related functions." am: 36b6aec26a
am: 9bc4a38707
am: 7f2487d5cc
Change-Id: Ia383f411632524fa2fb3fb238f754900564172c7
This commit is contained in:
@@ -41,12 +41,7 @@ type cflagArtifactsText struct {
|
||||
// filter.
|
||||
func allowedDir(subdir string) bool {
|
||||
subdir += "/"
|
||||
for _, prefix := range TrackedCFlagsDir {
|
||||
if strings.HasPrefix(subdir, prefix) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return android.HasAnyPrefix(subdir, TrackedCFlagsDir)
|
||||
}
|
||||
|
||||
func (s *cflagArtifactsText) genFlagFilename(flag string) string {
|
||||
|
@@ -241,12 +241,7 @@ func (compiler *baseCompiler) compilerDeps(ctx DepsContext, deps Deps) Deps {
|
||||
// Return true if the module is in the WarningAllowedProjects.
|
||||
func warningsAreAllowed(subdir string) bool {
|
||||
subdir += "/"
|
||||
for _, prefix := range config.WarningAllowedProjects {
|
||||
if strings.HasPrefix(subdir, prefix) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return android.HasAnyPrefix(subdir, config.WarningAllowedProjects)
|
||||
}
|
||||
|
||||
func addToModuleList(ctx ModuleContext, key android.OnceKey, module string) {
|
||||
@@ -515,7 +510,7 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
||||
|
||||
// Exclude directories from manual binder interface whitelisting.
|
||||
//TODO(b/145621474): Move this check into IInterface.h when clang-tidy no longer uses absolute paths.
|
||||
if android.PrefixInList(ctx.ModuleDir(), allowedManualInterfacePaths) {
|
||||
if android.HasAnyPrefix(ctx.ModuleDir(), allowedManualInterfacePaths) {
|
||||
flags.Local.CFlags = append(flags.Local.CFlags, "-DDO_NOT_CHECK_MANUAL_BINDER_INTERFACES")
|
||||
}
|
||||
|
||||
@@ -604,16 +599,12 @@ var thirdPartyDirPrefixExceptions = []*regexp.Regexp{
|
||||
func isThirdParty(path string) bool {
|
||||
thirdPartyDirPrefixes := []string{"external/", "vendor/", "hardware/"}
|
||||
|
||||
for _, prefix := range thirdPartyDirPrefixes {
|
||||
if strings.HasPrefix(path, prefix) {
|
||||
for _, prefix := range thirdPartyDirPrefixExceptions {
|
||||
if prefix.MatchString(path) {
|
||||
return false
|
||||
}
|
||||
if android.HasAnyPrefix(path, thirdPartyDirPrefixes) {
|
||||
for _, prefix := range thirdPartyDirPrefixExceptions {
|
||||
if prefix.MatchString(path) {
|
||||
return false
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
@@ -281,11 +281,9 @@ func (f *flagExporter) reexportSystemDirs(dirs ...android.Path) {
|
||||
}
|
||||
|
||||
func (f *flagExporter) reexportFlags(flags ...string) {
|
||||
for _, flag := range flags {
|
||||
if strings.HasPrefix(flag, "-I") || strings.HasPrefix(flag, "-isystem") {
|
||||
panic(fmt.Errorf("Exporting invalid flag %q: "+
|
||||
"use reexportDirs or reexportSystemDirs to export directories", flag))
|
||||
}
|
||||
if android.PrefixInList(flags, "-I") || android.PrefixInList(flags, "-isystem") {
|
||||
panic(fmt.Errorf("Exporting invalid flag %q: "+
|
||||
"use reexportDirs or reexportSystemDirs to export directories", flag))
|
||||
}
|
||||
f.flags = append(f.flags, flags...)
|
||||
}
|
||||
|
Reference in New Issue
Block a user