mirror of https://github.com/sbt/sbt.git
commit
128e9eff41
|
|
@ -11,7 +11,8 @@ def buildLevelSettings: Seq[Setting[_]] = inThisBuild(Seq(
|
|||
bintrayOrganization := Some(if (publishStatus.value == "releases") "typesafe" else "sbt"),
|
||||
bintrayRepository := s"ivy-${publishStatus.value}",
|
||||
bintrayPackage := "sbt",
|
||||
bintrayReleaseOnPublish := false
|
||||
bintrayReleaseOnPublish := false,
|
||||
resolvers += Resolver.mavenLocal
|
||||
))
|
||||
|
||||
def commonSettings: Seq[Setting[_]] = Seq(
|
||||
|
|
@ -129,7 +130,7 @@ lazy val scriptedBaseProj = (project in scriptedPath / "base").
|
|||
)
|
||||
|
||||
lazy val scriptedSbtProj = (project in scriptedPath / "sbt").
|
||||
dependsOn(scriptedBaseProj).
|
||||
dependsOn(scriptedBaseProj, commandProj).
|
||||
settings(
|
||||
baseSettings,
|
||||
name := "Scripted sbt",
|
||||
|
|
@ -202,7 +203,7 @@ lazy val mavenResolverPluginProj = (project in file("sbt-maven-resolver")).
|
|||
settings(
|
||||
baseSettings,
|
||||
name := "sbt-maven-resolver",
|
||||
libraryDependencies ++= aetherLibs ++ Seq((libraryManagement % Test).classifier("tests")),
|
||||
libraryDependencies ++= aetherLibs ++ Seq(utilTesting % Test, (libraryManagement % Test).classifier("tests"), libraryManagement % Test),
|
||||
sbtPlugin := true
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,16 +5,23 @@ package sbt
|
|||
|
||||
import Predef.{ Map, Set, implicitly } // excludes *both 2.10.x conforms and 2.11.x $conforms in source compatible manner.
|
||||
|
||||
import FileInfo.{ exists, hash }
|
||||
import sbt.internal.util.{ Cache, HList, HNil, InputCache, LinePosition, LineRange, NoPosition, RangePosition, SourcePosition }
|
||||
import sbt.internal.util.FileInfo.{ exists, hash }
|
||||
import sbt.internal.util.Types.{ :+:, idFun }
|
||||
import java.io.File
|
||||
import java.{ util => ju }
|
||||
import java.net.URL
|
||||
import Types.{ :+:, idFun }
|
||||
import scala.xml.NodeSeq
|
||||
import sbinary.{ DefaultProtocol, Format }
|
||||
import RepositoryHelpers._
|
||||
// import sbt.internal.librarymanagement.{ ExternalIvyConfiguration, IvyConfiguration, IvyPaths, IvyScala, ModuleSettings, RetrieveConfiguration, SbtExclusionRule, UpdateConfiguration, UpdateReport }
|
||||
// import sbt.librarymanagement.{ Configuration, ExclusionRule, CrossVersion, ModuleID, Patterns }
|
||||
import sbt.internal.librarymanagement._
|
||||
import sbt.librarymanagement._
|
||||
import sbt.librarymanagement.RepositoryHelpers._
|
||||
import Ordering._
|
||||
|
||||
import sbt.io.Hash
|
||||
|
||||
/**
|
||||
* InputCaches for IvyConfiguration, ModuleSettings, and UpdateConfiguration
|
||||
* The InputCaches for a basic data structure is built in two parts.
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ import inc._
|
|||
import Locate.DefinesClass
|
||||
import java.io.File
|
||||
|
||||
import sbt.internal.librarymanagement.{ ComponentManager, IvyConfiguration }
|
||||
import sbt.librarymanagement.ModuleID
|
||||
import sbt.util.Logger
|
||||
|
||||
object Compiler {
|
||||
val DefaultMaxErrors = 100
|
||||
|
||||
|
|
@ -45,94 +49,100 @@ object Compiler {
|
|||
incSetup
|
||||
)
|
||||
|
||||
def compilers(cpOptions: ClasspathOptions)(implicit app: AppConfiguration, log: Logger): Compilers =
|
||||
{
|
||||
val scalaProvider = app.provider.scalaProvider
|
||||
compilers(ScalaInstance(scalaProvider.version, scalaProvider.launcher), cpOptions)
|
||||
}
|
||||
// def compilers(cpOptions: ClasspathOptions)(implicit app: AppConfiguration, log: Logger): Compilers =
|
||||
// {
|
||||
// val scalaProvider = app.provider.scalaProvider
|
||||
// compilers(ScalaInstance(scalaProvider.version, scalaProvider.launcher), cpOptions)
|
||||
// }
|
||||
|
||||
def compilers(instance: ScalaInstance, cpOptions: ClasspathOptions)(implicit app: AppConfiguration, log: Logger): Compilers =
|
||||
compilers(instance, cpOptions, None)
|
||||
// def compilers(instance: ScalaInstance, cpOptions: ClasspathOptions)(implicit app: AppConfiguration, log: Logger): Compilers =
|
||||
// compilers(instance, cpOptions, None)
|
||||
|
||||
@deprecated("Use `compilers(ScalaInstance, ClasspathOptions, Option[File], IvyConfiguration)`.", "0.13.10")
|
||||
def compilers(instance: ScalaInstance, cpOptions: ClasspathOptions, javaHome: Option[File])(implicit app: AppConfiguration, log: Logger): Compilers =
|
||||
{
|
||||
val javac =
|
||||
AggressiveCompile.directOrFork(instance, cpOptions, javaHome)
|
||||
val javac2 =
|
||||
JavaTools.directOrFork(instance, cpOptions, javaHome)
|
||||
// Hackery to enable both the new and deprecated APIs to coexist peacefully.
|
||||
case class CheaterJavaTool(newJavac: IncrementalCompilerJavaTools, delegate: JavaTool) extends JavaTool with JavaToolWithNewInterface {
|
||||
def compile(contract: JavacContract, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String])(implicit log: Logger): Unit =
|
||||
javac.compile(contract, sources, classpath, outputDirectory, options)(log)
|
||||
def onArgs(f: Seq[String] => Unit): JavaTool = CheaterJavaTool(newJavac, delegate.onArgs(f))
|
||||
}
|
||||
compilers(instance, cpOptions, CheaterJavaTool(javac2, javac))
|
||||
}
|
||||
def compilers(instance: ScalaInstance, cpOptions: ClasspathOptions, javaHome: Option[File], ivyConfiguration: IvyConfiguration)(implicit app: AppConfiguration, log: Logger): Compilers =
|
||||
{
|
||||
val javac =
|
||||
AggressiveCompile.directOrFork(instance, cpOptions, javaHome)
|
||||
val javac2 =
|
||||
JavaTools.directOrFork(instance, cpOptions, javaHome)
|
||||
// Hackery to enable both the new and deprecated APIs to coexist peacefully.
|
||||
case class CheaterJavaTool(newJavac: IncrementalCompilerJavaTools, delegate: JavaTool) extends JavaTool with JavaToolWithNewInterface {
|
||||
def compile(contract: JavacContract, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String])(implicit log: Logger): Unit =
|
||||
javac.compile(contract, sources, classpath, outputDirectory, options)(log)
|
||||
def onArgs(f: Seq[String] => Unit): JavaTool = CheaterJavaTool(newJavac, delegate.onArgs(f))
|
||||
}
|
||||
val scalac = scalaCompiler(instance, cpOptions, ivyConfiguration)
|
||||
new Compilers(scalac, CheaterJavaTool(javac2, javac))
|
||||
}
|
||||
@deprecated("Deprecated in favor of new sbt.compiler.javac package.", "0.13.8")
|
||||
def compilers(instance: ScalaInstance, cpOptions: ClasspathOptions, javac: sbt.compiler.JavaCompiler.Fork)(implicit app: AppConfiguration, log: Logger): Compilers =
|
||||
{
|
||||
val javaCompiler = sbt.compiler.JavaCompiler.fork(cpOptions, instance)(javac)
|
||||
compilers(instance, cpOptions, javaCompiler)
|
||||
}
|
||||
@deprecated("Deprecated in favor of new sbt.compiler.javac package.", "0.13.8")
|
||||
def compilers(instance: ScalaInstance, cpOptions: ClasspathOptions, javac: JavaTool)(implicit app: AppConfiguration, log: Logger): Compilers =
|
||||
{
|
||||
val scalac = scalaCompiler(instance, cpOptions)
|
||||
new Compilers(scalac, javac)
|
||||
}
|
||||
@deprecated("Use `scalaCompiler(ScalaInstance, ClasspathOptions, IvyConfiguration)`.", "0.13.10")
|
||||
def scalaCompiler(instance: ScalaInstance, cpOptions: ClasspathOptions)(implicit app: AppConfiguration, log: Logger): AnalyzingCompiler =
|
||||
// @deprecated("Use `compilers(ScalaInstance, ClasspathOptions, Option[File], IvyConfiguration)`.", "0.13.10")
|
||||
// def compilers(instance: ScalaInstance, cpOptions: ClasspathOptions, javaHome: Option[File])(implicit app: AppConfiguration, log: Logger): Compilers =
|
||||
// {
|
||||
// val javac =
|
||||
// AggressiveCompile.directOrFork(instance, cpOptions, javaHome)
|
||||
// val javac2 =
|
||||
// JavaTools.directOrFork(instance, cpOptions, javaHome)
|
||||
// // Hackery to enable both the new and deprecated APIs to coexist peacefully.
|
||||
// case class CheaterJavaTool(newJavac: IncrementalCompilerJavaTools, delegate: JavaTool) extends JavaTool with JavaToolWithNewInterface {
|
||||
// def compile(contract: JavacContract, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String])(implicit log: Logger): Unit =
|
||||
// javac.compile(contract, sources, classpath, outputDirectory, options)(log)
|
||||
// def onArgs(f: Seq[String] => Unit): JavaTool = CheaterJavaTool(newJavac, delegate.onArgs(f))
|
||||
// }
|
||||
// compilers(instance, cpOptions, CheaterJavaTool(javac2, javac))
|
||||
// }
|
||||
// def compilers(instance: ScalaInstance, cpOptions: ClasspathOptions, javaHome: Option[File], ivyConfiguration: IvyConfiguration)(implicit app: AppConfiguration, log: Logger): Compilers =
|
||||
// {
|
||||
// val javac =
|
||||
// AggressiveCompile.directOrFork(instance, cpOptions, javaHome)
|
||||
// val javac2 =
|
||||
// JavaTools.directOrFork(instance, cpOptions, javaHome)
|
||||
// // Hackery to enable both the new and deprecated APIs to coexist peacefully.
|
||||
// case class CheaterJavaTool(newJavac: IncrementalCompilerJavaTools, delegate: JavaTool) extends JavaTool with JavaToolWithNewInterface {
|
||||
// def compile(contract: JavacContract, sources: Seq[File], classpath: Seq[File], outputDirectory: File, options: Seq[String])(implicit log: Logger): Unit =
|
||||
// javac.compile(contract, sources, classpath, outputDirectory, options)(log)
|
||||
// def onArgs(f: Seq[String] => Unit): JavaTool = CheaterJavaTool(newJavac, delegate.onArgs(f))
|
||||
// }
|
||||
// val scalac = scalaCompiler(instance, cpOptions, ivyConfiguration)
|
||||
// new Compilers(scalac, CheaterJavaTool(javac2, javac))
|
||||
// }
|
||||
// @deprecated("Deprecated in favor of new sbt.compiler.javac package.", "0.13.8")
|
||||
// def compilers(instance: ScalaInstance, cpOptions: ClasspathOptions, javac: sbt.compiler.JavaCompiler.Fork)(implicit app: AppConfiguration, log: Logger): Compilers =
|
||||
// {
|
||||
// val javaCompiler = sbt.compiler.JavaCompiler.fork(cpOptions, instance)(javac)
|
||||
// compilers(instance, cpOptions, javaCompiler)
|
||||
// }
|
||||
// @deprecated("Deprecated in favor of new sbt.compiler.javac package.", "0.13.8")
|
||||
// def compilers(instance: ScalaInstance, cpOptions: ClasspathOptions, javac: JavaTool)(implicit app: AppConfiguration, log: Logger): Compilers =
|
||||
// {
|
||||
// val scalac = scalaCompiler(instance, cpOptions)
|
||||
// new Compilers(scalac, javac)
|
||||
// }
|
||||
// @deprecated("Use `scalaCompiler(ScalaInstance, ClasspathOptions, IvyConfiguration)`.", "0.13.10")
|
||||
// def scalaCompiler(instance: ScalaInstance, cpOptions: ClasspathOptions)(implicit app: AppConfiguration, log: Logger): AnalyzingCompiler =
|
||||
// {
|
||||
// val launcher = app.provider.scalaProvider.launcher
|
||||
// val componentManager = new ComponentManager(launcher.globalLock, app.provider.components, Option(launcher.ivyHome), log)
|
||||
// val provider = ComponentCompiler.interfaceProvider(componentManager)
|
||||
// new AnalyzingCompiler(instance, provider, cpOptions)
|
||||
// }
|
||||
|
||||
// TODO: Get java compiler
|
||||
def compilers(instance: ScalaInstance, cpOptions: ClasspathOptions, javaHome: Option[File], ivyConfiguration: IvyConfiguration, sourcesModule: ModuleID)(implicit app: AppConfiguration, log: Logger): Compilers = {
|
||||
val scalac = scalaCompiler(instance, cpOptions, javaHome, ivyConfiguration, sourcesModule)
|
||||
val javac = ???
|
||||
new Compilers(scalac, javac)
|
||||
}
|
||||
def scalaCompiler(instance: ScalaInstance, cpOptions: ClasspathOptions, javaHome: Option[File], ivyConfiguration: IvyConfiguration, sourcesModule: ModuleID)(implicit app: AppConfiguration, log: Logger): AnalyzingCompiler =
|
||||
{
|
||||
val launcher = app.provider.scalaProvider.launcher
|
||||
val componentManager = new ComponentManager(launcher.globalLock, app.provider.components, Option(launcher.ivyHome), log)
|
||||
val provider = ComponentCompiler.interfaceProvider(componentManager)
|
||||
new AnalyzingCompiler(instance, provider, cpOptions)
|
||||
}
|
||||
def scalaCompiler(instance: ScalaInstance, cpOptions: ClasspathOptions, ivyConfiguration: IvyConfiguration)(implicit app: AppConfiguration, log: Logger): AnalyzingCompiler =
|
||||
{
|
||||
val launcher = app.provider.scalaProvider.launcher
|
||||
val componentManager = new ComponentManager(launcher.globalLock, app.provider.components, Option(launcher.ivyHome), log)
|
||||
val bootDirectory = launcher.bootDirectory
|
||||
val provider = ComponentCompiler.interfaceProvider(componentManager, ivyConfiguration, bootDirectory)
|
||||
val provider = ComponentCompiler.interfaceProvider(componentManager, ivyConfiguration, sourcesModule)
|
||||
new AnalyzingCompiler(instance, provider, cpOptions)
|
||||
}
|
||||
|
||||
@deprecated("Use the `compile` method instead.", "0.13.8")
|
||||
def apply(in: Inputs, log: Logger): Analysis = {
|
||||
import in.config._
|
||||
apply(in, log, new LoggerReporter(maxErrors, log, sourcePositionMapper))
|
||||
}
|
||||
@deprecated("Use the `compile` method instead.", "0.13.8")
|
||||
def apply(in: Inputs, log: Logger, reporter: xsbti.Reporter): Analysis = {
|
||||
import in.compilers._
|
||||
import in.config._
|
||||
import in.incSetup._
|
||||
// Here we load the previous analysis since the new paths don't.
|
||||
val (previousAnalysis, previousSetup) = {
|
||||
MixedAnalyzingCompiler.staticCachedStore(cacheFile).get().map {
|
||||
case (a, s) => (a, Some(s))
|
||||
} getOrElse {
|
||||
(Analysis.empty(nameHashing = incOptions.nameHashing), None)
|
||||
}
|
||||
}
|
||||
compile(InputsWithPrevious(in, PreviousAnalysis(previousAnalysis, previousSetup)), log, reporter).analysis
|
||||
}
|
||||
// @deprecated("Use the `compile` method instead.", "0.13.8")
|
||||
// def apply(in: Inputs, log: Logger): Analysis = {
|
||||
// import in.config._
|
||||
// apply(in, log, new LoggerReporter(maxErrors, log, sourcePositionMapper))
|
||||
// }
|
||||
// @deprecated("Use the `compile` method instead.", "0.13.8")
|
||||
// def apply(in: Inputs, log: Logger, reporter: xsbti.Reporter): Analysis = {
|
||||
// import in.compilers._
|
||||
// import in.config._
|
||||
// import in.incSetup._
|
||||
// // Here we load the previous analysis since the new paths don't.
|
||||
// val (previousAnalysis, previousSetup) = {
|
||||
// MixedAnalyzingCompiler.staticCachedStore(cacheFile).get().map {
|
||||
// case (a, s) => (a, Some(s))
|
||||
// } getOrElse {
|
||||
// (Analysis.empty(nameHashing = incOptions.nameHashing), None)
|
||||
// }
|
||||
// }
|
||||
// compile(InputsWithPrevious(in, PreviousAnalysis(previousAnalysis, previousSetup)), log, reporter).analysis
|
||||
// }
|
||||
def compile(in: InputsWithPrevious, log: Logger): CompileResult =
|
||||
{
|
||||
import in.inputs.config._
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ package sbt
|
|||
|
||||
import java.io.File
|
||||
import compiler.AnalyzingCompiler
|
||||
import sbt.internal.util.JLine
|
||||
import sbt.util.Logger
|
||||
|
||||
final class Console(compiler: AnalyzingCompiler) {
|
||||
/** Starts an interactive scala interpreter session with the given classpath.*/
|
||||
|
|
@ -20,9 +22,11 @@ final class Console(compiler: AnalyzingCompiler) {
|
|||
def apply(classpath: Seq[File], options: Seq[String], initialCommands: String, cleanupCommands: String)(loader: Option[ClassLoader], bindings: Seq[(String, Any)])(implicit log: Logger): Option[String] =
|
||||
{
|
||||
def console0() = compiler.console(classpath, options, initialCommands, cleanupCommands, log)(loader, bindings)
|
||||
JLine.withJLine(Run.executeTrapExit(console0, log))
|
||||
// TODO: Fix JLine
|
||||
//JLine.withJLine(Run.executeTrapExit(console0, log))
|
||||
Run.executeTrapExit(console0, log)
|
||||
}
|
||||
}
|
||||
object Console {
|
||||
def apply(conf: Compiler.Inputs): Console = new Console(conf.compilers.scalac)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,17 @@ import java.io.{ File, PrintWriter }
|
|||
import compiler.{ AnalyzingCompiler, JavaCompiler }
|
||||
|
||||
import Predef.{ conforms => _, _ }
|
||||
import Types.:+:
|
||||
import Path._
|
||||
import sbt.internal.util.Types.:+:
|
||||
import sbt.io.Path._
|
||||
import sbt.io.IO
|
||||
|
||||
import sbinary.DefaultProtocol.FileFormat
|
||||
import Cache.{ defaultEquiv, hConsCache, hNilCache, seqCache, seqFormat, streamFormat, StringFormat, UnitFormat, wrapIn }
|
||||
import Tracked.{ inputChanged, outputChanged }
|
||||
import FilesInfo.{ exists, hash, lastModified }
|
||||
import sbt.internal.util.Cache.{ defaultEquiv, hConsCache, hNilCache, seqCache, seqFormat, streamFormat, StringFormat, UnitFormat, wrapIn }
|
||||
import sbt.internal.util.Tracked.{ inputChanged, outputChanged }
|
||||
import sbt.internal.util.{ FilesInfo, HashFileInfo, HNil, ModifiedFileInfo, PlainFileInfo }
|
||||
import sbt.internal.util.FilesInfo.{ exists, hash, lastModified }
|
||||
|
||||
import sbt.util.Logger
|
||||
|
||||
object Doc {
|
||||
import RawCompileLike._
|
||||
|
|
@ -66,7 +70,7 @@ sealed trait Doc {
|
|||
log.debug("Doc uptodate: " + outputDirectory.getAbsolutePath)
|
||||
}
|
||||
}
|
||||
cachedDoc(inputs)(() => exists(outputDirectory.***.get.toSet))
|
||||
cachedDoc(inputs)(() => exists(outputDirectory.allPaths.get.toSet))
|
||||
}
|
||||
}
|
||||
@deprecated("No longer used. See `Doc.scaladoc`", "0.13.0")
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ package sbt
|
|||
import java.io.{ File, Writer }
|
||||
import inc.Relations
|
||||
|
||||
import sbt.internal.util.Relation
|
||||
|
||||
import sbt.io.IO
|
||||
|
||||
object DotGraph {
|
||||
private def fToString(roots: Iterable[File]): (File => String) =
|
||||
(x: File) => sourceToString(roots, x)
|
||||
|
|
|
|||
|
|
@ -4,11 +4,13 @@
|
|||
package sbt
|
||||
|
||||
import scala.collection.mutable
|
||||
import testing._
|
||||
import testing.{ Logger => _, _ }
|
||||
import java.net.ServerSocket
|
||||
import java.io._
|
||||
import Tests.{ Output => TestOutput, _ }
|
||||
import ForkMain._
|
||||
import sbt.io.IO
|
||||
import sbt.util.Logger
|
||||
|
||||
private[sbt] object ForkTests {
|
||||
def apply(runners: Map[TestFramework, Runner], tests: List[TestDefinition], config: Execution, classpath: Seq[File], fork: ForkOptions, log: Logger): Task[TestOutput] = {
|
||||
|
|
|
|||
|
|
@ -7,16 +7,20 @@ import Predef.{ conforms => _, _ }
|
|||
import java.io.File
|
||||
import java.util.jar.{ Attributes, Manifest }
|
||||
import collection.JavaConversions._
|
||||
import Types.:+:
|
||||
import Path._
|
||||
import sbt.internal.util.Types.:+:
|
||||
import sbt.io.Path._
|
||||
import sbt.io.IO
|
||||
|
||||
import sbinary.{ DefaultProtocol, Format }
|
||||
import DefaultProtocol.{ FileFormat, immutableMapFormat, StringFormat, UnitFormat }
|
||||
import sbt.internal.util.{ Cache, FileInfo, FilesInfo, HNil, ModifiedFileInfo, PlainFileInfo, Tracked }
|
||||
import Cache.{ defaultEquiv, hConsCache, hNilCache, streamFormat, wrapIn }
|
||||
import Tracked.{ inputChanged, outputChanged }
|
||||
import FileInfo.exists
|
||||
import FilesInfo.lastModified
|
||||
|
||||
import sbt.util.Logger
|
||||
|
||||
sealed trait PackageOption
|
||||
object Package {
|
||||
final case class JarManifest(m: Manifest) extends PackageOption {
|
||||
|
|
|
|||
|
|
@ -7,13 +7,17 @@ import java.io.File
|
|||
import compiler.{ AnalyzingCompiler, JavaCompiler }
|
||||
|
||||
import Predef.{ conforms => _, _ }
|
||||
import Types.:+:
|
||||
import Path._
|
||||
import sbt.io.Path._
|
||||
import sbt.io.IO
|
||||
|
||||
import sbinary.DefaultProtocol.FileFormat
|
||||
import Cache.{ defaultEquiv, hConsCache, hNilCache, IntFormat, seqCache, seqFormat, streamFormat, StringFormat, UnitFormat, wrapIn }
|
||||
import Tracked.{ inputChanged, outputChanged }
|
||||
import FilesInfo.{ exists, hash, lastModified }
|
||||
import sbt.internal.util.Types.:+:
|
||||
import sbt.internal.util.Cache.{ defaultEquiv, hConsCache, hNilCache, IntFormat, seqCache, seqFormat, streamFormat, StringFormat, UnitFormat, wrapIn }
|
||||
import sbt.internal.util.Tracked.{ inputChanged, outputChanged }
|
||||
import sbt.internal.util.{ FilesInfo, HashFileInfo, HNil, ModifiedFileInfo, PlainFileInfo }
|
||||
import sbt.internal.util.FilesInfo.{ exists, hash, lastModified }
|
||||
|
||||
import sbt.util.Logger
|
||||
|
||||
object RawCompileLike {
|
||||
type Gen = (Seq[File], Seq[File], File, Seq[String], Int, Logger) => Unit
|
||||
|
|
@ -51,7 +55,7 @@ object RawCompileLike {
|
|||
log.debug("Uptodate: " + outputDirectory.getAbsolutePath)
|
||||
}
|
||||
}
|
||||
cachedComp(inputs)(() => exists(outputDirectory.***.get.toSet))
|
||||
cachedComp(inputs)(() => exists(outputDirectory.allPaths.get.toSet))
|
||||
}
|
||||
def prepare(description: String, doCompile: Gen): Gen = (sources, classpath, outputDirectory, options, maxErrors, log) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ package sbt
|
|||
|
||||
import java.io.File
|
||||
|
||||
import sbt.internal.util.{ FileInfo, Relation }
|
||||
|
||||
import sbt.io.IO
|
||||
|
||||
/**
|
||||
* Maintains a set of mappings so that they are uptodate.
|
||||
* Specifically, 'apply' applies the mappings by creating target directories and copying source files to their destination.
|
||||
|
|
@ -71,7 +75,10 @@ object Sync {
|
|||
import sbinary._
|
||||
import Operations.{ read, write }
|
||||
import DefaultProtocol.{ FileFormat => _, _ }
|
||||
import sbt.inc.AnalysisFormats.{ fileFormat, relationFormat }
|
||||
//import sbt.inc.AnalysisFormats.{ fileFormat, relationFormat }
|
||||
implicit def fileFormat: Format[File] = wrap[File, String](_.getAbsolutePath, s => new File(s))
|
||||
implicit def relationFormat[A, B](implicit af: Format[Map[A, Set[B]]], bf: Format[Map[B, Set[A]]]): Format[Relation[A, B]] =
|
||||
asProduct2[Relation[A, B], Map[A, Set[B]], Map[B, Set[A]]](Relation.make _)(r => (r.forwardMap, r.reverseMap))(af, bf)
|
||||
|
||||
def writeInfo[F <: FileInfo](file: File, relation: Relation[File, File], info: Map[File, F])(implicit infoFormat: Format[F]): Unit =
|
||||
IO.gzipFileOut(file) { out =>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package sbt
|
||||
|
||||
import sbt.Tests.{ Output, Summary }
|
||||
import sbt.util.{ Level, Logger }
|
||||
|
||||
/**
|
||||
* Logs information about tests after they finish.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ import std._
|
|||
import xsbt.api.{ Discovered, Discovery }
|
||||
import inc.Analysis
|
||||
import TaskExtra._
|
||||
import Types._
|
||||
import sbt.internal.util.FeedbackProvidedException
|
||||
import sbt.internal.util.Types._
|
||||
import xsbti.api.Definition
|
||||
import ConcurrentRestrictions.Tag
|
||||
|
||||
|
|
@ -16,6 +17,8 @@ import scala.annotation.tailrec
|
|||
|
||||
import java.io.File
|
||||
|
||||
import sbt.util.Logger
|
||||
|
||||
sealed trait TestOption
|
||||
object Tests {
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import java.nio.ByteBuffer
|
|||
import java.net.URLClassLoader
|
||||
import Eval.{ getModule, getValue, WrapValName }
|
||||
|
||||
import sbt.io.{ DirectoryFilter, FileFilter, GlobFilter, Hash, IO, Path }
|
||||
|
||||
// TODO: provide a way to cleanup backing directory
|
||||
|
||||
final class EvalImports(val strings: Seq[(String, Int)], val srcName: String)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import org.scalacheck._
|
|||
import Prop._
|
||||
import scala.tools.nsc.reporters.StoreReporter
|
||||
|
||||
import sbt.io.IO
|
||||
|
||||
object EvalTest extends Properties("eval") {
|
||||
private[this] val reporter = new StoreReporter
|
||||
import reporter.{ ERROR, Info, Severity }
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import complete.HistoryCommands
|
||||
import sbt.util.Level
|
||||
import sbt.internal.util.complete.HistoryCommands
|
||||
import scala.annotation.tailrec
|
||||
|
||||
import java.io.File
|
||||
import Path._
|
||||
import sbt.io.Path._
|
||||
|
||||
object BasicCommandStrings {
|
||||
val HelpCommand = "help"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
package sbt
|
||||
|
||||
import complete.{ Completion, Completions, DefaultParsers, HistoryCommands, Parser, TokenCompletions }
|
||||
import sbt.internal.util.{ AttributeKey, FullReader }
|
||||
import sbt.internal.util.complete.{ Completion, Completions, DefaultParsers, History => CHistory, HistoryCommands, Parser, TokenCompletions }
|
||||
import sbt.internal.util.Types.{ const, idFun }
|
||||
import classpath.ClasspathUtilities.toLoader
|
||||
import DefaultParsers._
|
||||
import Types.{ const, idFun }
|
||||
import Function.tupled
|
||||
import Command.applyEffect
|
||||
import HistoryCommands.{ Start => HistoryPrefix }
|
||||
|
|
@ -12,6 +13,7 @@ import CommandUtil._
|
|||
import BasicKeys._
|
||||
|
||||
import java.io.File
|
||||
import sbt.io.IO
|
||||
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
|
|
@ -159,7 +161,7 @@ object BasicCommands {
|
|||
val logError = (msg: String) => s.log.error(msg)
|
||||
val hp = s get historyPath getOrElse None
|
||||
val lines = hp.toList.flatMap(p => IO.readLines(p)).toIndexedSeq
|
||||
histFun(complete.History(lines, hp, logError)) match {
|
||||
histFun(CHistory(lines, hp, logError)) match {
|
||||
case Some(commands) =>
|
||||
commands foreach println //printing is more appropriate than logging
|
||||
(commands ::: s).continue
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package sbt
|
||||
|
||||
import java.io.File
|
||||
import sbt.internal.util.AttributeKey
|
||||
|
||||
object BasicKeys {
|
||||
val historyPath = AttributeKey[Option[File]]("history", "The location where command line history is persisted.", 40)
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@
|
|||
package sbt
|
||||
|
||||
import java.io.File
|
||||
import complete.{ DefaultParsers, EditDistance, Parser }
|
||||
import Types.const
|
||||
import sbt.internal.util.complete.{ DefaultParsers, EditDistance, Parser }
|
||||
import sbt.internal.util.Types.const
|
||||
import sbt.internal.util.{ AttributeKey, AttributeMap, Util }
|
||||
|
||||
sealed trait Command {
|
||||
def help: State => Help
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@ package sbt
|
|||
import java.io.File
|
||||
import java.util.regex.{ Pattern, PatternSyntaxException }
|
||||
|
||||
import complete.Parser
|
||||
import complete.DefaultParsers._
|
||||
import sbt.internal.util.AttributeKey
|
||||
import sbt.internal.util.complete.Parser
|
||||
import sbt.internal.util.complete.DefaultParsers._
|
||||
|
||||
import sbt.io.IO
|
||||
|
||||
object CommandUtil {
|
||||
def readLines(files: Seq[File]): Seq[String] = files flatMap (line => IO.readLines(line)) flatMap processLine
|
||||
|
|
@ -71,4 +74,4 @@ object CommandUtil {
|
|||
|
||||
final val HelpPatternFlags = Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package sbt
|
|||
import java.lang.reflect.InvocationTargetException
|
||||
import scala.annotation.tailrec
|
||||
|
||||
import sbt.internal.util.{ AlreadyHandledException, MessageOnlyException, UnprintableException }
|
||||
|
||||
private[sbt] sealed abstract class ExceptionCategory {
|
||||
def isFull: Boolean = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package sbt
|
|||
import java.util.regex.Pattern
|
||||
import scala.Console.{ BOLD, RESET }
|
||||
|
||||
import sbt.internal.util.ConsoleLogger
|
||||
|
||||
object Highlight {
|
||||
final val NormalIntensity = "\033[22m"
|
||||
final val NormalTextColor = "\033[39m"
|
||||
|
|
@ -19,4 +21,4 @@ object Highlight {
|
|||
None
|
||||
}
|
||||
def bold(s: String) = if (ConsoleLogger.formatEnabled) BOLD + s + NormalIntensity else s
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@ import scala.annotation.tailrec
|
|||
import java.io.{ File, PrintWriter }
|
||||
import jline.TerminalFactory
|
||||
|
||||
import sbt.internal.io.Using
|
||||
import sbt.internal.util.{ ErrorHandling, GlobalLogBacking, GlobalLogging }
|
||||
import sbt.util.{ AbstractLogger, Logger }
|
||||
|
||||
object MainLoop {
|
||||
/** Entry point to run the remaining commands in State with managed global logging.*/
|
||||
def runLogged(state: State): xsbti.MainResult = {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ package sbt
|
|||
|
||||
import java.io.File
|
||||
import java.util.concurrent.Callable
|
||||
import sbt.util.Logger
|
||||
import sbt.internal.util.{ AttributeKey, AttributeMap, ErrorHandling, ExitHook, ExitHooks, GlobalLogging }
|
||||
import sbt.internal.util.complete.HistoryCommands
|
||||
|
||||
/**
|
||||
* Data structure representing all command execution information.
|
||||
|
|
@ -166,7 +169,7 @@ object State {
|
|||
def previous: Option[String] = executed.drop(1).headOption
|
||||
}
|
||||
/** Constructs an empty command History with a default, finite command limit.*/
|
||||
def newHistory = new History(Vector.empty, complete.HistoryCommands.MaxLines)
|
||||
def newHistory = new History(Vector.empty, HistoryCommands.MaxLines)
|
||||
|
||||
def defaultReload(state: State): Reboot =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,11 @@ import BasicCommandStrings.ClearOnFailure
|
|||
import State.FailureWall
|
||||
import annotation.tailrec
|
||||
import java.io.File
|
||||
import Types.const
|
||||
|
||||
import sbt.io.PathFinder
|
||||
import sbt.internal.io.{ SourceModificationWatch, WatchState }
|
||||
import sbt.internal.util.AttributeKey
|
||||
import sbt.internal.util.Types.const
|
||||
|
||||
trait Watched {
|
||||
/** The files watched when an action is run with a preceeding ~ */
|
||||
|
|
@ -77,4 +81,4 @@ object Watched {
|
|||
}
|
||||
val ContinuousState = AttributeKey[WatchState]("watch state", "Internal: tracks state for continuous execution.")
|
||||
val Configuration = AttributeKey[Watched]("watched-configuration", "Configures continuous execution.")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2009 Mark Harrah
|
||||
*/
|
||||
package xsbt
|
||||
|
||||
import java.io.{ BufferedReader, BufferedWriter, InputStream, InputStreamReader, OutputStreamWriter, OutputStream }
|
||||
import java.net.{ InetAddress, ServerSocket, Socket }
|
||||
|
||||
object IPC {
|
||||
private val portMin = 1025
|
||||
private val portMax = 65536
|
||||
private val loopback = InetAddress.getByName(null) // loopback
|
||||
|
||||
def client[T](port: Int)(f: IPC => T): T =
|
||||
ipc(new Socket(loopback, port))(f)
|
||||
|
||||
def pullServer[T](f: Server => T): T =
|
||||
{
|
||||
val server = makeServer
|
||||
try { f(new Server(server)) }
|
||||
finally { server.close() }
|
||||
}
|
||||
def unmanagedServer: Server = new Server(makeServer)
|
||||
def makeServer: ServerSocket =
|
||||
{
|
||||
val random = new java.util.Random
|
||||
def nextPort = random.nextInt(portMax - portMin + 1) + portMin
|
||||
def createServer(attempts: Int): ServerSocket =
|
||||
if (attempts > 0)
|
||||
try { new ServerSocket(nextPort, 1, loopback) }
|
||||
catch { case _: Exception => createServer(attempts - 1) }
|
||||
else
|
||||
sys.error("Could not connect to socket: maximum attempts exceeded")
|
||||
createServer(10)
|
||||
}
|
||||
def server[T](f: IPC => Option[T]): T = serverImpl(makeServer, f)
|
||||
def server[T](port: Int)(f: IPC => Option[T]): T =
|
||||
serverImpl(new ServerSocket(port, 1, loopback), f)
|
||||
private def serverImpl[T](server: ServerSocket, f: IPC => Option[T]): T =
|
||||
{
|
||||
def listen(): T =
|
||||
{
|
||||
ipc(server.accept())(f) match {
|
||||
case Some(done) => done
|
||||
case None => listen()
|
||||
}
|
||||
}
|
||||
|
||||
try { listen() }
|
||||
finally { server.close() }
|
||||
}
|
||||
private def ipc[T](s: Socket)(f: IPC => T): T =
|
||||
try { f(new IPC(s)) }
|
||||
finally { s.close() }
|
||||
|
||||
final class Server private[IPC] (s: ServerSocket) extends NotNull {
|
||||
def port = s.getLocalPort
|
||||
def close() = s.close()
|
||||
def isClosed: Boolean = s.isClosed
|
||||
def connection[T](f: IPC => T): T = IPC.ipc(s.accept())(f)
|
||||
}
|
||||
}
|
||||
final class IPC private (s: Socket) extends NotNull {
|
||||
def port = s.getLocalPort
|
||||
private val in = new BufferedReader(new InputStreamReader(s.getInputStream))
|
||||
private val out = new BufferedWriter(new OutputStreamWriter(s.getOutputStream))
|
||||
|
||||
def send(s: String) = { out.write(s); out.newLine(); out.flush() }
|
||||
def receive: String = in.readLine()
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package sbt
|
|||
import java.io.File
|
||||
import Def.Classpath
|
||||
import scala.annotation.implicitNotFound
|
||||
import sbt.internal.util.Attributed
|
||||
|
||||
object Append {
|
||||
@implicitNotFound(msg = "No implicit for Append.Value[${A}, ${B}] found,\n so ${B} cannot be appended to ${A}")
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@ package sbt
|
|||
|
||||
final case class ConfigKey(name: String)
|
||||
object ConfigKey {
|
||||
implicit def configurationToKey(c: Configuration): ConfigKey = ConfigKey(c.name)
|
||||
implicit def configurationToKey(c: sbt.librarymanagement.Configuration): ConfigKey = ConfigKey(c.name)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
package sbt
|
||||
|
||||
import Types.const
|
||||
import complete.Parser
|
||||
import sbt.internal.util.Types.const
|
||||
import sbt.internal.util.{ Attributed, AttributeKey, Init, Show }
|
||||
import sbt.internal.util.complete.Parser
|
||||
import java.io.File
|
||||
import Scope.{ ThisScope, GlobalScope }
|
||||
import KeyRanks.{ DTask, Invisible }
|
||||
|
|
@ -59,7 +60,7 @@ object Def extends Init[Scope] with TaskMacroExtra {
|
|||
* A default Parser for splitting input into space-separated arguments.
|
||||
* `argLabel` is an optional, fixed label shown for an argument during tab completion.
|
||||
*/
|
||||
def spaceDelimited(argLabel: String = "<arg>"): Parser[Seq[String]] = complete.Parsers.spaceDelimited(argLabel)
|
||||
def spaceDelimited(argLabel: String = "<arg>"): Parser[Seq[String]] = sbt.internal.util.complete.Parsers.spaceDelimited(argLabel)
|
||||
|
||||
/** Lifts the result of a setting initialization into a Task. */
|
||||
def toITask[T](i: Initialize[T]): Initialize[Task[T]] = map(i)(std.TaskExtra.inlineTask)
|
||||
|
|
@ -117,4 +118,4 @@ trait TaskMacroExtra {
|
|||
implicit def macroValueIn[T](in: InputTask[T]): std.InputEvaluated[T] = ???
|
||||
implicit def parserToInput[T](in: Parser[T]): std.ParserInput[T] = ???
|
||||
implicit def stateParserToInput[T](in: State => Parser[T]): std.ParserInput[T] = ???
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
package sbt
|
||||
|
||||
import complete.Parser
|
||||
import sbt.internal.util.complete.Parser
|
||||
import Def.{ Initialize, ScopedKey }
|
||||
import std.TaskExtra.{ task => mktask, _ }
|
||||
import Task._
|
||||
import Types._
|
||||
import sbt.internal.util.{ ~>, AttributeKey, Types }
|
||||
import sbt.internal.util.Types._
|
||||
|
||||
/** Parses input and produces a task to run. Constructed using the companion object. */
|
||||
final class InputTask[T] private (val parser: State => Parser[Task[T]]) {
|
||||
|
|
@ -76,7 +77,7 @@ object InputTask {
|
|||
separate(p)(std.FullInstance.flattenFun[I, T](action))
|
||||
|
||||
/** A dummy parser that consumes no input and produces nothing useful (unit).*/
|
||||
def emptyParser: State => Parser[Unit] = Types.const(complete.DefaultParsers.success(()))
|
||||
def emptyParser: State => Parser[Unit] = Types.const(sbt.internal.util.complete.DefaultParsers.success(()))
|
||||
|
||||
/** Implementation detail that is public because it is used by a macro.*/
|
||||
def parserAsInput[T](p: Parser[T]): Initialize[State => Parser[T]] = Def.valueStrict(Types.const(p))
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ package sbt
|
|||
|
||||
import Def.{ Initialize, resolvedScoped, ScopedKey, Setting, streamsManagerKey }
|
||||
import Previous._
|
||||
import Types._
|
||||
import sbt.internal.util.{ ~>, AttributeKey, IMap, RMap }
|
||||
import sbt.internal.util.Types._
|
||||
|
||||
import java.io.{ InputStream, OutputStream }
|
||||
import sbinary.{ DefaultProtocol, Format }
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ package sbt
|
|||
import java.io.File
|
||||
import java.net.URI
|
||||
|
||||
import sbt.io.IO
|
||||
|
||||
// in all of these, the URI must be resolved and normalized before it is definitive
|
||||
|
||||
/** Identifies a project or build. */
|
||||
|
|
@ -101,4 +103,4 @@ object Reference {
|
|||
|
||||
@deprecated("Explicitly wrap the String in a call to LocalProject.", "0.13.0")
|
||||
implicit def stringToReference(s: String): ProjectReference = LocalProject(s)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ package sbt
|
|||
import java.io.File
|
||||
import java.net.URI
|
||||
|
||||
import sbt.internal.util.{ AttributeKey, AttributeMap, Dag }
|
||||
|
||||
import sbt.io.IO
|
||||
|
||||
final case class Scope(project: ScopeAxis[Reference], config: ScopeAxis[ConfigKey], task: ScopeAxis[AttributeKey[_]], extra: ScopeAxis[AttributeMap]) {
|
||||
def in(project: Reference, config: ConfigKey): Scope = copy(project = Select(project), config = Select(config))
|
||||
def in(config: ConfigKey, task: AttributeKey[_]): Scope = copy(config = Select(config), task = Select(task))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package sbt
|
||||
|
||||
import Types.some
|
||||
import sbt.internal.util.Types.some
|
||||
|
||||
sealed trait ScopeAxis[+S] {
|
||||
def foldStrict[T](f: S => T, ifGlobal: T, ifThis: T): T = fold(f, ifGlobal, ifThis)
|
||||
|
|
|
|||
|
|
@ -10,10 +10,12 @@ import java.net.URI
|
|||
|
||||
import ConcurrentRestrictions.Tag
|
||||
import Def.{ Initialize, KeyedInitialize, ScopedKey, Setting, setting }
|
||||
import sbt.io.{ FileFilter, Path, PathFinder }
|
||||
import Path._
|
||||
import std.TaskExtra.{ task => mktask, _ }
|
||||
import Task._
|
||||
import Types._
|
||||
import sbt.internal.util.Types._
|
||||
import sbt.internal.util.{ ~>, AList, AttributeKey, Settings, SourcePosition }
|
||||
|
||||
import language.experimental.macros
|
||||
import reflect.internal.annotations.compileTimeOnly
|
||||
|
|
@ -214,19 +216,20 @@ object Scoped {
|
|||
final class RichInitializeTask[S](i: Initialize[Task[S]]) extends RichInitTaskBase[S, Task] {
|
||||
protected def onTask[T](f: Task[S] => Task[T]): Initialize[Task[T]] = i apply f
|
||||
|
||||
def dependsOn(tasks: AnyInitTask*): Initialize[Task[S]] = (i, Initialize.joinAny[Task](tasks)) { (thisTask, deps) => thisTask.dependsOn(deps: _*) }
|
||||
def dependsOn(tasks: AnyInitTask*): Initialize[Task[S]] = (i, Initialize.joinAny[Task, Any](tasks)) { (thisTask, deps) => thisTask.dependsOn(deps: _*) }
|
||||
|
||||
def failure: Initialize[Task[Incomplete]] = i(_.failure)
|
||||
def result: Initialize[Task[Result[S]]] = i(_.result)
|
||||
|
||||
def triggeredBy(tasks: AnyInitTask*): Initialize[Task[S]] = nonLocal(tasks, Def.triggeredBy)
|
||||
def runBefore(tasks: AnyInitTask*): Initialize[Task[S]] = nonLocal(tasks, Def.runBefore)
|
||||
private[this] def nonLocal(tasks: Seq[AnyInitTask], key: AttributeKey[Seq[Task[_]]]): Initialize[Task[S]] =
|
||||
(Initialize.joinAny[Task](tasks), i) { (ts, i) => i.copy(info = i.info.set(key, ts)) }
|
||||
def xtriggeredBy[T](tasks: Initialize[Task[T]]*): Initialize[Task[S]] = nonLocal(tasks, Def.triggeredBy)
|
||||
def triggeredBy[T](tasks: Initialize[Task[T]]*): Initialize[Task[S]] = nonLocal(tasks, Def.triggeredBy)
|
||||
def runBefore[T](tasks: Initialize[Task[T]]*): Initialize[Task[S]] = nonLocal(tasks, Def.runBefore)
|
||||
private[this] def nonLocal[T](tasks: Seq[Initialize[Task[T]]], key: AttributeKey[Seq[Task[_]]]): Initialize[Task[S]] =
|
||||
(Initialize.joinAny[Task, T](tasks), i) { (ts, i) => i.copy(info = i.info.set(key, ts)) }
|
||||
}
|
||||
final class RichInitializeInputTask[S](i: Initialize[InputTask[S]]) extends RichInitTaskBase[S, InputTask] {
|
||||
protected def onTask[T](f: Task[S] => Task[T]): Initialize[InputTask[T]] = i(_ mapTask f)
|
||||
def dependsOn(tasks: AnyInitTask*): Initialize[InputTask[S]] = (i, Initialize.joinAny[Task](tasks)) { (thisTask, deps) => thisTask.mapTask(_.dependsOn(deps: _*)) }
|
||||
def dependsOn(tasks: AnyInitTask*): Initialize[InputTask[S]] = (i, Initialize.joinAny[Task, Any](tasks)) { (thisTask, deps) => thisTask.mapTask(_.dependsOn(deps: _*)) }
|
||||
}
|
||||
|
||||
sealed abstract class RichInitTaskBase[S, R[_]] {
|
||||
|
|
@ -256,7 +259,7 @@ object Scoped {
|
|||
def mapFailure[T](f: Incomplete => T): Initialize[R[T]] = mapR(f compose failM)
|
||||
}
|
||||
|
||||
type AnyInitTask = Initialize[Task[T]] forSome { type T }
|
||||
type AnyInitTask = Initialize[Task[Any]] // forSome { type T }
|
||||
|
||||
implicit def richTaskSeq[T](in: Seq[Initialize[Task[T]]]): RichTaskSeq[T] = new RichTaskSeq(in)
|
||||
final class RichTaskSeq[T](keys: Seq[Initialize[Task[T]]]) {
|
||||
|
|
@ -265,7 +268,7 @@ object Scoped {
|
|||
}
|
||||
implicit def richAnyTaskSeq(in: Seq[AnyInitTask]): RichAnyTaskSeq = new RichAnyTaskSeq(in)
|
||||
final class RichAnyTaskSeq(keys: Seq[AnyInitTask]) {
|
||||
def dependOn: Initialize[Task[Unit]] = Initialize.joinAny[Task](keys).apply(deps => nop.dependsOn(deps: _*))
|
||||
def dependOn: Initialize[Task[Unit]] = Initialize.joinAny[Task, Any](keys).apply(deps => nop.dependsOn(deps: _*))
|
||||
}
|
||||
|
||||
implicit def richFileSetting(s: SettingKey[File]): RichFileSetting = new RichFileSetting(s)
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import scala.reflect._
|
|||
import reflect.macros._
|
||||
|
||||
import Def.Initialize
|
||||
import complete.Parser
|
||||
import appmacro.{ Convert, Converted }
|
||||
import sbt.internal.util.complete.Parser
|
||||
import sbt.internal.util.appmacro.{ Convert, Converted }
|
||||
|
||||
object InputInitConvert extends Convert {
|
||||
def apply[T: c.WeakTypeTag](c: Context)(nme: String, in: c.Tree): Converted[c.type] =
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import reflect.macros._
|
|||
import reflect.internal.annotations.compileTimeOnly
|
||||
|
||||
import Def.{ Initialize, ScopedKey }
|
||||
import appmacro.ContextUtil
|
||||
import complete.Parser
|
||||
import sbt.internal.util.appmacro.ContextUtil
|
||||
import sbt.internal.util.complete.Parser
|
||||
|
||||
/** Implementation detail. The wrap methods temporarily hold inputs (as a Tree, at compile time) until a task or setting macro processes it. */
|
||||
object InputWrapper {
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@ package sbt
|
|||
package std
|
||||
|
||||
import Def.{ Initialize, Setting }
|
||||
import Types.{ idFun, Id }
|
||||
import appmacro.{ Convert, Converted, Instance, MixedBuilder, MonadInstance }
|
||||
import sbt.internal.util.Types.{ idFun, Id }
|
||||
import sbt.internal.util.AList
|
||||
import sbt.internal.util.appmacro.{ Convert, Converted, Instance, MixedBuilder, MonadInstance }
|
||||
|
||||
object InitializeInstance extends MonadInstance {
|
||||
type M[x] = Initialize[x]
|
||||
|
|
|
|||
|
|
@ -2,11 +2,12 @@ package sbt
|
|||
package std
|
||||
|
||||
import Def.{ Initialize, Setting }
|
||||
import Types.{ const, idFun, Id }
|
||||
import sbt.internal.util.Types.{ const, idFun, Id }
|
||||
import TaskExtra.allM
|
||||
import appmacro.{ ContextUtil, Convert, Converted, Instance, MixedBuilder, MonadInstance }
|
||||
import sbt.internal.util.appmacro.{ ContextUtil, Convert, Converted, Instance, MixedBuilder, MonadInstance }
|
||||
import Instance.Transform
|
||||
import complete.{ DefaultParsers, Parser }
|
||||
import sbt.internal.util.complete.{ DefaultParsers, Parser }
|
||||
import sbt.internal.util.{ AList, LinePosition, NoPosition, SourcePosition }
|
||||
|
||||
import language.experimental.macros
|
||||
import scala.reflect._
|
||||
|
|
@ -24,7 +25,7 @@ object TaskInstance extends MonadInstance {
|
|||
def pure[T](t: () => T): Task[T] = toTask(t)
|
||||
}
|
||||
object ParserInstance extends Instance {
|
||||
import sbt.Classes.Applicative
|
||||
import sbt.internal.util.Classes.Applicative
|
||||
private[this] implicit val parserApplicative: Applicative[M] = new Applicative[M] {
|
||||
def apply[S, T](f: M[S => T], v: M[S]): M[T] = s => (f(s) ~ v(s)) map { case (a, b) => a(b) }
|
||||
def pure[S](s: => S) = const(Parser.success(s))
|
||||
|
|
@ -39,7 +40,7 @@ object ParserInstance extends Instance {
|
|||
|
||||
/** Composes the Task and Initialize Instances to provide an Instance for [T] Initialize[Task[T]].*/
|
||||
object FullInstance extends Instance.Composed[Initialize, Task](InitializeInstance, TaskInstance) with MonadInstance {
|
||||
type SS = sbt.Settings[Scope]
|
||||
type SS = sbt.internal.util.Settings[Scope]
|
||||
val settingsData = TaskKey[SS]("settings-data", "Provides access to the project data for the build.", KeyRanks.DTask)
|
||||
|
||||
def flatten[T](in: Initialize[Task[Initialize[Task[T]]]]): Initialize[Task[T]] =
|
||||
|
|
@ -222,15 +223,15 @@ object TaskMacro {
|
|||
}
|
||||
private[this] def sourcePosition(c: Context): c.Expr[SourcePosition] =
|
||||
{
|
||||
import c.universe._
|
||||
import c.universe.reify
|
||||
val pos = c.enclosingPosition
|
||||
if (pos.isDefined && pos.line >= 0 && pos.source != null) {
|
||||
val f = pos.source.file
|
||||
val name = constant[String](c, settingSource(c, f.path, f.name))
|
||||
val line = constant[Int](c, pos.line)
|
||||
reify { sbt.LinePosition(name.splice, line.splice) }
|
||||
reify { LinePosition(name.splice, line.splice) }
|
||||
} else
|
||||
reify { sbt.NoPosition }
|
||||
reify { NoPosition }
|
||||
}
|
||||
private[this] def settingSource(c: Context, path: String, name: String): String =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package sbt
|
|||
import org.specs2._
|
||||
import Scope.{ ThisScope, GlobalScope, parseScopedKey }
|
||||
import java.net.URI
|
||||
import sbt.internal.util.AttributeKey
|
||||
|
||||
/**
|
||||
* http://www.scala-sbt.org/0.13/tutorial/Scopes.html
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
package sbt
|
||||
package std
|
||||
|
||||
import complete.{ DefaultParsers, Parsers }
|
||||
import sbt.internal.util.complete
|
||||
import sbt.internal.util.complete.{ DefaultParsers, Parsers }
|
||||
|
||||
/*object UseTask
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@ package sbt
|
|||
import java.io.File
|
||||
import java.net.{ MalformedURLException, URL }
|
||||
|
||||
import sbt.mavenint.SbtPomExtraProperties
|
||||
import sbt.internal.librarymanagement.mavenint.SbtPomExtraProperties
|
||||
import sbt.librarymanagement.ModuleID
|
||||
|
||||
import sbt.internal.util.Attributed
|
||||
import sbt.util.Logger
|
||||
|
||||
private[sbt] object APIMappings {
|
||||
def extract(cp: Seq[Attributed[File]], log: Logger): Seq[(File, URL)] =
|
||||
|
|
@ -32,4 +36,4 @@ private[sbt] object APIMappings {
|
|||
case None => attr
|
||||
case Some(u) => attr.put(Keys.entryApiURL, u)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,13 @@ package sbt
|
|||
import Def.{ showRelativeKey, ScopedKey }
|
||||
import Project.showContextKey
|
||||
import Keys.{ sessionSettings, thisProject }
|
||||
import complete.{ DefaultParsers, Parser }
|
||||
import sbt.internal.util.complete.{ DefaultParsers, Parser }
|
||||
import Aggregation.{ KeyValue, Values }
|
||||
import DefaultParsers._
|
||||
import Types.idFun
|
||||
import sbt.internal.util.Types.idFun
|
||||
import java.net.URI
|
||||
import CommandStrings.{ MultiTaskCommand, ShowCommand }
|
||||
import sbt.internal.util.{ AttributeEntry, AttributeKey, AttributeMap, IMap, Settings, Show, Util }
|
||||
|
||||
final class ParsedKey(val key: ScopedKey[_], val mask: ScopeMask)
|
||||
|
||||
|
|
@ -300,4 +301,4 @@ object Act {
|
|||
final object Omitted extends ParsedAxis[Nothing]
|
||||
final class ParsedValue[T](val value: T) extends ParsedAxis[T]
|
||||
def value[T](t: Parser[T]): Parser[ParsedAxis[T]] = t map { v => new ParsedValue(v) }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package sbt
|
||||
|
||||
import Types.const
|
||||
import sbt.internal.util.Types.const
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ package sbt
|
|||
|
||||
import Def.ScopedKey
|
||||
import Keys.{ aggregate, showSuccess, showTiming, timingFormat }
|
||||
import sbt.complete.Parser
|
||||
import sbt.internal.util.complete.Parser
|
||||
import sbt.internal.util.{ Dag, HList, Relation, Settings, Show, Util }
|
||||
import sbt.util.Logger
|
||||
import java.net.URI
|
||||
import Parser._
|
||||
import collection.mutable
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ package sbt
|
|||
import java.io.File
|
||||
import Keys.{ name, organization, thisProject, autoGeneratedProject }
|
||||
import Def.{ ScopedKey, Setting }
|
||||
import sbt.io.Hash
|
||||
import sbt.internal.util.Attributed
|
||||
|
||||
// name is more like BuildDefinition, but that is too long
|
||||
trait Build {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package sbt
|
||||
|
||||
import Types.idFun
|
||||
import sbt.internal.util.Types.idFun
|
||||
import sbt.internal.util.Dag
|
||||
import BuildDependencies._
|
||||
|
||||
final class BuildDependencies private (val classpath: DependencyMap[ClasspathDep[ProjectRef]], val aggregate: DependencyMap[ProjectRef]) {
|
||||
|
|
@ -26,4 +27,4 @@ object BuildDependencies {
|
|||
(ref, sorted dropRight 1)
|
||||
}
|
||||
val getID: ClasspathDep[ProjectRef] => ProjectRef = _.project
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,10 @@ package sbt
|
|||
import java.io.File
|
||||
import java.net.URI
|
||||
import BuildLoader._
|
||||
import Alternatives._
|
||||
import Types.{ const, idFun }
|
||||
import sbt.internal.io.Alternatives._
|
||||
import sbt.internal.util.Types.{ const, idFun }
|
||||
import sbt.util.Logger
|
||||
import sbt.librarymanagement.ModuleID
|
||||
|
||||
final class MultiHandler[S, T](builtIn: S => Option[T], root: Option[S => Option[T]], nonRoots: List[(URI, S => Option[T])], getURI: S => URI, log: S => Logger) {
|
||||
def applyFun: S => Option[T] = apply
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@ import java.io.File
|
|||
import java.net.URI
|
||||
import KeyRanks.DSetting
|
||||
|
||||
import sbt.io.{ GlobFilter, Path }
|
||||
import sbt.internal.util.AttributeKey
|
||||
import sbt.util.Logger
|
||||
|
||||
object BuildPaths {
|
||||
val globalBaseDirectory = AttributeKey[File]("global-base-directory", "The base directory for global sbt configuration and staging.", DSetting)
|
||||
val globalPluginsDirectory = AttributeKey[File]("global-plugins-directory", "The base directory for global sbt plugins.", DSetting)
|
||||
|
|
@ -57,7 +61,7 @@ object BuildPaths {
|
|||
def defaultGlobalBase = Path.userHome / ConfigDirectoryName
|
||||
|
||||
private[this] def binarySbtVersion(state: State): String =
|
||||
sbt.cross.CrossVersionUtil.binarySbtVersion(state.configuration.provider.id.version)
|
||||
sbt.internal.librarymanagement.cross.CrossVersionUtil.binarySbtVersion(state.configuration.provider.id.version)
|
||||
private[this] def defaultStaging(globalBase: File) = globalBase / "staging"
|
||||
private[this] def defaultGlobalPlugins(globalBase: File) = globalBase / PluginsDirectoryName
|
||||
private[this] def defaultDependencyBase(globalBase: File) = globalBase / "dependency"
|
||||
|
|
|
|||
|
|
@ -6,11 +6,13 @@ package sbt
|
|||
import java.io.File
|
||||
import java.net.URI
|
||||
import Def.{ displayFull, ScopedKey, ScopeLocal, Setting }
|
||||
import Attributed.data
|
||||
import BuildPaths.outputDirectory
|
||||
import Scope.GlobalScope
|
||||
import BuildStreams.Streams
|
||||
import Path._
|
||||
import sbt.io.Path._
|
||||
import sbt.internal.util.{ Attributed, AttributeEntry, AttributeKey, AttributeMap, Settings }
|
||||
import sbt.internal.util.Attributed.data
|
||||
import sbt.util.Logger
|
||||
|
||||
final class BuildStructure(val units: Map[URI, LoadedBuildUnit], val root: URI, val settings: Seq[Setting[_]], val data: Settings[Scope], val index: StructureIndex, val streams: State => Streams, val delegates: Scope => Seq[Scope], val scopeLocal: ScopeLocal) {
|
||||
val rootProject: URI => String = Load getRootProject units
|
||||
|
|
@ -250,4 +252,4 @@ object BuildStreams {
|
|||
refTarget(GlobalScope.copy(project = Select(ref)), fallbackBase, data)
|
||||
def refTarget(scope: Scope, fallbackBase: File, data: Settings[Scope]): File =
|
||||
(Keys.target in scope get data getOrElse outputDirectory(fallbackBase).asFile) / StreamsDirectory
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package sbt
|
||||
|
||||
import sbt.internal.util.{ Relation, Settings, Dag }
|
||||
|
||||
import java.net.URI
|
||||
|
||||
final class BuildUtil[Proj](
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import sbt.io.Path
|
||||
|
||||
object CommandStrings {
|
||||
/** The prefix used to identify a request to execute the remaining input on source changes.*/
|
||||
val AboutCommand = "about"
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import sbt.util.Logger
|
||||
import java.io.File
|
||||
|
||||
object ConsoleProject {
|
||||
|
|
@ -11,7 +12,8 @@ object ConsoleProject {
|
|||
val cpImports = new Imports(extracted, state)
|
||||
val bindings = ("currentState" -> state) :: ("extracted" -> extracted) :: ("cpHelpers" -> cpImports) :: Nil
|
||||
val unit = extracted.currentUnit
|
||||
val compiler = Compiler.compilers(ClasspathOptions.repl)(state.configuration, log).scalac
|
||||
// TODO: Fix this
|
||||
val compiler: sbt.compiler.AnalyzingCompiler = ??? //Compiler.compilers(ClasspathOptions.repl)(state.configuration, log).scalac
|
||||
val imports = BuildUtil.getImports(unit.unit) ++ BuildUtil.importAll(bindings.map(_._1))
|
||||
val importString = imports.mkString("", ";\n", ";\n\n")
|
||||
val initCommands = importString + extra
|
||||
|
|
|
|||
|
|
@ -4,13 +4,16 @@
|
|||
package sbt
|
||||
|
||||
import Keys._
|
||||
import complete.{ DefaultParsers, Parser }
|
||||
import sbt.internal.util.complete.{ DefaultParsers, Parser }
|
||||
import sbt.internal.util.AttributeKey
|
||||
import DefaultParsers._
|
||||
import Def.{ ScopedKey, Setting }
|
||||
import Scope.GlobalScope
|
||||
import CommandStrings.{ CrossCommand, crossHelp, SwitchCommand, switchHelp }
|
||||
import java.io.File
|
||||
|
||||
import sbt.io.IO
|
||||
|
||||
object Cross {
|
||||
@deprecated("Moved to CommandStrings.Switch", "0.13.0")
|
||||
final val Switch = CommandStrings.SwitchCommand
|
||||
|
|
@ -123,4 +126,4 @@ object Cross {
|
|||
def requireSession[T](p: State => Parser[T]): State => Parser[T] = s =>
|
||||
if (s get sessionSettings isEmpty) failure("No project loaded") else p(s)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,23 +4,31 @@
|
|||
package sbt
|
||||
|
||||
import scala.concurrent.duration.{ FiniteDuration, Duration }
|
||||
import Attributed.data
|
||||
import sbt.internal.util.Attributed
|
||||
import sbt.internal.util.Attributed.data
|
||||
import Scope.{ fillTaskAxis, GlobalScope, ThisScope }
|
||||
import sbt.Compiler.InputsWithPrevious
|
||||
import sbt.mavenint.{ PomExtraDependencyAttributes, SbtPomExtraProperties }
|
||||
import sbt.internal.librarymanagement.mavenint.{ PomExtraDependencyAttributes, SbtPomExtraProperties }
|
||||
import xsbt.api.Discovery
|
||||
import xsbti.compile.CompileOrder
|
||||
import Project.{ inConfig, inScope, inTask, richInitialize, richInitializeTask, richTaskSessionVar }
|
||||
import Def.{ Initialize, ScopedKey, Setting, SettingsDefinition }
|
||||
import Artifact.{ DocClassifier, SourceClassifier }
|
||||
import Configurations.{ Compile, CompilerPlugin, IntegrationTest, names, Provided, Runtime, Test }
|
||||
import CrossVersion.{ binarySbtVersion, binaryScalaVersion, partialVersion }
|
||||
import complete._
|
||||
import sbt.internal.librarymanagement.{ CustomPomParser, DependencyFilter }
|
||||
import sbt.librarymanagement.Artifact.{ DocClassifier, SourceClassifier }
|
||||
import sbt.librarymanagement.{ Configuration, Configurations, ConflictManager, CrossVersion, MavenRepository, Resolver, ScalaArtifacts, UpdateOptions }
|
||||
import sbt.librarymanagement.Configurations.{ Compile, CompilerPlugin, IntegrationTest, names, Provided, Runtime, Test }
|
||||
import sbt.librarymanagement.CrossVersion.{ binarySbtVersion, binaryScalaVersion, partialVersion }
|
||||
import sbt.internal.util.complete._
|
||||
import std.TaskExtra._
|
||||
import sbt.inc.{ Analysis, FileValueCache, IncOptions, Locate }
|
||||
import sbt.compiler.{ MixedAnalyzingCompiler, AggressiveCompile }
|
||||
import sbt.compiler.MixedAnalyzingCompiler
|
||||
import testing.{ Framework, Runner, AnnotatedFingerprint, SubclassFingerprint }
|
||||
|
||||
import sbt.librarymanagement._
|
||||
import sbt.internal.librarymanagement._
|
||||
import sbt.internal.util._
|
||||
import sbt.util.Level
|
||||
|
||||
import sys.error
|
||||
import scala.xml.NodeSeq
|
||||
import org.apache.ivy.core.module.{ descriptor, id }
|
||||
|
|
@ -29,10 +37,15 @@ import java.io.{ File, PrintWriter }
|
|||
import java.net.{ URI, URL, MalformedURLException }
|
||||
import java.util.concurrent.{ TimeUnit, Callable }
|
||||
import sbinary.DefaultProtocol.StringFormat
|
||||
import Cache.seqFormat
|
||||
import sbt.internal.util.Cache.seqFormat
|
||||
import sbt.util.Logger
|
||||
import CommandStrings.ExportStream
|
||||
|
||||
import Types._
|
||||
import sbt.internal.util.Types._
|
||||
|
||||
import sbt.internal.io.WatchState
|
||||
import sbt.io.{ AllPassFilter, FileFilter, GlobFilter, HiddenFileFilter, IO, NameFilter, NothingFilter, Path, PathFinder }
|
||||
|
||||
import Path._
|
||||
import Keys._
|
||||
|
||||
|
|
@ -225,7 +238,7 @@ object Defaults extends BuildCommon {
|
|||
|
||||
def compileBase = inTask(console)(compilersSetting :: Nil) ++ compileBaseGlobal ++ Seq(
|
||||
incOptions := incOptions.value.withNewClassfileManager(
|
||||
sbt.inc.ClassfileManager.transactional(crossTarget.value / "classes.bak", sbt.Logger.Null)),
|
||||
sbt.inc.ClassfileManager.transactional(crossTarget.value / "classes.bak", sbt.util.Logger.Null)),
|
||||
scalaInstance <<= scalaInstanceTask,
|
||||
crossVersion := (if (crossPaths.value) CrossVersion.binary else CrossVersion.Disabled),
|
||||
crossTarget := makeCrossTarget(target.value, scalaBinaryVersion.value, sbtBinaryVersion.value, sbtPlugin.value, crossPaths.value),
|
||||
|
|
@ -261,7 +274,8 @@ object Defaults extends BuildCommon {
|
|||
if (plugin) scalaBase / ("sbt-" + sbtv) else scalaBase
|
||||
}
|
||||
|
||||
def compilersSetting = compilers := Compiler.compilers(scalaInstance.value, classpathOptions.value, javaHome.value, ivyConfiguration.value)(appConfiguration.value, streams.value.log)
|
||||
// TODO: Fix source module
|
||||
def compilersSetting = compilers := Compiler.compilers(scalaInstance.value, classpathOptions.value, javaHome.value, ivyConfiguration.value, ???)(appConfiguration.value, streams.value.log)
|
||||
|
||||
lazy val configTasks = docTaskSettings(doc) ++ inTask(compile)(compileInputsSettings) ++ configGlobal ++ compileAnalysisSettings ++ Seq(
|
||||
compile <<= compileTask,
|
||||
|
|
@ -279,7 +293,7 @@ object Defaults extends BuildCommon {
|
|||
compileIncSetup <<= compileIncSetupTask,
|
||||
console <<= consoleTask,
|
||||
consoleQuick <<= consoleQuickTask,
|
||||
discoveredMainClasses <<= compile map discoverMainClasses storeAs discoveredMainClasses triggeredBy compile,
|
||||
discoveredMainClasses <<= compile map discoverMainClasses storeAs discoveredMainClasses xtriggeredBy compile,
|
||||
definedSbtPlugins <<= discoverPlugins,
|
||||
discoveredSbtPlugins <<= discoverSbtPluginNames,
|
||||
inTask(run)(runnerTask :: Nil).head,
|
||||
|
|
@ -390,7 +404,7 @@ object Defaults extends BuildCommon {
|
|||
val libraryJar = file(ScalaArtifacts.LibraryID)
|
||||
val compilerJar = file(ScalaArtifacts.CompilerID)
|
||||
val otherJars = allFiles.filterNot(x => x == libraryJar || x == compilerJar)
|
||||
ScalaInstance(scalaVersion.value, libraryJar, compilerJar, otherJars: _*)(makeClassLoader(state.value))
|
||||
new ScalaInstance(scalaVersion.value, makeClassLoader(state.value)(libraryJar :: compilerJar :: otherJars.toList), libraryJar, compilerJar, otherJars.toArray, None)
|
||||
}
|
||||
def scalaInstanceFromHome(dir: File): Initialize[Task[ScalaInstance]] = Def.task {
|
||||
ScalaInstance(dir)(makeClassLoader(state.value))
|
||||
|
|
@ -716,7 +730,7 @@ object Defaults extends BuildCommon {
|
|||
|
||||
def doClean(clean: Seq[File], preserve: Seq[File]): Unit =
|
||||
IO.withTemporaryDirectory { temp =>
|
||||
val (dirs, files) = preserve.filter(_.exists).flatMap(_.***.get).partition(_.isDirectory)
|
||||
val (dirs, files) = preserve.filter(_.exists).flatMap(_.allPaths.get).partition(_.isDirectory)
|
||||
val mappings = files.zipWithIndex map { case (f, i) => (f, new File(temp, i.toHexString)) }
|
||||
IO.move(mappings)
|
||||
IO.delete(clean)
|
||||
|
|
@ -810,7 +824,7 @@ object Defaults extends BuildCommon {
|
|||
(compilers in task, classpath in task, scalacOptions in task, initialCommands in task, cleanupCommands in task, taskTemporaryDirectory in task, scalaInstance in task, streams) map {
|
||||
(cs, cp, options, initCommands, cleanup, temp, si, s) =>
|
||||
val cpFiles = data(cp)
|
||||
val fullcp = (cpFiles ++ si.jars).distinct
|
||||
val fullcp = (cpFiles ++ si.allJars).distinct
|
||||
val loader = sbt.classpath.ClasspathUtilities.makeLoader(fullcp, si, IO.createUniqueDirectory(temp))
|
||||
val compiler = cs.scalac.onArgs(exported(s, "scala"))
|
||||
(new Console(compiler))(cpFiles, options, loader, initCommands, cleanup)()(s.log).foreach(msg => sys.error(msg))
|
||||
|
|
@ -1370,7 +1384,7 @@ object Classpaths {
|
|||
case _ => Nil
|
||||
}
|
||||
val subScalaJars: String => Seq[File] = Defaults.unmanagedScalaInstanceOnly.value match {
|
||||
case Some(si) => subUnmanaged(si.version, si.jars)
|
||||
case Some(si) => subUnmanaged(si.version, si.allJars)
|
||||
case None => sv => if (scalaProvider.version == sv) scalaProvider.jars else Nil
|
||||
}
|
||||
val transform: UpdateReport => UpdateReport = r => substituteScalaFiles(scalaOrganization.value, r)(subScalaJars)
|
||||
|
|
@ -1746,7 +1760,7 @@ object Classpaths {
|
|||
|
||||
@deprecated("Directly provide the jar files per Scala version.", "0.13.0")
|
||||
def substituteScalaFiles(scalaInstance: ScalaInstance, scalaOrg: String, report: UpdateReport): UpdateReport =
|
||||
substituteScalaFiles(scalaOrg, report)(const(scalaInstance.jars))
|
||||
substituteScalaFiles(scalaOrg, report)(const(scalaInstance.allJars))
|
||||
|
||||
def substituteScalaFiles(scalaOrg: String, report: UpdateReport)(scalaJars: String => Seq[File]): UpdateReport =
|
||||
report.substitute { (configuration, module, arts) =>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import sbt.internal.util.{ complete, AttributeEntry, AttributeKey, LineRange, MessageOnlyException, RangePosition, Settings }
|
||||
|
||||
import java.io.File
|
||||
import compiler.{ Eval, EvalImports }
|
||||
import complete.DefaultParsers.validID
|
||||
|
|
@ -12,6 +14,8 @@ import sbt.internals.parser.SbtParser
|
|||
|
||||
import scala.annotation.tailrec
|
||||
|
||||
import sbt.io.IO
|
||||
|
||||
/**
|
||||
* This file is responsible for compiling the .sbt files used to configure sbt builds.
|
||||
*
|
||||
|
|
@ -311,4 +315,4 @@ object Index {
|
|||
private[this] def update(map: TriggerMap, base: Task[_], tasksOpt: Option[Seq[Task[_]]]): Unit =
|
||||
for (tasks <- tasksOpt; task <- tasks)
|
||||
map(task) = base +: map.getOrElse(task, Nil)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import sbt.internal.util.{ ErrorHandling, RMap, Show, Signals, Types }
|
||||
import sbt.util.Logger
|
||||
import sbt.librarymanagement.{ Resolver, UpdateReport }
|
||||
|
||||
import scala.concurrent.duration.Duration
|
||||
import java.io.File
|
||||
import Def.{ displayFull, dummyState, ScopedKey, Setting }
|
||||
|
|
@ -10,7 +14,8 @@ import Keys.{ streams, Streams, TaskStreams }
|
|||
import Keys.{ dummyRoots, dummyStreamsManager, executionRoots, pluginData, streamsManager, taskDefinitionKey, transformState }
|
||||
import Project.richInitializeTask
|
||||
import Scope.{ GlobalScope, ThisScope }
|
||||
import Types.const
|
||||
import sbt.internal.util.Types.const
|
||||
import sbt.internal.util.{ Attributed, HList }
|
||||
import scala.Console.RED
|
||||
import std.Transform.{ DummyTaskMap, TaskAndValue }
|
||||
import TaskName._
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ package sbt
|
|||
import Project._
|
||||
import Scope.GlobalScope
|
||||
import Def.{ ScopedKey, Setting }
|
||||
import sbt.complete.Parser
|
||||
import sbt.internal.util.complete.Parser
|
||||
import sbt.internal.util.{ AttributeKey, Show }
|
||||
import std.Transform.DummyTaskMap
|
||||
|
||||
final case class Extracted(structure: BuildStructure, session: SessionSettings, currentRef: ProjectRef)(implicit val showKey: Show[ScopedKey[_]]) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package sbt
|
|||
import java.util.concurrent.atomic.AtomicLong
|
||||
import scala.concurrent.duration._
|
||||
import scala.util.control.NonFatal
|
||||
import sbt.util.Logger
|
||||
|
||||
private[sbt] object GCUtil {
|
||||
// Returns the default force garbage collection flag,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package sbt
|
||||
|
||||
import sbt.librarymanagement.{ Configuration, Configurations, ModuleID, Resolver, SbtArtifacts, UpdateReport }
|
||||
import sbt.internal.util.Attributed
|
||||
|
||||
import Load.{ BuildStructure => _, _ }
|
||||
import Def.{ ScopedKey, Setting }
|
||||
import Scoped._
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package sbt
|
||||
|
||||
import sbt.internal.util.{ AttributeKey, complete, Types }
|
||||
|
||||
import complete.{ DefaultParsers, Parser }
|
||||
import DefaultParsers._
|
||||
import Def.ScopedKey
|
||||
|
|
|
|||
|
|
@ -3,12 +3,19 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import sbt.internal.util.Attributed
|
||||
import sbt.util.{ Level, Logger }
|
||||
|
||||
import sbt.librarymanagement.{ Configurations, CrossVersion, MavenRepository, ModuleID, Resolver }
|
||||
|
||||
import java.io.File
|
||||
import Attributed.blankSeq
|
||||
import Configurations.Compile
|
||||
import Def.Setting
|
||||
import Keys._
|
||||
|
||||
import sbt.io.IO
|
||||
|
||||
object IvyConsole {
|
||||
final val Name = "ivy-console"
|
||||
lazy val command =
|
||||
|
|
|
|||
|
|
@ -3,10 +3,13 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import sbt.internal.util.Relation
|
||||
|
||||
import java.net.URI
|
||||
import Def.ScopedKey
|
||||
import complete.DefaultParsers.validID
|
||||
import Types.{ idFun, some }
|
||||
import sbt.internal.util.complete.DefaultParsers.validID
|
||||
import sbt.internal.util.Types.{ idFun, some }
|
||||
import sbt.internal.util.AttributeKey
|
||||
|
||||
object KeyIndex {
|
||||
def empty: ExtendableKeyIndex = new KeyIndex0(emptyBuildIndex)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import java.io.File
|
|||
import java.net.URL
|
||||
import scala.concurrent.duration.{ FiniteDuration, Duration }
|
||||
import Def.ScopedKey
|
||||
import complete._
|
||||
import sbt.internal.util.complete._
|
||||
import inc.Analysis
|
||||
import inc.Locate.DefinesClass
|
||||
import sbt.compiler.MixedAnalyzingCompiler
|
||||
|
|
@ -17,10 +17,53 @@ import scala.xml.{ Node => XNode, NodeSeq }
|
|||
import org.apache.ivy.core.module.{ descriptor, id }
|
||||
import descriptor.ModuleDescriptor, id.ModuleRevisionId
|
||||
import testing.Framework
|
||||
import Configurations.CompilerPlugin
|
||||
import Types.Id
|
||||
import sbt.internal.util.Types.Id
|
||||
import KeyRanks._
|
||||
|
||||
import sbt.io.FileFilter
|
||||
import sbt.internal.io.WatchState
|
||||
import sbt.internal.util.AttributeKey
|
||||
|
||||
import sbt.librarymanagement.Configurations.CompilerPlugin
|
||||
import sbt.librarymanagement.{
|
||||
Artifact,
|
||||
Configuration,
|
||||
ConflictManager,
|
||||
ConflictWarning,
|
||||
Credentials,
|
||||
CrossVersion,
|
||||
Developer,
|
||||
EvictionWarning,
|
||||
EvictionWarningOptions,
|
||||
IvyScala,
|
||||
MavenRepository,
|
||||
ModuleConfiguration,
|
||||
ModuleID,
|
||||
ModuleInfo,
|
||||
Resolver,
|
||||
ScalaVersion,
|
||||
ScmInfo,
|
||||
UpdateOptions,
|
||||
UpdateReport
|
||||
}
|
||||
import sbt.internal.librarymanagement.{
|
||||
DeliverConfiguration,
|
||||
GetClassifiersModule,
|
||||
IvyConfiguration,
|
||||
IvyPaths,
|
||||
IvySbt,
|
||||
MakePomConfiguration,
|
||||
ModuleSettings,
|
||||
PublishConfiguration,
|
||||
RetrieveConfiguration,
|
||||
SbtExclusionRule,
|
||||
UnresolvedWarningConfiguration,
|
||||
UpdateConfiguration,
|
||||
UpdateLogging
|
||||
}
|
||||
import sbt.util.{ AbstractLogger, Level, Logger }
|
||||
import sbt.internal.util.SourcePosition
|
||||
|
||||
object Keys {
|
||||
val TraceValues = "-1 to disable, 0 for up to the first sbt frame, or a positive number to set the maximum number of frames shown."
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import sbt.internal.util.{ Settings, Show, ~> }
|
||||
import sbt.librarymanagement.{ Configuration, Configurations }
|
||||
|
||||
import java.io.File
|
||||
import java.net.{ URI, URL }
|
||||
import compiler.{ Eval, EvalImports }
|
||||
|
|
@ -16,12 +19,16 @@ import Def.{ isDummy, ScopedKey, ScopeLocal, Setting }
|
|||
import Keys.{ appConfiguration, baseDirectory, configuration, fullResolvers, fullClasspath, pluginData, streams, thisProject, thisProjectRef, update }
|
||||
import Keys.{ exportedProducts, loadedBuild, onLoadMessage, resolvedScoped, sbtPlugin, scalacOptions, taskDefinitionKey }
|
||||
import tools.nsc.reporters.ConsoleReporter
|
||||
import Attributed.data
|
||||
import sbt.internal.util.Attributed
|
||||
import sbt.internal.util.Attributed.data
|
||||
import Scope.{ GlobalScope, ThisScope }
|
||||
import Types.const
|
||||
import sbt.internal.util.Types.const
|
||||
import BuildPaths._
|
||||
import BuildStreams._
|
||||
import Locate.DefinesClass
|
||||
import sbt.io.{ GlobFilter, IO, Path }
|
||||
import sbt.internal.io.Alternatives
|
||||
import sbt.util.Logger
|
||||
|
||||
object Load {
|
||||
// note that there is State passed in but not pulled out
|
||||
|
|
@ -44,7 +51,8 @@ object Load {
|
|||
val stagingDirectory = getStagingDirectory(state, globalBase).getCanonicalFile
|
||||
val loader = getClass.getClassLoader
|
||||
val classpath = Attributed.blankSeq(provider.mainClasspath ++ scalaProvider.jars)
|
||||
val compilers = Compiler.compilers(ClasspathOptions.boot)(state.configuration, log)
|
||||
// TODO: Fix this
|
||||
val compilers = ??? //Compiler.compilers(ClasspathOptions.boot)(state.configuration, log)
|
||||
val evalPluginDef = EvaluateTask.evalPluginDef(log) _
|
||||
val delegates = defaultDelegates
|
||||
val initialID = baseDirectory.getName
|
||||
|
|
@ -259,7 +267,7 @@ object Load {
|
|||
if (keepSet.nonEmpty) {
|
||||
def keepFile(f: File) = keepSet(f.getCanonicalPath)
|
||||
import Path._
|
||||
val existing = (baseTarget.***.get).filterNot(_.isDirectory)
|
||||
val existing = (baseTarget.allPaths.get).filterNot(_.isDirectory)
|
||||
val toDelete = existing.filterNot(keepFile)
|
||||
if (toDelete.nonEmpty) {
|
||||
IO.delete(toDelete)
|
||||
|
|
|
|||
|
|
@ -9,10 +9,12 @@ import LogManager._
|
|||
import std.Transform
|
||||
import Def.ScopedKey
|
||||
import Scope.GlobalScope
|
||||
import MainLogging._
|
||||
import BasicKeys.explicitGlobalLogLevels
|
||||
import Keys.{ logLevel, logManager, persistLogLevel, persistTraceLevel, sLog, state, traceLevel }
|
||||
import scala.Console.{ BLUE, RESET }
|
||||
import sbt.internal.util.{ AttributeKey, ConsoleOut, MultiLoggerConfig, Settings, SuppressedTraceContext }
|
||||
import sbt.internal.util.MainLogging._
|
||||
import sbt.util.{ AbstractLogger, Level, Logger }
|
||||
|
||||
object LogManager {
|
||||
def construct(data: Settings[Scope], state: State) = (task: ScopedKey[_], to: PrintWriter) =>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import sbt.internal.util.{ AttributeKey, AttributeMap, complete, ConsoleOut, GlobalLogging, LineRange, MainLogging, SimpleReader, Types }
|
||||
import sbt.util.{ Level, Logger }
|
||||
|
||||
import complete.{ DefaultParsers, Parser }
|
||||
import compiler.{ CompilerCache, EvalImports }
|
||||
import Types.{ const, idFun }
|
||||
|
|
@ -10,7 +13,8 @@ import Aggregation.AnyKeys
|
|||
import Project.LoadAction
|
||||
|
||||
import scala.annotation.tailrec
|
||||
import Path._
|
||||
import sbt.io.IO
|
||||
import sbt.io.Path._
|
||||
import StandardMain._
|
||||
|
||||
import java.io.File
|
||||
|
|
|
|||
|
|
@ -3,9 +3,13 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import sbt.librarymanagement.{ Credentials, MavenRepository, Resolver }
|
||||
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
|
||||
import sbt.io.Path
|
||||
|
||||
/** Options for well-known tasks. */
|
||||
object Opts {
|
||||
object compile {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import sbt.internal.util.{ Show, Types }
|
||||
|
||||
import java.util.regex.Pattern
|
||||
import java.io.File
|
||||
import Keys.{ Streams, TaskStreams }
|
||||
|
|
@ -12,6 +14,8 @@ import Types.idFun
|
|||
import Highlight.{ bold, showMatches }
|
||||
import annotation.tailrec
|
||||
|
||||
import sbt.io.IO
|
||||
|
||||
object Output {
|
||||
final val DefaultTail = "> "
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
package sbt
|
||||
|
||||
import sbt.internal.util.Attributed
|
||||
|
||||
import java.io.File
|
||||
import java.net.URL
|
||||
import Attributed.data
|
||||
import Build.analyzed
|
||||
import xsbt.api.{ Discovered, Discovery }
|
||||
|
||||
import sbt.io.IO
|
||||
|
||||
object PluginDiscovery {
|
||||
/**
|
||||
* Relative paths of resources that list top-level modules that are available.
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package sbt
|
|||
import Keys.Classpath
|
||||
import Def.Setting
|
||||
import PluginManagement._
|
||||
import sbt.librarymanagement.ModuleID
|
||||
|
||||
import java.net.{ URI, URL, URLClassLoader }
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,14 @@ TODO:
|
|||
- error message when a task doesn't exist that it would be provided by plugin x, enabled by natures y,z, blocked by a, b
|
||||
*/
|
||||
|
||||
import logic.{Atom, Clause, Clauses, Formula, Literal, Logic, Negated}
|
||||
import sbt.librarymanagement.Configuration
|
||||
|
||||
import sbt.internal.util.logic.{Atom, Clause, Clauses, Formula, Literal, Logic, Negated}
|
||||
import Logic.{CyclicNegation, InitialContradictions, InitialOverlap, LogicException}
|
||||
import Def.Setting
|
||||
import Plugins._
|
||||
import annotation.tailrec
|
||||
import sbt.util.Logger
|
||||
|
||||
/**
|
||||
* An AutoPlugin defines a group of settings and the conditions where the settings are automatically added to a build (called "activation").
|
||||
|
|
@ -334,7 +337,7 @@ ${listConflicts(conflicting)}""")
|
|||
|
||||
private[sbt] def hasAutoImportGetter(ap: AutoPlugin, loader: ClassLoader): Boolean = {
|
||||
import reflect.runtime.{universe => ru}
|
||||
import util.control.Exception.catching
|
||||
import scala.util.control.Exception.catching
|
||||
val m = ru.runtimeMirror(loader)
|
||||
val im = m.reflect(ap)
|
||||
val hasGetterOpt = catching(classOf[ScalaReflectionException]) opt {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package sbt
|
||||
|
||||
import sbt.internal.util.{ AttributeKey, Dag, Relation, Util }
|
||||
import sbt.util.Logger
|
||||
|
||||
import Def.Setting
|
||||
import Plugins._
|
||||
import PluginsDebug._
|
||||
|
|
@ -372,4 +375,4 @@ private[sbt] object PluginsDebug {
|
|||
s"There is no way to enable plugin ${plugin.label}. It (or its dependencies) requires plugin ${contradiction.label} to both be present and absent. Please report the problem to the plugin's author."
|
||||
private[this] def pluginImpossibleN(plugin: AutoPlugin)(contradictions: List[AutoPlugin]): String =
|
||||
s"There is no way to enable plugin ${plugin.label}. It (or its dependencies) requires these plugins to be both present and absent:\n\t${labels(contradictions).mkString("\n\t")}\nPlease report the problem to the plugin's author."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,11 @@ import Project.{ Initialize => _, Setting => _, _ }
|
|||
import Keys.{ appConfiguration, stateBuildStructure, commands, configuration, historyPath, projectCommand, sessionSettings, shellPrompt, thisProject, thisProjectRef, watch }
|
||||
import Scope.{ GlobalScope, ThisScope }
|
||||
import Def.{ Flattened, Initialize, ScopedKey, Setting }
|
||||
import Types.{ const, idFun }
|
||||
import complete.DefaultParsers
|
||||
import sbt.internal.util.Types.{ const, idFun }
|
||||
import sbt.internal.util.complete.DefaultParsers
|
||||
import sbt.librarymanagement.Configuration
|
||||
|
||||
import sbt.internal.util.{ AttributeKey, AttributeMap, Dag, Relation, Settings, Show, ~> }
|
||||
|
||||
import language.experimental.macros
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import sbt.internal.util.complete
|
||||
|
||||
import ProjectNavigation._
|
||||
import Project.updateCurrent
|
||||
import Keys.sessionSettings
|
||||
|
|
@ -66,4 +68,4 @@ final class ProjectNavigation(s: State) {
|
|||
}
|
||||
def rootRef = ProjectRef(currentRef.build, getRoot(currentRef.build))
|
||||
val command: Parser[() => State] = Command.applyEffect(parser)(apply)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package sbt
|
||||
|
||||
import sbt.internal.util.AttributeKey
|
||||
|
||||
import java.net.URI
|
||||
|
||||
object Resolve {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
package sbt
|
||||
|
||||
import sbt.internal.librarymanagement.StringUtilities
|
||||
|
||||
import sbt.io.{ Hash, IO }
|
||||
|
||||
import java.io.File
|
||||
import java.net.URI
|
||||
|
||||
|
|
@ -11,6 +15,8 @@ import BuildLoader.ResolveInfo
|
|||
import RichURI.fromURI
|
||||
import java.util.Locale
|
||||
|
||||
import scala.sys.process.Process
|
||||
|
||||
object Resolvers {
|
||||
type Resolver = BuildLoader.Resolver
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
/* sbt -- Simple Build Tool
|
||||
* Copyright 2011 Sanjin Sehic
|
||||
*/
|
||||
|
||||
package sbt
|
||||
|
||||
import java.net.URI
|
||||
|
||||
/** Extends `URI` with additional convenience methods. */
|
||||
class RichURI(uri: URI) {
|
||||
/**
|
||||
* Provides a case-class-like `copy` method for URI.
|
||||
* Note that this method simply passes the individual components of this URI to the URI constructor
|
||||
* that accepts each component individually. It is thus limited by the implementation restrictions of the relevant methods.
|
||||
*/
|
||||
def copy(scheme: String = uri.getScheme, userInfo: String = uri.getUserInfo,
|
||||
host: String = uri.getHost, port: Int = uri.getPort, path: String = uri.getPath,
|
||||
query: String = uri.getQuery, fragment: String = uri.getFragment) =
|
||||
new URI(scheme, userInfo, host, port, path, query, fragment)
|
||||
|
||||
/** Returns `true` if the fragment of the URI is defined. */
|
||||
def hasFragment = uri.getFragment ne null
|
||||
|
||||
/** Returns a copy of the URI without the fragment. */
|
||||
def withoutFragment =
|
||||
if (hasFragment)
|
||||
new URI(uri.getScheme, uri.getSchemeSpecificPart, null)
|
||||
else
|
||||
uri
|
||||
|
||||
/** Returns `true` if the scheme specific part of the URI is also a valid URI. */
|
||||
def hasMarkerScheme = new URI(uri.getRawSchemeSpecificPart).getScheme ne null
|
||||
|
||||
/**
|
||||
* Strips the wrapper scheme from this URI.
|
||||
* If the URI has a fragment, the fragment is transferred to the wrapped URI.
|
||||
* If this URI does not have a marker scheme, it is returned unchanged.
|
||||
*/
|
||||
def withoutMarkerScheme =
|
||||
{
|
||||
if (hasMarkerScheme)
|
||||
if (hasFragment)
|
||||
new URI(uri.getRawSchemeSpecificPart + "#" + uri.getRawFragment)
|
||||
else
|
||||
new URI(uri.getRawSchemeSpecificPart)
|
||||
else
|
||||
uri
|
||||
}
|
||||
}
|
||||
|
||||
object RichURI {
|
||||
/** Provides additional convenience methods for `uri`. */
|
||||
implicit def fromURI(uri: URI): RichURI = new RichURI(uri)
|
||||
}
|
||||
|
|
@ -1,5 +1,9 @@
|
|||
package sbt
|
||||
|
||||
import sbt.internal.util.{ AttributeKey, Dag, Types }
|
||||
|
||||
import sbt.librarymanagement.Configuration
|
||||
|
||||
import Types.{ const, idFun }
|
||||
import Def.Initialize
|
||||
import java.net.URI
|
||||
|
|
@ -213,4 +217,4 @@ object ScopeFilter {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package sbt
|
|||
import Def.ScopedKey
|
||||
|
||||
final case class ScopedKeyData[A](scoped: ScopedKey[A], value: Any) {
|
||||
import Types.const
|
||||
import sbt.internal.util.Types.const
|
||||
val key = scoped.key
|
||||
val scope = scoped.scope
|
||||
def typeName: String = fold(fmtMf("Task[%s]"), fmtMf("InputTask[%s]"), key.manifest.toString)
|
||||
|
|
|
|||
|
|
@ -3,11 +3,17 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import sbt.librarymanagement.Configurations
|
||||
|
||||
import sbt.util.Level
|
||||
|
||||
import java.io.File
|
||||
import Keys._
|
||||
import EvaluateConfigurations.{ evaluateConfiguration => evaluate }
|
||||
import Configurations.Compile
|
||||
|
||||
import sbt.io.{ Hash, IO }
|
||||
|
||||
object Script {
|
||||
final val Name = "script"
|
||||
lazy val command =
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import sbt.internal.util.{ complete, LineRange, RangePosition, Types }
|
||||
|
||||
import java.io.File
|
||||
import java.net.URI
|
||||
import Def.{ ScopedKey, Setting }
|
||||
|
|
@ -12,6 +14,8 @@ import compiler.Eval
|
|||
import SessionSettings._
|
||||
import sbt.internals.parser.SbtRefactorings
|
||||
|
||||
import sbt.io.IO
|
||||
|
||||
/**
|
||||
* Represents (potentially) transient settings added into a build via commands/user.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package sbt
|
||||
|
||||
import sbt.internal.util.{ AttributeMap, IMap, Types }
|
||||
|
||||
import Def.ScopedKey
|
||||
import Types.Id
|
||||
import Keys.sessionVars
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
package sbt
|
||||
|
||||
import sbt.internal.util.{ AttributeKey, complete, Relation, Settings, Show, Types, Util }
|
||||
|
||||
import sbt.librarymanagement.Configuration
|
||||
|
||||
import java.io.File
|
||||
import java.net.URI
|
||||
import Project._
|
||||
|
|
|
|||
|
|
@ -3,11 +3,15 @@
|
|||
*/
|
||||
package sbt
|
||||
|
||||
import sbt.internal.util.Show
|
||||
|
||||
import java.net.URI
|
||||
import java.io.File
|
||||
import Def.{ compiled, flattenLocals, ScopedKey }
|
||||
import Predef.{ any2stringadd => _, _ }
|
||||
|
||||
import sbt.io.IO
|
||||
|
||||
object SettingGraph {
|
||||
def apply(structure: BuildStructure, basedir: File, scoped: ScopedKey[_], generation: Int)(implicit display: Show[ScopedKey[_]]): SettingGraph =
|
||||
{
|
||||
|
|
@ -57,7 +61,8 @@ object Graph {
|
|||
// [info] +-quux
|
||||
def toAscii[A](top: A, children: A => Seq[A], display: A => String): String = {
|
||||
val defaultWidth = 40
|
||||
val maxColumn = math.max(JLine.usingTerminal(_.getWidth), defaultWidth) - 8
|
||||
// TODO: Fix JLine
|
||||
val maxColumn = math.max( /*JLine.usingTerminal(_.getWidth)*/ 0, defaultWidth) - 8
|
||||
val twoSpaces = " " + " " // prevent accidentally being converted into a tab
|
||||
def limitLine(s: String): String =
|
||||
if (s.length > maxColumn) s.slice(0, maxColumn - 2) + ".."
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package sbt
|
||||
|
||||
import sbt.internal.util.RMap
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import TaskName._
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package sbt
|
||||
|
||||
import sbt.librarymanagement.Configuration
|
||||
|
||||
import internals.{
|
||||
DslEntry,
|
||||
DslConfigs,
|
||||
|
|
@ -12,4 +14,4 @@ package object dsl {
|
|||
def disablePlugins(ps: AutoPlugin*): DslEntry = DslDisablePlugins(ps)
|
||||
def configs(cs: Configuration*): DslEntry = DslConfigs(cs)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
package sbt
|
||||
package internals
|
||||
|
||||
import sbt.internal.util.RangePosition
|
||||
|
||||
import sbt.librarymanagement.Configuration
|
||||
|
||||
import Def._
|
||||
|
||||
/** This reprsents a `Setting` expression configured by the sbt DSL. */
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package sbt
|
|||
package internals
|
||||
package parser
|
||||
|
||||
import sbt.internal.util.{ LineRange, MessageOnlyException }
|
||||
|
||||
import java.io.File
|
||||
|
||||
import sbt.internals.parser.SbtParser._
|
||||
|
|
@ -130,8 +132,8 @@ private[sbt] case class SbtParser(file: File, lines: Seq[String]) extends Parsed
|
|||
* @return originalStatement or originalStatement with missing bracket
|
||||
*/
|
||||
def parseStatementAgain(t: Tree, originalStatement: String): String = {
|
||||
val statement = util.Try(toolbox.parse(originalStatement)) match {
|
||||
case util.Failure(th) =>
|
||||
val statement = scala.util.Try(toolbox.parse(originalStatement)) match {
|
||||
case scala.util.Failure(th) =>
|
||||
val missingText = findMissingText(content, t.pos.end, t.pos.line, fileName, th)
|
||||
originalStatement + missingText
|
||||
case _ =>
|
||||
|
|
@ -215,10 +217,10 @@ private[sbt] object MissingBracketHandler {
|
|||
case Some(index) =>
|
||||
val text = content.substring(positionEnd, index + 1)
|
||||
val textWithoutBracket = text.substring(0, text.length - 1)
|
||||
util.Try(SbtParser(FAKE_FILE, textWithoutBracket.lines.toSeq)) match {
|
||||
case util.Success(_) =>
|
||||
scala.util.Try(SbtParser(FAKE_FILE, textWithoutBracket.lines.toSeq)) match {
|
||||
case scala.util.Success(_) =>
|
||||
text
|
||||
case util.Failure(th) =>
|
||||
case scala.util.Failure(th) =>
|
||||
findMissingText(content, index + 1, positionLine, fileName, originalException)
|
||||
}
|
||||
case _ =>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package sbt
|
||||
package plugins
|
||||
|
||||
import sbt.librarymanagement.Configurations
|
||||
|
||||
import Def.Setting
|
||||
import Keys._
|
||||
import Project.inConfig
|
||||
|
|
@ -26,4 +28,4 @@ object JUnitXmlReportPlugin extends AutoPlugin {
|
|||
Seq(
|
||||
testListeners += new JUnitXmlTestsListener(target.value.getAbsolutePath)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package sbt
|
||||
package plugins
|
||||
|
||||
import sbt.librarymanagement.{ Configuration, Configurations }
|
||||
|
||||
import Def.Setting
|
||||
|
||||
/** A plugin representing the ability to build a JVM project.
|
||||
|
|
@ -34,4 +36,4 @@ object JvmPlugin extends AutoPlugin {
|
|||
|
||||
override def projectConfigurations: Seq[Configuration] =
|
||||
Configurations.default
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package sbt
|
||||
|
||||
import Project._
|
||||
import Types.{ idFun, some }
|
||||
import sbt.internal.util.Types.{ idFun, some }
|
||||
import TestBuild._
|
||||
|
||||
import java.io.File
|
||||
|
|
@ -70,4 +70,4 @@ object Delegates extends Properties("delegates") {
|
|||
}
|
||||
all(loop(s, Nil, modAndIdent).map(ds contains _: Prop): _*)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package sbt
|
|||
import Def.{ displayFull, displayMasked, ScopedKey }
|
||||
import java.net.URI
|
||||
import TestBuild._
|
||||
import complete._
|
||||
import sbt.internal.util.complete._
|
||||
|
||||
import org.scalacheck._
|
||||
import Gen._
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import java.io._
|
|||
|
||||
import org.specs2.mutable.Specification
|
||||
|
||||
import sbt.internal.util.{ AttributeEntry, AttributeMap, ConsoleOut, GlobalLogging, MainLogging, Settings }
|
||||
|
||||
object PluginCommandTestPlugin0 extends AutoPlugin
|
||||
|
||||
package subpackage {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package sbt
|
|||
import java.io.File
|
||||
import org.specs2._
|
||||
import mutable.Specification
|
||||
import sbt.util.Logger
|
||||
|
||||
object PluginsTest extends Specification
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
package sbt
|
||||
|
||||
import Def.{ ScopedKey, Setting }
|
||||
import Types.{ const, idFun, some }
|
||||
import complete.Parser
|
||||
import sbt.internal.util.{ AttributeKey, AttributeMap, Relation, Settings }
|
||||
import sbt.internal.util.Types.{ const, idFun, some }
|
||||
import sbt.internal.util.complete.Parser
|
||||
|
||||
import java.io.File
|
||||
import java.net.URI
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package sbt.internals.parser
|
||||
|
||||
import sbt.MessageOnlyException
|
||||
import sbt.internal.util.MessageOnlyException
|
||||
|
||||
class EmbeddedXmlSpec extends CheckIfParsedSpec {
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ package sbt.internals.parser
|
|||
import java.io.File
|
||||
|
||||
import org.specs2.ScalaCheck
|
||||
import sbt.{ EvaluateConfigurations, MessageOnlyException }
|
||||
import sbt.EvaluateConfigurations
|
||||
import sbt.internal.util.MessageOnlyException
|
||||
|
||||
import scala.io.Source
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ package sbt.internals.parser
|
|||
|
||||
import java.io.File
|
||||
|
||||
import sbt.{ EvaluateConfigurations, LineRange }
|
||||
import sbt.EvaluateConfigurations
|
||||
import sbt.internal.util.LineRange
|
||||
|
||||
import scala.annotation.tailrec
|
||||
|
||||
|
|
@ -14,4 +15,4 @@ object EvaluateConfigurationsOriginal {
|
|||
EvaluateConfigurations.splitExpressions(lines)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package sbt.internals.parser
|
|||
|
||||
import java.io.File
|
||||
|
||||
import sbt.LineRange
|
||||
import sbt.internal.util.LineRange
|
||||
|
||||
object SplitExpressions {
|
||||
type SplitExpression = (File, Seq[String]) => (Seq[(String, Int)], Seq[(String, LineRange)])
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.specs2.mutable.Specification
|
|||
import scala.annotation.tailrec
|
||||
import scala.io.Source
|
||||
import scala.tools.reflect.ToolBoxError
|
||||
import sbt.internal.util.LineRange
|
||||
|
||||
class SplitExpressionsFilesTest extends AbstractSplitExpressionsFilesTest("/old-format/")
|
||||
|
||||
|
|
@ -16,7 +17,7 @@ class SplitExpressionsFilesTest extends AbstractSplitExpressionsFilesTest("/old-
|
|||
|
||||
abstract class AbstractSplitExpressionsFilesTest(pathName: String) extends Specification {
|
||||
|
||||
case class SplitterComparison(oldSplitterResult: util.Try[(Seq[(String, Int)], Seq[LineRange])], newSplitterResult: util.Try[(Seq[(String, Int)], Seq[LineRange])])
|
||||
case class SplitterComparison(oldSplitterResult: scala.util.Try[(Seq[(String, Int)], Seq[LineRange])], newSplitterResult: scala.util.Try[(Seq[(String, Int)], Seq[LineRange])])
|
||||
|
||||
val oldSplitter: SplitExpressions.SplitExpression = EvaluateConfigurationsOriginal.splitExpressions
|
||||
val newSplitter: SplitExpressions.SplitExpression = EvaluateConfigurations.splitExpressions
|
||||
|
|
@ -40,7 +41,7 @@ abstract class AbstractSplitExpressionsFilesTest(pathName: String) extends Speci
|
|||
printResults(results)
|
||||
|
||||
val validResults = results.collect {
|
||||
case (path, SplitterComparison(util.Success(oldRes), util.Success(newRes))) if oldRes == newRes => path
|
||||
case (path, SplitterComparison(scala.util.Success(oldRes), scala.util.Success(newRes))) if oldRes == newRes => path
|
||||
}
|
||||
|
||||
validResults.length must be_==(results.length)
|
||||
|
|
@ -112,19 +113,19 @@ abstract class AbstractSplitExpressionsFilesTest(pathName: String) extends Speci
|
|||
removeDoubleSlashReversed(statements.reverse, lineRange).map(t => (t._1.reverse, t._2))
|
||||
}
|
||||
|
||||
def splitLines(file: File, splitter: SplitExpressions.SplitExpression, lines: List[String]): util.Try[(Seq[(String, Int)], Seq[LineRange])] = {
|
||||
def splitLines(file: File, splitter: SplitExpressions.SplitExpression, lines: List[String]): scala.util.Try[(Seq[(String, Int)], Seq[LineRange])] = {
|
||||
try {
|
||||
val (imports, settingsAndDefs) = splitter(file, lines)
|
||||
|
||||
//TODO: Return actual contents (after making both splitter...
|
||||
//TODO: ...implementations return CharRanges instead of LineRanges)
|
||||
val settingsAndDefWithoutComments = settingsAndDefs.flatMap(t => removeCommentFromStatement(t._1, t._2))
|
||||
util.Success((imports.map(imp => (imp._1.trim, imp._2)), settingsAndDefWithoutComments))
|
||||
scala.util.Success((imports.map(imp => (imp._1.trim, imp._2)), settingsAndDefWithoutComments))
|
||||
} catch {
|
||||
case e: ToolBoxError =>
|
||||
util.Failure(e)
|
||||
scala.util.Failure(e)
|
||||
case e: Throwable =>
|
||||
util.Failure(e)
|
||||
scala.util.Failure(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -132,12 +133,12 @@ abstract class AbstractSplitExpressionsFilesTest(pathName: String) extends Speci
|
|||
for ((file, comparison) <- results) {
|
||||
val fileName = file.getName
|
||||
comparison match {
|
||||
case SplitterComparison(util.Failure(ex), _) =>
|
||||
case SplitterComparison(scala.util.Failure(ex), _) =>
|
||||
println(s"In file: $fileName, old splitter failed. ${ex.toString}")
|
||||
case SplitterComparison(_, util.Failure(ex)) =>
|
||||
case SplitterComparison(_, scala.util.Failure(ex)) =>
|
||||
println(s"In file: $fileName, new splitter failed. ${ex.toString}")
|
||||
ex.printStackTrace()
|
||||
case SplitterComparison(util.Success(resultOld), util.Success(resultNew)) =>
|
||||
case SplitterComparison(scala.util.Success(resultOld), scala.util.Success(resultNew)) =>
|
||||
if (resultOld != resultNew) {
|
||||
println(
|
||||
s"""In file: $fileName, results differ:
|
||||
|
|
@ -150,4 +151,4 @@ abstract class AbstractSplitExpressionsFilesTest(pathName: String) extends Speci
|
|||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue