本文整理汇总了Golang中core.BuildState.NumDone方法的典型用法代码示例。如果您正苦于以下问题:Golang BuildState.NumDone方法的具体用法?Golang BuildState.NumDone怎么用?Golang BuildState.NumDone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.BuildState
的用法示例。
在下文中一共展示了BuildState.NumDone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: setWindowTitle
// setWindowTitle sets the title of the current shell window based on the current build state.
func setWindowTitle(state *core.BuildState) {
if state == nil {
SetWindowTitle("plz: finishing up")
} else {
SetWindowTitle(fmt.Sprintf("plz: %d / %d tasks, %3.1fs", state.NumDone(), state.NumActive(), time.Since(startTime).Seconds()))
}
}
示例2: printLines
func printLines(state *core.BuildState, buildingTargets []buildingTarget, maxLines, cols int) {
now := time.Now()
printf("Building [%d/%d, %3.1fs]:\n", state.NumDone(), state.NumActive(), time.Since(startTime).Seconds())
for i := 0; i < len(buildingTargets) && i < maxLines; i++ {
buildingTargets[i].Lock()
// Take a local copy of the structure, which isn't *that* big, so we don't need to retain the lock
// while we do potentially blocking things like printing.
target := buildingTargets[i].buildingTargetData
buildingTargets[i].Unlock()
label := target.Label.Parent()
if target.Active {
lprintf(cols, "${BOLD_WHITE}=> [%4.1fs] ${RESET}%s%s ${BOLD_WHITE}%s${ERASE_AFTER}\n",
now.Sub(target.Started).Seconds(), target.Colour, label, target.Description)
} else if time.Since(target.Finished).Seconds() < 0.5 {
// Only display finished targets for half a second after they're done.
duration := target.Finished.Sub(target.Started).Seconds()
if target.Failed {
lprintf(cols, "${BOLD_RED}=> [%4.1fs] ${RESET}%s%s ${BOLD_RED}Failed${ERASE_AFTER}\n",
duration, target.Colour, label)
} else if target.Cached {
lprintf(cols, "${BOLD_WHITE}=> [%4.1fs] ${RESET}%s%s ${BOLD_GREY}%s${ERASE_AFTER}\n",
duration, target.Colour, label, target.Description)
} else {
lprintf(cols, "${BOLD_WHITE}=> [%4.1fs] ${RESET}%s%s ${WHITE}%s${ERASE_AFTER}\n",
duration, target.Colour, label, target.Description)
}
} else {
printf("${BOLD_GREY}=|${ERASE_AFTER}\n")
}
}
printf("${RESET}")
}
示例3: updateTarget
func updateTarget(state *core.BuildState, plainOutput bool, buildingTarget *buildingTarget, label core.BuildLabel,
active bool, failed bool, cached bool, description string, err error, colour string) {
updateTarget2(buildingTarget, label, active, failed, cached, description, err, colour)
if plainOutput {
if failed {
log.Errorf("%s: %s", label.String(), description)
} else {
if !active {
active := pluralise(state.NumActive(), "task", "tasks")
log.Notice("[%d/%s] %s: %s [%3.1fs]", state.NumDone(), active, label.String(), description, time.Now().Sub(buildingTarget.Started).Seconds())
} else {
log.Info("%s: %s", label.String(), description)
}
}
}
}