|
@@ -53,10 +53,12 @@ var (
|
|
|
// TODO(asmundak): this option is for debugging
|
|
|
allInSource = flag.Bool("all", false, "convert all product config makefiles in the tree under //")
|
|
|
outputTop = flag.String("outdir", "", "write output files into this directory hierarchy")
|
|
|
- launcher = flag.String("launcher", "", "generated launcher path. If set, the non-flag argument is _product_name_")
|
|
|
+ launcher = flag.String("launcher", "", "generated launcher path.")
|
|
|
+ boardlauncher = flag.String("boardlauncher", "", "generated board configuration launcher path.")
|
|
|
printProductConfigMap = flag.Bool("print_product_config_map", false, "print product config map and exit")
|
|
|
cpuProfile = flag.String("cpu_profile", "", "write cpu profile to file")
|
|
|
traceCalls = flag.Bool("trace_calls", false, "trace function calls")
|
|
|
+ inputVariables = flag.String("input_variables", "", "starlark file containing product config and global variables")
|
|
|
)
|
|
|
|
|
|
func init() {
|
|
@@ -87,8 +89,7 @@ func main() {
|
|
|
flag.Usage = func() {
|
|
|
cmd := filepath.Base(os.Args[0])
|
|
|
fmt.Fprintf(flag.CommandLine.Output(),
|
|
|
- "Usage: %[1]s flags file...\n"+
|
|
|
- "or: %[1]s flags --launcher=PATH PRODUCT\n", cmd)
|
|
|
+ "Usage: %[1]s flags file...\n", cmd)
|
|
|
flag.PrintDefaults()
|
|
|
}
|
|
|
flag.Parse()
|
|
@@ -177,14 +178,31 @@ func main() {
|
|
|
versionDefaultsPath := outputFilePath(versionDefaultsMk)
|
|
|
err = writeGenerated(versionDefaultsPath, versionDefaults)
|
|
|
if err != nil {
|
|
|
- fmt.Fprintf(os.Stderr, "%s:%s", files[0], err)
|
|
|
+ fmt.Fprintf(os.Stderr, "%s: %s", files[0], err)
|
|
|
ok = false
|
|
|
}
|
|
|
|
|
|
err = writeGenerated(*launcher, mk2rbc.Launcher(outputFilePath(files[0]), versionDefaultsPath,
|
|
|
mk2rbc.MakePath2ModuleName(files[0])))
|
|
|
if err != nil {
|
|
|
- fmt.Fprintf(os.Stderr, "%s:%s", files[0], err)
|
|
|
+ fmt.Fprintf(os.Stderr, "%s: %s", files[0], err)
|
|
|
+ ok = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if *boardlauncher != "" {
|
|
|
+ if len(files) != 1 {
|
|
|
+ quit(fmt.Errorf("a launcher can be generated only for a single product"))
|
|
|
+ }
|
|
|
+ if *inputVariables == "" {
|
|
|
+ quit(fmt.Errorf("the board launcher requires an input variables file"))
|
|
|
+ }
|
|
|
+ if !convertOne(*inputVariables) {
|
|
|
+ quit(fmt.Errorf("the board launcher input variables file failed to convert"))
|
|
|
+ }
|
|
|
+ err := writeGenerated(*boardlauncher, mk2rbc.BoardLauncher(
|
|
|
+ outputFilePath(files[0]), outputFilePath(*inputVariables)))
|
|
|
+ if err != nil {
|
|
|
+ fmt.Fprintf(os.Stderr, "%s: %s", files[0], err)
|
|
|
ok = false
|
|
|
}
|
|
|
}
|