aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2015-04-24 15:16:39 -0700
committerColin Cross <ccross@android.com>2015-04-29 14:59:23 -0700
commit3d7678f9d6e69f07f5d09c3d4ec00f4213a65691 (patch)
tree6649ddfbed506b43553a06bd097cc5bb0893d2bc /java
parent6a114caa171970abd8a4c245a4a1831baa3306b0 (diff)
downloadbuild_soong-3d7678f9d6e69f07f5d09c3d4ec00f4213a65691.tar.gz
build_soong-3d7678f9d6e69f07f5d09c3d4ec00f4213a65691.tar.bz2
build_soong-3d7678f9d6e69f07f5d09c3d4ec00f4213a65691.zip
Fix java resource globbing
Handle java resource globbing in two passes, the first on the list of resource dirs to produce a list of directories, and the second to glob for files inside those directories using **/*. Fixes incorrect jarSpec dir errors when the resource directories list contains globs. Change-Id: Icea5d8178336eb7de4ad91a9acba4822423d9f60
Diffstat (limited to 'java')
-rw-r--r--java/resources.go47
1 files changed, 32 insertions, 15 deletions
diff --git a/java/resources.go b/java/resources.go
index 2fbf54bf..7aa909ee 100644
--- a/java/resources.go
+++ b/java/resources.go
@@ -21,24 +21,41 @@ import (
)
var resourceExcludes = []string{
- "*.java",
- "package.html",
- "overview.html",
- ".*.swp",
- ".DS_Store",
- "*~",
+ "**/*.java",
+ "**/package.html",
+ "**/overview.html",
+ "**/.*.swp",
+ "**/.DS_Store",
+ "**/*~",
}
-func ResourceDirsToJarSpecs(ctx common.AndroidModuleContext, dirs []string) []jarSpec {
- jarSpecs := make([]jarSpec, len(dirs))
+func ResourceDirsToJarSpecs(ctx common.AndroidModuleContext, resourceDirs []string) []jarSpec {
+ var excludes []string
- for i, dir := range dirs {
- fileListFile := filepath.Join(common.ModuleOutDir(ctx), "res", dir, "resources.list")
- depFile := fileListFile + ".d"
- dir := filepath.Join(common.ModuleSrcDir(ctx), dir)
- glob := filepath.Join(dir, "**/*")
- common.GlobRule(ctx, glob, resourceExcludes, fileListFile, depFile)
- jarSpecs[i] = jarSpec{fileListFile, dir}
+ for _, resourceDir := range resourceDirs {
+ if resourceDir[0] == '-' {
+ excludes = append(excludes, filepath.Join(common.ModuleSrcDir(ctx), resourceDir[1:], "**/*"))
+ }
+ }
+
+ excludes = append(excludes, resourceExcludes...)
+
+ var jarSpecs []jarSpec
+
+ for _, resourceDir := range resourceDirs {
+ if resourceDir[0] == '-' {
+ continue
+ }
+ resourceDir := filepath.Join(common.ModuleSrcDir(ctx), resourceDir)
+ dirs := common.Glob(ctx, resourceDir, nil)
+ for _, dir := range dirs {
+ fileListFile := filepath.Join(common.ModuleOutDir(ctx), "res", dir, "resources.list")
+ depFile := fileListFile + ".d"
+
+ glob := filepath.Join(dir, "**/*")
+ common.GlobRule(ctx, glob, excludes, fileListFile, depFile)
+ jarSpecs = append(jarSpecs, jarSpec{fileListFile, dir})
+ }
}
return jarSpecs