mirror of https://github.com/sbt/sbt.git
Add back, re-configure & re-enable Scalafmt
This commit is contained in:
parent
816958d8c8
commit
805b76f3d4
|
|
@ -8,11 +8,3 @@ docstrings = JavaDoc
|
||||||
|
|
||||||
# This also seems more idiomatic to include whitespace in import x.{ yyy }
|
# This also seems more idiomatic to include whitespace in import x.{ yyy }
|
||||||
spaces.inImportCurlyBraces = true
|
spaces.inImportCurlyBraces = true
|
||||||
|
|
||||||
# This works around sequence wildcard (`_*`) turning into `_ *`
|
|
||||||
spaces.beforeSeqWildcard = true
|
|
||||||
|
|
||||||
# Vertical alignment only => for pattern matching
|
|
||||||
align.tokens.add = [
|
|
||||||
{ code = "=>", owner = "Case" }
|
|
||||||
]
|
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,7 @@ matrix:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
matrix:
|
matrix:
|
||||||
# drop scalafmt on the 1.0.0 branch to dogfood 1.0.0-RC2 before there is a sbt 1.0 of new-sbt-scalafnt
|
- SBT_CMD=";mimaReportBinaryIssues ;scalafmt::test ;test:scalafmt::test ;sbt:scalafmt::test ;test:compile ;mainSettingsProj/test ;safeUnitTests ;otherUnitTests"
|
||||||
# - SBT_CMD=";mimaReportBinaryIssues;test:compile;scalafmt::test;test:scalafmt::test;mainSettingsProj/test;safeUnitTests;otherUnitTests"
|
|
||||||
- SBT_CMD=";mimaReportBinaryIssues;test:compile;mainSettingsProj/test;safeUnitTests;otherUnitTests"
|
|
||||||
- SBT_CMD="scripted actions/*"
|
- SBT_CMD="scripted actions/*"
|
||||||
- SBT_CMD="scripted apiinfo/* compiler-project/* ivy-deps-management/*"
|
- SBT_CMD="scripted apiinfo/* compiler-project/* ivy-deps-management/*"
|
||||||
- SBT_CMD="scripted dependency-management/*1of4"
|
- SBT_CMD="scripted dependency-management/*1of4"
|
||||||
|
|
|
||||||
13
build.sbt
13
build.sbt
|
|
@ -32,9 +32,8 @@ def buildLevelSettings: Seq[Setting[_]] =
|
||||||
homepage := Some(url("https://github.com/sbt/sbt")),
|
homepage := Some(url("https://github.com/sbt/sbt")),
|
||||||
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.0.0-RC3 has regression
|
scalafmtVersion := "1.1.0",
|
||||||
// scalafmtVersion := "0.6.8"
|
|
||||||
))
|
))
|
||||||
|
|
||||||
def commonSettings: Seq[Setting[_]] =
|
def commonSettings: Seq[Setting[_]] =
|
||||||
|
|
@ -66,8 +65,9 @@ def testedBaseSettings: Seq[Setting[_]] =
|
||||||
baseSettings ++ testDependencies
|
baseSettings ++ testDependencies
|
||||||
|
|
||||||
val mimaSettings = Def settings (
|
val mimaSettings = Def settings (
|
||||||
mimaPreviousArtifacts := Set(organization.value % moduleName.value % "1.0.0-RC3"
|
mimaPreviousArtifacts := Set(
|
||||||
cross (if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled)
|
organization.value % moduleName.value % "1.0.0-RC3"
|
||||||
|
cross (if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -367,7 +367,8 @@ lazy val mainProj = (project in file("main"))
|
||||||
addSbtLmCore,
|
addSbtLmCore,
|
||||||
addSbtLmIvy,
|
addSbtLmIvy,
|
||||||
addSbtCompilerInterface,
|
addSbtCompilerInterface,
|
||||||
addSbtZincCompile)
|
addSbtZincCompile
|
||||||
|
)
|
||||||
|
|
||||||
// Strictly for bringing implicits and aliases from subsystems into the top-level sbt namespace through a single package object
|
// Strictly for bringing implicits and aliases from subsystems into the top-level sbt namespace through a single package object
|
||||||
// technically, we need a dependency on all of mainProj's dependencies, but we don't do that since this is strictly an integration project
|
// technically, we need a dependency on all of mainProj's dependencies, but we don't do that since this is strictly an integration project
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,6 @@ object AttributeKey {
|
||||||
rank: Int): AttributeKey[T] =
|
rank: Int): AttributeKey[T] =
|
||||||
make(name, Some(description), extend, rank)
|
make(name, Some(description), extend, rank)
|
||||||
|
|
||||||
|
|
||||||
private[sbt] def copyWithRank[T](a: AttributeKey[T], rank: Int): AttributeKey[T] =
|
private[sbt] def copyWithRank[T](a: AttributeKey[T], rank: Int): AttributeKey[T] =
|
||||||
make(a.label, a.description, a.extend, rank)(a.manifest, a.optJsonWriter)
|
make(a.label, a.description, a.extend, rank)(a.manifest, a.optJsonWriter)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ abstract class JLine extends LineReader {
|
||||||
JLine.makeInputStream(injectThreadSleep && !Util.isNonCygwinWindows)
|
JLine.makeInputStream(injectThreadSleep && !Util.isNonCygwinWindows)
|
||||||
}
|
}
|
||||||
|
|
||||||
def readLine(prompt: String, mask: Option[Char] = None) =
|
def readLine(prompt: String, mask: Option[Char] = None) =
|
||||||
try {
|
try {
|
||||||
JLine.withJLine {
|
JLine.withJLine {
|
||||||
unsynchronizedReadLine(prompt, mask)
|
unsynchronizedReadLine(prompt, mask)
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,7 @@ object TokenCompletions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val default: TokenCompletions = mapDelegateCompletions(
|
val default: TokenCompletions = mapDelegateCompletions((seen, level, c) => ctoken(seen, c.append))
|
||||||
(seen, level, c) => ctoken(seen, c.append))
|
|
||||||
|
|
||||||
def displayOnly(msg: String): TokenCompletions = new Fixed {
|
def displayOnly(msg: String): TokenCompletions = new Fixed {
|
||||||
def completions(seen: String, level: Int) = Completions.single(Completion.displayOnly(msg))
|
def completions(seen: String, level: Int) = Completions.single(Completion.displayOnly(msg))
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,7 @@ object Tests {
|
||||||
* If None, the arguments will apply to all test frameworks.
|
* If None, the arguments will apply to all test frameworks.
|
||||||
* @param args The list of arguments to pass to the selected framework(s).
|
* @param args The list of arguments to pass to the selected framework(s).
|
||||||
*/
|
*/
|
||||||
final case class Argument(framework: Option[TestFramework], args: List[String])
|
final case class Argument(framework: Option[TestFramework], args: List[String]) extends TestOption
|
||||||
extends TestOption
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures test execution.
|
* Configures test execution.
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,7 @@ object Watched {
|
||||||
} catch {
|
} catch {
|
||||||
case e: Exception =>
|
case e: Exception =>
|
||||||
val log = s.log
|
val log = s.log
|
||||||
log.error(
|
log.error("Error occurred obtaining files to watch. Terminating continuous execution...")
|
||||||
"Error occurred obtaining files to watch. Terminating continuous execution...")
|
|
||||||
State.handleException(e, s, log)
|
State.handleException(e, s, log)
|
||||||
(false, watchState)
|
(false, watchState)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,9 @@ private[sbt] final class ConsoleChannel(val name: String) extends CommandChannel
|
||||||
case Some(src) if src.channelName != name =>
|
case Some(src) if src.channelName != name =>
|
||||||
askUserThread match {
|
askUserThread match {
|
||||||
case Some(x) =>
|
case Some(x) =>
|
||||||
// keep listening while network-origin command is running
|
// keep listening while network-origin command is running
|
||||||
// make sure to test Windows and Cygwin, if you uncomment
|
// make sure to test Windows and Cygwin, if you uncomment
|
||||||
// shutdown()
|
// shutdown()
|
||||||
case _ =>
|
case _ =>
|
||||||
}
|
}
|
||||||
case _ =>
|
case _ =>
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ object Remove {
|
||||||
trait Value[A, B] extends Any {
|
trait Value[A, B] extends Any {
|
||||||
def removeValue(a: A, b: B): A
|
def removeValue(a: A, b: B): A
|
||||||
}
|
}
|
||||||
@implicitNotFound(msg =
|
@implicitNotFound(
|
||||||
"No implicit for Remove.Values[${A}, ${B}] found,\n so ${B} cannot be removed from ${A}")
|
msg = "No implicit for Remove.Values[${A}, ${B}] found,\n so ${B} cannot be removed from ${A}")
|
||||||
trait Values[A, -B] extends Any {
|
trait Values[A, -B] extends Any {
|
||||||
def removeValues(a: A, b: B): A
|
def removeValues(a: A, b: B): A
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,25 +49,40 @@ object InputWrapper {
|
||||||
private[this] def implDetailError =
|
private[this] def implDetailError =
|
||||||
sys.error("This method is an implementation detail and should not be referenced.")
|
sys.error("This method is an implementation detail and should not be referenced.")
|
||||||
|
|
||||||
private[std] def wrapTask[T: c.WeakTypeTag](c: blackbox.Context)(ts: c.Expr[Any],
|
private[std] def wrapTask[T: c.WeakTypeTag](c: blackbox.Context)(
|
||||||
pos: c.Position): c.Expr[T] =
|
ts: c.Expr[Any],
|
||||||
|
pos: c.Position
|
||||||
|
): c.Expr[T] =
|
||||||
wrapImpl[T, InputWrapper.type](c, InputWrapper, WrapTaskName)(ts, pos)
|
wrapImpl[T, InputWrapper.type](c, InputWrapper, WrapTaskName)(ts, pos)
|
||||||
private[std] def wrapInit[T: c.WeakTypeTag](c: blackbox.Context)(ts: c.Expr[Any],
|
|
||||||
pos: c.Position): c.Expr[T] =
|
private[std] def wrapInit[T: c.WeakTypeTag](c: blackbox.Context)(
|
||||||
|
ts: c.Expr[Any],
|
||||||
|
pos: c.Position
|
||||||
|
): c.Expr[T] =
|
||||||
wrapImpl[T, InputWrapper.type](c, InputWrapper, WrapInitName)(ts, pos)
|
wrapImpl[T, InputWrapper.type](c, InputWrapper, WrapInitName)(ts, pos)
|
||||||
private[std] def wrapInitTask[T: c.WeakTypeTag](
|
|
||||||
c: blackbox.Context)(ts: c.Expr[Any], pos: c.Position): c.Expr[T] =
|
private[std] def wrapInitTask[T: c.WeakTypeTag](c: blackbox.Context)(
|
||||||
|
ts: c.Expr[Any],
|
||||||
|
pos: c.Position
|
||||||
|
): c.Expr[T] =
|
||||||
wrapImpl[T, InputWrapper.type](c, InputWrapper, WrapInitTaskName)(ts, pos)
|
wrapImpl[T, InputWrapper.type](c, InputWrapper, WrapInitTaskName)(ts, pos)
|
||||||
|
|
||||||
private[std] def wrapInitInputTask[T: c.WeakTypeTag](
|
private[std] def wrapInitInputTask[T: c.WeakTypeTag](c: blackbox.Context)(
|
||||||
c: blackbox.Context)(ts: c.Expr[Any], pos: c.Position): c.Expr[T] =
|
ts: c.Expr[Any],
|
||||||
|
pos: c.Position
|
||||||
|
): c.Expr[T] =
|
||||||
wrapImpl[T, InputWrapper.type](c, InputWrapper, WrapInitInputName)(ts, pos)
|
wrapImpl[T, InputWrapper.type](c, InputWrapper, WrapInitInputName)(ts, pos)
|
||||||
private[std] def wrapInputTask[T: c.WeakTypeTag](
|
|
||||||
c: blackbox.Context)(ts: c.Expr[Any], pos: c.Position): c.Expr[T] =
|
private[std] def wrapInputTask[T: c.WeakTypeTag](c: blackbox.Context)(
|
||||||
|
ts: c.Expr[Any],
|
||||||
|
pos: c.Position
|
||||||
|
): c.Expr[T] =
|
||||||
wrapImpl[T, InputWrapper.type](c, InputWrapper, WrapInputName)(ts, pos)
|
wrapImpl[T, InputWrapper.type](c, InputWrapper, WrapInputName)(ts, pos)
|
||||||
|
|
||||||
private[std] def wrapPrevious[T: c.WeakTypeTag](
|
private[std] def wrapPrevious[T: c.WeakTypeTag](c: blackbox.Context)(
|
||||||
c: blackbox.Context)(ts: c.Expr[Any], pos: c.Position): c.Expr[Option[T]] =
|
ts: c.Expr[Any],
|
||||||
|
pos: c.Position
|
||||||
|
): c.Expr[Option[T]] =
|
||||||
wrapImpl[Option[T], InputWrapper.type](c, InputWrapper, WrapPreviousName)(ts, pos)
|
wrapImpl[Option[T], InputWrapper.type](c, InputWrapper, WrapPreviousName)(ts, pos)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -79,8 +94,8 @@ object InputWrapper {
|
||||||
def wrapImpl[T: c.WeakTypeTag, S <: AnyRef with Singleton](
|
def wrapImpl[T: c.WeakTypeTag, S <: AnyRef with Singleton](
|
||||||
c: blackbox.Context,
|
c: blackbox.Context,
|
||||||
s: S,
|
s: S,
|
||||||
wrapName: String)(ts: c.Expr[Any], pos: c.Position)(
|
wrapName: String
|
||||||
implicit it: c.TypeTag[s.type]): c.Expr[T] = {
|
)(ts: c.Expr[Any], pos: c.Position)(implicit it: c.TypeTag[s.type]): c.Expr[T] = {
|
||||||
import c.universe.{ Apply => ApplyTree, _ }
|
import c.universe.{ Apply => ApplyTree, _ }
|
||||||
import internal.decorators._
|
import internal.decorators._
|
||||||
val util = new ContextUtil[c.type](c)
|
val util = new ContextUtil[c.type](c)
|
||||||
|
|
@ -260,8 +275,7 @@ 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,
|
private def wrapInitParser[T: c.WeakTypeTag](c: blackbox.Context)(tree: c.Tree, pos: c.Position) = {
|
||||||
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)
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,7 @@ object InitializeConvert extends Convert {
|
||||||
|
|
||||||
object SettingMacro {
|
object SettingMacro {
|
||||||
import LinterDSL.{ Empty => EmptyLinter }
|
import LinterDSL.{ Empty => EmptyLinter }
|
||||||
def settingMacroImpl[T: c.WeakTypeTag](c: blackbox.Context)(
|
def settingMacroImpl[T: c.WeakTypeTag](c: blackbox.Context)(t: c.Expr[T]): c.Expr[Initialize[T]] =
|
||||||
t: c.Expr[T]): c.Expr[Initialize[T]] =
|
|
||||||
Instance.contImpl[T, Id](c, InitializeInstance, InitializeConvert, MixedBuilder, EmptyLinter)(
|
Instance.contImpl[T, Id](c, InitializeInstance, InitializeConvert, MixedBuilder, EmptyLinter)(
|
||||||
Left(t),
|
Left(t),
|
||||||
Instance.idTransform[c.type])
|
Instance.idTransform[c.type])
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,7 @@ object TaskMacro {
|
||||||
f: c.Expr[S => S]): c.Expr[Setting[S]] =
|
f: c.Expr[S => S]): c.Expr[Setting[S]] =
|
||||||
c.Expr[Setting[S]](transformMacroImpl(c)(f.tree)(TransformInitName))
|
c.Expr[Setting[S]](transformMacroImpl(c)(f.tree)(TransformInitName))
|
||||||
|
|
||||||
def settingAssignPure[T: c.WeakTypeTag](c: blackbox.Context)(
|
def settingAssignPure[T: c.WeakTypeTag](c: blackbox.Context)(app: c.Expr[T]): c.Expr[Setting[T]] =
|
||||||
app: c.Expr[T]): c.Expr[Setting[T]] =
|
|
||||||
settingAssignPosition(c)(c.universe.reify { Def.valueStrict(app.splice) })
|
settingAssignPosition(c)(c.universe.reify { Def.valueStrict(app.splice) })
|
||||||
|
|
||||||
def settingAssignPosition[T: c.WeakTypeTag](c: blackbox.Context)(
|
def settingAssignPosition[T: c.WeakTypeTag](c: blackbox.Context)(
|
||||||
|
|
@ -301,8 +300,7 @@ object TaskMacro {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private[this] def transformMacroImpl(c: blackbox.Context)(init: c.Tree)(
|
private[this] def transformMacroImpl(c: blackbox.Context)(init: c.Tree)(newName: String): c.Tree = {
|
||||||
newName: String): c.Tree = {
|
|
||||||
import c.universe._
|
import c.universe._
|
||||||
val target =
|
val target =
|
||||||
c.macroApplication match {
|
c.macroApplication match {
|
||||||
|
|
|
||||||
|
|
@ -58,9 +58,9 @@ object BuildPaths {
|
||||||
fileSetting(globalSettingsDirectory, GlobalSettingsProperty, globalBase)(state)
|
fileSetting(globalSettingsDirectory, GlobalSettingsProperty, globalBase)(state)
|
||||||
|
|
||||||
def getDependencyDirectory(state: State, globalBase: File): File =
|
def getDependencyDirectory(state: State, globalBase: File): File =
|
||||||
fileSetting(dependencyBaseDirectory,
|
fileSetting(dependencyBaseDirectory, DependencyBaseProperty, defaultDependencyBase(globalBase))(
|
||||||
DependencyBaseProperty,
|
state
|
||||||
defaultDependencyBase(globalBase))(state)
|
)
|
||||||
|
|
||||||
def getZincDirectory(state: State, globalBase: File): File =
|
def getZincDirectory(state: State, globalBase: File): File =
|
||||||
fileSetting(globalZincDirectory, GlobalZincProperty, defaultGlobalZinc(globalBase))(state)
|
fileSetting(globalZincDirectory, GlobalZincProperty, defaultGlobalZinc(globalBase))(state)
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,7 @@ import java.util.concurrent.{ TimeUnit, Callable }
|
||||||
import Keys._
|
import Keys._
|
||||||
import org.apache.ivy.core.module.{ descriptor, id }, descriptor.ModuleDescriptor,
|
import org.apache.ivy.core.module.{ descriptor, id }, descriptor.ModuleDescriptor,
|
||||||
id.ModuleRevisionId
|
id.ModuleRevisionId
|
||||||
import Project.{
|
import Project.{ inConfig, inScope, inTask, richInitialize, richInitializeTask, richTaskSessionVar }
|
||||||
inConfig,
|
|
||||||
inScope,
|
|
||||||
inTask,
|
|
||||||
richInitialize,
|
|
||||||
richInitializeTask,
|
|
||||||
richTaskSessionVar
|
|
||||||
}
|
|
||||||
import sbt.internal._
|
import sbt.internal._
|
||||||
import sbt.internal.CommandStrings.ExportStream
|
import sbt.internal.CommandStrings.ExportStream
|
||||||
import sbt.internal.inc.ZincUtil
|
import sbt.internal.inc.ZincUtil
|
||||||
|
|
@ -419,10 +412,7 @@ object Defaults extends BuildCommon {
|
||||||
derive(scalaBinaryVersion := binaryScalaVersion(scalaVersion.value))
|
derive(scalaBinaryVersion := binaryScalaVersion(scalaVersion.value))
|
||||||
))
|
))
|
||||||
|
|
||||||
def makeCrossSources(scalaSrcDir: File,
|
def makeCrossSources(scalaSrcDir: File, javaSrcDir: File, sv: String, cross: Boolean): Seq[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
|
||||||
|
|
@ -1070,8 +1060,7 @@ object Defaults extends BuildCommon {
|
||||||
case None => scope :: Nil
|
case None => scope :: Nil
|
||||||
}
|
}
|
||||||
|
|
||||||
def packageTaskSettings(key: TaskKey[File],
|
def packageTaskSettings(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File, String)]]]) =
|
||||||
mappingsTask: Initialize[Task[Seq[(File, String)]]]) =
|
|
||||||
inTask(key)(
|
inTask(key)(
|
||||||
Seq(
|
Seq(
|
||||||
key in TaskZero := packageTask.value,
|
key in TaskZero := packageTask.value,
|
||||||
|
|
@ -2125,12 +2114,13 @@ object Classpaths {
|
||||||
LibraryManagement.transitiveScratch(
|
LibraryManagement.transitiveScratch(
|
||||||
lm,
|
lm,
|
||||||
"sbt",
|
"sbt",
|
||||||
GetClassifiersConfiguration(mod,
|
GetClassifiersConfiguration(
|
||||||
excludes.toVector,
|
mod,
|
||||||
c.withArtifactFilter(c.artifactFilter.map(af =>
|
excludes.toVector,
|
||||||
af.withInverted(!af.inverted))),
|
c.withArtifactFilter(c.artifactFilter.map(af => af.withInverted(!af.inverted))),
|
||||||
srcTypes.toVector,
|
srcTypes.toVector,
|
||||||
docTypes.toVector),
|
docTypes.toVector
|
||||||
|
),
|
||||||
uwConfig,
|
uwConfig,
|
||||||
log
|
log
|
||||||
) match {
|
) match {
|
||||||
|
|
@ -2171,11 +2161,11 @@ object Classpaths {
|
||||||
val s = streams.value
|
val s = streams.value
|
||||||
val skp = (skip in publish).value
|
val skp = (skip in publish).value
|
||||||
val ref = thisProjectRef.value
|
val ref = thisProjectRef.value
|
||||||
if (skp) Def.task { s.log.debug(s"Skipping publish* for ${ref.project}") }
|
if (skp) Def.task { s.log.debug(s"Skipping publish* for ${ref.project}") } else
|
||||||
else Def.task {
|
Def.task {
|
||||||
val cfg = config.value
|
val cfg = config.value
|
||||||
IvyActions.publish(ivyModule.value, config.value, s.log)
|
IvyActions.publish(ivyModule.value, config.value, s.log)
|
||||||
}
|
}
|
||||||
} tag (Tags.Publish, Tags.Network)
|
} tag (Tags.Publish, Tags.Network)
|
||||||
|
|
||||||
val moduleIdJsonKeyFormat: sjsonnew.JsonKeyFormat[ModuleID] =
|
val moduleIdJsonKeyFormat: sjsonnew.JsonKeyFormat[ModuleID] =
|
||||||
|
|
|
||||||
|
|
@ -114,10 +114,8 @@ final case class Extracted(structure: BuildStructure,
|
||||||
display.show(ScopedKey(scope, key)) + " is undefined.")
|
display.show(ScopedKey(scope, key)) + " is undefined.")
|
||||||
|
|
||||||
def append(settings: Seq[Setting[_]], state: State): State = {
|
def append(settings: Seq[Setting[_]], state: State): State = {
|
||||||
val appendSettings = Load.transformSettings(Load.projectScope(currentRef),
|
val appendSettings =
|
||||||
currentRef.build,
|
Load.transformSettings(Load.projectScope(currentRef), currentRef.build, rootProject, settings)
|
||||||
rootProject,
|
|
||||||
settings)
|
|
||||||
val newStructure = Load.reapply(session.original ++ appendSettings, structure)
|
val newStructure = Load.reapply(session.original ++ appendSettings, structure)
|
||||||
Project.setProject(session, newStructure, state)
|
Project.setProject(session, newStructure, state)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,9 @@ private[sbt] object PluginCross {
|
||||||
state.log.info(s"Setting `sbtVersion in pluginCrossBuild` to $version")
|
state.log.info(s"Setting `sbtVersion in pluginCrossBuild` to $version")
|
||||||
val add = List(sbtVersion in GlobalScope in pluginCrossBuild :== version) ++
|
val add = List(sbtVersion in GlobalScope in pluginCrossBuild :== version) ++
|
||||||
List(scalaVersion := scalaVersionSetting.value) ++
|
List(scalaVersion := scalaVersionSetting.value) ++
|
||||||
inScope(GlobalScope.copy(project = Select(currentRef)))(Seq(
|
inScope(GlobalScope.copy(project = Select(currentRef)))(
|
||||||
scalaVersion := scalaVersionSetting.value
|
Seq(scalaVersion := scalaVersionSetting.value)
|
||||||
))
|
)
|
||||||
val cleared = session.mergeSettings.filterNot(crossExclude)
|
val cleared = session.mergeSettings.filterNot(crossExclude)
|
||||||
val newStructure = Load.reapply(cleared ++ add, structure)
|
val newStructure = Load.reapply(cleared ++ add, structure)
|
||||||
Project.setProject(session, newStructure, command :: state)
|
Project.setProject(session, newStructure, command :: state)
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,8 @@ object Plugins extends PluginsFunctions {
|
||||||
val selectedPlugins = selectedAtoms map { a =>
|
val selectedPlugins = selectedAtoms map { a =>
|
||||||
byAtomMap.getOrElse(
|
byAtomMap.getOrElse(
|
||||||
a,
|
a,
|
||||||
throw AutoPluginException(s"${a} was not found in atom map."))
|
throw AutoPluginException(s"${a} was not found in atom map.")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
val forbidden: Set[AutoPlugin] =
|
val forbidden: Set[AutoPlugin] =
|
||||||
(selectedPlugins flatMap { Plugins.asExclusions }).toSet
|
(selectedPlugins flatMap { Plugins.asExclusions }).toSet
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,7 @@ object SessionVar {
|
||||||
set(key, state, value)
|
set(key, state, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
def persist[T](key: ScopedKey[Task[T]], state: State, value: T)(
|
def persist[T](key: ScopedKey[Task[T]], state: State, value: T)(implicit f: JsonFormat[T]): Unit =
|
||||||
implicit f: JsonFormat[T]): Unit =
|
|
||||||
Project.structure(state).streams(state).use(key)(s => s.getOutput(DefaultDataID).write(value))
|
Project.structure(state).streams(state).use(key)(s => s.getOutput(DefaultDataID).write(value))
|
||||||
|
|
||||||
def clear(s: State): State = s.put(sessionVars, SessionVar.emptyMap)
|
def clear(s: State): State = s.put(sessionVars, SessionVar.emptyMap)
|
||||||
|
|
@ -41,14 +40,11 @@ object SessionVar {
|
||||||
def orEmpty(opt: Option[Map]) = opt getOrElse emptyMap
|
def orEmpty(opt: Option[Map]) = opt getOrElse emptyMap
|
||||||
|
|
||||||
def transform[S](task: Task[S], f: (State, S) => State): Task[S] = {
|
def transform[S](task: Task[S], f: (State, S) => State): Task[S] = {
|
||||||
val g = (s: S, map: AttributeMap) =>
|
val g = (s: S, map: AttributeMap) => map.put(Keys.transformState, (state: State) => f(state, s))
|
||||||
map.put(Keys.transformState, (state: State) => f(state, s))
|
|
||||||
task.copy(info = task.info.postTransform(g))
|
task.copy(info = task.info.postTransform(g))
|
||||||
}
|
}
|
||||||
|
|
||||||
def resolveContext[T](key: ScopedKey[Task[T]],
|
def resolveContext[T](key: ScopedKey[Task[T]], context: Scope, state: State): 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)
|
||||||
|
|
|
||||||
|
|
@ -159,11 +159,14 @@ object Act {
|
||||||
case ParsedZero => None :: Nil
|
case ParsedZero => None :: Nil
|
||||||
case pv: ParsedValue[x] => Some(pv.value) :: Nil
|
case pv: ParsedValue[x] => Some(pv.value) :: Nil
|
||||||
}
|
}
|
||||||
|
|
||||||
def defaultConfigurations(
|
def defaultConfigurations(
|
||||||
proj: Option[ResolvedReference],
|
proj: Option[ResolvedReference],
|
||||||
index: KeyIndex,
|
index: KeyIndex,
|
||||||
defaultConfigs: Option[ResolvedReference] => Seq[String]): Seq[String] =
|
defaultConfigs: Option[ResolvedReference] => Seq[String]
|
||||||
|
): Seq[String] =
|
||||||
if (index exists proj) defaultConfigs(proj) else Nil
|
if (index exists proj) defaultConfigs(proj) else Nil
|
||||||
|
|
||||||
def nonEmptyConfig(index: KeyIndex,
|
def nonEmptyConfig(index: KeyIndex,
|
||||||
proj: Option[ResolvedReference]): String => Seq[Option[String]] =
|
proj: Option[ResolvedReference]): String => Seq[Option[String]] =
|
||||||
config => if (index.isEmpty(proj, Some(config))) Nil else Some(config) :: Nil
|
config => if (index.isEmpty(proj, Some(config))) Nil else Some(config) :: Nil
|
||||||
|
|
|
||||||
|
|
@ -204,8 +204,7 @@ object Aggregation {
|
||||||
if (other.nonEmpty) {
|
if (other.nonEmpty) {
|
||||||
val inputStrings = inputTasks.map(_.key).mkString("Input task(s):\n\t", "\n\t", "\n")
|
val inputStrings = inputTasks.map(_.key).mkString("Input task(s):\n\t", "\n\t", "\n")
|
||||||
val otherStrings = other.map(_.key).mkString("Task(s)/setting(s):\n\t", "\n\t", "\n")
|
val otherStrings = other.map(_.key).mkString("Task(s)/setting(s):\n\t", "\n\t", "\n")
|
||||||
failure(
|
failure(s"Cannot mix input tasks with plain tasks/settings. $inputStrings $otherStrings")
|
||||||
s"Cannot mix input tasks with plain tasks/settings. $inputStrings $otherStrings")
|
|
||||||
} else
|
} else
|
||||||
applyDynamicTasks(s, structure, maps(inputTasks)(castToAny), show)
|
applyDynamicTasks(s, structure, maps(inputTasks)(castToAny), show)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -138,8 +138,8 @@ $LastCommand <key>
|
||||||
""".stripMargin.trim
|
""".stripMargin.trim
|
||||||
|
|
||||||
val SetCommand = "set"
|
val SetCommand = "set"
|
||||||
val setBrief = (s"$SetCommand [every] <setting>",
|
val setBrief =
|
||||||
"Evaluates a Setting and applies it to the current project.")
|
(s"$SetCommand [every] <setting>", "Evaluates a Setting and applies it to the current project.")
|
||||||
val setDetailed =
|
val setDetailed =
|
||||||
s"""$SetCommand [every] <setting-expression>
|
s"""$SetCommand [every] <setting-expression>
|
||||||
|
|
||||||
|
|
@ -275,8 +275,7 @@ $ProjectsCommand remove <URI>+
|
||||||
def LoadProjectImpl = "loadp"
|
def LoadProjectImpl = "loadp"
|
||||||
def LoadProject = "reload"
|
def LoadProject = "reload"
|
||||||
def LoadProjectBrief =
|
def LoadProjectBrief =
|
||||||
(LoadProject,
|
(LoadProject, "(Re)loads the current project or changes to plugins project or returns from it.")
|
||||||
"(Re)loads the current project or changes to plugins project or returns from it.")
|
|
||||||
def LoadProjectDetailed =
|
def LoadProjectDetailed =
|
||||||
s"""$LoadProject
|
s"""$LoadProject
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,8 @@ object KeyIndex {
|
||||||
concat(_.tasks(proj, conf, key))
|
concat(_.tasks(proj, conf, key))
|
||||||
def keys(proj: Option[ResolvedReference]) = concat(_.keys(proj))
|
def keys(proj: Option[ResolvedReference]) = concat(_.keys(proj))
|
||||||
def keys(proj: Option[ResolvedReference], conf: Option[String]) = concat(_.keys(proj, conf))
|
def keys(proj: Option[ResolvedReference], conf: Option[String]) = concat(_.keys(proj, conf))
|
||||||
def keys(proj: Option[ResolvedReference],
|
def keys(proj: Option[ResolvedReference], conf: Option[String], task: Option[AttributeKey[_]]) =
|
||||||
conf: Option[String],
|
concat(_.keys(proj, conf, task))
|
||||||
task: Option[AttributeKey[_]]) = concat(_.keys(proj, conf, task))
|
|
||||||
def concat[T](f: KeyIndex => Set[T]): Set[T] =
|
def concat[T](f: KeyIndex => Set[T]): Set[T] =
|
||||||
(Set.empty[T] /: indices)((s, k) => s ++ f(k))
|
(Set.empty[T] /: indices)((s, k) => s ++ f(k))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -742,9 +742,8 @@ private[sbt] object Load {
|
||||||
val defs = if (defsScala.isEmpty) defaultBuildIfNone :: Nil else defsScala
|
val defs = if (defsScala.isEmpty) defaultBuildIfNone :: Nil else defsScala
|
||||||
// HERE we pull out the defined vals from memoSettings and unify them all so
|
// HERE we pull out the defined vals from memoSettings and unify them all so
|
||||||
// we can use them later.
|
// we can use them later.
|
||||||
val valDefinitions = memoSettings.values.foldLeft(DefinedSbtValues.empty) {
|
val valDefinitions = memoSettings.values.foldLeft(DefinedSbtValues.empty) { (prev, sbtFile) =>
|
||||||
(prev, sbtFile) =>
|
prev.zip(sbtFile.definitions)
|
||||||
prev.zip(sbtFile.definitions)
|
|
||||||
}
|
}
|
||||||
val loadedDefs = new LoadedDefinitions(
|
val loadedDefs = new LoadedDefinitions(
|
||||||
defDir,
|
defDir,
|
||||||
|
|
|
||||||
|
|
@ -167,8 +167,7 @@ object LogManager {
|
||||||
def command(useFormat: Boolean) =
|
def command(useFormat: Boolean) =
|
||||||
if (useFormat) BLUE + commandBase + RESET else s"'$commandBase'"
|
if (useFormat) BLUE + commandBase + RESET else s"'$commandBase'"
|
||||||
context =>
|
context =>
|
||||||
Some(
|
Some("Stack trace suppressed: run %s for the full output.".format(command(context.useFormat)))
|
||||||
"Stack trace suppressed: run %s for the full output.".format(command(context.useFormat)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def unwrapStreamsKey(key: ScopedKey[_]): ScopedKey[_] = key.scope.task match {
|
def unwrapStreamsKey(key: ScopedKey[_]): ScopedKey[_] = key.scope.task match {
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,8 @@ private[sbt] object SettingCompletions {
|
||||||
settings: Seq[Def.Setting[_]],
|
settings: Seq[Def.Setting[_]],
|
||||||
arg: String): SetResult = {
|
arg: String): SetResult = {
|
||||||
import extracted._
|
import extracted._
|
||||||
val append = Load.transformSettings(Load.projectScope(currentRef),
|
val append =
|
||||||
currentRef.build,
|
Load.transformSettings(Load.projectScope(currentRef), currentRef.build, rootProject, settings)
|
||||||
rootProject,
|
|
||||||
settings)
|
|
||||||
val newSession = session.appendSettings(append map (a => (a, arg.split('\n').toList)))
|
val newSession = session.appendSettings(append map (a => (a, arg.split('\n').toList)))
|
||||||
val r = relation(newSession.mergeSettings, true)(structure.delegates,
|
val r = relation(newSession.mergeSettings, true)(structure.delegates,
|
||||||
structure.scopeLocal,
|
structure.scopeLocal,
|
||||||
|
|
|
||||||
|
|
@ -382,43 +382,27 @@ trait TaskSequential {
|
||||||
),
|
),
|
||||||
last
|
last
|
||||||
)
|
)
|
||||||
def sequential[A0,
|
def sequential[A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, B](
|
||||||
A1,
|
task0: Initialize[Task[A0]],
|
||||||
A2,
|
task1: Initialize[Task[A1]],
|
||||||
A3,
|
task2: Initialize[Task[A2]],
|
||||||
A4,
|
task3: Initialize[Task[A3]],
|
||||||
A5,
|
task4: Initialize[Task[A4]],
|
||||||
A6,
|
task5: Initialize[Task[A5]],
|
||||||
A7,
|
task6: Initialize[Task[A6]],
|
||||||
A8,
|
task7: Initialize[Task[A7]],
|
||||||
A9,
|
task8: Initialize[Task[A8]],
|
||||||
A10,
|
task9: Initialize[Task[A9]],
|
||||||
A11,
|
task10: Initialize[Task[A10]],
|
||||||
A12,
|
task11: Initialize[Task[A11]],
|
||||||
A13,
|
task12: Initialize[Task[A12]],
|
||||||
A14,
|
task13: Initialize[Task[A13]],
|
||||||
A15,
|
task14: Initialize[Task[A14]],
|
||||||
A16,
|
task15: Initialize[Task[A15]],
|
||||||
A17,
|
task16: Initialize[Task[A16]],
|
||||||
B](task0: Initialize[Task[A0]],
|
task17: Initialize[Task[A17]],
|
||||||
task1: Initialize[Task[A1]],
|
last: Initialize[Task[B]]
|
||||||
task2: Initialize[Task[A2]],
|
): Initialize[Task[B]] =
|
||||||
task3: Initialize[Task[A3]],
|
|
||||||
task4: Initialize[Task[A4]],
|
|
||||||
task5: Initialize[Task[A5]],
|
|
||||||
task6: Initialize[Task[A6]],
|
|
||||||
task7: Initialize[Task[A7]],
|
|
||||||
task8: Initialize[Task[A8]],
|
|
||||||
task9: Initialize[Task[A9]],
|
|
||||||
task10: Initialize[Task[A10]],
|
|
||||||
task11: Initialize[Task[A11]],
|
|
||||||
task12: Initialize[Task[A12]],
|
|
||||||
task13: Initialize[Task[A13]],
|
|
||||||
task14: Initialize[Task[A14]],
|
|
||||||
task15: Initialize[Task[A15]],
|
|
||||||
task16: Initialize[Task[A16]],
|
|
||||||
task17: Initialize[Task[A17]],
|
|
||||||
last: Initialize[Task[B]]): Initialize[Task[B]] =
|
|
||||||
sequential(
|
sequential(
|
||||||
List(
|
List(
|
||||||
unitTask(task0),
|
unitTask(task0),
|
||||||
|
|
|
||||||
|
|
@ -185,8 +185,7 @@ sealed trait ParsedSbtFileExpressions {
|
||||||
* @param file The file we're parsing (may be a dummy file)
|
* @param file The file we're parsing (may be a dummy file)
|
||||||
* @param lines The parsed "lines" of the file, where each string is a line.
|
* @param lines The parsed "lines" of the file, where each string is a line.
|
||||||
*/
|
*/
|
||||||
private[sbt] case class SbtParser(file: File, lines: Seq[String])
|
private[sbt] case class SbtParser(file: File, lines: Seq[String]) extends ParsedSbtFileExpressions {
|
||||||
extends ParsedSbtFileExpressions {
|
|
||||||
//settingsTrees,modifiedContent needed for "session save"
|
//settingsTrees,modifiedContent needed for "session save"
|
||||||
// TODO - We should look into splitting out "definitions" vs. "settings" here instead of further string lookups, since we have the
|
// TODO - We should look into splitting out "definitions" vs. "settings" here instead of further string lookups, since we have the
|
||||||
// parsed trees.
|
// parsed trees.
|
||||||
|
|
@ -265,8 +264,7 @@ private[sbt] case class SbtParser(file: File, lines: Seq[String])
|
||||||
* @param imports - trees
|
* @param imports - trees
|
||||||
* @return imports per line
|
* @return imports per line
|
||||||
*/
|
*/
|
||||||
private def importsToLineRanges(modifiedContent: String,
|
private def importsToLineRanges(modifiedContent: String, imports: Seq[Tree]): Seq[(String, Int)] = {
|
||||||
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 {
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,7 @@ final class NetworkChannel(val name: String, connection: Socket, structure: Buil
|
||||||
}
|
}
|
||||||
|
|
||||||
private def onExecCommand(cmd: ExecCommand) =
|
private def onExecCommand(cmd: ExecCommand) =
|
||||||
append(
|
append(Exec(cmd.commandLine, cmd.execId orElse Some(Exec.newExecId), Some(CommandSource(name))))
|
||||||
Exec(cmd.commandLine, cmd.execId orElse Some(Exec.newExecId), Some(CommandSource(name))))
|
|
||||||
|
|
||||||
private def onSettingQuery(req: SettingQuery) =
|
private def onSettingQuery(req: SettingQuery) =
|
||||||
StandardMain.exchange publishEventMessage SettingQuery.handleSettingQuery(req, structure)
|
StandardMain.exchange publishEventMessage SettingQuery.handleSettingQuery(req, structure)
|
||||||
|
|
|
||||||
|
|
@ -87,9 +87,7 @@ object ParseKey extends Properties("Key parser test") {
|
||||||
structureGen: Gen[Structure]): Gen[StructureKeyMask] =
|
structureGen: Gen[Structure]): Gen[StructureKeyMask] =
|
||||||
for (mask <- maskGen; structure <- structureGen; key <- genKey(structure))
|
for (mask <- maskGen; structure <- structureGen; key <- genKey(structure))
|
||||||
yield new StructureKeyMask(structure, key, mask)
|
yield new StructureKeyMask(structure, key, mask)
|
||||||
final class StructureKeyMask(val structure: Structure,
|
final class StructureKeyMask(val structure: Structure, val key: ScopedKey[_], val mask: ScopeMask)
|
||||||
val key: ScopedKey[_],
|
|
||||||
val mask: ScopeMask)
|
|
||||||
|
|
||||||
def resolve(structure: Structure, key: ScopedKey[_], mask: ScopeMask): ScopedKey[_] =
|
def resolve(structure: Structure, key: ScopedKey[_], mask: ScopeMask): ScopedKey[_] =
|
||||||
ScopedKey(Resolve(structure.extra, Select(structure.current), key.key, mask)(key.scope),
|
ScopedKey(Resolve(structure.extra, Select(structure.current), key.key, mask)(key.scope),
|
||||||
|
|
|
||||||
|
|
@ -184,8 +184,7 @@ abstract class TestBuild {
|
||||||
project <- oneOf(build.projects)
|
project <- oneOf(build.projects)
|
||||||
cAxis <- oneOrGlobal(project.configurations map toConfigKey)
|
cAxis <- oneOrGlobal(project.configurations map toConfigKey)
|
||||||
tAxis <- oneOrGlobal(env.tasks map getKey)
|
tAxis <- oneOrGlobal(env.tasks map getKey)
|
||||||
pAxis <- orGlobal(
|
pAxis <- orGlobal(frequency((1, BuildRef(build.uri)), (3, ProjectRef(build.uri, project.id))))
|
||||||
frequency((1, BuildRef(build.uri)), (3, ProjectRef(build.uri, project.id))))
|
|
||||||
} yield Scope(pAxis, cAxis, tAxis, Zero)
|
} yield Scope(pAxis, cAxis, tAxis, Zero)
|
||||||
|
|
||||||
def orGlobal[T](gen: Gen[T]): Gen[ScopeAxis[T]] =
|
def orGlobal[T](gen: Gen[T]): Gen[ScopeAxis[T]] =
|
||||||
|
|
@ -265,9 +264,7 @@ abstract class TestBuild {
|
||||||
maxDeps: Gen[Int],
|
maxDeps: Gen[Int],
|
||||||
count: Gen[Int]): Gen[Seq[Config]] =
|
count: Gen[Int]): Gen[Seq[Config]] =
|
||||||
genAcyclicDirect[Config, String](maxDeps, genName, count)((key, deps) => new Config(key, deps))
|
genAcyclicDirect[Config, String](maxDeps, genName, count)((key, deps) => new Config(key, deps))
|
||||||
def genTasks(implicit genName: Gen[String],
|
def genTasks(implicit genName: Gen[String], maxDeps: Gen[Int], count: Gen[Int]): Gen[Seq[Taskk]] =
|
||||||
maxDeps: Gen[Int],
|
|
||||||
count: Gen[Int]): Gen[Seq[Taskk]] =
|
|
||||||
genAcyclicDirect[Taskk, String](maxDeps, genName, count)((key, deps) =>
|
genAcyclicDirect[Taskk, String](maxDeps, genName, count)((key, deps) =>
|
||||||
new Taskk(AttributeKey[String](key), deps))
|
new Taskk(AttributeKey[String](key), deps))
|
||||||
|
|
||||||
|
|
@ -286,8 +283,7 @@ abstract class TestBuild {
|
||||||
genAcyclic(maxDeps, keys.distinct)(make)
|
genAcyclic(maxDeps, keys.distinct)(make)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def genAcyclic[A, T](maxDeps: Gen[Int], keys: List[T])(
|
def genAcyclic[A, T](maxDeps: Gen[Int], keys: List[T])(make: T => Gen[Seq[A] => A]): Gen[Seq[A]] =
|
||||||
make: T => Gen[Seq[A] => A]): Gen[Seq[A]] =
|
|
||||||
genAcyclic(maxDeps, keys, Nil) flatMap { pairs =>
|
genAcyclic(maxDeps, keys, Nil) flatMap { pairs =>
|
||||||
sequence(pairs.map { case (key, deps) => mapMake(key, deps, make) }) flatMap { inputs =>
|
sequence(pairs.map { case (key, deps) => mapMake(key, deps, make) }) flatMap { inputs =>
|
||||||
val made = new collection.mutable.HashMap[T, A]
|
val made = new collection.mutable.HashMap[T, A]
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,7 @@ abstract class AbstractSessionSettingsSpec(folder: String) extends AbstractSpec
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private def runTestOnFiles(
|
private def runTestOnFiles(expectedResultAndMap: File => Seq[(List[String], Seq[SessionSetting])])
|
||||||
expectedResultAndMap: File => Seq[(List[String], Seq[SessionSetting])])
|
|
||||||
: MatchResult[GenTraversableOnce[File]] = {
|
: MatchResult[GenTraversableOnce[File]] = {
|
||||||
|
|
||||||
val allFiles = rootDir
|
val allFiles = rootDir
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,8 @@ object Dependencies {
|
||||||
def addSbtUtilScripted(p: Project): Project =
|
def addSbtUtilScripted(p: Project): Project =
|
||||||
addSbtModule(p, sbtUtilPath, "utilScripted", utilScripted)
|
addSbtModule(p, sbtUtilPath, "utilScripted", utilScripted)
|
||||||
|
|
||||||
def addSbtLmCore(p: Project): Project = addSbtModule(p, sbtLmPath, "lmCore", libraryManagementCore)
|
def addSbtLmCore(p: Project): Project =
|
||||||
|
addSbtModule(p, sbtLmPath, "lmCore", libraryManagementCore)
|
||||||
def addSbtLmIvy(p: Project): Project = addSbtModule(p, sbtLmPath, "lmIvy", libraryManagementIvy)
|
def addSbtLmIvy(p: Project): Project = addSbtModule(p, sbtLmPath, "lmIvy", libraryManagementIvy)
|
||||||
|
|
||||||
def addSbtCompilerInterface(p: Project): Project =
|
def addSbtCompilerInterface(p: Project): Project =
|
||||||
|
|
@ -95,7 +96,9 @@ object Dependencies {
|
||||||
def addSbtZincCompile(p: Project): Project =
|
def addSbtZincCompile(p: Project): Project =
|
||||||
addSbtModule(p, sbtZincPath, "zincCompile", zincCompile)
|
addSbtModule(p, sbtZincPath, "zincCompile", zincCompile)
|
||||||
|
|
||||||
val sjsonNewScalaJson = Def.setting { "com.eed3si9n" %% "sjson-new-scalajson" % contrabandSjsonNewVersion.value }
|
val sjsonNewScalaJson = Def.setting {
|
||||||
|
"com.eed3si9n" %% "sjson-new-scalajson" % contrabandSjsonNewVersion.value
|
||||||
|
}
|
||||||
|
|
||||||
val jline = "jline" % "jline" % "2.14.4"
|
val jline = "jline" % "jline" % "2.14.4"
|
||||||
val scalatest = "org.scalatest" %% "scalatest" % "3.0.1"
|
val scalatest = "org.scalatest" %% "scalatest" % "3.0.1"
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ object PublishBinPlugin extends AutoPlugin {
|
||||||
|
|
||||||
override def projectSettings = Def settings (
|
override def projectSettings = Def settings (
|
||||||
publishLocalBin := Classpaths.publishTask(publishLocalBinConfig, deliverLocal).value,
|
publishLocalBin := Classpaths.publishTask(publishLocalBinConfig, deliverLocal).value,
|
||||||
|
|
||||||
publishLocalBinConfig := {
|
publishLocalBinConfig := {
|
||||||
val _ = deliverLocal.value
|
val _ = deliverLocal.value
|
||||||
Classpaths.publishConfig(
|
Classpaths.publishConfig(
|
||||||
|
|
@ -31,9 +30,9 @@ object PublishBinPlugin extends AutoPlugin {
|
||||||
(checksums in publishLocalBin).value.toVector,
|
(checksums in publishLocalBin).value.toVector,
|
||||||
resolverName = "local",
|
resolverName = "local",
|
||||||
logging = ivyLoggingLevel.value,
|
logging = ivyLoggingLevel.value,
|
||||||
overwrite = isSnapshot.value)
|
overwrite = isSnapshot.value
|
||||||
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
packagedArtifacts in publishLocalBin := Classpaths.packaged(Seq(packageBin in Compile)).value
|
packagedArtifacts in publishLocalBin := Classpaths.packaged(Seq(packageBin in Compile)).value
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,7 @@ object Util {
|
||||||
val timestamp = formatter.format(new Date)
|
val timestamp = formatter.format(new Date)
|
||||||
val content = versionLine(version) + "\ntimestamp=" + timestamp
|
val content = versionLine(version) + "\ntimestamp=" + timestamp
|
||||||
val f = dir / "xsbt.version.properties"
|
val f = dir / "xsbt.version.properties"
|
||||||
if (!f.exists || f.lastModified < lastCompilationTime(analysis) || !containsVersion(f,
|
if (!f.exists || f.lastModified < lastCompilationTime(analysis) || !containsVersion(f, version)) {
|
||||||
version)) {
|
|
||||||
s.log.info("Writing version information to " + f + " :\n" + content)
|
s.log.info("Writing version information to " + f + " :\n" + content)
|
||||||
IO.write(f, content)
|
IO.write(f, content)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,4 @@ addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.17")
|
||||||
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.1")
|
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.1")
|
||||||
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0")
|
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0")
|
||||||
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0-M1")
|
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0-M1")
|
||||||
// addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.3")
|
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.10")
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,7 @@ object OutputStrategy {
|
||||||
* the `error` level. The output is buffered until the process completes, at which point
|
* the `error` level. The output is buffered until the process completes, at which point
|
||||||
* the logger flushes it (to the screen, for example).
|
* the logger flushes it (to the screen, for example).
|
||||||
*/
|
*/
|
||||||
final class BufferedOutput private (val logger: Logger)
|
final class BufferedOutput private (val logger: Logger) extends OutputStrategy with Serializable {
|
||||||
extends OutputStrategy
|
|
||||||
with Serializable {
|
|
||||||
override def equals(o: Any): Boolean = o match {
|
override def equals(o: Any): Boolean = o match {
|
||||||
case x: BufferedOutput => (this.logger == x.logger)
|
case x: BufferedOutput => (this.logger == x.logger)
|
||||||
case _ => false
|
case _ => false
|
||||||
|
|
|
||||||
|
|
@ -24,23 +24,24 @@ final class SbtHandler(directory: File,
|
||||||
type State = Option[SbtInstance]
|
type State = Option[SbtInstance]
|
||||||
def initialState = None
|
def initialState = None
|
||||||
|
|
||||||
def apply(command: String,
|
def apply(command: String, arguments: List[String], i: Option[SbtInstance]): Option[SbtInstance] =
|
||||||
arguments: List[String],
|
onSbtInstance(i) { (process, server) =>
|
||||||
i: Option[SbtInstance]): Option[SbtInstance] = onSbtInstance(i) { (process, server) =>
|
send((command :: arguments.map(escape)).mkString(" "), server)
|
||||||
send((command :: arguments.map(escape)).mkString(" "), server)
|
receive(command + " failed", server)
|
||||||
receive(command + " failed", server)
|
}
|
||||||
}
|
|
||||||
def onSbtInstance(i: Option[SbtInstance])(
|
def onSbtInstance(i: Option[SbtInstance])(f: (Process, IPC.Server) => Unit): Option[SbtInstance] =
|
||||||
f: (Process, IPC.Server) => Unit): Option[SbtInstance] = i match {
|
i match {
|
||||||
case Some(ai @ SbtInstance(process, server)) if server.isClosed =>
|
case Some(ai @ SbtInstance(process, server)) if server.isClosed =>
|
||||||
finish(i)
|
finish(i)
|
||||||
onNewSbtInstance(f)
|
onNewSbtInstance(f)
|
||||||
case Some(SbtInstance(process, server)) =>
|
case Some(SbtInstance(process, server)) =>
|
||||||
f(process, server)
|
f(process, server)
|
||||||
i
|
i
|
||||||
case None =>
|
case None =>
|
||||||
onNewSbtInstance(f)
|
onNewSbtInstance(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
private[this] def onNewSbtInstance(f: (Process, IPC.Server) => Unit): Option[SbtInstance] = {
|
private[this] def onNewSbtInstance(f: (Process, IPC.Server) => Unit): Option[SbtInstance] = {
|
||||||
val server = IPC.unmanagedServer
|
val server = IPC.unmanagedServer
|
||||||
val p = try newRemote(server)
|
val p = try newRemote(server)
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,7 @@ final class ScriptedTests(resourceBaseDirectory: File,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private def createScriptedHandlers(testDir: File,
|
private def createScriptedHandlers(testDir: File, buffered: Logger): Map[Char, StatementHandler] = {
|
||||||
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)
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,7 @@ import sbt.io.syntax._
|
||||||
import sbt.internal.util.ManagedLogger
|
import sbt.internal.util.ManagedLogger
|
||||||
|
|
||||||
import sjsonnew.{ IsoString, SupportConverter }
|
import sjsonnew.{ IsoString, SupportConverter }
|
||||||
import sbt.util.{
|
import sbt.util.{ CacheStoreFactory, DirectoryStoreFactory, Input, Output, PlainInput, PlainOutput }
|
||||||
CacheStoreFactory,
|
|
||||||
DirectoryStoreFactory,
|
|
||||||
Input,
|
|
||||||
Output,
|
|
||||||
PlainInput,
|
|
||||||
PlainOutput
|
|
||||||
}
|
|
||||||
|
|
||||||
// no longer specific to Tasks, so 'TaskStreams' should be renamed
|
// no longer specific to Tasks, so 'TaskStreams' should be renamed
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -222,11 +222,11 @@ trait TaskExtra {
|
||||||
IO.readLines(s.readText(key(in), sid))
|
IO.readLines(s.readText(key(in), sid))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
implicit def processToTask(p: ProcessBuilder)(
|
implicit def processToTask(p: ProcessBuilder)(implicit streams: Task[TaskStreams[_]]): Task[Int] =
|
||||||
implicit streams: Task[TaskStreams[_]]): Task[Int] = streams map { s =>
|
streams map { s =>
|
||||||
val pio = TaskExtra.processIO(s)
|
val pio = TaskExtra.processIO(s)
|
||||||
(p run pio).exitValue
|
(p run pio).exitValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
object TaskExtra extends TaskExtra {
|
object TaskExtra extends TaskExtra {
|
||||||
def processIO(s: TaskStreams[_]): ProcessIO = {
|
def processIO(s: TaskStreams[_]): ProcessIO = {
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,10 @@ object TaskRunnerForkTest extends Properties("TaskRunner Fork") {
|
||||||
def inner(i: Int) = List.range(0, b).map(j => task(j).named(j.toString)).join
|
def inner(i: Int) = List.range(0, b).map(j => task(j).named(j.toString)).join
|
||||||
tryRun(List.range(0, a).map(inner).join, false, workers)
|
tryRun(List.range(0, a).map(inner).join, false, workers)
|
||||||
}
|
}
|
||||||
property("fork and reduce") = forAll(TaskListGen, MaxWorkersGen) {
|
property("fork and reduce") = forAll(TaskListGen, MaxWorkersGen) { (m: List[Int], workers: Int) =>
|
||||||
(m: List[Int], workers: Int) =>
|
m.nonEmpty ==> {
|
||||||
m.nonEmpty ==> {
|
val expected = m.sum
|
||||||
val expected = m.sum
|
checkResult(tryRun(m.tasks.reduced(_ + _), false, workers), expected)
|
||||||
checkResult(tryRun(m.tasks.reduced(_ + _), false, workers), expected)
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue