Support excludes in globs
Java resource support requires globbing directories while ignoring specific filenames. Add support for multiple -e options to soong_glob to specify filenames to exclude, and split out Glob into GlobRule to insert a rule to generate a glob file list. Change-Id: Ia911dd68bd1638452881d18378572d015fd4e31a
This commit is contained in:
@@ -28,8 +28,29 @@ import (
|
||||
|
||||
var (
|
||||
out = flag.String("o", "", "file to write list of files that match glob")
|
||||
|
||||
excludes multiArg
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.Var(&excludes, "e", "pattern to exclude from results")
|
||||
}
|
||||
|
||||
type multiArg []string
|
||||
|
||||
func (m *multiArg) String() string {
|
||||
return `""`
|
||||
}
|
||||
|
||||
func (m *multiArg) Set(s string) error {
|
||||
*m = append(*m, s)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *multiArg) Get() interface{} {
|
||||
return m
|
||||
}
|
||||
|
||||
func usage() {
|
||||
fmt.Fprintf(os.Stderr, "usage: soong_glob -o out glob\n")
|
||||
flag.PrintDefaults()
|
||||
@@ -48,7 +69,7 @@ func main() {
|
||||
usage()
|
||||
}
|
||||
|
||||
_, err := glob.GlobWithDepFile(flag.Arg(0), *out, *out+".d")
|
||||
_, err := glob.GlobWithDepFile(flag.Arg(0), *out, *out+".d", excludes)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error: %s\n", err.Error())
|
||||
os.Exit(1)
|
||||
|
Reference in New Issue
Block a user