mirror of https://github.com/sbt/sbt.git
Fix spelling: 'descendent' is now 'descendant', English ftw. Closes #293
This commit is contained in:
parent
447608c596
commit
859f569da0
|
|
@ -37,7 +37,7 @@ object Defaults extends BuildCommon
|
||||||
|
|
||||||
def lock(app: xsbti.AppConfiguration): xsbti.GlobalLock = app.provider.scalaProvider.launcher.globalLock
|
def lock(app: xsbti.AppConfiguration): xsbti.GlobalLock = app.provider.scalaProvider.launcher.globalLock
|
||||||
|
|
||||||
def extractAnalysis[T](a: Attributed[T]): (T, inc.Analysis) =
|
def extractAnalysis[T](a: Attributed[T]): (T, inc.Analysis) =
|
||||||
(a.data, a.metadata get Keys.analysis getOrElse inc.Analysis.Empty)
|
(a.data, a.metadata get Keys.analysis getOrElse inc.Analysis.Empty)
|
||||||
|
|
||||||
def analysisMap[T](cp: Seq[Attributed[T]]): Map[T, inc.Analysis] =
|
def analysisMap[T](cp: Seq[Attributed[T]]): Map[T, inc.Analysis] =
|
||||||
|
|
@ -173,7 +173,7 @@ object Defaults extends BuildCommon
|
||||||
)
|
)
|
||||||
def addBaseSources = Seq(
|
def addBaseSources = Seq(
|
||||||
unmanagedSources <<= (unmanagedSources, baseDirectory, includeFilter in unmanagedSources, excludeFilter in unmanagedSources) map {
|
unmanagedSources <<= (unmanagedSources, baseDirectory, includeFilter in unmanagedSources, excludeFilter in unmanagedSources) map {
|
||||||
(srcs,b,f,excl) => (srcs +++ b * (f -- excl)).get
|
(srcs,b,f,excl) => (srcs +++ b * (f -- excl)).get
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -261,7 +261,7 @@ object Defaults extends BuildCommon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy val testTasks: Seq[Setting[_]] = testTaskOptions(test) ++ testTaskOptions(testOnly) ++ Seq(
|
lazy val testTasks: Seq[Setting[_]] = testTaskOptions(test) ++ testTaskOptions(testOnly) ++ Seq(
|
||||||
testLoader <<= (fullClasspath, scalaInstance, taskTemporaryDirectory) map { (cp, si, temp) => TestFramework.createTestLoader(data(cp), si, IO.createUniqueDirectory(temp)) },
|
testLoader <<= (fullClasspath, scalaInstance, taskTemporaryDirectory) map { (cp, si, temp) => TestFramework.createTestLoader(data(cp), si, IO.createUniqueDirectory(temp)) },
|
||||||
testFrameworks in GlobalScope :== {
|
testFrameworks in GlobalScope :== {
|
||||||
import sbt.TestFrameworks._
|
import sbt.TestFrameworks._
|
||||||
|
|
@ -312,7 +312,7 @@ object Defaults extends BuildCommon
|
||||||
def testExecutionTask(task: Scoped): Initialize[Task[Tests.Execution]] =
|
def testExecutionTask(task: Scoped): Initialize[Task[Tests.Execution]] =
|
||||||
(testOptions in task, parallelExecution in task, tags in task) map { (opts, par, ts) => new Tests.Execution(opts, par, ts) }
|
(testOptions in task, parallelExecution in task, tags in task) map { (opts, par, ts) => new Tests.Execution(opts, par, ts) }
|
||||||
|
|
||||||
def testOnlyTask =
|
def testOnlyTask =
|
||||||
InputTask( loadForParser(definedTestNames)( (s, i) => testOnlyParser(s, i getOrElse Nil) ) ) { result =>
|
InputTask( loadForParser(definedTestNames)( (s, i) => testOnlyParser(s, i getOrElse Nil) ) ) { result =>
|
||||||
(streams, loadedTestFrameworks, testExecution in testOnly, testLoader, definedTests, resolvedScoped, result, state) flatMap {
|
(streams, loadedTestFrameworks, testExecution in testOnly, testLoader, definedTests, resolvedScoped, result, state) flatMap {
|
||||||
case (s, frameworks, config, loader, discovered, scoped, (tests, frameworkOptions), st) =>
|
case (s, frameworks, config, loader, discovered, scoped, (tests, frameworkOptions), st) =>
|
||||||
|
|
@ -371,9 +371,9 @@ object Defaults extends BuildCommon
|
||||||
(files, dirs) map { (rs, rdirs) =>
|
(files, dirs) map { (rs, rdirs) =>
|
||||||
(rs --- rdirs) x (relativeTo(rdirs)|flat) toSeq
|
(rs --- rdirs) x (relativeTo(rdirs)|flat) toSeq
|
||||||
}
|
}
|
||||||
|
|
||||||
def collectFiles(dirs: ScopedTaskable[Seq[File]], filter: ScopedTaskable[FileFilter], excludes: ScopedTaskable[FileFilter]): Initialize[Task[Seq[File]]] =
|
def collectFiles(dirs: ScopedTaskable[Seq[File]], filter: ScopedTaskable[FileFilter], excludes: ScopedTaskable[FileFilter]): Initialize[Task[Seq[File]]] =
|
||||||
(dirs, filter, excludes) map { (d,f,excl) => d.descendentsExcept(f,excl).get }
|
(dirs, filter, excludes) map { (d,f,excl) => d.descendantsExcept(f,excl).get }
|
||||||
|
|
||||||
def artifactPathSetting(art: SettingKey[Artifact]) = (crossTarget, projectID, art, scalaVersion in artifactName, artifactName) { (t, module, a, sv, toString) => t / toString(sv, module, a) asFile }
|
def artifactPathSetting(art: SettingKey[Artifact]) = (crossTarget, projectID, art, scalaVersion in artifactName, artifactName) { (t, module, a, sv, toString) => t / toString(sv, module, a) asFile }
|
||||||
def artifactSetting = ((artifact, artifactClassifier).identity zipWith configuration.?) { case ((a,classifier),cOpt) =>
|
def artifactSetting = ((artifact, artifactClassifier).identity zipWith configuration.?) { case ((a,classifier),cOpt) =>
|
||||||
|
|
@ -381,7 +381,7 @@ object Defaults extends BuildCommon
|
||||||
val combined = cPart.toList ++ classifier.toList
|
val combined = cPart.toList ++ classifier.toList
|
||||||
if(combined.isEmpty) a.copy(classifier = None, configurations = cOpt.toList) else {
|
if(combined.isEmpty) a.copy(classifier = None, configurations = cOpt.toList) else {
|
||||||
val classifierString = combined mkString "-"
|
val classifierString = combined mkString "-"
|
||||||
val confs = cOpt.toList flatMap { c => artifactConfigurations(a, c, classifier) }
|
val confs = cOpt.toList flatMap { c => artifactConfigurations(a, c, classifier) }
|
||||||
a.copy(classifier = Some(classifierString), `type` = Artifact.classifierType(classifierString), configurations = confs)
|
a.copy(classifier = Some(classifierString), `type` = Artifact.classifierType(classifierString), configurations = confs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -445,7 +445,7 @@ object Defaults extends BuildCommon
|
||||||
}
|
}
|
||||||
|
|
||||||
def runnerTask = runner <<= runnerInit
|
def runnerTask = runner <<= runnerInit
|
||||||
def runnerInit: Initialize[Task[ScalaRun]] =
|
def runnerInit: Initialize[Task[ScalaRun]] =
|
||||||
(taskTemporaryDirectory, scalaInstance, baseDirectory, javaOptions, outputStrategy, fork, javaHome, trapExit, connectInput) map {
|
(taskTemporaryDirectory, scalaInstance, baseDirectory, javaOptions, outputStrategy, fork, javaHome, trapExit, connectInput) map {
|
||||||
(tmp, si, base, options, strategy, forkRun, javaHomeDir, trap, connectIn) =>
|
(tmp, si, base, options, strategy, forkRun, javaHomeDir, trap, connectIn) =>
|
||||||
if(forkRun) {
|
if(forkRun) {
|
||||||
|
|
@ -460,7 +460,7 @@ object Defaults extends BuildCommon
|
||||||
target <<= docDirectory, // deprecate docDirectory in favor of 'target in doc'; remove when docDirectory is removed
|
target <<= docDirectory, // deprecate docDirectory in favor of 'target in doc'; remove when docDirectory is removed
|
||||||
scalacOptions <<= scaladocOptions or scalacOptions, // deprecate scaladocOptions in favor of 'scalacOptions in doc'; remove when scaladocOptions is removed
|
scalacOptions <<= scaladocOptions or scalacOptions, // deprecate scaladocOptions in favor of 'scalacOptions in doc'; remove when scaladocOptions is removed
|
||||||
key in TaskGlobal <<= (cacheDirectory, compileInputs, target, configuration, streams) map { (cache, in, out, config, s) =>
|
key in TaskGlobal <<= (cacheDirectory, compileInputs, target, configuration, streams) map { (cache, in, out, config, s) =>
|
||||||
// For Scala/Java hybrid projects, the output docs are rebased to `scala` or `java` sub-directory accordingly. We do hybrid
|
// For Scala/Java hybrid projects, the output docs are rebased to `scala` or `java` sub-directory accordingly. We do hybrid
|
||||||
// mode iff both *.scala and *.java files exist -- other doc resources (package.html, *.jpg etc.) don't influence the decision.
|
// mode iff both *.scala and *.java files exist -- other doc resources (package.html, *.jpg etc.) don't influence the decision.
|
||||||
val srcs = in.config.sources
|
val srcs = in.config.sources
|
||||||
val hybrid = srcs.exists(_.name.endsWith(".scala")) && srcs.exists(_.name.endsWith(".java"))
|
val hybrid = srcs.exists(_.name.endsWith(".scala")) && srcs.exists(_.name.endsWith(".java"))
|
||||||
|
|
@ -494,9 +494,9 @@ object Defaults extends BuildCommon
|
||||||
(new Console(cs.scalac))(data(cp), options, initCommands, cleanup, s.log).foreach(msg => error(msg))
|
(new Console(cs.scalac))(data(cp), options, initCommands, cleanup, s.log).foreach(msg => error(msg))
|
||||||
println()
|
println()
|
||||||
}
|
}
|
||||||
|
|
||||||
def compileTask = (compileInputs, streams) map { (i,s) => Compiler(i,s.log) }
|
def compileTask = (compileInputs, streams) map { (i,s) => Compiler(i,s.log) }
|
||||||
def compileIncSetupTask =
|
def compileIncSetupTask =
|
||||||
(dependencyClasspath, cacheDirectory, skip in compile, definesClass) map { (cp, cacheDir, skip, definesC) =>
|
(dependencyClasspath, cacheDirectory, skip in compile, definesClass) map { (cp, cacheDir, skip, definesC) =>
|
||||||
Compiler.IncSetup(analysisMap(cp), definesC, skip, cacheDir / "compile")
|
Compiler.IncSetup(analysisMap(cp), definesC, skip, cacheDir / "compile")
|
||||||
}
|
}
|
||||||
|
|
@ -576,7 +576,7 @@ object Defaults extends BuildCommon
|
||||||
|
|
||||||
def transitiveDependencies(base: ProjectRef, structure: LoadedBuild, includeRoot: Boolean, classpath: Boolean = true, aggregate: Boolean = false): Seq[ProjectRef] =
|
def transitiveDependencies(base: ProjectRef, structure: LoadedBuild, includeRoot: Boolean, classpath: Boolean = true, aggregate: Boolean = false): Seq[ProjectRef] =
|
||||||
{
|
{
|
||||||
def tdeps(enabled: Boolean, f: ProjectRef => Seq[ProjectRef]): Seq[ProjectRef] =
|
def tdeps(enabled: Boolean, f: ProjectRef => Seq[ProjectRef]): Seq[ProjectRef] =
|
||||||
{
|
{
|
||||||
val full = if(enabled) Dag.topologicalSort(base)(f) else Nil
|
val full = if(enabled) Dag.topologicalSort(base)(f) else Nil
|
||||||
if(includeRoot) full else full dropRight 1
|
if(includeRoot) full else full dropRight 1
|
||||||
|
|
@ -596,12 +596,12 @@ object Defaults extends BuildCommon
|
||||||
}
|
}
|
||||||
|
|
||||||
val CompletionsID = "completions"
|
val CompletionsID = "completions"
|
||||||
|
|
||||||
def noAggregation: Seq[Scoped] = Seq(run, console, consoleQuick, consoleProject)
|
def noAggregation: Seq[Scoped] = Seq(run, console, consoleQuick, consoleProject)
|
||||||
lazy val disableAggregation = noAggregation map disableAggregate
|
lazy val disableAggregation = noAggregation map disableAggregate
|
||||||
def disableAggregate(k: Scoped) =
|
def disableAggregate(k: Scoped) =
|
||||||
aggregate in Scope.GlobalScope.copy(task = Select(k.key)) :== false
|
aggregate in Scope.GlobalScope.copy(task = Select(k.key)) :== false
|
||||||
|
|
||||||
lazy val baseTasks: Seq[Setting[_]] = projectTasks ++ packageBase
|
lazy val baseTasks: Seq[Setting[_]] = projectTasks ++ packageBase
|
||||||
|
|
||||||
lazy val baseClasspaths: Seq[Setting[_]] = Classpaths.publishSettings ++ Classpaths.baseSettings
|
lazy val baseClasspaths: Seq[Setting[_]] = Classpaths.publishSettings ++ Classpaths.baseSettings
|
||||||
|
|
@ -612,7 +612,7 @@ object Defaults extends BuildCommon
|
||||||
|
|
||||||
lazy val itSettings: Seq[Setting[_]] = inConfig(IntegrationTest)(testSettings)
|
lazy val itSettings: Seq[Setting[_]] = inConfig(IntegrationTest)(testSettings)
|
||||||
lazy val defaultConfigs: Seq[Setting[_]] = inConfig(Compile)(compileSettings) ++ inConfig(Test)(testSettings) ++ inConfig(Runtime)(Classpaths.configSettings)
|
lazy val defaultConfigs: Seq[Setting[_]] = inConfig(Compile)(compileSettings) ++ inConfig(Test)(testSettings) ++ inConfig(Runtime)(Classpaths.configSettings)
|
||||||
|
|
||||||
|
|
||||||
// settings that are not specific to a configuration
|
// settings that are not specific to a configuration
|
||||||
lazy val projectBaseSettings: Seq[Setting[_]] = projectCore ++ paths ++ baseClasspaths ++ baseTasks ++ compileBase ++ disableAggregation
|
lazy val projectBaseSettings: Seq[Setting[_]] = projectCore ++ paths ++ baseClasspaths ++ baseTasks ++ compileBase ++ disableAggregation
|
||||||
|
|
@ -645,7 +645,7 @@ object Classpaths
|
||||||
excludeFilter in unmanagedJars <<= (defaultExcludes in unmanagedJars) or (excludeFilter in unmanagedJars),
|
excludeFilter in unmanagedJars <<= (defaultExcludes in unmanagedJars) or (excludeFilter in unmanagedJars),
|
||||||
includeFilter in unmanagedJars <<= classpathFilter or (includeFilter in unmanagedJars),
|
includeFilter in unmanagedJars <<= classpathFilter or (includeFilter in unmanagedJars),
|
||||||
unmanagedJars <<= (configuration, unmanagedBase, includeFilter in unmanagedJars, excludeFilter in unmanagedJars) map { (config, base, filter, excl) =>
|
unmanagedJars <<= (configuration, unmanagedBase, includeFilter in unmanagedJars, excludeFilter in unmanagedJars) map { (config, base, filter, excl) =>
|
||||||
(base * (filter -- excl) +++ (base / config.name).descendentsExcept(filter, excl)).classpath
|
(base * (filter -- excl) +++ (base / config.name).descendantsExcept(filter, excl)).classpath
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
def defaultPackageKeys = Seq(packageBin, packageSrc, packageDoc)
|
def defaultPackageKeys = Seq(packageBin, packageSrc, packageDoc)
|
||||||
|
|
@ -792,7 +792,7 @@ object Classpaths
|
||||||
(projectID, allDependencies, ivyXML, ivyConfigurations, defaultConfiguration, ivyScala, ivyValidate, projectInfo) map {
|
(projectID, allDependencies, ivyXML, ivyConfigurations, defaultConfiguration, ivyScala, ivyValidate, projectInfo) map {
|
||||||
(pid, deps, ivyXML, confs, defaultConf, ivyS, validate, pinfo) => new InlineConfiguration(pid, pinfo, deps, ivyXML, confs, defaultConf, ivyS, validate)
|
(pid, deps, ivyXML, confs, defaultConf, ivyS, validate, pinfo) => new InlineConfiguration(pid, pinfo, deps, ivyXML, confs, defaultConf, ivyS, validate)
|
||||||
}
|
}
|
||||||
|
|
||||||
def sbtClassifiersTasks = inTask(updateSbtClassifiers)(Seq(
|
def sbtClassifiersTasks = inTask(updateSbtClassifiers)(Seq(
|
||||||
transitiveClassifiers in GlobalScope in updateSbtClassifiers ~= ( _.filter(_ != DocClassifier) ),
|
transitiveClassifiers in GlobalScope in updateSbtClassifiers ~= ( _.filter(_ != DocClassifier) ),
|
||||||
externalResolvers <<= (externalResolvers, appConfiguration) map { (defaultRs, ac) =>
|
externalResolvers <<= (externalResolvers, appConfiguration) map { (defaultRs, ac) =>
|
||||||
|
|
@ -855,7 +855,7 @@ object Classpaths
|
||||||
out.cachedDescriptor.exists
|
out.cachedDescriptor.exists
|
||||||
|
|
||||||
val outCacheFile = cacheFile / "output"
|
val outCacheFile = cacheFile / "output"
|
||||||
def skipWork: In => UpdateReport =
|
def skipWork: In => UpdateReport =
|
||||||
Tracked.lastOutput[In, UpdateReport](outCacheFile) {
|
Tracked.lastOutput[In, UpdateReport](outCacheFile) {
|
||||||
case (_, Some(out)) => out
|
case (_, Some(out)) => out
|
||||||
case _ => error("Skipping update requested, but update has not previously run successfully.")
|
case _ => error("Skipping update requested, but update has not previously run successfully.")
|
||||||
|
|
@ -913,7 +913,7 @@ object Classpaths
|
||||||
}
|
}
|
||||||
|
|
||||||
def analyzed[T](data: T, analysis: inc.Analysis) = Attributed.blank(data).put(Keys.analysis, analysis)
|
def analyzed[T](data: T, analysis: inc.Analysis) = Attributed.blank(data).put(Keys.analysis, analysis)
|
||||||
def makeProducts: Initialize[Task[Seq[File]]] =
|
def makeProducts: Initialize[Task[Seq[File]]] =
|
||||||
(compile, compileInputs, copyResources) map { (_, i, _) => i.config.classesDirectory :: Nil }
|
(compile, compileInputs, copyResources) map { (_, i, _) => i.config.classesDirectory :: Nil }
|
||||||
def exportProductsTask: Initialize[Task[Classpath]] =
|
def exportProductsTask: Initialize[Task[Classpath]] =
|
||||||
(products.task, packageBin.task, exportJars, compile) flatMap { (psTask, pkgTask, useJars, analysis) =>
|
(products.task, packageBin.task, exportJars, compile) flatMap { (psTask, pkgTask, useJars, analysis) =>
|
||||||
|
|
@ -985,7 +985,7 @@ object Classpaths
|
||||||
|
|
||||||
(tasks.toSeq.join).map(_.flatten.distinct)
|
(tasks.toSeq.join).map(_.flatten.distinct)
|
||||||
}
|
}
|
||||||
|
|
||||||
def mapped(confString: Option[String], masterConfs: Seq[String], depConfs: Seq[String], default: String, defaultMapping: String): String => Seq[String] =
|
def mapped(confString: Option[String], masterConfs: Seq[String], depConfs: Seq[String], default: String, defaultMapping: String): String => Seq[String] =
|
||||||
{
|
{
|
||||||
lazy val defaultMap = parseMapping(defaultMapping, masterConfs, depConfs, _ :: Nil)
|
lazy val defaultMap = parseMapping(defaultMapping, masterConfs, depConfs, _ :: Nil)
|
||||||
|
|
@ -1011,7 +1011,7 @@ object Classpaths
|
||||||
def parseList(s: String, allConfs: Seq[String]): Seq[String] = (trim(s split ",") flatMap replaceWildcard(allConfs)).distinct
|
def parseList(s: String, allConfs: Seq[String]): Seq[String] = (trim(s split ",") flatMap replaceWildcard(allConfs)).distinct
|
||||||
def replaceWildcard(allConfs: Seq[String])(conf: String): Seq[String] =
|
def replaceWildcard(allConfs: Seq[String])(conf: String): Seq[String] =
|
||||||
if(conf == "") Nil else if(conf == "*") allConfs else conf :: Nil
|
if(conf == "") Nil else if(conf == "*") allConfs else conf :: Nil
|
||||||
|
|
||||||
private def trim(a: Array[String]): List[String] = a.toList.map(_.trim)
|
private def trim(a: Array[String]): List[String] = a.toList.map(_.trim)
|
||||||
def missingConfiguration(in: String, conf: String) =
|
def missingConfiguration(in: String, conf: String) =
|
||||||
error("Configuration '" + conf + "' not defined in '" + in + "'")
|
error("Configuration '" + conf + "' not defined in '" + in + "'")
|
||||||
|
|
@ -1139,7 +1139,7 @@ trait BuildExtra extends BuildCommon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def externalIvyFile(file: Initialize[File] = baseDirectory / "ivy.xml", iScala: Initialize[Option[IvyScala]] = ivyScala): Setting[Task[ModuleSettings]] =
|
def externalIvyFile(file: Initialize[File] = baseDirectory / "ivy.xml", iScala: Initialize[Option[IvyScala]] = ivyScala): Setting[Task[ModuleSettings]] =
|
||||||
external(file, iScala)( (f, is, v) => new IvyFileConfiguration(f, is, v) )
|
external(file, iScala)( (f, is, v) => new IvyFileConfiguration(f, is, v) )
|
||||||
def externalPom(file: Initialize[File] = baseDirectory / "pom.xml", iScala: Initialize[Option[IvyScala]] = ivyScala): Setting[Task[ModuleSettings]] =
|
def externalPom(file: Initialize[File] = baseDirectory / "pom.xml", iScala: Initialize[Option[IvyScala]] = ivyScala): Setting[Task[ModuleSettings]] =
|
||||||
external(file, iScala)( (f, is, v) => new PomConfiguration(f, is, v) )
|
external(file, iScala)( (f, is, v) => new PomConfiguration(f, is, v) )
|
||||||
|
|
||||||
|
|
@ -1156,7 +1156,7 @@ trait BuildExtra extends BuildCommon
|
||||||
(fullClasspath in config, runner in (config, run), streams) map { (cp, r, s) =>
|
(fullClasspath in config, runner in (config, run), streams) map { (cp, r, s) =>
|
||||||
toError(r.run(mainClass, data(cp), arguments, s.log))
|
toError(r.run(mainClass, data(cp), arguments, s.log))
|
||||||
}
|
}
|
||||||
|
|
||||||
def fullRunInputTask(scoped: InputKey[Unit], config: Configuration, mainClass: String, baseArguments: String*): Setting[InputTask[Unit]] =
|
def fullRunInputTask(scoped: InputKey[Unit], config: Configuration, mainClass: String, baseArguments: String*): Setting[InputTask[Unit]] =
|
||||||
scoped <<= inputTask { result =>
|
scoped <<= inputTask { result =>
|
||||||
( initScoped(scoped.scopedKey, runnerInit) zipWith (fullClasspath in config, streams, result).identityMap) { (rTask, t) =>
|
( initScoped(scoped.scopedKey, runnerInit) zipWith (fullClasspath in config, streams, result).identityMap) { (rTask, t) =>
|
||||||
|
|
@ -1173,7 +1173,7 @@ trait BuildExtra extends BuildCommon
|
||||||
}
|
}
|
||||||
def initScoped[T](sk: ScopedKey[_], i: Initialize[T]): Initialize[T] = initScope(fillTaskAxis(sk.scope, sk.key), i)
|
def initScoped[T](sk: ScopedKey[_], i: Initialize[T]): Initialize[T] = initScope(fillTaskAxis(sk.scope, sk.key), i)
|
||||||
def initScope[T](s: Scope, i: Initialize[T]): Initialize[T] = i mapReferenced Project.mapScope(Scope.replaceThis(s))
|
def initScope[T](s: Scope, i: Initialize[T]): Initialize[T] = i mapReferenced Project.mapScope(Scope.replaceThis(s))
|
||||||
|
|
||||||
/** Disables post-compilation hook for determining tests for tab-completion (such as for 'test-only').
|
/** Disables post-compilation hook for determining tests for tab-completion (such as for 'test-only').
|
||||||
* This is useful for reducing test:compile time when not running test. */
|
* This is useful for reducing test:compile time when not running test. */
|
||||||
def noTestCompletion(config: Configuration = Test): Setting[_] = inConfig(config)( Seq(definedTests <<= Defaults.detectTests) ).head
|
def noTestCompletion(config: Configuration = Test): Setting[_] = inConfig(config)( Seq(definedTests <<= Defaults.detectTests) ).head
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
> compile
|
> compile
|
||||||
|
|
||||||
# modify A.scala so that the signature of its method changes to be identical to
|
# modify A.scala so that the signature of its method changes to be identical to
|
||||||
# that of the method in its descendent in C.scala
|
# that of the method in its descendant in C.scala
|
||||||
$ copy-file changes/A.scala A.scala
|
$ copy-file changes/A.scala A.scala
|
||||||
# Should recompile C.scala and report this error, failing the compile
|
# Should recompile C.scala and report this error, failing the compile
|
||||||
-> compile
|
-> compile
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ final class RichFile(val asFile: File)
|
||||||
/** The wrapped file converted to a <code>URL</code>.*/
|
/** The wrapped file converted to a <code>URL</code>.*/
|
||||||
def asURL = asFile.toURI.toURL
|
def asURL = asFile.toURI.toURL
|
||||||
def absolutePath: String = asFile.getAbsolutePath
|
def absolutePath: String = asFile.getAbsolutePath
|
||||||
|
|
||||||
/** The last component of this path.*/
|
/** The last component of this path.*/
|
||||||
def name = asFile.getName
|
def name = asFile.getName
|
||||||
/** The extension part of the name of this path. This is the part of the name after the last period, or the empty string if there is no period.*/
|
/** The extension part of the name of this path. This is the part of the name after the last period, or the empty string if there is no period.*/
|
||||||
|
|
@ -59,18 +59,18 @@ trait PathExtra extends Alternatives with Mapper with PathLow
|
||||||
implicit def richFile(file: File): RichFile = new RichFile(file)
|
implicit def richFile(file: File): RichFile = new RichFile(file)
|
||||||
implicit def filesToFinder(cc: Traversable[File]): PathFinder = PathFinder.strict(cc)
|
implicit def filesToFinder(cc: Traversable[File]): PathFinder = PathFinder.strict(cc)
|
||||||
}
|
}
|
||||||
object Path extends PathExtra
|
object Path extends PathExtra
|
||||||
{
|
{
|
||||||
def apply(f: File): RichFile = new RichFile(f)
|
def apply(f: File): RichFile = new RichFile(f)
|
||||||
def apply(f: String): RichFile = new RichFile(new File(f))
|
def apply(f: String): RichFile = new RichFile(new File(f))
|
||||||
def fileProperty(name: String): File = new File(System.getProperty(name))
|
def fileProperty(name: String): File = new File(System.getProperty(name))
|
||||||
def userHome: File = fileProperty("user.home")
|
def userHome: File = fileProperty("user.home")
|
||||||
|
|
||||||
def absolute(file: File): File = new File(file.toURI.normalize).getAbsoluteFile
|
def absolute(file: File): File = new File(file.toURI.normalize).getAbsoluteFile
|
||||||
def makeString(paths: Seq[File]): String = makeString(paths, pathSeparator)
|
def makeString(paths: Seq[File]): String = makeString(paths, pathSeparator)
|
||||||
def makeString(paths: Seq[File], sep: String): String = paths.map(_.getAbsolutePath).mkString(sep)
|
def makeString(paths: Seq[File], sep: String): String = paths.map(_.getAbsolutePath).mkString(sep)
|
||||||
def newerThan(a: File, b: File): Boolean = a.exists && (!b.exists || a.lastModified > b.lastModified)
|
def newerThan(a: File, b: File): Boolean = a.exists && (!b.exists || a.lastModified > b.lastModified)
|
||||||
|
|
||||||
/** The separator character of the platform.*/
|
/** The separator character of the platform.*/
|
||||||
val sep = java.io.File.separatorChar
|
val sep = java.io.File.separatorChar
|
||||||
|
|
||||||
|
|
@ -125,8 +125,8 @@ sealed abstract class PathFinder
|
||||||
/** Excludes all paths from <code>excludePaths</code> from the paths selected by this <code>PathFinder</code>.*/
|
/** Excludes all paths from <code>excludePaths</code> from the paths selected by this <code>PathFinder</code>.*/
|
||||||
def ---(excludePaths: PathFinder): PathFinder = new ExcludeFiles(this, excludePaths)
|
def ---(excludePaths: PathFinder): PathFinder = new ExcludeFiles(this, excludePaths)
|
||||||
/** Constructs a new finder that selects all paths with a name that matches <code>filter</code> and are
|
/** Constructs a new finder that selects all paths with a name that matches <code>filter</code> and are
|
||||||
* descendents of paths selected by this finder.*/
|
* descendants of paths selected by this finder.*/
|
||||||
def **(filter: FileFilter): PathFinder = new DescendentOrSelfPathFinder(this, filter)
|
def **(filter: FileFilter): PathFinder = new DescendantOrSelfPathFinder(this, filter)
|
||||||
def *** : PathFinder = **(AllPassFilter)
|
def *** : PathFinder = **(AllPassFilter)
|
||||||
/** Constructs a new finder that selects all paths with a name that matches <code>filter</code> and are
|
/** Constructs a new finder that selects all paths with a name that matches <code>filter</code> and are
|
||||||
* immediate children of paths selected by this finder.*/
|
* immediate children of paths selected by this finder.*/
|
||||||
|
|
@ -148,13 +148,16 @@ sealed abstract class PathFinder
|
||||||
for(file <- get; mapped <- apply(file)) yield (file, mapped)
|
for(file <- get; mapped <- apply(file)) yield (file, mapped)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Selects all descendent paths with a name that matches <code>include</code> and do not have an intermediate
|
/** Selects all descendant paths with a name that matches <code>include</code> and do not have an intermediate
|
||||||
* path with a name that matches <code>intermediateExclude</code>. Typical usage is:
|
* path with a name that matches <code>intermediateExclude</code>. Typical usage is:
|
||||||
*
|
*
|
||||||
* <code>descendentsExcept("*.jar", ".svn")</code>*/
|
* <code>descendantsExcept("*.jar", ".svn")</code>*/
|
||||||
def descendentsExcept(include: FileFilter, intermediateExclude: FileFilter): PathFinder =
|
def descendantsExcept(include: FileFilter, intermediateExclude: FileFilter): PathFinder =
|
||||||
(this ** include) --- (this ** intermediateExclude ** include)
|
(this ** include) --- (this ** intermediateExclude ** include)
|
||||||
|
@deprecated("Use `descendantsExcept` instead.", "0.11.3")
|
||||||
|
def descendentsExcept(include: FileFilter, intermediateExclude: FileFilter): PathFinder =
|
||||||
|
descendantsExcept(include, intermediateExclude)
|
||||||
|
|
||||||
/** Evaluates this finder and converts the results to a `Seq` of distinct `File`s. The files returned by this method will reflect the underlying filesystem at the
|
/** Evaluates this finder and converts the results to a `Seq` of distinct `File`s. The files returned by this method will reflect the underlying filesystem at the
|
||||||
* time of calling. If the filesystem changes, two calls to this method might be different.*/
|
* time of calling. If the filesystem changes, two calls to this method might be different.*/
|
||||||
final def get: Seq[File] =
|
final def get: Seq[File] =
|
||||||
|
|
@ -193,12 +196,12 @@ private abstract class FilterFiles extends PathFinder with FileFilter
|
||||||
def parent: PathFinder
|
def parent: PathFinder
|
||||||
def filter: FileFilter
|
def filter: FileFilter
|
||||||
final def accept(file: File) = filter.accept(file)
|
final def accept(file: File) = filter.accept(file)
|
||||||
|
|
||||||
protected def handleFile(file: File, fileSet: mutable.Set[File]): Unit =
|
protected def handleFile(file: File, fileSet: mutable.Set[File]): Unit =
|
||||||
for(matchedFile <- wrapNull(file.listFiles(this)))
|
for(matchedFile <- wrapNull(file.listFiles(this)))
|
||||||
fileSet += new File(file, matchedFile.getName)
|
fileSet += new File(file, matchedFile.getName)
|
||||||
}
|
}
|
||||||
private class DescendentOrSelfPathFinder(val parent: PathFinder, val filter: FileFilter) extends FilterFiles
|
private class DescendantOrSelfPathFinder(val parent: PathFinder, val filter: FileFilter) extends FilterFiles
|
||||||
{
|
{
|
||||||
private[sbt] def addTo(fileSet: mutable.Set[File])
|
private[sbt] def addTo(fileSet: mutable.Set[File])
|
||||||
{
|
{
|
||||||
|
|
@ -206,14 +209,14 @@ private class DescendentOrSelfPathFinder(val parent: PathFinder, val filter: Fil
|
||||||
{
|
{
|
||||||
if(accept(file))
|
if(accept(file))
|
||||||
fileSet += file
|
fileSet += file
|
||||||
handleFileDescendent(file, fileSet)
|
handleFileDescendant(file, fileSet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private def handleFileDescendent(file: File, fileSet: mutable.Set[File])
|
private def handleFileDescendant(file: File, fileSet: mutable.Set[File])
|
||||||
{
|
{
|
||||||
handleFile(file, fileSet)
|
handleFile(file, fileSet)
|
||||||
for(childDirectory <- wrapNull(file listFiles DirectoryFilter))
|
for(childDirectory <- wrapNull(file listFiles DirectoryFilter))
|
||||||
handleFileDescendent(new File(file, childDirectory.getName), fileSet)
|
handleFileDescendant(new File(file, childDirectory.getName), fileSet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private class ChildPathFinder(val parent: PathFinder, val filter: FileFilter) extends FilterFiles
|
private class ChildPathFinder(val parent: PathFinder, val filter: FileFilter) extends FilterFiles
|
||||||
|
|
@ -236,11 +239,11 @@ private class ExcludeFiles(include: PathFinder, exclude: PathFinder) extends Pat
|
||||||
{
|
{
|
||||||
val includeSet = new mutable.LinkedHashSet[File]
|
val includeSet = new mutable.LinkedHashSet[File]
|
||||||
include.addTo(includeSet)
|
include.addTo(includeSet)
|
||||||
|
|
||||||
val excludeSet = new mutable.HashSet[File]
|
val excludeSet = new mutable.HashSet[File]
|
||||||
exclude.addTo(excludeSet)
|
exclude.addTo(excludeSet)
|
||||||
|
|
||||||
includeSet --= excludeSet
|
includeSet --= excludeSet
|
||||||
pathSet ++= includeSet
|
pathSet ++= includeSet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue