Merge "Add support for prepending text from a file"
This commit is contained in:
@@ -824,6 +824,7 @@ Usage: %s [--rewrite <regex>=<replace>] [--exclude <module>] [--extra-static-lib
|
|||||||
|
|
||||||
var regen string
|
var regen string
|
||||||
var pom2build bool
|
var pom2build bool
|
||||||
|
var prepend string
|
||||||
|
|
||||||
flag.Var(&excludes, "exclude", "Exclude module")
|
flag.Var(&excludes, "exclude", "Exclude module")
|
||||||
flag.Var(&extraStaticLibs, "extra-static-libs", "Extra static dependencies needed when depending on a module")
|
flag.Var(&extraStaticLibs, "extra-static-libs", "Extra static dependencies needed when depending on a module")
|
||||||
@@ -839,6 +840,7 @@ Usage: %s [--rewrite <regex>=<replace>] [--exclude <module>] [--extra-static-lib
|
|||||||
flag.BoolVar(&jetifier, "jetifier", false, "Sets jetifier: true on all modules")
|
flag.BoolVar(&jetifier, "jetifier", false, "Sets jetifier: true on all modules")
|
||||||
flag.StringVar(®en, "regen", "", "Rewrite specified file")
|
flag.StringVar(®en, "regen", "", "Rewrite specified file")
|
||||||
flag.BoolVar(&pom2build, "pom2build", false, "If true, will generate a Bazel BUILD file *instead* of a .bp file")
|
flag.BoolVar(&pom2build, "pom2build", false, "If true, will generate a Bazel BUILD file *instead* of a .bp file")
|
||||||
|
flag.StringVar(&prepend, "prepend", "", "Path to a file containing text to insert at the beginning of the generated build file")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if regen != "" {
|
if regen != "" {
|
||||||
@@ -965,6 +967,15 @@ Usage: %s [--rewrite <regex>=<replace>] [--exclude <module>] [--extra-static-lib
|
|||||||
fmt.Fprintln(buf, commentString, "Automatically generated with:")
|
fmt.Fprintln(buf, commentString, "Automatically generated with:")
|
||||||
fmt.Fprintln(buf, commentString, "pom2bp", strings.Join(proptools.ShellEscapeList(os.Args[1:]), " "))
|
fmt.Fprintln(buf, commentString, "pom2bp", strings.Join(proptools.ShellEscapeList(os.Args[1:]), " "))
|
||||||
|
|
||||||
|
if prepend != "" {
|
||||||
|
contents, err := ioutil.ReadFile(prepend)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintln(os.Stderr, "Error reading", prepend, err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
fmt.Fprintln(buf, string(contents))
|
||||||
|
}
|
||||||
|
|
||||||
depsTemplate := bpDepsTemplate
|
depsTemplate := bpDepsTemplate
|
||||||
template := bpTemplate
|
template := bpTemplate
|
||||||
if pom2build {
|
if pom2build {
|
||||||
|
Reference in New Issue
Block a user