Support more all-*-files-under functions in androidmk

Add support for all-aidl-files-under, all-Iaidl-files-under,
and all-logtags-files-under to android.mk

Test: manual
Change-Id: I5e187e0c5f9d1c63c8632f84ab47665ba85a5678
This commit is contained in:
Colin Cross
2017-12-14 11:23:47 -08:00
parent e1731a5803
commit 3ce001aa40

View File

@@ -637,22 +637,15 @@ func mydir(args []string) string {
return "." return "."
} }
func allJavaFilesUnder(args []string) string { func allFilesUnder(wildcard string) func(args []string) string {
dir := "" return func(args []string) string {
if len(args) > 0 { dir := ""
dir = strings.TrimSpace(args[0]) if len(args) > 0 {
dir = strings.TrimSpace(args[0])
}
return fmt.Sprintf("%s/**/"+wildcard, dir)
} }
return fmt.Sprintf("%s/**/*.java", dir)
}
func allProtoFilesUnder(args []string) string {
dir := ""
if len(args) > 0 {
dir = strings.TrimSpace(args[0])
}
return fmt.Sprintf("%s/**/*.proto", dir)
} }
func allSubdirJavaFiles(args []string) string { func allSubdirJavaFiles(args []string) string {
@@ -696,8 +689,11 @@ func androidScope() mkparser.Scope {
globalScope := mkparser.NewScope(nil) globalScope := mkparser.NewScope(nil)
globalScope.Set("CLEAR_VARS", clear_vars) globalScope.Set("CLEAR_VARS", clear_vars)
globalScope.SetFunc("my-dir", mydir) globalScope.SetFunc("my-dir", mydir)
globalScope.SetFunc("all-java-files-under", allJavaFilesUnder) globalScope.SetFunc("all-java-files-under", allFilesUnder("*.java"))
globalScope.SetFunc("all-proto-files-under", allProtoFilesUnder) globalScope.SetFunc("all-proto-files-under", allFilesUnder("*.proto"))
globalScope.SetFunc("all-aidl-files-under", allFilesUnder("*.aidl"))
globalScope.SetFunc("all-Iaidl-files-under", allFilesUnder("I*.aidl"))
globalScope.SetFunc("all-logtags-files-under", allFilesUnder("*.logtags"))
globalScope.SetFunc("all-subdir-java-files", allSubdirJavaFiles) globalScope.SetFunc("all-subdir-java-files", allSubdirJavaFiles)
globalScope.SetFunc("all-makefiles-under", includeIgnored) globalScope.SetFunc("all-makefiles-under", includeIgnored)
globalScope.SetFunc("first-makefiles-under", includeIgnored) globalScope.SetFunc("first-makefiles-under", includeIgnored)