diff options
author | Colin Cross <ccross@android.com> | 2016-11-01 11:10:25 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2016-11-04 04:54:16 +0000 |
commit | 7f19f37443f35f2fdd50f31bcc9263c002dab424 (patch) | |
tree | 1d9d16434a7c8558970017e9f3d0cdf5df0da077 /cmd | |
parent | 28f9094ee7d48a610c482bc5d20ceaf9a95cfaca (diff) | |
download | build_soong-7f19f37443f35f2fdd50f31bcc9263c002dab424.tar.gz build_soong-7f19f37443f35f2fdd50f31bcc9263c002dab424.tar.bz2 build_soong-7f19f37443f35f2fdd50f31bcc9263c002dab424.zip |
Move globbing to Blueprint
Move Soong's globbing-with-dependencies support into Blueprint so it can
be used for subdirs= lines in Android.bp files.
Blueprint has a slight change in behavior around subname= lines, it now
always uses the subname and doesn't fall back to Blueprints. To support
the Blueprints files in build/blueprint, use them directly with build=.
Test: build, add source file that matches glob, rebuild
Change-Id: Ifd0b0d3bc061aae0a16d6c7ca9a1cd8672656b4d
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/soong_glob/Android.bp | 23 | ||||
-rw-r--r-- | cmd/soong_glob/soong_glob.go | 77 |
2 files changed, 0 insertions, 100 deletions
diff --git a/cmd/soong_glob/Android.bp b/cmd/soong_glob/Android.bp deleted file mode 100644 index bd8a4a23..00000000 --- a/cmd/soong_glob/Android.bp +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 Google Inc. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -blueprint_go_binary { - name: "soong_glob", - deps: [ - "soong-glob", - ], - srcs: [ - "soong_glob.go", - ], -} diff --git a/cmd/soong_glob/soong_glob.go b/cmd/soong_glob/soong_glob.go deleted file mode 100644 index 83b8154c..00000000 --- a/cmd/soong_glob/soong_glob.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2015 Google Inc. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// soong_glob is the command line tool that checks if the list of files matching a glob has -// changed, and only updates the output file list if it has changed. It is used to optimize -// out build.ninja regenerations when non-matching files are added. See -// android/soong/common/glob.go for a longer description. -package main - -import ( - "flag" - "fmt" - "os" - - "android/soong/glob" -) - -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() - os.Exit(2) -} - -func main() { - flag.Parse() - - if *out == "" { - fmt.Fprintf(os.Stderr, "error: -o is required\n") - usage() - } - - if flag.NArg() != 1 { - usage() - } - - _, 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) - } -} |