...
1
2
3 package bazelx
4
5 import (
6 "context"
7
8 "edge-infra.dev/pkg/lib/build/bazel"
9 "edge-infra.dev/pkg/lib/cli/rags"
10 "edge-infra.dev/pkg/lib/cli/sink"
11 )
12
13 type Bazelx struct {
14 *bazel.Bazel
15
16 cfgs []string
17 }
18
19 func (b *Bazelx) RegisterFlags(rs *rags.RagSet) {
20 rs.Add(&rags.Rag{
21 Name: "bazel-configs",
22 Usage: "Config profiles passed to Bazel via --config (https://docs.bazel.build/versions/master/guide.html#--config). Multiple values can be provided as a comma separated list or multiple occurrences of the flag.",
23 Category: "bazel",
24 Value: &rags.StringSet{Var: &b.cfgs},
25 })
26 }
27
28 func (b *Bazelx) BeforeRun(ctx context.Context, r sink.Run) (context.Context, sink.Run, error) {
29 b.Bazel = bazel.New(
30 bazel.WithCtx(ctx),
31 bazel.WithConfigProfiles(b.cfgs...),
32 )
33
34 return ctx, r, nil
35 }
36
View as plain text