本文整理匯總了Golang中core.BuildState.AddPendingParse方法的典型用法代碼示例。如果您正苦於以下問題:Golang BuildState.AddPendingParse方法的具體用法?Golang BuildState.AddPendingParse怎麽用?Golang BuildState.AddPendingParse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core.BuildState
的用法示例。
在下文中一共展示了BuildState.AddPendingParse方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: addDep
// Adds a single target to the build queue.
func addDep(state *core.BuildState, label, dependor core.BuildLabel, rescan, forceBuild bool) {
// Stop at any package that's not loaded yet
if state.Graph.Package(label.PackageName) == nil {
state.AddPendingParse(label, dependor, false)
return
}
target := state.Graph.Target(label)
if target == nil {
log.Fatalf("Target %s (referenced by %s) doesn't exist\n", label, dependor)
}
if target.State() >= core.Active && !rescan && !forceBuild {
return // Target is already tagged to be built and likely on the queue.
}
// Only do this bit if we actually need to build the target
if !target.SyncUpdateState(core.Inactive, core.Semiactive) && !rescan && !forceBuild {
return
}
if state.NeedBuild || forceBuild {
if target.SyncUpdateState(core.Semiactive, core.Active) {
state.AddActiveTarget()
if target.IsTest && state.NeedTests {
state.AddActiveTarget() // Tests count twice if we're gonna run them.
}
}
}
// If this target has no deps, add it to the queue now, otherwise handle its deps.
// Only add if we need to build targets (not if we're just parsing) but we might need it to parse...
if target.State() == core.Active && state.Graph.AllDepsBuilt(target) {
if target.SyncUpdateState(core.Active, core.Pending) {
state.AddPendingBuild(label, dependor.IsAllTargets())
}
if !rescan {
return
}
}
for _, dep := range target.DeclaredDependencies() {
// Check the require/provide stuff; we may need to add a different target.
if len(target.Requires) > 0 {
if depTarget := state.Graph.Target(dep); depTarget != nil && len(depTarget.Provides) > 0 {
for _, provided := range depTarget.ProvideFor(target) {
addDep(state, provided, label, false, forceBuild)
}
continue
}
}
addDep(state, dep, label, false, forceBuild)
}
}
示例2: UndeferAnyParses
// UndeferAnyParses un-defers the parsing of a package if it depended on some subinclude target being built.
func UndeferAnyParses(state *core.BuildState, target *core.BuildTarget) {
pendingTargetMutex.Lock()
defer pendingTargetMutex.Unlock()
if m, present := deferredParses[target.Label.PackageName]; present {
if s, present := m[target.Label.Name]; present {
for _, deferredPackageName := range s {
log.Debug("Undeferring parse of %s", deferredPackageName)
state.AddPendingParse(
core.BuildLabel{PackageName: deferredPackageName, Name: getDependingTarget(deferredPackageName)},
core.BuildLabel{PackageName: deferredPackageName, Name: "_UNDEFER_"},
false,
)
}
delete(m, target.Label.Name) // Don't need this any more
}
}
}