This commit is contained in:
Brad Fitzpatrick 2013-08-26 18:01:30 -05:00
commit 22e7395f85
2 changed files with 11 additions and 5 deletions

View File

@ -134,16 +134,21 @@ func (c *serverCmd) build(name string) error {
return fmt.Errorf("Could not build, invalid target: %v", name)
}
binPath := filepath.Join(c.camliSrcRoot, "bin", name)
var modtime int64
fi, err := os.Stat(binPath)
if err != nil {
return fmt.Errorf("Could not stat %v: %v", binPath, err)
if !os.IsNotExist(err) {
return fmt.Errorf("Could not stat %v: %v", binPath, err)
}
} else {
modtime = fi.ModTime().Unix()
}
args := []string{
"run", "make.go",
"--quiet",
"--embed_static=false",
"--sqlite=false",
fmt.Sprintf("--if_mods_since=%d", fi.ModTime().Unix()),
fmt.Sprintf("--if_mods_since=%d", modtime),
"--targets=" + target,
}
cmd := exec.Command("go", args...)

View File

@ -53,9 +53,10 @@ var (
verbose = flag.Bool("v", false, "Verbose mode")
targets = flag.String("targets", "", "Optional comma-separated list of targets (i.e go packages) to build and install. Empty means all. Example: camlistore.org/server/camlistored,camlistore.org/cmd/camput")
quiet = flag.Bool("quiet", false, "Don't print anything unless there's a failure.")
ifModsSince = flag.Int64("if_mods_since", 0, "If non-zero return immediately without building if there aren't any filesystem modifications past this time (in unix seconds)")
buildARCH = flag.String("arch", runtime.GOARCH, "Architecture to build for.")
buildOS = flag.String("os", runtime.GOOS, "Operating system to build for.")
// TODO(mpl): looks like ifModsSince is not used anywhere?
ifModsSince = flag.Int64("if_mods_since", 0, "If non-zero return immediately without building if there aren't any filesystem modifications past this time (in unix seconds)")
buildARCH = flag.String("arch", runtime.GOARCH, "Architecture to build for.")
buildOS = flag.String("os", runtime.GOOS, "Operating system to build for.")
)
var (