mirror of https://github.com/sbt/sbt.git
[2.x] refactor: Remove unused code (#9589)
This commit is contained in:
parent
5da646f977
commit
c5eac14c14
|
|
@ -152,39 +152,6 @@ object Logic {
|
|||
if (contradictions.nonEmpty) Some(new InitialContradictions(contradictions)) else None
|
||||
}
|
||||
|
||||
private def checkAcyclic(clauses: Clauses): Option[CyclicNegation] = {
|
||||
val deps = dependencyMap(clauses)
|
||||
// println(s"deps = $deps")
|
||||
// println(s"graph(deps) = ${graph(deps)}")
|
||||
val cycle = Dag.findNegativeCycle(graph(deps))
|
||||
if (cycle.nonEmpty) Some(new CyclicNegation(cycle)) else None
|
||||
}
|
||||
|
||||
private def graph(deps: Map[Atom, Set[Literal]]) = new Dag.DirectedSignedGraph[Atom] {
|
||||
type Arrow = Literal
|
||||
def nodes: List[Atom] = deps.keys.toList
|
||||
def dependencies(a: Atom) = deps.getOrElse(a, Set.empty).toList
|
||||
|
||||
def isNegative(b: Literal) = b match {
|
||||
case Negated(_) => true
|
||||
case Atom(_) => false
|
||||
}
|
||||
|
||||
def head(b: Literal) = b.atom
|
||||
override def toString(): String =
|
||||
nodes
|
||||
.flatMap(n => List(n) ++ dependencies(n).map(d => s"$n -> $d"))
|
||||
.mkString("{\n", "\n", "\n}")
|
||||
}
|
||||
|
||||
private def dependencyMap(clauses: Clauses): Map[Atom, Set[Literal]] =
|
||||
clauses.clauses.foldLeft(Map.empty[Atom, Set[Literal]]) { case (m, Clause(formula, heads)) =>
|
||||
val deps = literals(formula)
|
||||
heads.foldLeft(m) { (n, head) =>
|
||||
n.updated(head, n.getOrElse(head, Set.empty) ++ deps)
|
||||
}
|
||||
}
|
||||
|
||||
sealed abstract class LogicException(override val toString: String)
|
||||
|
||||
final class InitialContradictions(val literals: Set[Atom])
|
||||
|
|
|
|||
|
|
@ -33,10 +33,6 @@ sealed class Disabled private () extends sbt.librarymanagement.CrossVersion() wi
|
|||
override def toString: String = {
|
||||
"Disabled()"
|
||||
}
|
||||
private def copy(): Disabled = {
|
||||
new Disabled()
|
||||
}
|
||||
|
||||
}
|
||||
object Disabled extends sbt.librarymanagement.Disabled {
|
||||
def apply(): Disabled = Disabled
|
||||
|
|
@ -97,7 +93,7 @@ final class Constant private (val value: String)
|
|||
override def toString: String = {
|
||||
"Constant(" + value + ")"
|
||||
}
|
||||
private def copy(value: String = value): Constant = {
|
||||
private def copy(value: String): Constant = {
|
||||
new Constant(value)
|
||||
}
|
||||
def withValue(value: String): Constant = {
|
||||
|
|
@ -125,9 +121,6 @@ final class Patch private () extends sbt.librarymanagement.CrossVersion() with S
|
|||
override def toString: String = {
|
||||
"Patch()"
|
||||
}
|
||||
private def copy(): Patch = {
|
||||
new Patch()
|
||||
}
|
||||
}
|
||||
|
||||
object Patch {
|
||||
|
|
|
|||
|
|
@ -22,9 +22,6 @@ object Watched:
|
|||
|
||||
type WatchSource = Source
|
||||
|
||||
private def waitMessage(project: String): String =
|
||||
s"Waiting for source changes$project... (press enter to interrupt)"
|
||||
|
||||
def clearScreen: String = "\u001b[2J\u001b[0;0H"
|
||||
|
||||
object WatchSource {
|
||||
|
|
|
|||
|
|
@ -1195,7 +1195,7 @@ object NetworkClient {
|
|||
}
|
||||
private def simpleConsoleInterface(
|
||||
doPrintln: String => Unit,
|
||||
useColor: Boolean = Terminal.isColorEnabled
|
||||
useColor: Boolean
|
||||
): ConsoleInterface =
|
||||
new ConsoleInterface {
|
||||
import scala.Console.{ GREEN, RED, RESET, YELLOW }
|
||||
|
|
@ -1517,21 +1517,6 @@ object NetworkClient {
|
|||
useJNI: Boolean
|
||||
): Int = client(baseDirectory, parseArgs(args), inputStream, errorStream, terminal, useJNI)
|
||||
|
||||
private def simpleClient(
|
||||
arguments: Arguments,
|
||||
inputStream: InputStream,
|
||||
errorStream: PrintStream,
|
||||
useJNI: Boolean,
|
||||
terminal: Terminal
|
||||
): NetworkClient = {
|
||||
val doPrint: String => Unit = line => {
|
||||
if (terminal.getLastLine.isDefined) terminal.printStream.println()
|
||||
terminal.printStream.println(line)
|
||||
}
|
||||
val interface = NetworkClient.simpleConsoleInterface(doPrint, terminal.isColorEnabled)
|
||||
val printStream = terminal.printStream
|
||||
new NetworkClient(arguments, interface, inputStream, errorStream, printStream, useJNI)
|
||||
}
|
||||
private def simpleClient(
|
||||
arguments: Arguments,
|
||||
inputStream: InputStream,
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ class GenericPublisher private[sbt] (
|
|||
private def credentialFor(
|
||||
url: URL,
|
||||
credentials: Seq[Credentials.DirectCredentials],
|
||||
realm: Option[String] = None
|
||||
realm: Option[String]
|
||||
): Option[Credentials.DirectCredentials] =
|
||||
val byHost = credentials.filter(_.host == url.getHost)
|
||||
realm match
|
||||
|
|
|
|||
|
|
@ -821,50 +821,6 @@ object BuildServerProtocol {
|
|||
)
|
||||
}
|
||||
|
||||
private def scalacOptionsTask: Def.Initialize[Task[ScalacOptionsItem]] =
|
||||
Def
|
||||
.task {
|
||||
val target = Keys.bspTargetIdentifier.value
|
||||
val scalacOptions = Keys.scalacOptions.value
|
||||
val classDirectory = Keys.classDirectory.value
|
||||
val externalDependencyClasspath = Keys.externalDependencyClasspath.value
|
||||
val internalDependencyClasspath = for {
|
||||
(ref, configs) <- bspInternalDependencyConfigurations.value
|
||||
config <- configs
|
||||
} yield ref / config / Keys.packageBin
|
||||
(
|
||||
target,
|
||||
scalacOptions,
|
||||
classDirectory,
|
||||
externalDependencyClasspath,
|
||||
internalDependencyClasspath
|
||||
)
|
||||
}
|
||||
.flatMapTask {
|
||||
(
|
||||
target,
|
||||
scalacOptions,
|
||||
classDirectory,
|
||||
externalDependencyClasspath,
|
||||
internalDependencyClasspath
|
||||
) =>
|
||||
Def.task {
|
||||
val converter = fileConverter.value
|
||||
val cp0 = internalDependencyClasspath.join.value.distinct ++
|
||||
externalDependencyClasspath.map(_.data)
|
||||
val classpath = cp0
|
||||
.map(converter.toPath)
|
||||
.map(_.toFile.toURI)
|
||||
.toVector
|
||||
ScalacOptionsItem(
|
||||
target,
|
||||
scalacOptions.toVector,
|
||||
classpath,
|
||||
classDirectory.toURI
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private lazy val classpathTask: Def.Initialize[Task[Vector[URI]]] = Def.taskDyn {
|
||||
val converter = fileConverter.value
|
||||
val externalDependencyClasspath = Keys.externalDependencyClasspath.value
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ object OutputStrategy {
|
|||
override def toString: String = {
|
||||
"BufferedOutput(" + logger + ")"
|
||||
}
|
||||
private def copy(logger: Logger = logger): BufferedOutput = {
|
||||
private def copy(logger: Logger): BufferedOutput = {
|
||||
new BufferedOutput(logger)
|
||||
}
|
||||
def withLogger(logger: Logger): BufferedOutput = {
|
||||
|
|
@ -65,7 +65,7 @@ object OutputStrategy {
|
|||
override def toString: String = {
|
||||
"LoggedOutput(" + logger + ")"
|
||||
}
|
||||
private def copy(logger: Logger = logger): LoggedOutput = {
|
||||
private def copy(logger: Logger): LoggedOutput = {
|
||||
new LoggedOutput(logger)
|
||||
}
|
||||
def withLogger(logger: Logger): LoggedOutput = {
|
||||
|
|
@ -93,7 +93,7 @@ object OutputStrategy {
|
|||
override def toString: String = {
|
||||
"CustomOutput(" + output + ")"
|
||||
}
|
||||
private def copy(output: OutputStream = output): CustomOutput = {
|
||||
private def copy(output: OutputStream): CustomOutput = {
|
||||
new CustomOutput(output)
|
||||
}
|
||||
def withOutput(output: OutputStream): CustomOutput = {
|
||||
|
|
@ -117,7 +117,7 @@ object OutputStrategy {
|
|||
37 * (17 + processIO.##) + "CustomInputOutput".##
|
||||
override def toString: String =
|
||||
"CustomInputOutput(...)"
|
||||
private def copy(processIO: ProcessIO = processIO): CustomInputOutput =
|
||||
private def copy(processIO: ProcessIO): CustomInputOutput =
|
||||
new CustomInputOutput(processIO)
|
||||
|
||||
def withProcessIO(processIO: ProcessIO): CustomInputOutput =
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ final class ScriptedTests(
|
|||
preHook: File => Unit,
|
||||
prop: RemoteSbtCreatorProp,
|
||||
log: Logger,
|
||||
keepTempDirectory: Boolean = false
|
||||
keepTempDirectory: Boolean
|
||||
): Seq[Option[String]] = {
|
||||
|
||||
val runner = new BatchScriptRunner
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ package sbt.util
|
|||
private[sbt] object OptionInstances:
|
||||
lazy val optionMonad: Monad[Option] =
|
||||
new Monad[Option]:
|
||||
type F[a] = Option[a]
|
||||
|
||||
def pure[A](x: () => A): Option[A] = Some(x())
|
||||
def ap[A, B](ff: Option[A => B])(fa: Option[A]): Option[B] =
|
||||
|
|
|
|||
Loading…
Reference in New Issue