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
This commit is contained in:
@@ -21,24 +21,41 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var resourceExcludes = []string{
|
var resourceExcludes = []string{
|
||||||
"*.java",
|
"**/*.java",
|
||||||
"package.html",
|
"**/package.html",
|
||||||
"overview.html",
|
"**/overview.html",
|
||||||
".*.swp",
|
"**/.*.swp",
|
||||||
".DS_Store",
|
"**/.DS_Store",
|
||||||
"*~",
|
"**/*~",
|
||||||
}
|
}
|
||||||
|
|
||||||
func ResourceDirsToJarSpecs(ctx common.AndroidModuleContext, dirs []string) []jarSpec {
|
func ResourceDirsToJarSpecs(ctx common.AndroidModuleContext, resourceDirs []string) []jarSpec {
|
||||||
jarSpecs := make([]jarSpec, len(dirs))
|
var excludes []string
|
||||||
|
|
||||||
for i, dir := range dirs {
|
for _, resourceDir := range resourceDirs {
|
||||||
fileListFile := filepath.Join(common.ModuleOutDir(ctx), "res", dir, "resources.list")
|
if resourceDir[0] == '-' {
|
||||||
depFile := fileListFile + ".d"
|
excludes = append(excludes, filepath.Join(common.ModuleSrcDir(ctx), resourceDir[1:], "**/*"))
|
||||||
dir := filepath.Join(common.ModuleSrcDir(ctx), dir)
|
}
|
||||||
glob := filepath.Join(dir, "**/*")
|
}
|
||||||
common.GlobRule(ctx, glob, resourceExcludes, fileListFile, depFile)
|
|
||||||
jarSpecs[i] = jarSpec{fileListFile, dir}
|
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
|
return jarSpecs
|
||||||
|
Reference in New Issue
Block a user