// please mimics the core build 'loop' from src/please.go.
func please(tid int, state *core.BuildState) {
	for {
		label, _, t := state.NextTask()
		switch t {
		case core.Stop, core.Kill:
			return
		case core.Build:
			Build(tid, state, label)
		default:
			panic(fmt.Sprintf("unexpected task type: %d", t))
		}
		state.TaskDone()
	}
}
예제 #2
0
func please(tid int, state *core.BuildState, parsePackageOnly bool, include, exclude []string) {
	for {
		label, dependor, t := state.NextTask()
		switch t {
		case core.Stop, core.Kill:
			return
		case core.Parse, core.SubincludeParse:
			parse.Parse(tid, state, label, dependor, parsePackageOnly, include, exclude)
		case core.Build, core.SubincludeBuild:
			build.Build(tid, state, label)
		case core.Test:
			test.Test(tid, state, label)
		}
		state.TaskDone()
	}
}
예제 #3
0
func assertPendingBuilds(t *testing.T, state *core.BuildState, targets ...string) {
	state.Stop(1)
	pending := []core.BuildLabel{}
	for {
		label, _, typ := state.NextTask()
		if typ == core.Stop {
			break
		} else if typ != core.Build && typ != core.SubincludeBuild {
			t.Errorf("Unexpected non-build task")
		} else {
			pending = append(pending, label)
		}
	}
	expected := []core.BuildLabel{}
	for _, target := range targets {
		expected = append(expected, core.ParseBuildLabel(target, ""))
	}
	assert.Equal(t, expected, pending)
}