mirror of
https://github.com/golang/go
synced 2024-11-22 07:24:47 -07:00
builder: build multiple targets in parallel
R=rsc, dfc CC=golang-dev https://golang.org/cl/4452047
This commit is contained in:
parent
a2014f104c
commit
50e65ab30d
@ -60,6 +60,7 @@ var (
|
|||||||
buildRevision = flag.String("rev", "", "Build specified revision and exit")
|
buildRevision = flag.String("rev", "", "Build specified revision and exit")
|
||||||
buildCmd = flag.String("cmd", "./all.bash", "Build command (specify absolute or relative to go/src/)")
|
buildCmd = flag.String("cmd", "./all.bash", "Build command (specify absolute or relative to go/src/)")
|
||||||
external = flag.Bool("external", false, "Build external packages")
|
external = flag.Bool("external", false, "Build external packages")
|
||||||
|
parallel = flag.Bool("parallel", false, "Build multiple targets in parallel")
|
||||||
verbose = flag.Bool("v", false, "verbose")
|
verbose = flag.Bool("v", false, "verbose")
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -133,9 +134,19 @@ func main() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
built := false
|
built := false
|
||||||
|
if *parallel {
|
||||||
|
done := make(chan bool)
|
||||||
for _, b := range builders {
|
for _, b := range builders {
|
||||||
if b.build() {
|
go func(b *Builder) {
|
||||||
built = true
|
done <- b.build()
|
||||||
|
}(b)
|
||||||
|
}
|
||||||
|
for _ = range builders {
|
||||||
|
built = <-done || built
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for _, b := range builders {
|
||||||
|
built = b.build() || built
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// only run benchmarks if we didn't build anything
|
// only run benchmarks if we didn't build anything
|
||||||
|
Loading…
Reference in New Issue
Block a user