Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
peterebden committed Oct 9, 2023
1 parent 2f78a73 commit eb9020e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
10 changes: 9 additions & 1 deletion src/please.go
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,15 @@ type TargetsOrArgs []TargetOrArg
func (l TargetsOrArgs) Separate() (annotated []core.AnnotatedOutputLabel, unannotated []core.BuildLabel, args []string) {
for _, arg := range l {
if l, _ := arg.label.Label(); l.IsEmpty() {
args = append(args, arg.arg)
if arg.arg == "-" {
labels := plz.ReadAndParseStdinLabels()
unannotated = append(unannotated, labels...)
for _, label := range labels {
annotated = append(annotated, core.AnnotatedOutputLabel{BuildLabel: label})
}
} else {
args = append(args, arg.arg)
}
} else {
annotated = append(annotated, arg.label)
unannotated = append(unannotated, arg.label.BuildLabel)
Expand Down
13 changes: 10 additions & 3 deletions src/plz/plz.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,16 +239,23 @@ func ReadStdinLabels(labels []core.BuildLabel) []core.BuildLabel {
ret := []core.BuildLabel{}
for _, l := range labels {
if l == core.BuildLabelStdin {
for s := range flags.ReadStdin() {
ret = append(ret, core.ParseBuildLabels([]string{s})...)
}
ret = append(ret, ReadAndParseStdinLabels()...)
} else {
ret = append(ret, l)
}
}
return ret
}

// ReadAndParseStdinLabels unconditionally reads stdin and parses it into build labels.
func ReadAndParseStdinLabels() []core.BuildLabel {
ret := []core.BuildLabel{}
for s := range flags.ReadStdin() {
ret = append(ret, core.ParseBuildLabels([]string{s})...)
}
return ret
}

// A limiter allows only a certain number of concurrent tasks
// TODO(peterebden): We have about four of these now, commonise this somewhere
type limiter chan struct{}
Expand Down

0 comments on commit eb9020e

Please sign in to comment.