Add exclude_* and remove arch_subtract / "-file"
To align with the current make build system, add exclude_srcs and
exclude_java_resource_dirs. These replace the functionality of
arch_subtract and glob exclusions that use "-file" to exclude a file.
Change-Id: I91c23d5e3c9409f2d9f7921f950153a03a68ad61
diff --git a/java/resources.go b/java/resources.go
index f9d7a05..dfdbeb5 100644
--- a/java/resources.go
+++ b/java/resources.go
@@ -29,13 +29,20 @@
"**/*~",
}
-func ResourceDirsToJarSpecs(ctx common.AndroidModuleContext, resourceDirs []string) []jarSpec {
+func isStringInSlice(str string, slice []string) bool {
+ for _, s := range slice {
+ if s == str {
+ return true
+ }
+ }
+ return false
+}
+
+func ResourceDirsToJarSpecs(ctx common.AndroidModuleContext, resourceDirs, excludeDirs []string) []jarSpec {
var excludes []string
- for _, resourceDir := range resourceDirs {
- if resourceDir[0] == '-' {
- excludes = append(excludes, filepath.Join(common.ModuleSrcDir(ctx), resourceDir[1:], "**/*"))
- }
+ for _, exclude := range excludeDirs {
+ excludes = append(excludes, filepath.Join(common.ModuleSrcDir(ctx), exclude, "**/*"))
}
excludes = append(excludes, resourceExcludes...)
@@ -43,7 +50,7 @@
var jarSpecs []jarSpec
for _, resourceDir := range resourceDirs {
- if resourceDir[0] == '-' {
+ if isStringInSlice(resourceDir, excludeDirs) {
continue
}
resourceDir := filepath.Join(common.ModuleSrcDir(ctx), resourceDir)