From 3ce001aa40d29b913f2942024eba34f949ec7f3a Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 14 Dec 2017 11:23:47 -0800 Subject: [PATCH] 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 --- androidmk/cmd/androidmk/android.go | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go index 125462158..c6e90f00b 100644 --- a/androidmk/cmd/androidmk/android.go +++ b/androidmk/cmd/androidmk/android.go @@ -637,22 +637,15 @@ func mydir(args []string) string { return "." } -func allJavaFilesUnder(args []string) string { - dir := "" - if len(args) > 0 { - dir = strings.TrimSpace(args[0]) +func allFilesUnder(wildcard string) func(args []string) string { + return func(args []string) string { + dir := "" + 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 { @@ -696,8 +689,11 @@ func androidScope() mkparser.Scope { globalScope := mkparser.NewScope(nil) globalScope.Set("CLEAR_VARS", clear_vars) globalScope.SetFunc("my-dir", mydir) - globalScope.SetFunc("all-java-files-under", allJavaFilesUnder) - globalScope.SetFunc("all-proto-files-under", allProtoFilesUnder) + globalScope.SetFunc("all-java-files-under", allFilesUnder("*.java")) + 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-makefiles-under", includeIgnored) globalScope.SetFunc("first-makefiles-under", includeIgnored)