Skip to content

Instantly share code, notes, and snippets.

@szabba
Created September 1, 2018 15:57
Show Gist options
  • Save szabba/57597d7fb9cfc5a73f2de4dc5a50de74 to your computer and use it in GitHub Desktop.
Save szabba/57597d7fb9cfc5a73f2de4dc5a50de74 to your computer and use it in GitHub Desktop.
func runBuild(ctx context.Context, repos *repo.Set, flags *Flags) error {
phase := "syncing repos"
handle err {
return oops.Wrapf(err, "problem " + phase)
}
clones := check repo.SyncAll(ctx, repos, ".")
phase = "checking out appropriate branches"
check clones.EachTry(func(l repo.Local) error {
return l.CheckoutFirst(ctx, flags.branches.topic, flags.branches.default_)
})
phase = "analyzing projects"
prjs := check analyzeProjects(ctx, clones)
ws := unibuild.NewWorkspace(prjs)
phase = "resolving build order"
order := check ws.BuildOrder()
for _, p := range order {
phase = fmt.Sprintf("building project %s", p.Info().Name)
check p.Build(ctx, os.Stdout)
log.Printf("succesfully built %s", p.Info().Name)
}
return nil
}
func runBuild(ctx context.Context, repos *repo.Set, flags *Flags) error {
clones, err := repo.SyncAll(ctx, repos, ".")
if err != nil {
return oops.Wrapf(err, "problem syncing repos")
}
err = clones.EachTry(func(l repo.Local) error {
return l.CheckoutFirst(ctx, flags.branches.topic, flags.branches.default_)
})
if err != nil {
return oops.Wrapf(err, "problem checking out appropriate branches")
}
prjs, err := analyzeProjects(ctx, clones)
if err != nil {
return oops.Wrapf(err, "problem analyzing projects")
}
ws := unibuild.NewWorkspace(prjs)
order, err := ws.BuildOrder()
if err != nil {
return oops.Wrapf(err, "problem finding build order")
}
for _, p := range order {
err := p.Build(ctx, os.Stdout)
if err != nil {
return oops.Wrapf(err, "problem building project %s", p.Info().Name)
}
log.Printf("succesfully built %s", p.Info().Name)
}
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment