mirror of https://github.com/sbt/sbt.git
commit
037559c8d3
|
|
@ -33,7 +33,7 @@ def buildLevelSettings: Seq[Setting[_]] =
|
||||||
scmInfo := Some(ScmInfo(url("https://github.com/sbt/sbt"), "git@github.com:sbt/sbt.git")),
|
scmInfo := Some(ScmInfo(url("https://github.com/sbt/sbt"), "git@github.com:sbt/sbt.git")),
|
||||||
resolvers += Resolver.mavenLocal,
|
resolvers += Resolver.mavenLocal,
|
||||||
scalafmtOnCompile := true,
|
scalafmtOnCompile := true,
|
||||||
scalafmtVersion := "1.1.0",
|
scalafmtVersion := "1.2.0",
|
||||||
))
|
))
|
||||||
|
|
||||||
def commonSettings: Seq[Setting[_]] =
|
def commonSettings: Seq[Setting[_]] =
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,10 @@ final class ContextUtil[C <: blackbox.Context](val ctx: C) {
|
||||||
* Collects all definitions in the tree for use in checkReferences.
|
* Collects all definitions in the tree for use in checkReferences.
|
||||||
* This excludes definitions in wrapped expressions because checkReferences won't allow nested dereferencing anyway.
|
* This excludes definitions in wrapped expressions because checkReferences won't allow nested dereferencing anyway.
|
||||||
*/
|
*/
|
||||||
def collectDefs(tree: Tree, isWrapper: (String, Type, Tree) => Boolean): collection.Set[Symbol] = {
|
def collectDefs(
|
||||||
|
tree: Tree,
|
||||||
|
isWrapper: (String, Type, Tree) => Boolean
|
||||||
|
): collection.Set[Symbol] = {
|
||||||
val defs = new collection.mutable.HashSet[Symbol]
|
val defs = new collection.mutable.HashSet[Symbol]
|
||||||
// adds the symbols for all non-Ident subtrees to `defs`.
|
// adds the symbols for all non-Ident subtrees to `defs`.
|
||||||
val process = new Traverser {
|
val process = new Traverser {
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,9 @@ object ParserInput {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private def wrapInputTask[T: c.WeakTypeTag](c: blackbox.Context)(tree: c.Tree, pos: c.Position) = {
|
private def wrapInputTask[T: c.WeakTypeTag](
|
||||||
|
c: blackbox.Context
|
||||||
|
)(tree: c.Tree, pos: c.Position) = {
|
||||||
val e = c.Expr[InputTask[T]](tree)
|
val e = c.Expr[InputTask[T]](tree)
|
||||||
wrap[Task[T]](c)(inputParser(c)(e), pos)
|
wrap[Task[T]](c)(inputParser(c)(e), pos)
|
||||||
}
|
}
|
||||||
|
|
@ -275,7 +277,9 @@ object ParserInput {
|
||||||
wrap[T](c)(c.universe.reify { Def.toSParser(e.splice) }, pos)
|
wrap[T](c)(c.universe.reify { Def.toSParser(e.splice) }, pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
private def wrapInitParser[T: c.WeakTypeTag](c: blackbox.Context)(tree: c.Tree, pos: c.Position) = {
|
private def wrapInitParser[T: c.WeakTypeTag](
|
||||||
|
c: blackbox.Context
|
||||||
|
)(tree: c.Tree, pos: c.Position) = {
|
||||||
val e = c.Expr[Initialize[Parser[T]]](tree)
|
val e = c.Expr[Initialize[Parser[T]]](tree)
|
||||||
val es = c.universe.reify { Def.toISParser(e.splice) }
|
val es = c.universe.reify { Def.toISParser(e.splice) }
|
||||||
wrapInit[T](c)(es, pos)
|
wrapInit[T](c)(es, pos)
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,9 @@ object TaskMacro {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private[this] def transformMacroImpl(c: blackbox.Context)(init: c.Tree)(newName: String): c.Tree = {
|
private[this] def transformMacroImpl(c: blackbox.Context)(init: c.Tree)(
|
||||||
|
newName: String
|
||||||
|
): c.Tree = {
|
||||||
import c.universe._
|
import c.universe._
|
||||||
val target =
|
val target =
|
||||||
c.macroApplication match {
|
c.macroApplication match {
|
||||||
|
|
|
||||||
|
|
@ -412,7 +412,12 @@ object Defaults extends BuildCommon {
|
||||||
derive(scalaBinaryVersion := binaryScalaVersion(scalaVersion.value))
|
derive(scalaBinaryVersion := binaryScalaVersion(scalaVersion.value))
|
||||||
))
|
))
|
||||||
|
|
||||||
def makeCrossSources(scalaSrcDir: File, javaSrcDir: File, sv: String, cross: Boolean): Seq[File] = {
|
def makeCrossSources(
|
||||||
|
scalaSrcDir: File,
|
||||||
|
javaSrcDir: File,
|
||||||
|
sv: String,
|
||||||
|
cross: Boolean
|
||||||
|
): Seq[File] = {
|
||||||
if (cross)
|
if (cross)
|
||||||
Seq(scalaSrcDir.getParentFile / s"${scalaSrcDir.name}-$sv", scalaSrcDir, javaSrcDir)
|
Seq(scalaSrcDir.getParentFile / s"${scalaSrcDir.name}-$sv", scalaSrcDir, javaSrcDir)
|
||||||
else
|
else
|
||||||
|
|
@ -3151,7 +3156,9 @@ trait BuildCommon {
|
||||||
def classpath: Classpath = Attributed blankSeq s
|
def classpath: Classpath = Attributed blankSeq s
|
||||||
}
|
}
|
||||||
|
|
||||||
def overrideConfigs(cs: Configuration*)(configurations: Seq[Configuration]): Seq[Configuration] = {
|
def overrideConfigs(cs: Configuration*)(
|
||||||
|
configurations: Seq[Configuration]
|
||||||
|
): Seq[Configuration] = {
|
||||||
val existingName = configurations.map(_.name).toSet
|
val existingName = configurations.map(_.name).toSet
|
||||||
val newByName = cs.map(c => (c.name, c)).toMap
|
val newByName = cs.map(c => (c.name, c)).toMap
|
||||||
val overridden = configurations map { conf =>
|
val overridden = configurations map { conf =>
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,11 @@ object SessionVar {
|
||||||
task.copy(info = task.info.postTransform(g))
|
task.copy(info = task.info.postTransform(g))
|
||||||
}
|
}
|
||||||
|
|
||||||
def resolveContext[T](key: ScopedKey[Task[T]], context: Scope, state: State): ScopedKey[Task[T]] = {
|
def resolveContext[T](
|
||||||
|
key: ScopedKey[Task[T]],
|
||||||
|
context: Scope,
|
||||||
|
state: State
|
||||||
|
): ScopedKey[Task[T]] = {
|
||||||
val subScope = Scope.replaceThis(context)(key.scope)
|
val subScope = Scope.replaceThis(context)(key.scope)
|
||||||
val scope = Project.structure(state).data.definingScope(subScope, key.key) getOrElse subScope
|
val scope = Project.structure(state).data.definingScope(subScope, key.key) getOrElse subScope
|
||||||
ScopedKey(scope, key.key)
|
ScopedKey(scope, key.key)
|
||||||
|
|
|
||||||
|
|
@ -617,7 +617,11 @@ private[sbt] object Load {
|
||||||
new LoadedBuild(loaded.root, units)
|
new LoadedBuild(loaded.root, units)
|
||||||
}
|
}
|
||||||
|
|
||||||
def resolveProjects(uri: URI, unit: PartBuildUnit, rootProject: URI => String): LoadedBuildUnit = {
|
def resolveProjects(
|
||||||
|
uri: URI,
|
||||||
|
unit: PartBuildUnit,
|
||||||
|
rootProject: URI => String
|
||||||
|
): LoadedBuildUnit = {
|
||||||
IO.assertAbsolute(uri)
|
IO.assertAbsolute(uri)
|
||||||
val resolve = (_: Project).resolve(ref => Scope.resolveProjectRef(uri, rootProject, ref))
|
val resolve = (_: Project).resolve(ref => Scope.resolveProjectRef(uri, rootProject, ref))
|
||||||
new LoadedBuildUnit(
|
new LoadedBuildUnit(
|
||||||
|
|
@ -842,7 +846,11 @@ private[sbt] object Load {
|
||||||
// a. Apply all the project manipulations from .sbt files in order
|
// a. Apply all the project manipulations from .sbt files in order
|
||||||
// b. Deduce the auto plugins for the project
|
// b. Deduce the auto plugins for the project
|
||||||
// c. Finalize a project with all its settings/configuration.
|
// c. Finalize a project with all its settings/configuration.
|
||||||
def finalizeProject(p: Project, files: Seq[File], expand: Boolean): (Project, Seq[Project]) = {
|
def finalizeProject(
|
||||||
|
p: Project,
|
||||||
|
files: Seq[File],
|
||||||
|
expand: Boolean
|
||||||
|
): (Project, Seq[Project]) = {
|
||||||
val configFiles = files flatMap { f =>
|
val configFiles = files flatMap { f =>
|
||||||
memoSettings.get(f)
|
memoSettings.get(f)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,10 @@ private[sbt] case class SbtParser(file: File, lines: Seq[String]) extends Parsed
|
||||||
* @param imports - trees
|
* @param imports - trees
|
||||||
* @return imports per line
|
* @return imports per line
|
||||||
*/
|
*/
|
||||||
private def importsToLineRanges(modifiedContent: String, imports: Seq[Tree]): Seq[(String, Int)] = {
|
private def importsToLineRanges(
|
||||||
|
modifiedContent: String,
|
||||||
|
imports: Seq[Tree]
|
||||||
|
): Seq[(String, Int)] = {
|
||||||
val toLineRange = imports map convertImport(modifiedContent)
|
val toLineRange = imports map convertImport(modifiedContent)
|
||||||
val groupedByLineNumber = toLineRange.groupBy { case (_, lineNumber) => lineNumber }
|
val groupedByLineNumber = toLineRange.groupBy { case (_, lineNumber) => lineNumber }
|
||||||
val mergedImports = groupedByLineNumber.map {
|
val mergedImports = groupedByLineNumber.map {
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,11 @@ abstract class TestBuild {
|
||||||
val root = projects.head
|
val root = projects.head
|
||||||
val projectMap = mapBy(projects)(_.id)
|
val projectMap = mapBy(projects)(_.id)
|
||||||
}
|
}
|
||||||
final class Proj(val id: String, val delegates: Seq[ProjectRef], val configurations: Seq[Config]) {
|
final class Proj(
|
||||||
|
val id: String,
|
||||||
|
val delegates: Seq[ProjectRef],
|
||||||
|
val configurations: Seq[Config]
|
||||||
|
) {
|
||||||
override def toString =
|
override def toString =
|
||||||
"Project " + id + "\n Delegates:\n " + delegates.mkString("\n ") +
|
"Project " + id + "\n Delegates:\n " + delegates.mkString("\n ") +
|
||||||
"\n Configurations:\n " + configurations.mkString("\n ")
|
"\n Configurations:\n " + configurations.mkString("\n ")
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,10 @@ final class ScriptedTests(resourceBaseDirectory: File,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private def createScriptedHandlers(testDir: File, buffered: Logger): Map[Char, StatementHandler] = {
|
private def createScriptedHandlers(
|
||||||
|
testDir: File,
|
||||||
|
buffered: Logger
|
||||||
|
): Map[Char, StatementHandler] = {
|
||||||
val fileHandler = new FileCommands(testDir)
|
val fileHandler = new FileCommands(testDir)
|
||||||
val sbtHandler = new SbtHandler(testDir, launcher, buffered, launchOpts)
|
val sbtHandler = new SbtHandler(testDir, launcher, buffered, launchOpts)
|
||||||
Map('$' -> fileHandler, '>' -> sbtHandler, '#' -> CommentHandler)
|
Map('$' -> fileHandler, '>' -> sbtHandler, '#' -> CommentHandler)
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,11 @@ final class TestDefinition(val name: String,
|
||||||
override def hashCode: Int = (name.hashCode, TestFramework.hashCode(fingerprint)).hashCode
|
override def hashCode: Int = (name.hashCode, TestFramework.hashCode(fingerprint)).hashCode
|
||||||
}
|
}
|
||||||
|
|
||||||
final class TestRunner(delegate: Runner, listeners: Vector[TestReportListener], log: ManagedLogger) {
|
final class TestRunner(
|
||||||
|
delegate: Runner,
|
||||||
|
listeners: Vector[TestReportListener],
|
||||||
|
log: ManagedLogger
|
||||||
|
) {
|
||||||
|
|
||||||
final def tasks(testDefs: Set[TestDefinition]): Array[TestTask] =
|
final def tasks(testDefs: Set[TestDefinition]): Array[TestTask] =
|
||||||
delegate.tasks(
|
delegate.tasks(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue