mirror of https://github.com/perkeep/perkeep.git
dev/devcam: don't invoke make.go four times for four targets
Just once is fine. Change-Id: I74b34f34ee5a193dcf7ac7d28acc858fd6263a68
This commit is contained in:
parent
38d0075c3a
commit
e5e29b004b
|
@ -233,26 +233,35 @@ func checkModtime() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Build builds the camlistore command at the given path from the source tree root.
|
||||
func build(path string) error {
|
||||
// build builds the named perkeep targets.
|
||||
// Each target may have its "perkeep.org" prefix removed.
|
||||
func build(targets ...string) error {
|
||||
if v, _ := strconv.ParseBool(os.Getenv("CAMLI_FAST_DEV")); v {
|
||||
// Demo mode. See dev/demo.sh.
|
||||
return nil
|
||||
}
|
||||
target := pathpkg.Join("perkeep.org", filepath.ToSlash(path))
|
||||
var fullTargets []string
|
||||
for _, t := range targets {
|
||||
t = filepath.ToSlash(t)
|
||||
if !strings.HasPrefix(t, "perkeep.org") {
|
||||
t = pathpkg.Join("perkeep.org", t)
|
||||
}
|
||||
fullTargets = append(fullTargets, t)
|
||||
}
|
||||
targetsComma := strings.Join(fullTargets, ",")
|
||||
args := []string{
|
||||
"run", "make.go",
|
||||
"--quiet",
|
||||
"--race=" + strconv.FormatBool(*race),
|
||||
"--embed_static=false",
|
||||
"--sqlite=" + strconv.FormatBool(withSqlite),
|
||||
"--targets=" + target,
|
||||
"--targets=" + targetsComma,
|
||||
}
|
||||
cmd := exec.Command("go", args...)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
if err := cmd.Run(); err != nil {
|
||||
return fmt.Errorf("Error building %v: %v", target, err)
|
||||
return fmt.Errorf("error building %v: %v", targetsComma, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ func init() {
|
|||
flags.BoolVar(&cmd.debug, "debug", false, "Enable http debugging.")
|
||||
flags.BoolVar(&cmd.sha1, "sha1", false, "Use sha1 instead of sha224.")
|
||||
flags.BoolVar(&cmd.publish, "publish", true, "Enable publisher app(s)")
|
||||
flags.BoolVar(&cmd.scancab, "scancab", true, "Enable scancab app(s)")
|
||||
flags.BoolVar(&cmd.scancab, "scancab", false, "Enable scancab app(s)")
|
||||
flags.BoolVar(&cmd.hello, "hello", false, "Enable hello (demo) app")
|
||||
flags.BoolVar(&cmd.mini, "mini", false, "Enable minimal mode, where all optional features are disabled. (Currently just publishing)")
|
||||
|
||||
|
@ -511,17 +511,15 @@ func (c *serverCmd) RunCommand(args []string) error {
|
|||
filepath.Join("cmd", "pk"),
|
||||
}
|
||||
if c.hello {
|
||||
targets = append(targets, filepath.Join("app", "hello"))
|
||||
targets = append(targets, "app/hello")
|
||||
}
|
||||
if c.publish {
|
||||
targets = append(targets, filepath.Join("app", "publisher"))
|
||||
targets = append(targets, "app/publisher")
|
||||
}
|
||||
targets = append(targets, filepath.Join("app", "scanningcabinet"))
|
||||
for _, name := range targets {
|
||||
err := build(name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not build %v: %v", name, err)
|
||||
}
|
||||
targets = append(targets, "app/scanningcabinet")
|
||||
err := build(targets...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := c.setRoot(); err != nil {
|
||||
|
|
Loading…
Reference in New Issue