diff --git a/android/expand.go b/android/expand.go index dafb2b6e8..101318108 100644 --- a/android/expand.go +++ b/android/expand.go @@ -59,9 +59,7 @@ func getMapping(s string, mapping func(string) (string, error)) (string, int, er case '$': return s[0:1], 1, nil default: - i := strings.IndexFunc(s, func(c rune) bool { - return !(unicode.IsLetter(c) || unicode.IsNumber(c) || c == '_' || c == '.' || c == '-') - }) + i := strings.IndexFunc(s, unicode.IsSpace) if i == 0 { return "", 0, fmt.Errorf("unexpected character '%c' after '$'", s[0]) } else if i == -1 { diff --git a/genrule/genrule.go b/genrule/genrule.go index 5ee8b0bc2..498858d28 100644 --- a/genrule/genrule.go +++ b/genrule/genrule.go @@ -15,7 +15,8 @@ package genrule import ( - "os" + "fmt" + "strings" "github.com/google/blueprint" @@ -31,11 +32,6 @@ var ( pctx = android.NewPackageContext("android/soong/genrule") ) -func init() { - pctx.SourcePathVariable("srcDir", "") - pctx.HostBinToolVariable("hostBin", "") -} - type SourceFileGenerator interface { GeneratedSourceFiles() android.Paths GeneratedHeaderDir() android.Path @@ -47,20 +43,24 @@ type HostToolProvider interface { type generatorProperties struct { // command to run on one or more input files. Available variables for substitution: - // $tool: the path to the `tool` or `tool_file` - // $in: one or more input files - // $out: a single output file - // $srcDir: the root directory of the source tree - // $genDir: the sandbox directory for this tool; contains $out - // The host bin directory will be in the path + // $(location): the path to the first entry in tools or tool_files + // $(location