func replaceSequenceLabel(target *core.BuildTarget, label core.BuildLabel, in string, runnable, multiple, dir, outPrefix, hash, test, allOutputs bool) string { // Check this label is a dependency of the target, otherwise it's not allowed. if label == target.Label { // targets can always use themselves. return checkAndReplaceSequence(target, target, in, runnable, multiple, dir, outPrefix, hash, test, allOutputs, false) } deps := target.DependenciesFor(label) if len(deps) == 0 { panic(fmt.Sprintf("Rule %s can't use %s; doesn't depend on target %s", target.Label, in, label)) } // TODO(pebers): this does not correctly handle the case where there are multiple deps here // (but is better than the previous case where it never worked at all) return checkAndReplaceSequence(target, deps[0], in, runnable, multiple, dir, outPrefix, hash, test, allOutputs, target.IsTool(label)) }