diff options
author | Colin Cross <ccross@android.com> | 2015-03-31 16:40:23 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2015-04-03 15:55:08 -0700 |
commit | 3e8ec07787180c043d1f82bb7ef98d5d8c3d370c (patch) | |
tree | 6b7cb2f84065b553747e6b448670aea1a53e1fd3 /cmd | |
parent | c77f9d14045fbe96e5c541d69476a83e332091c6 (diff) | |
download | build_soong-3e8ec07787180c043d1f82bb7ef98d5d8c3d370c.tar.gz build_soong-3e8ec07787180c043d1f82bb7ef98d5d8c3d370c.tar.bz2 build_soong-3e8ec07787180c043d1f82bb7ef98d5d8c3d370c.zip |
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
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/soong_glob/soong_glob.go | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/cmd/soong_glob/soong_glob.go b/cmd/soong_glob/soong_glob.go index 227d7b01..6f56bb98 100644 --- a/cmd/soong_glob/soong_glob.go +++ b/cmd/soong_glob/soong_glob.go @@ -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) |