mirror of https://github.com/sbt/sbt.git
commit
e6fec6b1db
|
|
@ -10,6 +10,7 @@ package sbt
|
||||||
import sbt.Def.{ Initialize, ScopedKey }
|
import sbt.Def.{ Initialize, ScopedKey }
|
||||||
import sbt.Previous._
|
import sbt.Previous._
|
||||||
import sbt.Scope.Global
|
import sbt.Scope.Global
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.internal.util._
|
import sbt.internal.util._
|
||||||
import sbt.std.TaskExtra._
|
import sbt.std.TaskExtra._
|
||||||
import sbt.util.StampedFormat
|
import sbt.util.StampedFormat
|
||||||
|
|
@ -146,7 +147,7 @@ object Previous {
|
||||||
|
|
||||||
/** Public as a macro implementation detail. Do not call directly. */
|
/** Public as a macro implementation detail. Do not call directly. */
|
||||||
def runtime[T](skey: TaskKey[T])(implicit format: JsonFormat[T]): Initialize[Task[Option[T]]] = {
|
def runtime[T](skey: TaskKey[T])(implicit format: JsonFormat[T]): Initialize[Task[Option[T]]] = {
|
||||||
val inputs = (cache in Global) zip Def.validated(skey, selfRefOk = true) zip (references in Global)
|
val inputs = (Global / cache) zip Def.validated(skey, selfRefOk = true) zip (Global / references)
|
||||||
inputs {
|
inputs {
|
||||||
case ((prevTask, resolved), refs) =>
|
case ((prevTask, resolved), refs) =>
|
||||||
val key = Key(resolved, resolved)
|
val key = Key(resolved, resolved)
|
||||||
|
|
@ -159,9 +160,9 @@ object Previous {
|
||||||
def runtimeInEnclosingTask[T](skey: TaskKey[T])(
|
def runtimeInEnclosingTask[T](skey: TaskKey[T])(
|
||||||
implicit format: JsonFormat[T]
|
implicit format: JsonFormat[T]
|
||||||
): Initialize[Task[Option[T]]] = {
|
): Initialize[Task[Option[T]]] = {
|
||||||
val inputs = (cache in Global)
|
val inputs = (Global / cache)
|
||||||
.zip(Def.validated(skey, selfRefOk = true))
|
.zip(Def.validated(skey, selfRefOk = true))
|
||||||
.zip(references in Global)
|
.zip(Global / references)
|
||||||
.zip(Def.resolvedScoped)
|
.zip(Def.resolvedScoped)
|
||||||
inputs {
|
inputs {
|
||||||
case (((prevTask, resolved), refs), inTask: ScopedKey[Task[_]] @unchecked) =>
|
case (((prevTask, resolved), refs), inTask: ScopedKey[Task[_]] @unchecked) =>
|
||||||
|
|
|
||||||
|
|
@ -20,16 +20,29 @@ final case class Scope(
|
||||||
task: ScopeAxis[AttributeKey[_]],
|
task: ScopeAxis[AttributeKey[_]],
|
||||||
extra: ScopeAxis[AttributeMap]
|
extra: ScopeAxis[AttributeMap]
|
||||||
) {
|
) {
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(project: Reference, config: ConfigKey): Scope =
|
def in(project: Reference, config: ConfigKey): Scope =
|
||||||
copy(project = Select(project), config = Select(config))
|
copy(project = Select(project), config = Select(config))
|
||||||
|
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(config: ConfigKey, task: AttributeKey[_]): Scope =
|
def in(config: ConfigKey, task: AttributeKey[_]): Scope =
|
||||||
copy(config = Select(config), task = Select(task))
|
copy(config = Select(config), task = Select(task))
|
||||||
|
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(project: Reference, task: AttributeKey[_]): Scope =
|
def in(project: Reference, task: AttributeKey[_]): Scope =
|
||||||
copy(project = Select(project), task = Select(task))
|
copy(project = Select(project), task = Select(task))
|
||||||
|
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(project: Reference, config: ConfigKey, task: AttributeKey[_]): Scope =
|
def in(project: Reference, config: ConfigKey, task: AttributeKey[_]): Scope =
|
||||||
copy(project = Select(project), config = Select(config), task = Select(task))
|
copy(project = Select(project), config = Select(config), task = Select(task))
|
||||||
|
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(project: Reference): Scope = copy(project = Select(project))
|
def in(project: Reference): Scope = copy(project = Select(project))
|
||||||
|
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(config: ConfigKey): Scope = copy(config = Select(config))
|
def in(config: ConfigKey): Scope = copy(config = Select(config))
|
||||||
|
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(task: AttributeKey[_]): Scope = copy(task = Select(task))
|
def in(task: AttributeKey[_]): Scope = copy(task = Select(task))
|
||||||
|
|
||||||
override def toString: String = this match {
|
override def toString: String = this match {
|
||||||
|
|
@ -43,6 +56,9 @@ object Scope {
|
||||||
val Global: Scope = Scope(Zero, Zero, Zero, Zero)
|
val Global: Scope = Scope(Zero, Zero, Zero, Zero)
|
||||||
val GlobalScope: Scope = Global
|
val GlobalScope: Scope = Global
|
||||||
|
|
||||||
|
private[sbt] final val inIsDeprecated =
|
||||||
|
"`in` is deprecated; migrate to slash syntax - https://www.scala-sbt.org/1.x/docs/Migrating-from-sbt-013x.html#slash"
|
||||||
|
|
||||||
def resolveScope(thisScope: Scope, current: URI, rootProject: URI => String): Scope => Scope =
|
def resolveScope(thisScope: Scope, current: URI, rootProject: URI => String): Scope => Scope =
|
||||||
resolveProject(current, rootProject) compose replaceThis(thisScope) compose subThisProject
|
resolveProject(current, rootProject) compose replaceThis(thisScope) compose subThisProject
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ package sbt
|
||||||
|
|
||||||
import sbt.librarymanagement.Configuration
|
import sbt.librarymanagement.Configuration
|
||||||
import sbt.internal.util.AttributeKey
|
import sbt.internal.util.AttributeKey
|
||||||
|
import scala.annotation.nowarn
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SlashSyntax implements the slash syntax to scope keys for build.sbt DSL.
|
* SlashSyntax implements the slash syntax to scope keys for build.sbt DSL.
|
||||||
|
|
@ -60,19 +61,25 @@ object SlashSyntax {
|
||||||
|
|
||||||
sealed trait HasSlashKey {
|
sealed trait HasSlashKey {
|
||||||
protected def scope: Scope
|
protected def scope: Scope
|
||||||
|
@nowarn
|
||||||
final def /[K](key: Scoped.ScopingSetting[K]): K = key in scope
|
final def /[K](key: Scoped.ScopingSetting[K]): K = key in scope
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed trait HasSlashKeyOrAttrKey extends HasSlashKey {
|
sealed trait HasSlashKeyOrAttrKey extends HasSlashKey {
|
||||||
|
@nowarn
|
||||||
final def /(key: AttributeKey[_]): RichScope = new RichScope(scope in key)
|
final def /(key: AttributeKey[_]): RichScope = new RichScope(scope in key)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** RichReference wraps a reference to provide the `/` operator for scoping. */
|
/** RichReference wraps a reference to provide the `/` operator for scoping. */
|
||||||
final class RichReference(protected val scope: Scope) extends HasSlashKeyOrAttrKey {
|
final class RichReference(protected val scope: Scope) extends HasSlashKeyOrAttrKey {
|
||||||
|
@nowarn
|
||||||
def /(c: ConfigKey): RichConfiguration = new RichConfiguration(scope in c)
|
def /(c: ConfigKey): RichConfiguration = new RichConfiguration(scope in c)
|
||||||
|
|
||||||
|
@nowarn
|
||||||
def /(c: Configuration): RichConfiguration = new RichConfiguration(scope in c)
|
def /(c: Configuration): RichConfiguration = new RichConfiguration(scope in c)
|
||||||
|
|
||||||
// This is for handling `Zero / Zero / name`.
|
// This is for handling `Zero / Zero / name`.
|
||||||
|
@nowarn
|
||||||
def /(configAxis: ScopeAxis[ConfigKey]): RichConfiguration =
|
def /(configAxis: ScopeAxis[ConfigKey]): RichConfiguration =
|
||||||
new RichConfiguration(scope.copy(config = configAxis))
|
new RichConfiguration(scope.copy(config = configAxis))
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +92,7 @@ object SlashSyntax {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** RichScope wraps a general scope to provide the `/` operator for scoping. */
|
/** RichScope wraps a general scope to provide the `/` operator for scoping. */
|
||||||
final class RichScope(protected val scope: Scope) extends HasSlashKey
|
final class RichScope(protected val scope: Scope) extends HasSlashKeyOrAttrKey
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ sealed abstract class SettingKey[T]
|
||||||
|
|
||||||
final def scopedKey: ScopedKey[T] = ScopedKey(scope, key)
|
final def scopedKey: ScopedKey[T] = ScopedKey(scope, key)
|
||||||
|
|
||||||
|
// @deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
final def in(scope: Scope): SettingKey[T] =
|
final def in(scope: Scope): SettingKey[T] =
|
||||||
Scoped.scopedSetting(Scope.replaceThis(this.scope)(scope), this.key)
|
Scoped.scopedSetting(Scope.replaceThis(this.scope)(scope), this.key)
|
||||||
|
|
||||||
|
|
@ -140,6 +141,7 @@ sealed abstract class TaskKey[T]
|
||||||
|
|
||||||
def scopedKey: ScopedKey[Task[T]] = ScopedKey(scope, key)
|
def scopedKey: ScopedKey[Task[T]] = ScopedKey(scope, key)
|
||||||
|
|
||||||
|
// @deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(scope: Scope): TaskKey[T] =
|
def in(scope: Scope): TaskKey[T] =
|
||||||
Scoped.scopedTask(Scope.replaceThis(this.scope)(scope), this.key)
|
Scoped.scopedTask(Scope.replaceThis(this.scope)(scope), this.key)
|
||||||
|
|
||||||
|
|
@ -206,6 +208,7 @@ sealed trait InputKey[T]
|
||||||
|
|
||||||
def scopedKey: ScopedKey[InputTask[T]] = ScopedKey(scope, key)
|
def scopedKey: ScopedKey[InputTask[T]] = ScopedKey(scope, key)
|
||||||
|
|
||||||
|
// @deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(scope: Scope): InputKey[T] =
|
def in(scope: Scope): InputKey[T] =
|
||||||
Scoped.scopedInput(Scope.replaceThis(this.scope)(scope), this.key)
|
Scoped.scopedInput(Scope.replaceThis(this.scope)(scope), this.key)
|
||||||
|
|
||||||
|
|
@ -244,18 +247,32 @@ object Scoped {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
sealed trait ScopingSetting[ResultType] {
|
sealed trait ScopingSetting[ResultType] {
|
||||||
|
// @deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(s: Scope): ResultType
|
def in(s: Scope): ResultType
|
||||||
|
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(p: Reference): ResultType = in(Select(p), This, This)
|
def in(p: Reference): ResultType = in(Select(p), This, This)
|
||||||
|
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(t: Scoped): ResultType = in(This, This, Select(t.key))
|
def in(t: Scoped): ResultType = in(This, This, Select(t.key))
|
||||||
|
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(c: ConfigKey): ResultType = in(This, Select(c), This)
|
def in(c: ConfigKey): ResultType = in(This, Select(c), This)
|
||||||
|
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(c: ConfigKey, t: Scoped): ResultType = in(This, Select(c), Select(t.key))
|
def in(c: ConfigKey, t: Scoped): ResultType = in(This, Select(c), Select(t.key))
|
||||||
|
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(p: Reference, c: ConfigKey): ResultType = in(Select(p), Select(c), This)
|
def in(p: Reference, c: ConfigKey): ResultType = in(Select(p), Select(c), This)
|
||||||
|
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(p: Reference, t: Scoped): ResultType = in(Select(p), This, Select(t.key))
|
def in(p: Reference, t: Scoped): ResultType = in(Select(p), This, Select(t.key))
|
||||||
|
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(p: Reference, c: ConfigKey, t: Scoped): ResultType =
|
def in(p: Reference, c: ConfigKey, t: Scoped): ResultType =
|
||||||
in(Select(p), Select(c), Select(t.key))
|
in(Select(p), Select(c), Select(t.key))
|
||||||
|
|
||||||
|
@deprecated(Scope.inIsDeprecated, "1.5.0")
|
||||||
def in(
|
def in(
|
||||||
p: ScopeAxis[Reference],
|
p: ScopeAxis[Reference],
|
||||||
c: ScopeAxis[ConfigKey],
|
c: ScopeAxis[ConfigKey],
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import sbt.ConfigKey
|
||||||
import sbt.librarymanagement.syntax._
|
import sbt.librarymanagement.syntax._
|
||||||
import sbt.{ InputKey, SettingKey, TaskKey }
|
import sbt.{ InputKey, SettingKey, TaskKey }
|
||||||
import sbt.internal.util.{ AttributeKey, AttributeMap }
|
import sbt.internal.util.{ AttributeKey, AttributeMap }
|
||||||
|
import scala.annotation.nowarn
|
||||||
|
|
||||||
object BuildSettingsInstances {
|
object BuildSettingsInstances {
|
||||||
val genFile: Gen[File] = Gen.oneOf(new File("."), new File("/tmp")) // for now..
|
val genFile: Gen[File] = Gen.oneOf(new File("."), new File("/tmp")) // for now..
|
||||||
|
|
@ -99,6 +100,7 @@ object BuildSettingsInstances {
|
||||||
def genSettingKey[A: Manifest]: Gen[SettingKey[A]] = genLabel map (x => SettingKey[A](x.value))
|
def genSettingKey[A: Manifest]: Gen[SettingKey[A]] = genLabel map (x => SettingKey[A](x.value))
|
||||||
def genTaskKey[A: Manifest]: Gen[TaskKey[A]] = genLabel map (x => TaskKey[A](x.value))
|
def genTaskKey[A: Manifest]: Gen[TaskKey[A]] = genLabel map (x => TaskKey[A](x.value))
|
||||||
|
|
||||||
|
@nowarn
|
||||||
def withScope[K <: Scoped.ScopingSetting[K]](keyGen: Gen[K]): Arbitrary[K] = Arbitrary {
|
def withScope[K <: Scoped.ScopingSetting[K]](keyGen: Gen[K]): Arbitrary[K] = Arbitrary {
|
||||||
Gen.frequency(
|
Gen.frequency(
|
||||||
5 -> keyGen,
|
5 -> keyGen,
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,13 @@ package sbt
|
||||||
import org.scalatest.FlatSpec
|
import org.scalatest.FlatSpec
|
||||||
import sbt.internal.util.{ AttributeKey, AttributeMap }
|
import sbt.internal.util.{ AttributeKey, AttributeMap }
|
||||||
import sbt.io.syntax.file
|
import sbt.io.syntax.file
|
||||||
|
import scala.annotation.nowarn
|
||||||
|
|
||||||
class ScopeDisplaySpec extends FlatSpec {
|
class ScopeDisplaySpec extends FlatSpec {
|
||||||
val project = ProjectRef(file("foo/bar"), "bar")
|
val project = ProjectRef(file("foo/bar"), "bar")
|
||||||
val mangledName = "bar_slash_blah_blah_blah"
|
val mangledName = "bar_slash_blah_blah_blah"
|
||||||
|
|
||||||
|
@nowarn
|
||||||
val scopedKey = Def.ScopedKey(Scope.Global in project, AttributeKey[Task[String]](mangledName))
|
val scopedKey = Def.ScopedKey(Scope.Global in project, AttributeKey[Task[String]](mangledName))
|
||||||
val am = AttributeMap.empty.put(Scope.customShowString, "blah")
|
val am = AttributeMap.empty.put(Scope.customShowString, "blah")
|
||||||
val sanitizedKey = scopedKey.copy(scope = scopedKey.scope.copy(extra = Select(am)))
|
val sanitizedKey = scopedKey.copy(scope = scopedKey.scope.copy(extra = Select(am)))
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,9 @@ import sbt.ConfigKey
|
||||||
import sbt.internal.util.AttributeKey
|
import sbt.internal.util.AttributeKey
|
||||||
|
|
||||||
import BuildSettingsInstances._
|
import BuildSettingsInstances._
|
||||||
|
import scala.annotation.nowarn
|
||||||
|
|
||||||
|
@nowarn
|
||||||
object SlashSyntaxSpec extends Properties("SlashSyntax") with SlashSyntax {
|
object SlashSyntaxSpec extends Properties("SlashSyntax") with SlashSyntax {
|
||||||
property("Global / key == key in Global") = {
|
property("Global / key == key in Global") = {
|
||||||
forAll((k: Key) => expectValue(k in Global)(Global / k))
|
forAll((k: Key) => expectValue(k in Global)(Global / k))
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import java.io.File
|
||||||
|
|
||||||
import sbt.Def.{ ScopedKey, Setting }
|
import sbt.Def.{ ScopedKey, Setting }
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.internal.Act
|
import sbt.internal.Act
|
||||||
import sbt.internal.CommandStrings._
|
import sbt.internal.CommandStrings._
|
||||||
import sbt.internal.inc.ScalaInstance
|
import sbt.internal.inc.ScalaInstance
|
||||||
|
|
@ -102,9 +103,9 @@ object Cross {
|
||||||
|
|
||||||
private def crossVersions(extracted: Extracted, proj: ResolvedReference): Seq[String] = {
|
private def crossVersions(extracted: Extracted, proj: ResolvedReference): Seq[String] = {
|
||||||
import extracted._
|
import extracted._
|
||||||
(crossScalaVersions in proj get structure.data) getOrElse {
|
((proj / crossScalaVersions) get structure.data) getOrElse {
|
||||||
// reading scalaVersion is a one-time deal
|
// reading scalaVersion is a one-time deal
|
||||||
(scalaVersion in proj get structure.data).toSeq
|
((proj / scalaVersion) get structure.data).toSeq
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -358,16 +359,16 @@ object Cross {
|
||||||
instance match {
|
instance match {
|
||||||
case Some((home, inst)) =>
|
case Some((home, inst)) =>
|
||||||
Seq(
|
Seq(
|
||||||
scalaVersion in scope := version,
|
scope / scalaVersion := version,
|
||||||
crossScalaVersions in scope := scalaVersions,
|
scope / crossScalaVersions := scalaVersions,
|
||||||
scalaHome in scope := Some(home),
|
scope / scalaHome := Some(home),
|
||||||
scalaInstance in scope := inst
|
scope / scalaInstance := inst
|
||||||
)
|
)
|
||||||
case None =>
|
case None =>
|
||||||
Seq(
|
Seq(
|
||||||
scalaVersion in scope := version,
|
scope / scalaVersion := version,
|
||||||
crossScalaVersions in scope := scalaVersions,
|
scope / crossScalaVersions := scalaVersions,
|
||||||
scalaHome in scope := None
|
scope / scalaHome := None
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ object Defaults extends BuildCommon {
|
||||||
|
|
||||||
def configSrcSub(key: SettingKey[File]): Initialize[File] =
|
def configSrcSub(key: SettingKey[File]): Initialize[File] =
|
||||||
Def.setting {
|
Def.setting {
|
||||||
(key in ThisScope.copy(config = Zero)).value / nameForSrc(configuration.value.name)
|
(ThisScope.copy(config = Zero) / key).value / nameForSrc(configuration.value.name)
|
||||||
}
|
}
|
||||||
def nameForSrc(config: String) = if (config == Configurations.Compile.name) "main" else config
|
def nameForSrc(config: String) = if (config == Configurations.Compile.name) "main" else config
|
||||||
def prefix(config: String) = if (config == Configurations.Compile.name) "" else config + "-"
|
def prefix(config: String) = if (config == Configurations.Compile.name) "" else config + "-"
|
||||||
|
|
@ -191,12 +191,12 @@ object Defaults extends BuildCommon {
|
||||||
extraIncOptions :== Seq("JAVA_CLASS_VERSION" -> sys.props("java.class.version")),
|
extraIncOptions :== Seq("JAVA_CLASS_VERSION" -> sys.props("java.class.version")),
|
||||||
allowMachinePath :== true,
|
allowMachinePath :== true,
|
||||||
reportAbsolutePath := true,
|
reportAbsolutePath := true,
|
||||||
traceLevel in run :== 0,
|
run / traceLevel :== 0,
|
||||||
traceLevel in runMain :== 0,
|
runMain / traceLevel :== 0,
|
||||||
traceLevel in bgRun :== 0,
|
bgRun / traceLevel :== 0,
|
||||||
traceLevel in fgRun :== 0,
|
fgRun / traceLevel :== 0,
|
||||||
traceLevel in console :== Int.MaxValue,
|
console / traceLevel :== Int.MaxValue,
|
||||||
traceLevel in consoleProject :== Int.MaxValue,
|
consoleProject / traceLevel :== Int.MaxValue,
|
||||||
autoCompilerPlugins :== true,
|
autoCompilerPlugins :== true,
|
||||||
scalaHome :== None,
|
scalaHome :== None,
|
||||||
apiURL := None,
|
apiURL := None,
|
||||||
|
|
@ -211,12 +211,12 @@ object Defaults extends BuildCommon {
|
||||||
reresolveSbtArtifacts :== false,
|
reresolveSbtArtifacts :== false,
|
||||||
crossPaths :== true,
|
crossPaths :== true,
|
||||||
sourcePositionMappers :== Nil,
|
sourcePositionMappers :== Nil,
|
||||||
artifactClassifier in packageSrc :== Some(SourceClassifier),
|
packageSrc / artifactClassifier :== Some(SourceClassifier),
|
||||||
artifactClassifier in packageDoc :== Some(DocClassifier),
|
packageDoc / artifactClassifier :== Some(DocClassifier),
|
||||||
includeFilter :== NothingFilter,
|
includeFilter :== NothingFilter,
|
||||||
includeFilter in unmanagedSources :== ("*.java" | "*.scala"),
|
unmanagedSources / includeFilter :== ("*.java" | "*.scala"),
|
||||||
includeFilter in unmanagedJars :== "*.jar" | "*.so" | "*.dll" | "*.jnilib" | "*.zip",
|
unmanagedJars / includeFilter :== "*.jar" | "*.so" | "*.dll" | "*.jnilib" | "*.zip",
|
||||||
includeFilter in unmanagedResources :== AllPassFilter,
|
unmanagedResources / includeFilter :== AllPassFilter,
|
||||||
bgList := { bgJobService.value.jobs },
|
bgList := { bgJobService.value.jobs },
|
||||||
ps := psTask.value,
|
ps := psTask.value,
|
||||||
bgStop := bgStopTask.evaluated,
|
bgStop := bgStopTask.evaluated,
|
||||||
|
|
@ -279,8 +279,8 @@ object Defaults extends BuildCommon {
|
||||||
outputStrategy :== None, // TODO - This might belong elsewhere.
|
outputStrategy :== None, // TODO - This might belong elsewhere.
|
||||||
buildStructure := Project.structure(state.value),
|
buildStructure := Project.structure(state.value),
|
||||||
settingsData := buildStructure.value.data,
|
settingsData := buildStructure.value.data,
|
||||||
aggregate in checkBuildSources :== false,
|
checkBuildSources / aggregate :== false,
|
||||||
aggregate in checkBuildSources / changedInputFiles := false,
|
checkBuildSources / changedInputFiles / aggregate := false,
|
||||||
checkBuildSources / Continuous.dynamicInputs := None,
|
checkBuildSources / Continuous.dynamicInputs := None,
|
||||||
checkBuildSources / fileInputs := CheckBuildSources.buildSourceFileInputs.value,
|
checkBuildSources / fileInputs := CheckBuildSources.buildSourceFileInputs.value,
|
||||||
checkBuildSources := CheckBuildSources.needReloadImpl.value,
|
checkBuildSources := CheckBuildSources.needReloadImpl.value,
|
||||||
|
|
@ -298,7 +298,7 @@ object Defaults extends BuildCommon {
|
||||||
// `pluginCrossBuild` scoping is based on sbt-cross-building plugin.
|
// `pluginCrossBuild` scoping is based on sbt-cross-building plugin.
|
||||||
// The idea here is to be able to define a `sbtVersion in pluginCrossBuild`, which
|
// The idea here is to be able to define a `sbtVersion in pluginCrossBuild`, which
|
||||||
// directs the dependencies of the plugin to build to the specified sbt plugin version.
|
// directs the dependencies of the plugin to build to the specified sbt plugin version.
|
||||||
sbtVersion in pluginCrossBuild := sbtVersion.value,
|
pluginCrossBuild / sbtVersion := sbtVersion.value,
|
||||||
onLoad := idFun[State],
|
onLoad := idFun[State],
|
||||||
onUnload := idFun[State],
|
onUnload := idFun[State],
|
||||||
onUnload := { s =>
|
onUnload := { s =>
|
||||||
|
|
@ -572,13 +572,13 @@ object Defaults extends BuildCommon {
|
||||||
makePluginCrossSources(
|
makePluginCrossSources(
|
||||||
sbtPlugin.value,
|
sbtPlugin.value,
|
||||||
scalaSource.value,
|
scalaSource.value,
|
||||||
(sbtBinaryVersion in pluginCrossBuild).value,
|
(pluginCrossBuild / sbtBinaryVersion).value,
|
||||||
crossPaths.value
|
crossPaths.value
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
unmanagedSources / fileInputs := {
|
unmanagedSources / fileInputs := {
|
||||||
val include = (includeFilter in unmanagedSources).value
|
val include = (unmanagedSources / includeFilter).value
|
||||||
val filter = (excludeFilter in unmanagedSources).value match {
|
val filter = (unmanagedSources / excludeFilter).value match {
|
||||||
// Hidden files are already filtered out by the FileStamps method
|
// Hidden files are already filtered out by the FileStamps method
|
||||||
case NothingFilter | HiddenFileFilter => include
|
case NothingFilter | HiddenFileFilter => include
|
||||||
case exclude => include -- exclude
|
case exclude => include -- exclude
|
||||||
|
|
@ -617,8 +617,8 @@ object Defaults extends BuildCommon {
|
||||||
.concatSettings(unmanagedResourceDirectories, managedResourceDirectories)
|
.concatSettings(unmanagedResourceDirectories, managedResourceDirectories)
|
||||||
.value,
|
.value,
|
||||||
unmanagedResources / fileInputs := {
|
unmanagedResources / fileInputs := {
|
||||||
val include = (includeFilter in unmanagedResources).value
|
val include = (unmanagedResources / includeFilter).value
|
||||||
val filter = (excludeFilter in unmanagedResources).value match {
|
val filter = (unmanagedResources / excludeFilter).value match {
|
||||||
// Hidden files are already filtered out by the FileStamps method
|
// Hidden files are already filtered out by the FileStamps method
|
||||||
case NothingFilter | HiddenFileFilter => include
|
case NothingFilter | HiddenFileFilter => include
|
||||||
case exclude => include -- exclude
|
case exclude => include -- exclude
|
||||||
|
|
@ -651,25 +651,25 @@ object Defaults extends BuildCommon {
|
||||||
semanticdbTargetRoot := crossTarget.value / (prefix(configuration.value.name) + "meta"),
|
semanticdbTargetRoot := crossTarget.value / (prefix(configuration.value.name) + "meta"),
|
||||||
compileAnalysisTargetRoot := crossTarget.value / (prefix(configuration.value.name) + "zinc"),
|
compileAnalysisTargetRoot := crossTarget.value / (prefix(configuration.value.name) + "zinc"),
|
||||||
earlyCompileAnalysisTargetRoot := crossTarget.value / (prefix(configuration.value.name) + "early-zinc"),
|
earlyCompileAnalysisTargetRoot := crossTarget.value / (prefix(configuration.value.name) + "early-zinc"),
|
||||||
target in doc := crossTarget.value / (prefix(configuration.value.name) + "api")
|
doc / target := crossTarget.value / (prefix(configuration.value.name) + "api")
|
||||||
)
|
)
|
||||||
|
|
||||||
// This is included into JvmPlugin.projectSettings
|
// This is included into JvmPlugin.projectSettings
|
||||||
def compileBase = inTask(console)(compilersSetting :: Nil) ++ compileBaseGlobal ++ Seq(
|
def compileBase = inTask(console)(compilersSetting :: Nil) ++ compileBaseGlobal ++ Seq(
|
||||||
scalaInstance := scalaInstanceTask.value,
|
scalaInstance := scalaInstanceTask.value,
|
||||||
crossVersion := (if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled),
|
crossVersion := (if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled),
|
||||||
sbtBinaryVersion in pluginCrossBuild := binarySbtVersion(
|
pluginCrossBuild / sbtBinaryVersion := binarySbtVersion(
|
||||||
(sbtVersion in pluginCrossBuild).value
|
(pluginCrossBuild / sbtVersion).value
|
||||||
),
|
),
|
||||||
// Use (sbtVersion in pluginCrossBuild) to pick the sbt module to depend from the plugin.
|
// Use (sbtVersion in pluginCrossBuild) to pick the sbt module to depend from the plugin.
|
||||||
// Because `sbtVersion in pluginCrossBuild` can be scoped to project level,
|
// Because `sbtVersion in pluginCrossBuild` can be scoped to project level,
|
||||||
// this setting needs to be set here too.
|
// this setting needs to be set here too.
|
||||||
sbtDependency in pluginCrossBuild := {
|
pluginCrossBuild / sbtDependency := {
|
||||||
val app = appConfiguration.value
|
val app = appConfiguration.value
|
||||||
val id = app.provider.id
|
val id = app.provider.id
|
||||||
val sv = (sbtVersion in pluginCrossBuild).value
|
val sv = (pluginCrossBuild / sbtVersion).value
|
||||||
val scalaV = (scalaVersion in pluginCrossBuild).value
|
val scalaV = (pluginCrossBuild / scalaVersion).value
|
||||||
val binVersion = (scalaBinaryVersion in pluginCrossBuild).value
|
val binVersion = (pluginCrossBuild / scalaBinaryVersion).value
|
||||||
val cross = id.crossVersionedValue match {
|
val cross = id.crossVersionedValue match {
|
||||||
case CrossValue.Disabled => Disabled()
|
case CrossValue.Disabled => Disabled()
|
||||||
case CrossValue.Full => CrossVersion.full
|
case CrossValue.Full => CrossVersion.full
|
||||||
|
|
@ -678,11 +678,11 @@ object Defaults extends BuildCommon {
|
||||||
val base = ModuleID(id.groupID, id.name, sv).withCrossVersion(cross)
|
val base = ModuleID(id.groupID, id.name, sv).withCrossVersion(cross)
|
||||||
CrossVersion(scalaV, binVersion)(base).withCrossVersion(Disabled())
|
CrossVersion(scalaV, binVersion)(base).withCrossVersion(Disabled())
|
||||||
},
|
},
|
||||||
crossSbtVersions := Vector((sbtVersion in pluginCrossBuild).value),
|
crossSbtVersions := Vector((pluginCrossBuild / sbtVersion).value),
|
||||||
crossTarget := makeCrossTarget(
|
crossTarget := makeCrossTarget(
|
||||||
target.value,
|
target.value,
|
||||||
scalaBinaryVersion.value,
|
scalaBinaryVersion.value,
|
||||||
(sbtBinaryVersion in pluginCrossBuild).value,
|
(pluginCrossBuild / sbtBinaryVersion).value,
|
||||||
sbtPlugin.value,
|
sbtPlugin.value,
|
||||||
crossPaths.value
|
crossPaths.value
|
||||||
),
|
),
|
||||||
|
|
@ -705,7 +705,7 @@ object Defaults extends BuildCommon {
|
||||||
auxiliaryClassFiles := Nil,
|
auxiliaryClassFiles := Nil,
|
||||||
incOptions := IncOptions.of(),
|
incOptions := IncOptions.of(),
|
||||||
classpathOptions :== ClasspathOptionsUtil.boot,
|
classpathOptions :== ClasspathOptionsUtil.boot,
|
||||||
classpathOptions in console :== ClasspathOptionsUtil.repl,
|
console / classpathOptions :== ClasspathOptionsUtil.repl,
|
||||||
compileOrder :== CompileOrder.Mixed,
|
compileOrder :== CompileOrder.Mixed,
|
||||||
javacOptions :== Nil,
|
javacOptions :== Nil,
|
||||||
scalacOptions :== Nil,
|
scalacOptions :== Nil,
|
||||||
|
|
@ -946,7 +946,7 @@ object Defaults extends BuildCommon {
|
||||||
// This fork options, scoped to the configuration is used for tests
|
// This fork options, scoped to the configuration is used for tests
|
||||||
forkOptions := forkOptionsTask.value,
|
forkOptions := forkOptionsTask.value,
|
||||||
selectMainClass := mainClass.value orElse askForMainClass(discoveredMainClasses.value),
|
selectMainClass := mainClass.value orElse askForMainClass(discoveredMainClasses.value),
|
||||||
mainClass in run := (selectMainClass in run).value,
|
run / mainClass := (run / selectMainClass).value,
|
||||||
mainClass := {
|
mainClass := {
|
||||||
val logWarning = state.value.currentCommand
|
val logWarning = state.value.currentCommand
|
||||||
.flatMap(_.commandLine.split(" ").headOption.map(_.trim))
|
.flatMap(_.commandLine.split(" ").headOption.map(_.trim))
|
||||||
|
|
@ -958,8 +958,8 @@ object Defaults extends BuildCommon {
|
||||||
},
|
},
|
||||||
runMain := foregroundRunMainTask.evaluated,
|
runMain := foregroundRunMainTask.evaluated,
|
||||||
run := foregroundRunTask.evaluated,
|
run := foregroundRunTask.evaluated,
|
||||||
fgRun := runTask(fullClasspath, mainClass in run, runner in run).evaluated,
|
fgRun := runTask(fullClasspath, (run / mainClass), (run / runner)).evaluated,
|
||||||
fgRunMain := runMainTask(fullClasspath, runner in run).evaluated,
|
fgRunMain := runMainTask(fullClasspath, (run / runner)).evaluated,
|
||||||
copyResources := copyResourcesTask.value,
|
copyResources := copyResourcesTask.value,
|
||||||
// note that we use the same runner and mainClass as plain run
|
// note that we use the same runner and mainClass as plain run
|
||||||
mainBgRunMainTaskForConfig(This),
|
mainBgRunMainTaskForConfig(This),
|
||||||
|
|
@ -1020,7 +1020,7 @@ object Defaults extends BuildCommon {
|
||||||
val msg = watchingMessage.?.value.getOrElse(Watched.defaultWatchingMessage)
|
val msg = watchingMessage.?.value.getOrElse(Watched.defaultWatchingMessage)
|
||||||
val trigMsg = triggeredMessage.?.value.getOrElse(Watched.defaultTriggeredMessage)
|
val trigMsg = triggeredMessage.?.value.getOrElse(Watched.defaultTriggeredMessage)
|
||||||
new Watched {
|
new Watched {
|
||||||
val scoped = watchTransitiveSources in base
|
val scoped = (base / watchTransitiveSources)
|
||||||
val key = scoped.scopedKey
|
val key = scoped.scopedKey
|
||||||
override def antiEntropy: FiniteDuration = _antiEntropy
|
override def antiEntropy: FiniteDuration = _antiEntropy
|
||||||
override def pollInterval: FiniteDuration = interval
|
override def pollInterval: FiniteDuration = interval
|
||||||
|
|
@ -1189,7 +1189,7 @@ object Defaults extends BuildCommon {
|
||||||
testListeners :== Nil,
|
testListeners :== Nil,
|
||||||
testOptions :== Nil,
|
testOptions :== Nil,
|
||||||
testResultLogger :== TestResultLogger.Default,
|
testResultLogger :== TestResultLogger.Default,
|
||||||
testFilter in testOnly :== (selectedFilter _)
|
testOnly / testFilter :== (selectedFilter _)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
lazy val testTasks
|
lazy val testTasks
|
||||||
|
|
@ -1204,27 +1204,27 @@ object Defaults extends BuildCommon {
|
||||||
},
|
},
|
||||||
definedTests := detectTests.value,
|
definedTests := detectTests.value,
|
||||||
definedTestNames := (definedTests map (_.map(_.name).distinct) storeAs definedTestNames triggeredBy compile).value,
|
definedTestNames := (definedTests map (_.map(_.name).distinct) storeAs definedTestNames triggeredBy compile).value,
|
||||||
testFilter in testQuick := testQuickFilter.value,
|
testQuick / testFilter := testQuickFilter.value,
|
||||||
executeTests := (
|
executeTests := (
|
||||||
Def.taskDyn {
|
Def.taskDyn {
|
||||||
allTestGroupsTask(
|
allTestGroupsTask(
|
||||||
(streams in test).value,
|
(test / streams).value,
|
||||||
loadedTestFrameworks.value,
|
loadedTestFrameworks.value,
|
||||||
testLoader.value,
|
testLoader.value,
|
||||||
(testGrouping in test).value,
|
(test / testGrouping).value,
|
||||||
(testExecution in test).value,
|
(test / testExecution).value,
|
||||||
(fullClasspath in test).value,
|
(test / fullClasspath).value,
|
||||||
testForkedParallel.value,
|
testForkedParallel.value,
|
||||||
(javaOptions in test).value,
|
(test / javaOptions).value,
|
||||||
(classLoaderLayeringStrategy).value,
|
(classLoaderLayeringStrategy).value,
|
||||||
projectId = s"${thisProject.value.id} / ",
|
projectId = s"${thisProject.value.id} / ",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
).value,
|
).value,
|
||||||
// ((streams in test, loadedTestFrameworks, testLoader, testGrouping in test, testExecution in test, fullClasspath in test, javaHome in test, testForkedParallel, javaOptions in test) flatMap allTestGroupsTask).value,
|
// ((streams in test, loadedTestFrameworks, testLoader, testGrouping in test, testExecution in test, fullClasspath in test, javaHome in test, testForkedParallel, javaOptions in test) flatMap allTestGroupsTask).value,
|
||||||
testResultLogger in (Test, test) :== TestResultLogger.SilentWhenNoTests, // https://github.com/sbt/sbt/issues/1185
|
Test / test / testResultLogger :== TestResultLogger.SilentWhenNoTests, // https://github.com/sbt/sbt/issues/1185
|
||||||
test := {
|
test := {
|
||||||
val trl = (testResultLogger in (Test, test)).value
|
val trl = (Test / test / testResultLogger).value
|
||||||
val taskName = Project.showContextKey(state.value).show(resolvedScoped.value)
|
val taskName = Project.showContextKey(state.value).show(resolvedScoped.value)
|
||||||
try trl.run(streams.value.log, executeTests.value, taskName)
|
try trl.run(streams.value.log, executeTests.value, taskName)
|
||||||
finally close(testLoader.value)
|
finally close(testLoader.value)
|
||||||
|
|
@ -1264,15 +1264,15 @@ object Defaults extends BuildCommon {
|
||||||
streams.value.log,
|
streams.value.log,
|
||||||
closeableTestLogger(
|
closeableTestLogger(
|
||||||
streamsManager.value,
|
streamsManager.value,
|
||||||
test in resolvedScoped.value.scope,
|
(resolvedScoped.value.scope / test),
|
||||||
logBuffered.value
|
logBuffered.value
|
||||||
),
|
),
|
||||||
Keys.logLevel.?.value.getOrElse(stateLogLevel),
|
Keys.logLevel.?.value.getOrElse(stateLogLevel),
|
||||||
) +:
|
) +:
|
||||||
new TestStatusReporter(succeededFile(streams.in(test).value.cacheDirectory)) +:
|
new TestStatusReporter(succeededFile((test / streams).value.cacheDirectory)) +:
|
||||||
testListeners.in(TaskZero).value
|
(TaskZero / testListeners).value
|
||||||
},
|
},
|
||||||
testOptions := Tests.Listeners(testListeners.value) +: (testOptions in TaskZero).value,
|
testOptions := Tests.Listeners(testListeners.value) +: (TaskZero / testOptions).value,
|
||||||
testExecution := testExecutionTask(key).value
|
testExecution := testExecutionTask(key).value
|
||||||
)
|
)
|
||||||
) ++ inScope(GlobalScope)(
|
) ++ inScope(GlobalScope)(
|
||||||
|
|
@ -1332,16 +1332,16 @@ object Defaults extends BuildCommon {
|
||||||
def testExecutionTask(task: Scoped): Initialize[Task[Tests.Execution]] =
|
def testExecutionTask(task: Scoped): Initialize[Task[Tests.Execution]] =
|
||||||
Def.task {
|
Def.task {
|
||||||
new Tests.Execution(
|
new Tests.Execution(
|
||||||
(testOptions in task).value,
|
(task / testOptions).value,
|
||||||
(parallelExecution in task).value,
|
(task / parallelExecution).value,
|
||||||
(tags in task).value
|
(task / tags).value
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
def testQuickFilter: Initialize[Task[Seq[String] => Seq[String => Boolean]]] =
|
def testQuickFilter: Initialize[Task[Seq[String] => Seq[String => Boolean]]] =
|
||||||
Def.task {
|
Def.task {
|
||||||
val cp = (fullClasspath in test).value
|
val cp = (test / fullClasspath).value
|
||||||
val s = (streams in test).value
|
val s = (test / streams).value
|
||||||
val ans: Seq[Analysis] = cp.flatMap(_.metadata get Keys.analysis) map {
|
val ans: Seq[Analysis] = cp.flatMap(_.metadata get Keys.analysis) map {
|
||||||
case a0: Analysis => a0
|
case a0: Analysis => a0
|
||||||
}
|
}
|
||||||
|
|
@ -1383,8 +1383,10 @@ object Defaults extends BuildCommon {
|
||||||
}
|
}
|
||||||
def succeededFile(dir: File) = dir / "succeeded_tests"
|
def succeededFile(dir: File) = dir / "succeeded_tests"
|
||||||
|
|
||||||
|
@nowarn
|
||||||
def inputTests(key: InputKey[_]): Initialize[InputTask[Unit]] =
|
def inputTests(key: InputKey[_]): Initialize[InputTask[Unit]] =
|
||||||
inputTests0.mapReferenced(Def.mapScope(_ in key.key))
|
inputTests0.mapReferenced(Def.mapScope(_ in key.key))
|
||||||
|
|
||||||
private[this] lazy val inputTests0: Initialize[InputTask[Unit]] = {
|
private[this] lazy val inputTests0: Initialize[InputTask[Unit]] = {
|
||||||
val parser = loadForParser(definedTestNames)((s, i) => testOnlyParser(s, i getOrElse Nil))
|
val parser = loadForParser(definedTestNames)((s, i) => testOnlyParser(s, i getOrElse Nil))
|
||||||
Def.inputTaskDyn {
|
Def.inputTaskDyn {
|
||||||
|
|
@ -1711,8 +1713,8 @@ object Defaults extends BuildCommon {
|
||||||
crossTarget.value /
|
crossTarget.value /
|
||||||
(prefix(configuration.value.name) + extraPrefix) / f(
|
(prefix(configuration.value.name) + extraPrefix) / f(
|
||||||
ScalaVersion(
|
ScalaVersion(
|
||||||
(scalaVersion in artifactName).value,
|
(artifactName / scalaVersion).value,
|
||||||
(scalaBinaryVersion in artifactName).value
|
(artifactName / scalaBinaryVersion).value
|
||||||
),
|
),
|
||||||
projectID.value,
|
projectID.value,
|
||||||
art.value
|
art.value
|
||||||
|
|
@ -1727,8 +1729,8 @@ object Defaults extends BuildCommon {
|
||||||
val f = artifactName.value
|
val f = artifactName.value
|
||||||
crossTarget.value / extraPrefix / f(
|
crossTarget.value / extraPrefix / f(
|
||||||
ScalaVersion(
|
ScalaVersion(
|
||||||
(scalaVersion in artifactName).value,
|
(artifactName / scalaVersion).value,
|
||||||
(scalaBinaryVersion in artifactName).value
|
(artifactName / scalaBinaryVersion).value
|
||||||
),
|
),
|
||||||
projectID.value,
|
projectID.value,
|
||||||
art.value
|
art.value
|
||||||
|
|
@ -1740,8 +1742,8 @@ object Defaults extends BuildCommon {
|
||||||
val f = artifactName.value
|
val f = artifactName.value
|
||||||
crossTarget.value / f(
|
crossTarget.value / f(
|
||||||
ScalaVersion(
|
ScalaVersion(
|
||||||
(scalaVersion in artifactName).value,
|
(artifactName / scalaVersion).value,
|
||||||
(scalaBinaryVersion in artifactName).value
|
(artifactName / scalaBinaryVersion).value
|
||||||
),
|
),
|
||||||
projectID.value,
|
projectID.value,
|
||||||
art.value
|
art.value
|
||||||
|
|
@ -1787,7 +1789,7 @@ object Defaults extends BuildCommon {
|
||||||
def packageTaskSettings(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File, String)]]]) =
|
def packageTaskSettings(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File, String)]]]) =
|
||||||
inTask(key)(
|
inTask(key)(
|
||||||
Seq(
|
Seq(
|
||||||
key in TaskZero := packageTask.value,
|
(TaskZero / key) := packageTask.value,
|
||||||
packageConfiguration := packageConfigurationTask.value,
|
packageConfiguration := packageConfigurationTask.value,
|
||||||
mappings := mappingsTask.value,
|
mappings := mappingsTask.value,
|
||||||
packagedArtifact := (artifact.value -> key.value),
|
packagedArtifact := (artifact.value -> key.value),
|
||||||
|
|
@ -1881,7 +1883,7 @@ object Defaults extends BuildCommon {
|
||||||
Def.inputTask {
|
Def.inputTask {
|
||||||
val service = bgJobService.value
|
val service = bgJobService.value
|
||||||
val (mainClass, args) = parser.parsed
|
val (mainClass, args) = parser.parsed
|
||||||
val hashClasspath = (bgHashClasspath in bgRunMain).value
|
val hashClasspath = (bgRunMain / bgHashClasspath).value
|
||||||
val wrapper = termWrapper(canonicalInput.value, echoInput.value)
|
val wrapper = termWrapper(canonicalInput.value, echoInput.value)
|
||||||
service.runInBackgroundWithLoader(resolvedScoped.value, state.value) { (logger, workingDir) =>
|
service.runInBackgroundWithLoader(resolvedScoped.value, state.value) { (logger, workingDir) =>
|
||||||
val files =
|
val files =
|
||||||
|
|
@ -1912,7 +1914,7 @@ object Defaults extends BuildCommon {
|
||||||
Def.inputTask {
|
Def.inputTask {
|
||||||
val service = bgJobService.value
|
val service = bgJobService.value
|
||||||
val mainClass = mainClassTask.value getOrElse sys.error("No main class detected.")
|
val mainClass = mainClassTask.value getOrElse sys.error("No main class detected.")
|
||||||
val hashClasspath = (bgHashClasspath in bgRun).value
|
val hashClasspath = (bgRun / bgHashClasspath).value
|
||||||
val wrapper = termWrapper(canonicalInput.value, echoInput.value)
|
val wrapper = termWrapper(canonicalInput.value, echoInput.value)
|
||||||
service.runInBackgroundWithLoader(resolvedScoped.value, state.value) { (logger, workingDir) =>
|
service.runInBackgroundWithLoader(resolvedScoped.value, state.value) { (logger, workingDir) =>
|
||||||
val files =
|
val files =
|
||||||
|
|
@ -1990,13 +1992,13 @@ object Defaults extends BuildCommon {
|
||||||
if (options.nonEmpty) {
|
if (options.nonEmpty) {
|
||||||
val mask = ScopeMask(project = false)
|
val mask = ScopeMask(project = false)
|
||||||
val showJavaOptions = Scope.displayMasked(
|
val showJavaOptions = Scope.displayMasked(
|
||||||
(javaOptions in resolvedScope).scopedKey.scope,
|
(resolvedScope / javaOptions).scopedKey.scope,
|
||||||
(javaOptions in resolvedScope).key.label,
|
(resolvedScope / javaOptions).key.label,
|
||||||
mask
|
mask
|
||||||
)
|
)
|
||||||
val showFork = Scope.displayMasked(
|
val showFork = Scope.displayMasked(
|
||||||
(fork in resolvedScope).scopedKey.scope,
|
(resolvedScope / fork).scopedKey.scope,
|
||||||
(fork in resolvedScope).key.label,
|
(resolvedScope / fork).key.label,
|
||||||
mask
|
mask
|
||||||
)
|
)
|
||||||
s.log.warn(s"$showJavaOptions will be ignored, $showFork is set to false")
|
s.log.warn(s"$showJavaOptions will be ignored, $showFork is set to false")
|
||||||
|
|
@ -2062,7 +2064,7 @@ object Defaults extends BuildCommon {
|
||||||
Seq("-project", project)
|
Seq("-project", project)
|
||||||
} else compileOptions
|
} else compileOptions
|
||||||
},
|
},
|
||||||
key in TaskZero := {
|
(TaskZero / key) := {
|
||||||
val s = streams.value
|
val s = streams.value
|
||||||
val cs: Compilers = compilers.value
|
val cs: Compilers = compilers.value
|
||||||
val srcs = sources.value
|
val srcs = sources.value
|
||||||
|
|
@ -2128,18 +2130,18 @@ object Defaults extends BuildCommon {
|
||||||
private[this] def mainBgRunTaskForConfig(c: ScopeAxis[ConfigKey]) =
|
private[this] def mainBgRunTaskForConfig(c: ScopeAxis[ConfigKey]) =
|
||||||
bgRun := bgRunTask(
|
bgRun := bgRunTask(
|
||||||
exportedProductJars,
|
exportedProductJars,
|
||||||
fullClasspathAsJars in (This, c, This),
|
This / c / This / fullClasspathAsJars,
|
||||||
mainClass in run,
|
run / mainClass,
|
||||||
bgCopyClasspath in bgRun,
|
bgRun / bgCopyClasspath,
|
||||||
runner in run
|
run / runner
|
||||||
).evaluated
|
).evaluated
|
||||||
|
|
||||||
private[this] def mainBgRunMainTaskForConfig(c: ScopeAxis[ConfigKey]) =
|
private[this] def mainBgRunMainTaskForConfig(c: ScopeAxis[ConfigKey]) =
|
||||||
bgRunMain := bgRunMainTask(
|
bgRunMain := bgRunMainTask(
|
||||||
exportedProductJars,
|
exportedProductJars,
|
||||||
fullClasspathAsJars in (This, c, This),
|
This / c / This / fullClasspathAsJars,
|
||||||
bgCopyClasspath in bgRunMain,
|
bgRunMain / bgCopyClasspath,
|
||||||
runner in run
|
run / runner
|
||||||
).evaluated
|
).evaluated
|
||||||
|
|
||||||
def discoverMainClasses(analysis: CompileAnalysis): Seq[String] = analysis match {
|
def discoverMainClasses(analysis: CompileAnalysis): Seq[String] = analysis match {
|
||||||
|
|
@ -2149,7 +2151,7 @@ object Defaults extends BuildCommon {
|
||||||
|
|
||||||
def consoleProjectTask =
|
def consoleProjectTask =
|
||||||
Def.task {
|
Def.task {
|
||||||
ConsoleProject(state.value, (initialCommands in consoleProject).value)(streams.value.log)
|
ConsoleProject(state.value, (consoleProject / initialCommands).value)(streams.value.log)
|
||||||
println()
|
println()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2157,19 +2159,19 @@ object Defaults extends BuildCommon {
|
||||||
def consoleQuickTask = consoleTask(externalDependencyClasspath, consoleQuick)
|
def consoleQuickTask = consoleTask(externalDependencyClasspath, consoleQuick)
|
||||||
def consoleTask(classpath: TaskKey[Classpath], task: TaskKey[_]): Initialize[Task[Unit]] =
|
def consoleTask(classpath: TaskKey[Classpath], task: TaskKey[_]): Initialize[Task[Unit]] =
|
||||||
Def.task {
|
Def.task {
|
||||||
val si = (scalaInstance in task).value
|
val si = (task / scalaInstance).value
|
||||||
val s = streams.value
|
val s = streams.value
|
||||||
val cpFiles = data((classpath in task).value)
|
val cpFiles = data((task / classpath).value)
|
||||||
val fullcp = (cpFiles ++ si.allJars).distinct
|
val fullcp = (cpFiles ++ si.allJars).distinct
|
||||||
val tempDir = IO.createUniqueDirectory((taskTemporaryDirectory in task).value).toPath
|
val tempDir = IO.createUniqueDirectory((task / taskTemporaryDirectory).value).toPath
|
||||||
val loader = ClasspathUtil.makeLoader(fullcp.map(_.toPath), si, tempDir)
|
val loader = ClasspathUtil.makeLoader(fullcp.map(_.toPath), si, tempDir)
|
||||||
val compiler =
|
val compiler =
|
||||||
(compilers in task).value.scalac match {
|
(task / compilers).value.scalac match {
|
||||||
case ac: AnalyzingCompiler => ac.onArgs(exported(s, "scala"))
|
case ac: AnalyzingCompiler => ac.onArgs(exported(s, "scala"))
|
||||||
}
|
}
|
||||||
val sc = (scalacOptions in task).value
|
val sc = (task / scalacOptions).value
|
||||||
val ic = (initialCommands in task).value
|
val ic = (task / initialCommands).value
|
||||||
val cc = (cleanupCommands in task).value
|
val cc = (task / cleanupCommands).value
|
||||||
(new Console(compiler))(cpFiles, sc, loader, ic, cc)()(s.log).get
|
(new Console(compiler))(cpFiles, sc, loader, ic, cc)()(s.log).get
|
||||||
println()
|
println()
|
||||||
}
|
}
|
||||||
|
|
@ -2332,7 +2334,7 @@ object Defaults extends BuildCommon {
|
||||||
else None
|
else None
|
||||||
Setup.of(
|
Setup.of(
|
||||||
lookup,
|
lookup,
|
||||||
(skip in compile).value,
|
(compile / skip).value,
|
||||||
compileAnalysisFile.value.toPath,
|
compileAnalysisFile.value.toPath,
|
||||||
compilerCache.value,
|
compilerCache.value,
|
||||||
incOptions.value,
|
incOptions.value,
|
||||||
|
|
@ -2493,7 +2495,7 @@ object Defaults extends BuildCommon {
|
||||||
def noAggregation: Seq[Scoped] =
|
def noAggregation: Seq[Scoped] =
|
||||||
Seq(run, runMain, bgRun, bgRunMain, console, consoleQuick, consoleProject)
|
Seq(run, runMain, bgRun, bgRunMain, console, consoleQuick, consoleProject)
|
||||||
lazy val disableAggregation = Defaults.globalDefaults(noAggregation map disableAggregate)
|
lazy val disableAggregation = Defaults.globalDefaults(noAggregation map disableAggregate)
|
||||||
def disableAggregate(k: Scoped) = aggregate in k :== false
|
def disableAggregate(k: Scoped) = (k / aggregate) :== false
|
||||||
|
|
||||||
// 1. runnerSettings is added unscoped via JvmPlugin.
|
// 1. runnerSettings is added unscoped via JvmPlugin.
|
||||||
// 2. In addition it's added scoped to run task.
|
// 2. In addition it's added scoped to run task.
|
||||||
|
|
@ -2634,8 +2636,8 @@ object Classpaths {
|
||||||
unmanagedJars := findUnmanagedJars(
|
unmanagedJars := findUnmanagedJars(
|
||||||
configuration.value,
|
configuration.value,
|
||||||
unmanagedBase.value,
|
unmanagedBase.value,
|
||||||
includeFilter in unmanagedJars value,
|
(unmanagedJars / includeFilter) value,
|
||||||
excludeFilter in unmanagedJars value
|
(unmanagedJars / excludeFilter) value
|
||||||
)
|
)
|
||||||
).map(exportClasspath) ++ Seq(
|
).map(exportClasspath) ++ Seq(
|
||||||
externalDependencyClasspath / outputFileStamps := {
|
externalDependencyClasspath / outputFileStamps := {
|
||||||
|
|
@ -2698,7 +2700,7 @@ object Classpaths {
|
||||||
|
|
||||||
def defaultPackageKeys = Seq(packageBin, packageSrc, packageDoc)
|
def defaultPackageKeys = Seq(packageBin, packageSrc, packageDoc)
|
||||||
lazy val defaultPackages: Seq[TaskKey[File]] =
|
lazy val defaultPackages: Seq[TaskKey[File]] =
|
||||||
for (task <- defaultPackageKeys; conf <- Seq(Compile, Test)) yield (task in conf)
|
for (task <- defaultPackageKeys; conf <- Seq(Compile, Test)) yield (conf / task)
|
||||||
lazy val defaultArtifactTasks: Seq[TaskKey[File]] = makePom +: defaultPackages
|
lazy val defaultArtifactTasks: Seq[TaskKey[File]] = makePom +: defaultPackages
|
||||||
|
|
||||||
def findClasspathConfig(
|
def findClasspathConfig(
|
||||||
|
|
@ -2729,6 +2731,7 @@ object Classpaths {
|
||||||
case (a, true) => a
|
case (a, true) => a
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@nowarn
|
||||||
def forallIn[T](
|
def forallIn[T](
|
||||||
key: Scoped.ScopingSetting[SettingKey[T]], // should be just SettingKey[T] (mea culpa)
|
key: Scoped.ScopingSetting[SettingKey[T]], // should be just SettingKey[T] (mea culpa)
|
||||||
pkgTasks: Seq[TaskKey[_]],
|
pkgTasks: Seq[TaskKey[_]],
|
||||||
|
|
@ -2740,7 +2743,7 @@ object Classpaths {
|
||||||
Seq(
|
Seq(
|
||||||
publishMavenStyle :== true,
|
publishMavenStyle :== true,
|
||||||
publishArtifact :== true,
|
publishArtifact :== true,
|
||||||
publishArtifact in Test :== false
|
(Test / publishArtifact) :== false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -2759,7 +2762,7 @@ object Classpaths {
|
||||||
publisher.makePomFile(ivyModule.value, config, streams.value.log)
|
publisher.makePomFile(ivyModule.value, config, streams.value.log)
|
||||||
config.file.get
|
config.file.get
|
||||||
},
|
},
|
||||||
packagedArtifact in makePom := ((artifact in makePom).value -> makePom.value),
|
(makePom / packagedArtifact) := ((makePom / artifact).value -> makePom.value),
|
||||||
deliver := deliverTask(makeIvyXmlConfiguration).value,
|
deliver := deliverTask(makeIvyXmlConfiguration).value,
|
||||||
deliverLocal := deliverTask(makeIvyXmlLocalConfiguration).value,
|
deliverLocal := deliverTask(makeIvyXmlLocalConfiguration).value,
|
||||||
makeIvyXml := deliverTask(makeIvyXmlConfiguration).value,
|
makeIvyXml := deliverTask(makeIvyXmlConfiguration).value,
|
||||||
|
|
@ -2936,8 +2939,8 @@ object Classpaths {
|
||||||
Def.setting {
|
Def.setting {
|
||||||
Option(
|
Option(
|
||||||
ScalaModuleInfo(
|
ScalaModuleInfo(
|
||||||
(scalaVersion in update).value,
|
(update / scalaVersion).value,
|
||||||
(scalaBinaryVersion in update).value,
|
(update / scalaBinaryVersion).value,
|
||||||
Vector.empty,
|
Vector.empty,
|
||||||
filterImplicit = false,
|
filterImplicit = false,
|
||||||
checkExplicit = true,
|
checkExplicit = true,
|
||||||
|
|
@ -2947,9 +2950,9 @@ object Classpaths {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)).value,
|
)).value,
|
||||||
artifactPath in makePom := artifactPathSetting(artifact in makePom).value,
|
makePom / artifactPath := artifactPathSetting((makePom / artifact)).value,
|
||||||
publishArtifact in makePom := publishMavenStyle.value && publishArtifact.value,
|
makePom / publishArtifact := publishMavenStyle.value && publishArtifact.value,
|
||||||
artifact in makePom := Artifact.pom(moduleName.value),
|
makePom / artifact := Artifact.pom(moduleName.value),
|
||||||
projectID := defaultProjectID.value,
|
projectID := defaultProjectID.value,
|
||||||
projectID := pluginProjectID.value,
|
projectID := pluginProjectID.value,
|
||||||
projectDescriptors := depMap.value,
|
projectDescriptors := depMap.value,
|
||||||
|
|
@ -3029,7 +3032,7 @@ object Classpaths {
|
||||||
},
|
},
|
||||||
moduleSettings := moduleSettings0.value,
|
moduleSettings := moduleSettings0.value,
|
||||||
makePomConfiguration := MakePomConfiguration()
|
makePomConfiguration := MakePomConfiguration()
|
||||||
.withFile((artifactPath in makePom).value)
|
.withFile((makePom / artifactPath).value)
|
||||||
.withModuleInfo(projectInfo.value)
|
.withModuleInfo(projectInfo.value)
|
||||||
.withExtra(pomExtra.value)
|
.withExtra(pomExtra.value)
|
||||||
.withProcess(pomPostProcess.value)
|
.withProcess(pomPostProcess.value)
|
||||||
|
|
@ -3042,7 +3045,7 @@ object Classpaths {
|
||||||
sbt.Classpaths.deliverPattern(crossTarget.value),
|
sbt.Classpaths.deliverPattern(crossTarget.value),
|
||||||
if (isSnapshot.value) "integration" else "release",
|
if (isSnapshot.value) "integration" else "release",
|
||||||
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
|
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
|
||||||
checksums.in(publish).value.toVector,
|
(publish / checksums).value.toVector,
|
||||||
ivyLoggingLevel.value,
|
ivyLoggingLevel.value,
|
||||||
isSnapshot.value
|
isSnapshot.value
|
||||||
)
|
)
|
||||||
|
|
@ -3061,8 +3064,8 @@ object Classpaths {
|
||||||
deliverPattern(crossTarget.value),
|
deliverPattern(crossTarget.value),
|
||||||
if (isSnapshot.value) "integration" else "release",
|
if (isSnapshot.value) "integration" else "release",
|
||||||
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
|
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
|
||||||
packagedArtifacts.in(publish).value.toVector,
|
(publish / packagedArtifacts).value.toVector,
|
||||||
checksums.in(publish).value.toVector,
|
(publish / checksums).value.toVector,
|
||||||
getPublishTo(publishTo.value).name,
|
getPublishTo(publishTo.value).name,
|
||||||
ivyLoggingLevel.value,
|
ivyLoggingLevel.value,
|
||||||
isSnapshot.value
|
isSnapshot.value
|
||||||
|
|
@ -3074,7 +3077,7 @@ object Classpaths {
|
||||||
sbt.Classpaths.deliverPattern(crossTarget.value),
|
sbt.Classpaths.deliverPattern(crossTarget.value),
|
||||||
if (isSnapshot.value) "integration" else "release",
|
if (isSnapshot.value) "integration" else "release",
|
||||||
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
|
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
|
||||||
checksums.in(publish).value.toVector,
|
(publish / checksums).value.toVector,
|
||||||
ivyLoggingLevel.value,
|
ivyLoggingLevel.value,
|
||||||
isSnapshot.value,
|
isSnapshot.value,
|
||||||
optResolverName = Some("local")
|
optResolverName = Some("local")
|
||||||
|
|
@ -3085,8 +3088,8 @@ object Classpaths {
|
||||||
deliverPattern(crossTarget.value),
|
deliverPattern(crossTarget.value),
|
||||||
if (isSnapshot.value) "integration" else "release",
|
if (isSnapshot.value) "integration" else "release",
|
||||||
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
|
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
|
||||||
packagedArtifacts.in(publishLocal).value.toVector,
|
(publishLocal / packagedArtifacts).value.toVector,
|
||||||
checksums.in(publishLocal).value.toVector,
|
(publishLocal / checksums).value.toVector,
|
||||||
logging = ivyLoggingLevel.value,
|
logging = ivyLoggingLevel.value,
|
||||||
overwrite = isSnapshot.value
|
overwrite = isSnapshot.value
|
||||||
),
|
),
|
||||||
|
|
@ -3095,8 +3098,8 @@ object Classpaths {
|
||||||
deliverPattern(crossTarget.value),
|
deliverPattern(crossTarget.value),
|
||||||
if (isSnapshot.value) "integration" else "release",
|
if (isSnapshot.value) "integration" else "release",
|
||||||
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
|
ivyConfigurations.value.map(c => ConfigRef(c.name)).toVector,
|
||||||
packagedArtifacts.in(publishM2).value.toVector,
|
(publishM2 / packagedArtifacts).value.toVector,
|
||||||
checksums = checksums.in(publishM2).value.toVector,
|
checksums = (publishM2 / checksums).value.toVector,
|
||||||
resolverName = Resolver.publishMavenLocal.name,
|
resolverName = Resolver.publishMavenLocal.name,
|
||||||
logging = ivyLoggingLevel.value,
|
logging = ivyLoggingLevel.value,
|
||||||
overwrite = isSnapshot.value
|
overwrite = isSnapshot.value
|
||||||
|
|
@ -3111,7 +3114,7 @@ object Classpaths {
|
||||||
s"update_cache$suffix"
|
s"update_cache$suffix"
|
||||||
},
|
},
|
||||||
dependencyPositions := dependencyPositionsTask.value,
|
dependencyPositions := dependencyPositionsTask.value,
|
||||||
unresolvedWarningConfiguration in update := UnresolvedWarningConfiguration(
|
update / unresolvedWarningConfiguration := UnresolvedWarningConfiguration(
|
||||||
dependencyPositions.value
|
dependencyPositions.value
|
||||||
),
|
),
|
||||||
updateFull := (updateTask tag (Tags.Update, Tags.Network)).value,
|
updateFull := (updateTask tag (Tags.Update, Tags.Network)).value,
|
||||||
|
|
@ -3122,8 +3125,8 @@ object Classpaths {
|
||||||
ConflictWarning(conflictWarning.value, report, log)
|
ConflictWarning(conflictWarning.value, report, log)
|
||||||
report
|
report
|
||||||
},
|
},
|
||||||
evictionWarningOptions in update := evictionWarningOptions.value,
|
update / evictionWarningOptions := evictionWarningOptions.value,
|
||||||
evictionWarningOptions in evicted := EvictionWarningOptions.full,
|
evicted / evictionWarningOptions := EvictionWarningOptions.full,
|
||||||
evicted := {
|
evicted := {
|
||||||
import ShowLines._
|
import ShowLines._
|
||||||
val report = (updateTask tag (Tags.Update, Tags.Network)).value
|
val report = (updateTask tag (Tags.Update, Tags.Network)).value
|
||||||
|
|
@ -3151,7 +3154,7 @@ object Classpaths {
|
||||||
},
|
},
|
||||||
dependencyResolution := dependencyResolutionTask.value,
|
dependencyResolution := dependencyResolutionTask.value,
|
||||||
csrConfiguration := LMCoursier.updateClassifierConfigurationTask.value,
|
csrConfiguration := LMCoursier.updateClassifierConfigurationTask.value,
|
||||||
updateClassifiers in TaskGlobal := LibraryManagement.updateClassifiersTask.value,
|
TaskGlobal / updateClassifiers := LibraryManagement.updateClassifiersTask.value,
|
||||||
)
|
)
|
||||||
) ++ Seq(
|
) ++ Seq(
|
||||||
csrProject := CoursierInputsTasks.coursierProjectTask.value,
|
csrProject := CoursierInputsTasks.coursierProjectTask.value,
|
||||||
|
|
@ -3178,7 +3181,7 @@ object Classpaths {
|
||||||
val base = projectDependencies.value ++ libraryDependencies.value
|
val base = projectDependencies.value ++ libraryDependencies.value
|
||||||
val isPlugin = sbtPlugin.value
|
val isPlugin = sbtPlugin.value
|
||||||
val sbtdeps =
|
val sbtdeps =
|
||||||
(sbtDependency in pluginCrossBuild).value.withConfigurations(Some(Provided.name))
|
(pluginCrossBuild / sbtDependency).value.withConfigurations(Some(Provided.name))
|
||||||
val pluginAdjust =
|
val pluginAdjust =
|
||||||
if (isPlugin) sbtdeps +: base
|
if (isPlugin) sbtdeps +: base
|
||||||
else base
|
else base
|
||||||
|
|
@ -3217,7 +3220,7 @@ object Classpaths {
|
||||||
val isPlugin = sbtPlugin.value
|
val isPlugin = sbtPlugin.value
|
||||||
val app = appConfiguration.value
|
val app = appConfiguration.value
|
||||||
val id = app.provider.id
|
val id = app.provider.id
|
||||||
val sv = (sbtVersion in pluginCrossBuild).value
|
val sv = (pluginCrossBuild / sbtVersion).value
|
||||||
val base = ModuleID(id.groupID, "scripted-plugin", sv).withCrossVersion(CrossVersion.binary)
|
val base = ModuleID(id.groupID, "scripted-plugin", sv).withCrossVersion(CrossVersion.binary)
|
||||||
if (isPlugin) Seq(base)
|
if (isPlugin) Seq(base)
|
||||||
else Seq()
|
else Seq()
|
||||||
|
|
@ -3250,7 +3253,7 @@ object Classpaths {
|
||||||
|
|
||||||
private[sbt] def defaultProjectID: Initialize[ModuleID] = Def.setting {
|
private[sbt] def defaultProjectID: Initialize[ModuleID] = Def.setting {
|
||||||
val p0 = ModuleID(organization.value, moduleName.value, version.value)
|
val p0 = ModuleID(organization.value, moduleName.value, version.value)
|
||||||
.cross(crossVersion in projectID value)
|
.cross((projectID / crossVersion) value)
|
||||||
.artifacts(artifacts.value: _*)
|
.artifacts(artifacts.value: _*)
|
||||||
val p1 = apiURL.value match {
|
val p1 = apiURL.value match {
|
||||||
case Some(u) => p0.extra(SbtPomExtraProperties.POM_API_KEY -> u.toExternalForm)
|
case Some(u) => p0.extra(SbtPomExtraProperties.POM_API_KEY -> u.toExternalForm)
|
||||||
|
|
@ -3269,8 +3272,8 @@ object Classpaths {
|
||||||
if (sbtPlugin.value)
|
if (sbtPlugin.value)
|
||||||
sbtPluginExtra(
|
sbtPluginExtra(
|
||||||
projectID.value,
|
projectID.value,
|
||||||
(sbtBinaryVersion in pluginCrossBuild).value,
|
(pluginCrossBuild / sbtBinaryVersion).value,
|
||||||
(scalaBinaryVersion in pluginCrossBuild).value
|
(pluginCrossBuild / scalaBinaryVersion).value
|
||||||
)
|
)
|
||||||
else projectID.value
|
else projectID.value
|
||||||
}
|
}
|
||||||
|
|
@ -3297,7 +3300,7 @@ object Classpaths {
|
||||||
private[this] def sbtClassifiersGlobalDefaults =
|
private[this] def sbtClassifiersGlobalDefaults =
|
||||||
Defaults.globalDefaults(
|
Defaults.globalDefaults(
|
||||||
Seq(
|
Seq(
|
||||||
transitiveClassifiers in updateSbtClassifiers ~= (_.filter(_ != DocClassifier))
|
(updateSbtClassifiers / transitiveClassifiers) ~= (_.filter(_ != DocClassifier))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
def sbtClassifiersTasks =
|
def sbtClassifiersTasks =
|
||||||
|
|
@ -3347,7 +3350,7 @@ object Classpaths {
|
||||||
},
|
},
|
||||||
dependencyResolution := dependencyResolutionTask.value,
|
dependencyResolution := dependencyResolutionTask.value,
|
||||||
csrConfiguration := LMCoursier.updateSbtClassifierConfigurationTask.value,
|
csrConfiguration := LMCoursier.updateSbtClassifierConfigurationTask.value,
|
||||||
updateSbtClassifiers in TaskGlobal := (Def.task {
|
(TaskGlobal / updateSbtClassifiers) := (Def.task {
|
||||||
val lm = dependencyResolution.value
|
val lm = dependencyResolution.value
|
||||||
val s = streams.value
|
val s = streams.value
|
||||||
val is = ivySbt.value
|
val is = ivySbt.value
|
||||||
|
|
@ -3363,7 +3366,7 @@ object Classpaths {
|
||||||
val docTypes = docArtifactTypes.value
|
val docTypes = docArtifactTypes.value
|
||||||
val log = s.log
|
val log = s.log
|
||||||
val out = is.withIvy(log)(_.getSettings.getDefaultIvyUserDir)
|
val out = is.withIvy(log)(_.getSettings.getDefaultIvyUserDir)
|
||||||
val uwConfig = (unresolvedWarningConfiguration in update).value
|
val uwConfig = (update / unresolvedWarningConfiguration).value
|
||||||
withExcludes(out, mod.classifiers, lock(app)) { excludes =>
|
withExcludes(out, mod.classifiers, lock(app)) { excludes =>
|
||||||
// val noExplicitCheck = ivy.map(_.withCheckExplicit(false))
|
// val noExplicitCheck = ivy.map(_.withCheckExplicit(false))
|
||||||
LibraryManagement.transitiveScratch(
|
LibraryManagement.transitiveScratch(
|
||||||
|
|
@ -3560,7 +3563,7 @@ object Classpaths {
|
||||||
// Use full level when debug is enabled so that ivy logs are shown.
|
// Use full level when debug is enabled so that ivy logs are shown.
|
||||||
import UpdateLogging.{ Default, DownloadOnly, Full }
|
import UpdateLogging.{ Default, DownloadOnly, Full }
|
||||||
val conf = updateConfiguration.value
|
val conf = updateConfiguration.value
|
||||||
val maybeUpdateLevel = (logLevel in update).?.value
|
val maybeUpdateLevel = (update / logLevel).?.value
|
||||||
val conf1 = maybeUpdateLevel.orElse(state0.get(logLevel.key)) match {
|
val conf1 = maybeUpdateLevel.orElse(state0.get(logLevel.key)) match {
|
||||||
case Some(Level.Debug) if conf.logging == Default => conf.withLogging(logging = Full)
|
case Some(Level.Debug) if conf.logging == Default => conf.withLogging(logging = Full)
|
||||||
case Some(_) if conf.logging == Default => conf.withLogging(logging = DownloadOnly)
|
case Some(_) if conf.logging == Default => conf.withLogging(logging = DownloadOnly)
|
||||||
|
|
@ -3589,10 +3592,10 @@ object Classpaths {
|
||||||
label = label,
|
label = label,
|
||||||
updateConf,
|
updateConf,
|
||||||
substituteScalaFiles(scalaOrganization.value, _)(providedScalaJars),
|
substituteScalaFiles(scalaOrganization.value, _)(providedScalaJars),
|
||||||
skip = (skip in update).value,
|
skip = (update / skip).value,
|
||||||
force = shouldForce,
|
force = shouldForce,
|
||||||
depsUpdated = transitiveUpdate.value.exists(!_.stats.cached),
|
depsUpdated = transitiveUpdate.value.exists(!_.stats.cached),
|
||||||
uwConfig = (unresolvedWarningConfiguration in update).value,
|
uwConfig = (update / unresolvedWarningConfiguration).value,
|
||||||
evictionLevel = evictionErrorLevel.value,
|
evictionLevel = evictionErrorLevel.value,
|
||||||
versionSchemeOverrides = libraryDependencySchemes.value,
|
versionSchemeOverrides = libraryDependencySchemes.value,
|
||||||
assumedEvictionErrorLevel = assumedEvictionErrorLevel.value,
|
assumedEvictionErrorLevel = assumedEvictionErrorLevel.value,
|
||||||
|
|
@ -3616,7 +3619,7 @@ object Classpaths {
|
||||||
def modulePositions: Map[ModuleID, SourcePosition] =
|
def modulePositions: Map[ModuleID, SourcePosition] =
|
||||||
try {
|
try {
|
||||||
val extracted = (Project extract st)
|
val extracted = (Project extract st)
|
||||||
val sk = (libraryDependencies in (GlobalScope in projRef)).scopedKey
|
val sk = (projRef / Zero / Zero / libraryDependencies).scopedKey
|
||||||
val empty = extracted.structure.data set (sk.scope, sk.key, Nil)
|
val empty = extracted.structure.data set (sk.scope, sk.key, Nil)
|
||||||
val settings = extracted.structure.settings filter { s: Setting[_] =>
|
val settings = extracted.structure.settings filter { s: Setting[_] =>
|
||||||
(s.key.key == libraryDependencies.key) &&
|
(s.key.key == libraryDependencies.key) &&
|
||||||
|
|
@ -3775,6 +3778,7 @@ object Classpaths {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
private[sbt] def depMap(
|
private[sbt] def depMap(
|
||||||
projects: Seq[ProjectRef],
|
projects: Seq[ProjectRef],
|
||||||
data: Settings[Scope],
|
data: Settings[Scope],
|
||||||
|
|
@ -3836,7 +3840,7 @@ object Classpaths {
|
||||||
.withOtherResolvers(other)
|
.withOtherResolvers(other)
|
||||||
.withModuleConfigurations(moduleConfigurations.value.toVector)
|
.withModuleConfigurations(moduleConfigurations.value.toVector)
|
||||||
.withLock(lock(appConfiguration.value))
|
.withLock(lock(appConfiguration.value))
|
||||||
.withChecksums((checksums in update).value.toVector)
|
.withChecksums((update / checksums).value.toVector)
|
||||||
.withResolutionCacheDir(crossTarget.value / "resolution-cache")
|
.withResolutionCacheDir(crossTarget.value / "resolution-cache")
|
||||||
.withUpdateOptions(updateOptions.value)
|
.withUpdateOptions(updateOptions.value)
|
||||||
.withLog(s.log)
|
.withLog(s.log)
|
||||||
|
|
@ -3913,7 +3917,7 @@ object Classpaths {
|
||||||
ClasspathImpl.getClasspath(key, dep, conf, data)
|
ClasspathImpl.getClasspath(key, dep, conf, data)
|
||||||
|
|
||||||
def defaultConfigurationTask(p: ResolvedReference, data: Settings[Scope]): Configuration =
|
def defaultConfigurationTask(p: ResolvedReference, data: Settings[Scope]): Configuration =
|
||||||
flatten(defaultConfiguration in p get data) getOrElse Configurations.Default
|
flatten((p / defaultConfiguration) get data) getOrElse Configurations.Default
|
||||||
|
|
||||||
def flatten[T](o: Option[Option[T]]): Option[T] = o flatMap idFun
|
def flatten[T](o: Option[Option[T]]): Option[T] = o flatMap idFun
|
||||||
|
|
||||||
|
|
@ -3939,7 +3943,7 @@ object Classpaths {
|
||||||
Nil
|
Nil
|
||||||
|
|
||||||
def addUnmanagedLibrary: Seq[Setting[_]] =
|
def addUnmanagedLibrary: Seq[Setting[_]] =
|
||||||
Seq(unmanagedJars in Compile ++= unmanagedScalaLibrary.value)
|
Seq((Compile / unmanagedJars) ++= unmanagedScalaLibrary.value)
|
||||||
|
|
||||||
def unmanagedScalaLibrary: Initialize[Task[Seq[File]]] = Def.taskDyn {
|
def unmanagedScalaLibrary: Initialize[Task[Seq[File]]] = Def.taskDyn {
|
||||||
if (autoScalaLibrary.value && scalaHome.value.isDefined)
|
if (autoScalaLibrary.value && scalaHome.value.isDefined)
|
||||||
|
|
@ -4143,7 +4147,7 @@ object Classpaths {
|
||||||
def shellPromptFromState: State => String = shellPromptFromState(ITerminal.console.isColorEnabled)
|
def shellPromptFromState: State => String = shellPromptFromState(ITerminal.console.isColorEnabled)
|
||||||
def shellPromptFromState(isColorEnabled: Boolean): State => String = { s: State =>
|
def shellPromptFromState(isColorEnabled: Boolean): State => String = { s: State =>
|
||||||
val extracted = Project.extract(s)
|
val extracted = Project.extract(s)
|
||||||
(name in extracted.currentRef).get(extracted.structure.data) match {
|
(extracted.currentRef / name).get(extracted.structure.data) match {
|
||||||
case Some(name) =>
|
case Some(name) =>
|
||||||
s"sbt:$name" + Def.withColor(s"> ", Option(scala.Console.CYAN), isColorEnabled)
|
s"sbt:$name" + Def.withColor(s"> ", Option(scala.Console.CYAN), isColorEnabled)
|
||||||
case _ => "> "
|
case _ => "> "
|
||||||
|
|
@ -4167,7 +4171,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
|
||||||
val add = (s: State) => BasicCommands.addAlias(s, name, value)
|
val add = (s: State) => BasicCommands.addAlias(s, name, value)
|
||||||
val remove = (s: State) => BasicCommands.removeAlias(s, name)
|
val remove = (s: State) => BasicCommands.removeAlias(s, name)
|
||||||
def compose(setting: SettingKey[State => State], f: State => State) =
|
def compose(setting: SettingKey[State => State], f: State => State) =
|
||||||
setting in GlobalScope ~= (_ compose f)
|
(GlobalScope / setting) ~= (_ compose f)
|
||||||
Seq(compose(onLoad, add), compose(onUnload, remove))
|
Seq(compose(onLoad, add), compose(onUnload, remove))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4208,7 +4212,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
|
||||||
*/
|
*/
|
||||||
def addSbtPlugin(dependency: ModuleID, sbtVersion: String): Setting[Seq[ModuleID]] =
|
def addSbtPlugin(dependency: ModuleID, sbtVersion: String): Setting[Seq[ModuleID]] =
|
||||||
libraryDependencies += {
|
libraryDependencies += {
|
||||||
val scalaV = (scalaBinaryVersion in update).value
|
val scalaV = (update / scalaBinaryVersion).value
|
||||||
sbtPluginExtra(dependency, sbtVersion, scalaV)
|
sbtPluginExtra(dependency, sbtVersion, scalaV)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4218,8 +4222,8 @@ trait BuildExtra extends BuildCommon with DefExtra {
|
||||||
*/
|
*/
|
||||||
def addSbtPlugin(dependency: ModuleID): Setting[Seq[ModuleID]] =
|
def addSbtPlugin(dependency: ModuleID): Setting[Seq[ModuleID]] =
|
||||||
libraryDependencies += {
|
libraryDependencies += {
|
||||||
val sbtV = (sbtBinaryVersion in pluginCrossBuild).value
|
val sbtV = (pluginCrossBuild / sbtBinaryVersion).value
|
||||||
val scalaV = (scalaBinaryVersion in update).value
|
val scalaV = (update / scalaBinaryVersion).value
|
||||||
sbtPluginExtra(dependency, sbtV, scalaV)
|
sbtPluginExtra(dependency, sbtV, scalaV)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4331,8 +4335,8 @@ trait BuildExtra extends BuildCommon with DefExtra {
|
||||||
): Initialize[InputTask[Unit]] =
|
): Initialize[InputTask[Unit]] =
|
||||||
Def.inputTask {
|
Def.inputTask {
|
||||||
import Def._
|
import Def._
|
||||||
val r = (runner in (config, run)).value
|
val r = (config / run / runner).value
|
||||||
val cp = (fullClasspath in config).value
|
val cp = (config / fullClasspath).value
|
||||||
val args = spaceDelimited().parsed
|
val args = spaceDelimited().parsed
|
||||||
r.run(mainClass, data(cp), baseArguments ++ args, streams.value.log).get
|
r.run(mainClass, data(cp), baseArguments ++ args, streams.value.log).get
|
||||||
}
|
}
|
||||||
|
|
@ -4343,14 +4347,15 @@ trait BuildExtra extends BuildCommon with DefExtra {
|
||||||
arguments: String*
|
arguments: String*
|
||||||
): Initialize[Task[Unit]] =
|
): Initialize[Task[Unit]] =
|
||||||
Def.task {
|
Def.task {
|
||||||
val cp = (fullClasspath in config).value
|
val cp = (config / fullClasspath).value
|
||||||
val r = (runner in (config, run)).value
|
val r = (config / run / runner).value
|
||||||
val s = streams.value
|
val s = streams.value
|
||||||
r.run(mainClass, data(cp), arguments, s.log).get
|
r.run(mainClass, data(cp), arguments, s.log).get
|
||||||
}
|
}
|
||||||
|
|
||||||
// public API
|
// public API
|
||||||
/** Returns a vector of settings that create custom run input task. */
|
/** Returns a vector of settings that create custom run input task. */
|
||||||
|
@nowarn
|
||||||
def fullRunInputTask(
|
def fullRunInputTask(
|
||||||
scoped: InputKey[Unit],
|
scoped: InputKey[Unit],
|
||||||
config: Configuration,
|
config: Configuration,
|
||||||
|
|
@ -4370,7 +4375,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
|
||||||
initScoped(
|
initScoped(
|
||||||
scoped.scopedKey,
|
scoped.scopedKey,
|
||||||
ClassLoaders.runner mapReferenced Project.mapScope(s => s.in(config))
|
ClassLoaders.runner mapReferenced Project.mapScope(s => s.in(config))
|
||||||
).zipWith(Def.task { ((fullClasspath in config).value, streams.value, result.value) }) {
|
).zipWith(Def.task { ((config / fullClasspath).value, streams.value, result.value) }) {
|
||||||
(rTask, t) =>
|
(rTask, t) =>
|
||||||
(t, rTask) map {
|
(t, rTask) map {
|
||||||
case ((cp, s, args), r) =>
|
case ((cp, s, args), r) =>
|
||||||
|
|
@ -4378,11 +4383,12 @@ trait BuildExtra extends BuildCommon with DefExtra {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.evaluated
|
}.evaluated
|
||||||
) ++ inTask(scoped)(forkOptions in config := forkOptionsTask.value)
|
) ++ inTask(scoped)((config / forkOptions) := forkOptionsTask.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// public API
|
// public API
|
||||||
/** Returns a vector of settings that create custom run task. */
|
/** Returns a vector of settings that create custom run task. */
|
||||||
|
@nowarn
|
||||||
def fullRunTask(
|
def fullRunTask(
|
||||||
scoped: TaskKey[Unit],
|
scoped: TaskKey[Unit],
|
||||||
config: Configuration,
|
config: Configuration,
|
||||||
|
|
@ -4393,7 +4399,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
|
||||||
scoped := initScoped(
|
scoped := initScoped(
|
||||||
scoped.scopedKey,
|
scoped.scopedKey,
|
||||||
ClassLoaders.runner mapReferenced Project.mapScope(s => s.in(config))
|
ClassLoaders.runner mapReferenced Project.mapScope(s => s.in(config))
|
||||||
).zipWith(Def.task { ((fullClasspath in config).value, streams.value) }) {
|
).zipWith(Def.task { ((config / fullClasspath).value, streams.value) }) {
|
||||||
case (rTask, t) =>
|
case (rTask, t) =>
|
||||||
(t, rTask) map {
|
(t, rTask) map {
|
||||||
case ((cp, s), r) =>
|
case ((cp, s), r) =>
|
||||||
|
|
@ -4401,7 +4407,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.value
|
.value
|
||||||
) ++ inTask(scoped)(forkOptions in config := forkOptionsTask.value)
|
) ++ inTask(scoped)((config / forkOptions) := forkOptionsTask.value)
|
||||||
|
|
||||||
def initScoped[T](sk: ScopedKey[_], i: Initialize[T]): Initialize[T] =
|
def initScoped[T](sk: ScopedKey[_], i: Initialize[T]): Initialize[T] =
|
||||||
initScope(fillTaskAxis(sk.scope, sk.key), i)
|
initScope(fillTaskAxis(sk.scope, sk.key), i)
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import sbt.Def.{ ScopedKey, Setting, dummyState }
|
||||||
import sbt.Keys.{ TaskProgress => _, name => _, _ }
|
import sbt.Keys.{ TaskProgress => _, name => _, _ }
|
||||||
import sbt.Project.richInitializeTask
|
import sbt.Project.richInitializeTask
|
||||||
import sbt.Scope.Global
|
import sbt.Scope.Global
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.internal.Aggregation.KeyValue
|
import sbt.internal.Aggregation.KeyValue
|
||||||
import sbt.internal.TaskName._
|
import sbt.internal.TaskName._
|
||||||
import sbt.internal._
|
import sbt.internal._
|
||||||
|
|
@ -269,11 +270,11 @@ object EvaluateTask {
|
||||||
}
|
}
|
||||||
// TODO - Should this pull from Global or from the project itself?
|
// TODO - Should this pull from Global or from the project itself?
|
||||||
private[sbt] def forcegc(extracted: Extracted, structure: BuildStructure): Boolean =
|
private[sbt] def forcegc(extracted: Extracted, structure: BuildStructure): Boolean =
|
||||||
getSetting(Keys.forcegc in Global, GCUtil.defaultForceGarbageCollection, extracted, structure)
|
getSetting((Global / Keys.forcegc), GCUtil.defaultForceGarbageCollection, extracted, structure)
|
||||||
// TODO - Should this pull from Global or from the project itself?
|
// TODO - Should this pull from Global or from the project itself?
|
||||||
private[sbt] def minForcegcInterval(extracted: Extracted, structure: BuildStructure): Duration =
|
private[sbt] def minForcegcInterval(extracted: Extracted, structure: BuildStructure): Duration =
|
||||||
getSetting(
|
getSetting(
|
||||||
Keys.minForcegcInterval in Global,
|
(Global / Keys.minForcegcInterval),
|
||||||
GCUtil.defaultMinForcegcInterval,
|
GCUtil.defaultMinForcegcInterval,
|
||||||
extracted,
|
extracted,
|
||||||
structure
|
structure
|
||||||
|
|
@ -285,12 +286,12 @@ object EvaluateTask {
|
||||||
extracted: Extracted,
|
extracted: Extracted,
|
||||||
structure: BuildStructure
|
structure: BuildStructure
|
||||||
): T =
|
): T =
|
||||||
(key in extracted.currentRef).get(structure.data).getOrElse(default)
|
(extracted.currentRef / key).get(structure.data).getOrElse(default)
|
||||||
|
|
||||||
def injectSettings: Seq[Setting[_]] = Seq(
|
def injectSettings: Seq[Setting[_]] = Seq(
|
||||||
(state in Global) ::= dummyState,
|
Global / state ::= dummyState,
|
||||||
(streamsManager in Global) ::= Def.dummyStreamsManager,
|
Global / streamsManager ::= Def.dummyStreamsManager,
|
||||||
(executionRoots in Global) ::= dummyRoots,
|
Global / executionRoots ::= dummyRoots,
|
||||||
)
|
)
|
||||||
|
|
||||||
@deprecated("Use variant which doesn't take a logger", "1.1.1")
|
@deprecated("Use variant which doesn't take a logger", "1.1.1")
|
||||||
|
|
@ -508,7 +509,7 @@ object EvaluateTask {
|
||||||
state: State,
|
state: State,
|
||||||
streams: Streams
|
streams: Streams
|
||||||
): Unit =
|
): Unit =
|
||||||
for (referenced <- Previous.references in Global get Project.structure(state).data)
|
for (referenced <- (Global / Previous.references) get Project.structure(state).data)
|
||||||
Previous.complete(referenced, results, streams)
|
Previous.complete(referenced, results, streams)
|
||||||
|
|
||||||
def applyResults[T](
|
def applyResults[T](
|
||||||
|
|
@ -589,7 +590,7 @@ object EvaluateTask {
|
||||||
// if the return type Seq[Setting[_]] is not explicitly given, scalac hangs
|
// if the return type Seq[Setting[_]] is not explicitly given, scalac hangs
|
||||||
val injectStreams: ScopedKey[_] => Seq[Setting[_]] = scoped =>
|
val injectStreams: ScopedKey[_] => Seq[Setting[_]] = scoped =>
|
||||||
if (scoped.key == streams.key) {
|
if (scoped.key == streams.key) {
|
||||||
Seq(streams in scoped.scope := {
|
Seq(scoped.scope / streams := {
|
||||||
(streamsManager map { mgr =>
|
(streamsManager map { mgr =>
|
||||||
val stream = mgr(scoped)
|
val stream = mgr(scoped)
|
||||||
stream.open()
|
stream.open()
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import sbt.internal.util.AttributeKey
|
||||||
import sbt.util.Show
|
import sbt.util.Show
|
||||||
import std.Transform.DummyTaskMap
|
import std.Transform.DummyTaskMap
|
||||||
import sbt.EvaluateTask.extractedTaskConfig
|
import sbt.EvaluateTask.extractedTaskConfig
|
||||||
|
import scala.annotation.nowarn
|
||||||
|
|
||||||
final case class Extracted(
|
final case class Extracted(
|
||||||
structure: BuildStructure,
|
structure: BuildStructure,
|
||||||
|
|
@ -43,6 +44,7 @@ final case class Extracted(
|
||||||
def getOpt[T](key: TaskKey[T]): Option[Task[T]] =
|
def getOpt[T](key: TaskKey[T]): Option[Task[T]] =
|
||||||
structure.data.get(inCurrent(key.scope), key.key)
|
structure.data.get(inCurrent(key.scope), key.key)
|
||||||
|
|
||||||
|
@nowarn
|
||||||
private[this] def inCurrent[T](scope: Scope): Scope =
|
private[this] def inCurrent[T](scope: Scope): Scope =
|
||||||
if (scope.project == This) scope in currentRef else scope
|
if (scope.project == This) scope in currentRef else scope
|
||||||
|
|
||||||
|
|
@ -110,6 +112,7 @@ final case class Extracted(
|
||||||
)(showKey)
|
)(showKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
private[this] def resolve[K <: Scoped.ScopingSetting[K] with Scoped](key: K): K =
|
private[this] def resolve[K <: Scoped.ScopingSetting[K] with Scoped](key: K): K =
|
||||||
key in Scope.resolveScope(GlobalScope, currentRef.build, rootProject)(key.scope)
|
key in Scope.resolveScope(GlobalScope, currentRef.build, rootProject)(key.scope)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,19 @@ import DefaultParsers._
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
import Scope.GlobalScope
|
import Scope.GlobalScope
|
||||||
import Def.ScopedKey
|
import Def.ScopedKey
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.internal.Load
|
import sbt.internal.Load
|
||||||
import sbt.internal.CommandStrings._
|
import sbt.internal.CommandStrings._
|
||||||
import Cross.{ spacedFirst, requireSession }
|
import Cross.{ spacedFirst, requireSession }
|
||||||
import sbt.librarymanagement.VersionNumber
|
import sbt.librarymanagement.VersionNumber
|
||||||
import Project.inScope
|
import Project.inScope
|
||||||
|
import scala.annotation.nowarn
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module responsible for plugin cross building.
|
* Module responsible for plugin cross building.
|
||||||
*/
|
*/
|
||||||
private[sbt] object PluginCross {
|
private[sbt] object PluginCross {
|
||||||
|
@nowarn
|
||||||
lazy val pluginSwitch: Command = {
|
lazy val pluginSwitch: Command = {
|
||||||
def switchParser(state: State): Parser[(String, String)] = {
|
def switchParser(state: State): Parser[(String, String)] = {
|
||||||
lazy val switchArgs = token(NotSpace.examples()) ~ (token(
|
lazy val switchArgs = token(NotSpace.examples()) ~ (token(
|
||||||
|
|
@ -68,14 +71,14 @@ private[sbt] object PluginCross {
|
||||||
def crossVersions(state: State): List[String] = {
|
def crossVersions(state: State): List[String] = {
|
||||||
val x = Project.extract(state)
|
val x = Project.extract(state)
|
||||||
import x._
|
import x._
|
||||||
((crossSbtVersions in currentRef) get structure.data getOrElse Nil).toList
|
((currentRef / crossSbtVersions) get structure.data getOrElse Nil).toList
|
||||||
}
|
}
|
||||||
Command.arb(requireSession(crossParser), pluginCrossHelp) {
|
Command.arb(requireSession(crossParser), pluginCrossHelp) {
|
||||||
case (state, command) =>
|
case (state, command) =>
|
||||||
val x = Project.extract(state)
|
val x = Project.extract(state)
|
||||||
import x._
|
import x._
|
||||||
val versions = crossVersions(state)
|
val versions = crossVersions(state)
|
||||||
val current = (sbtVersion in pluginCrossBuild)
|
val current = (pluginCrossBuild / sbtVersion)
|
||||||
.get(structure.data)
|
.get(structure.data)
|
||||||
.map(PluginSwitchCommand + " " + _)
|
.map(PluginSwitchCommand + " " + _)
|
||||||
.toList
|
.toList
|
||||||
|
|
@ -86,7 +89,7 @@ private[sbt] object PluginCross {
|
||||||
|
|
||||||
def scalaVersionSetting: Def.Initialize[String] = Def.setting {
|
def scalaVersionSetting: Def.Initialize[String] = Def.setting {
|
||||||
val scalaV = scalaVersion.value
|
val scalaV = scalaVersion.value
|
||||||
val sv = (sbtBinaryVersion in pluginCrossBuild).value
|
val sv = (pluginCrossBuild / sbtBinaryVersion).value
|
||||||
val isPlugin = sbtPlugin.value
|
val isPlugin = sbtPlugin.value
|
||||||
if (isPlugin) scalaVersionFromSbtBinaryVersion(sv)
|
if (isPlugin) scalaVersionFromSbtBinaryVersion(sv)
|
||||||
else scalaV
|
else scalaV
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import Keys.{
|
||||||
windowsServerSecurityLevel,
|
windowsServerSecurityLevel,
|
||||||
}
|
}
|
||||||
import Scope.{ Global, ThisScope }
|
import Scope.{ Global, ThisScope }
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import Def.{ Flattened, Initialize, ScopedKey, Setting }
|
import Def.{ Flattened, Initialize, ScopedKey, Setting }
|
||||||
import sbt.internal.{
|
import sbt.internal.{
|
||||||
Load,
|
Load,
|
||||||
|
|
@ -504,7 +505,7 @@ object Project extends ProjectExtra {
|
||||||
def orIdentity[T](opt: Option[T => T]): T => T = opt getOrElse idFun
|
def orIdentity[T](opt: Option[T => T]): T => T = opt getOrElse idFun
|
||||||
|
|
||||||
def getHook[T](key: SettingKey[T => T], data: Settings[Scope]): T => T =
|
def getHook[T](key: SettingKey[T => T], data: Settings[Scope]): T => T =
|
||||||
orIdentity(key in Global get data)
|
orIdentity((Global / key) get data)
|
||||||
|
|
||||||
def getHooks(data: Settings[Scope]): (State => State, State => State) =
|
def getHooks(data: Settings[Scope]): (State => State, State => State) =
|
||||||
(getHook(Keys.onLoad, data), getHook(Keys.onUnload, data))
|
(getHook(Keys.onLoad, data), getHook(Keys.onUnload, data))
|
||||||
|
|
@ -515,16 +516,16 @@ object Project extends ProjectExtra {
|
||||||
val structure = Project.structure(s)
|
val structure = Project.structure(s)
|
||||||
val ref = Project.current(s)
|
val ref = Project.current(s)
|
||||||
Load.getProject(structure.units, ref.build, ref.project)
|
Load.getProject(structure.units, ref.build, ref.project)
|
||||||
val msg = Keys.onLoadMessage in ref get structure.data getOrElse ""
|
val msg = (ref / Keys.onLoadMessage) get structure.data getOrElse ""
|
||||||
if (!msg.isEmpty) s.log.info(msg)
|
if (!msg.isEmpty) s.log.info(msg)
|
||||||
def get[T](k: SettingKey[T]): Option[T] = k in ref get structure.data
|
def get[T](k: SettingKey[T]): Option[T] = (ref / k) get structure.data
|
||||||
def commandsIn(axis: ResolvedReference) = commands in axis get structure.data toList
|
def commandsIn(axis: ResolvedReference) = (axis / commands) get structure.data toList
|
||||||
|
|
||||||
val allCommands = commandsIn(ref) ++ commandsIn(BuildRef(ref.build)) ++ (commands in Global get structure.data toList)
|
val allCommands = commandsIn(ref) ++ commandsIn(BuildRef(ref.build)) ++ ((Global / commands) get structure.data toList)
|
||||||
val history = get(historyPath) flatMap idFun
|
val history = get(historyPath) flatMap idFun
|
||||||
val prompt = get(shellPrompt)
|
val prompt = get(shellPrompt)
|
||||||
val newPrompt = get(colorShellPrompt)
|
val newPrompt = get(colorShellPrompt)
|
||||||
val trs = (templateResolverInfos in Global get structure.data).toList.flatten
|
val trs = ((Global / templateResolverInfos) get structure.data).toList.flatten
|
||||||
val startSvr: Option[Boolean] = get(autoStartServer)
|
val startSvr: Option[Boolean] = get(autoStartServer)
|
||||||
val host: Option[String] = get(serverHost)
|
val host: Option[String] = get(serverHost)
|
||||||
val port: Option[Int] = get(serverPort)
|
val port: Option[Int] = get(serverPort)
|
||||||
|
|
@ -532,8 +533,8 @@ object Project extends ProjectExtra {
|
||||||
val timeout: Option[Option[FiniteDuration]] = get(serverIdleTimeout)
|
val timeout: Option[Option[FiniteDuration]] = get(serverIdleTimeout)
|
||||||
val authentication: Option[Set[ServerAuthentication]] = get(serverAuthentication)
|
val authentication: Option[Set[ServerAuthentication]] = get(serverAuthentication)
|
||||||
val connectionType: Option[ConnectionType] = get(serverConnectionType)
|
val connectionType: Option[ConnectionType] = get(serverConnectionType)
|
||||||
val srvLogLevel: Option[Level.Value] = (logLevel in (ref, serverLog)).get(structure.data)
|
val srvLogLevel: Option[Level.Value] = (ref / serverLog / logLevel).get(structure.data)
|
||||||
val hs: Option[Seq[ServerHandler]] = get(fullServerHandlers in ThisBuild)
|
val hs: Option[Seq[ServerHandler]] = get(ThisBuild / fullServerHandlers)
|
||||||
val commandDefs = allCommands.distinct.flatten[Command].map(_ tag (projectCommand, true))
|
val commandDefs = allCommands.distinct.flatten[Command].map(_ tag (projectCommand, true))
|
||||||
val newDefinedCommands = commandDefs ++ BasicCommands.removeTagged(
|
val newDefinedCommands = commandDefs ++ BasicCommands.removeTagged(
|
||||||
s.definedCommands,
|
s.definedCommands,
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import sbt.Def._
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
import sbt.nio.Keys._
|
import sbt.nio.Keys._
|
||||||
import sbt.Project._
|
import sbt.Project._
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.internal.inc.ModuleUtilities
|
import sbt.internal.inc.ModuleUtilities
|
||||||
import sbt.internal.inc.classpath.ClasspathUtil
|
import sbt.internal.inc.classpath.ClasspathUtil
|
||||||
import sbt.internal.librarymanagement.cross.CrossVersionUtil
|
import sbt.internal.librarymanagement.cross.CrossVersionUtil
|
||||||
|
|
@ -60,7 +61,7 @@ object ScriptedPlugin extends AutoPlugin {
|
||||||
|
|
||||||
override lazy val projectSettings: Seq[Setting[_]] = Seq(
|
override lazy val projectSettings: Seq[Setting[_]] = Seq(
|
||||||
ivyConfigurations ++= Seq(ScriptedConf, ScriptedLaunchConf),
|
ivyConfigurations ++= Seq(ScriptedConf, ScriptedLaunchConf),
|
||||||
scriptedSbt := (sbtVersion in pluginCrossBuild).value,
|
scriptedSbt := (pluginCrossBuild / sbtVersion).value,
|
||||||
sbtLauncher := getJars(ScriptedLaunchConf).map(_.get.head).value,
|
sbtLauncher := getJars(ScriptedLaunchConf).map(_.get.head).value,
|
||||||
sbtTestDirectory := sourceDirectory.value / "sbt-test",
|
sbtTestDirectory := sourceDirectory.value / "sbt-test",
|
||||||
libraryDependencies ++= (CrossVersion.partialVersion(scriptedSbt.value) match {
|
libraryDependencies ++= (CrossVersion.partialVersion(scriptedSbt.value) match {
|
||||||
|
|
@ -92,12 +93,12 @@ object ScriptedPlugin extends AutoPlugin {
|
||||||
scriptedRun := scriptedRunTask.value,
|
scriptedRun := scriptedRunTask.value,
|
||||||
scriptedDependencies := {
|
scriptedDependencies := {
|
||||||
def use[A](@deprecated("unused", "") x: A*): Unit = () // avoid unused warnings
|
def use[A](@deprecated("unused", "") x: A*): Unit = () // avoid unused warnings
|
||||||
val analysis = (Keys.compile in Test).value
|
val analysis = (Test / Keys.compile).value
|
||||||
val pub = (publishLocal).value
|
val pub = (publishLocal).value
|
||||||
use(analysis, pub)
|
use(analysis, pub)
|
||||||
},
|
},
|
||||||
scripted := scriptedTask.evaluated,
|
scripted := scriptedTask.evaluated,
|
||||||
watchTriggers in scripted += Glob(sbtTestDirectory.value, RecursiveGlob)
|
scripted / watchTriggers += Glob(sbtTestDirectory.value, RecursiveGlob)
|
||||||
)
|
)
|
||||||
|
|
||||||
private[sbt] def scriptedTestsTask: Initialize[Task[AnyRef]] =
|
private[sbt] def scriptedTestsTask: Initialize[Task[AnyRef]] =
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import java.nio.file.Path
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
import sbt.BasicCommandStrings.TerminateAction
|
import sbt.BasicCommandStrings.TerminateAction
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.io._, syntax._
|
import sbt.io._, syntax._
|
||||||
import sbt.util._
|
import sbt.util._
|
||||||
import sbt.internal.util.complete.{ DefaultParsers, Parser }, DefaultParsers._
|
import sbt.internal.util.complete.{ DefaultParsers, Parser }, DefaultParsers._
|
||||||
|
|
@ -48,7 +49,7 @@ private[sbt] object TemplateCommandUtil {
|
||||||
val log = state.globalLogging.full
|
val log = state.globalLogging.full
|
||||||
val extracted = (Project extract state)
|
val extracted = (Project extract state)
|
||||||
val (s2, ivyConf) = extracted.runTask(Keys.ivyConfiguration, state)
|
val (s2, ivyConf) = extracted.runTask(Keys.ivyConfiguration, state)
|
||||||
val scalaModuleInfo = extracted.get(Keys.scalaModuleInfo in Keys.updateSbtClassifiers)
|
val scalaModuleInfo = extracted.get(Keys.updateSbtClassifiers / Keys.scalaModuleInfo)
|
||||||
val arguments = inputArg.toList ++
|
val arguments = inputArg.toList ++
|
||||||
(state.remainingCommands match {
|
(state.remainingCommands match {
|
||||||
case exec :: Nil if exec.commandLine == "shell" => Nil
|
case exec :: Nil if exec.commandLine == "shell" => Nil
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import lmcoursier.definitions.{
|
||||||
}
|
}
|
||||||
import sbt.librarymanagement._
|
import sbt.librarymanagement._
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
|
|
||||||
object CoursierArtifactsTasks {
|
object CoursierArtifactsTasks {
|
||||||
def coursierPublicationsTask(
|
def coursierPublicationsTask(
|
||||||
|
|
@ -48,18 +49,12 @@ object CoursierArtifactsTasks {
|
||||||
for ((config, targetConfig) <- configsMap) yield {
|
for ((config, targetConfig) <- configsMap) yield {
|
||||||
|
|
||||||
val publish = getOpt(
|
val publish = getOpt(
|
||||||
publishArtifact
|
projectRef / config / packageBin / publishArtifact
|
||||||
.in(projectRef)
|
|
||||||
.in(packageBin)
|
|
||||||
.in(config)
|
|
||||||
).getOrElse(false)
|
).getOrElse(false)
|
||||||
|
|
||||||
if (publish)
|
if (publish)
|
||||||
getOpt(
|
getOpt(
|
||||||
artifact
|
projectRef / config / packageBin / artifact
|
||||||
.in(projectRef)
|
|
||||||
.in(packageBin)
|
|
||||||
.in(config)
|
|
||||||
).map(targetConfig -> _)
|
).map(targetConfig -> _)
|
||||||
else
|
else
|
||||||
None
|
None
|
||||||
|
|
@ -69,18 +64,12 @@ object CoursierArtifactsTasks {
|
||||||
for ((config, targetConfig) <- configsMap) yield {
|
for ((config, targetConfig) <- configsMap) yield {
|
||||||
|
|
||||||
val publish = getOpt(
|
val publish = getOpt(
|
||||||
publishArtifact
|
projectRef / config / packageSrc / publishArtifact
|
||||||
.in(projectRef)
|
|
||||||
.in(packageSrc)
|
|
||||||
.in(config)
|
|
||||||
).getOrElse(false)
|
).getOrElse(false)
|
||||||
|
|
||||||
if (publish)
|
if (publish)
|
||||||
getOpt(
|
getOpt(
|
||||||
artifact
|
projectRef / config / packageSrc / artifact
|
||||||
.in(projectRef)
|
|
||||||
.in(packageSrc)
|
|
||||||
.in(config)
|
|
||||||
).map(sourcesConfigOpt.getOrElse(targetConfig) -> _)
|
).map(sourcesConfigOpt.getOrElse(targetConfig) -> _)
|
||||||
else
|
else
|
||||||
None
|
None
|
||||||
|
|
@ -91,18 +80,12 @@ object CoursierArtifactsTasks {
|
||||||
|
|
||||||
val publish =
|
val publish =
|
||||||
getOpt(
|
getOpt(
|
||||||
publishArtifact
|
projectRef / config / packageDoc / publishArtifact
|
||||||
.in(projectRef)
|
|
||||||
.in(packageDoc)
|
|
||||||
.in(config)
|
|
||||||
).getOrElse(false)
|
).getOrElse(false)
|
||||||
|
|
||||||
if (publish)
|
if (publish)
|
||||||
getOpt(
|
getOpt(
|
||||||
artifact
|
projectRef / config / packageDoc / artifact
|
||||||
.in(projectRef)
|
|
||||||
.in(packageDoc)
|
|
||||||
.in(config)
|
|
||||||
).map(docsConfigOpt.getOrElse(targetConfig) -> _)
|
).map(docsConfigOpt.getOrElse(targetConfig) -> _)
|
||||||
else
|
else
|
||||||
None
|
None
|
||||||
|
|
@ -134,8 +117,7 @@ object CoursierArtifactsTasks {
|
||||||
// No obvious way of getting the corresponding publishArtifact value for the ones
|
// No obvious way of getting the corresponding publishArtifact value for the ones
|
||||||
// only here, it seems.
|
// only here, it seems.
|
||||||
val extraSbtArtifacts = getOpt(
|
val extraSbtArtifacts = getOpt(
|
||||||
sbt.Keys.artifacts
|
projectRef / sbt.Keys.artifacts
|
||||||
.in(projectRef)
|
|
||||||
).getOrElse(Nil)
|
).getOrElse(Nil)
|
||||||
.filterNot(stdArtifactsSet)
|
.filterNot(stdArtifactsSet)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ package coursierint
|
||||||
import sbt.librarymanagement._
|
import sbt.librarymanagement._
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
import sbt.ScopeFilter.Make._
|
import sbt.ScopeFilter.Make._
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
|
|
||||||
object CoursierRepositoriesTasks {
|
object CoursierRepositoriesTasks {
|
||||||
private object CResolvers {
|
private object CResolvers {
|
||||||
|
|
@ -108,7 +109,7 @@ object CoursierRepositoriesTasks {
|
||||||
.bootRepositories(appConfiguration.value)
|
.bootRepositories(appConfiguration.value)
|
||||||
.toSeq
|
.toSeq
|
||||||
.flatten ++ // required because of the hack above it seems
|
.flatten ++ // required because of the hack above it seems
|
||||||
externalResolvers.in(updateSbtClassifiers).value
|
(updateSbtClassifiers / externalResolvers).value
|
||||||
|
|
||||||
val pluginIvySnapshotsFound = resolvers.exists {
|
val pluginIvySnapshotsFound = resolvers.exists {
|
||||||
case repo: URLRepository =>
|
case repo: URLRepository =>
|
||||||
|
|
|
||||||
|
|
@ -315,8 +315,8 @@ object LMCoursier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
import scala.collection.JavaConverters._
|
import scala.collection.JavaConverters._
|
||||||
(Keys.credentials in ThisBuild).value foreach registerCredentials
|
(ThisBuild / Keys.credentials).value foreach registerCredentials
|
||||||
(Keys.credentials in LocalRootProject).value foreach registerCredentials
|
(LocalRootProject / Keys.credentials).value foreach registerCredentials
|
||||||
Keys.credentials.value foreach registerCredentials
|
Keys.credentials.value foreach registerCredentials
|
||||||
credentialRegistry.values.asScala.toVector
|
credentialRegistry.values.asScala.toVector
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,13 @@ import java.text.DateFormat
|
||||||
|
|
||||||
import sbt.Def.ScopedKey
|
import sbt.Def.ScopedKey
|
||||||
import sbt.Keys.{ showSuccess, showTiming, timingFormat }
|
import sbt.Keys.{ showSuccess, showTiming, timingFormat }
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.internal.util.complete.Parser
|
import sbt.internal.util.complete.Parser
|
||||||
import sbt.internal.util.complete.Parser.{ failure, seq, success }
|
import sbt.internal.util.complete.Parser.{ failure, seq, success }
|
||||||
import sbt.internal.util._
|
import sbt.internal.util._
|
||||||
import sbt.std.Transform.DummyTaskMap
|
import sbt.std.Transform.DummyTaskMap
|
||||||
import sbt.util.{ Logger, Show }
|
import sbt.util.{ Logger, Show }
|
||||||
|
import scala.annotation.nowarn
|
||||||
|
|
||||||
sealed trait Aggregation
|
sealed trait Aggregation
|
||||||
object Aggregation {
|
object Aggregation {
|
||||||
|
|
@ -127,7 +129,8 @@ object Aggregation {
|
||||||
): Unit = {
|
): Unit = {
|
||||||
import extracted._
|
import extracted._
|
||||||
def get(key: SettingKey[Boolean]): Boolean =
|
def get(key: SettingKey[Boolean]): Boolean =
|
||||||
key in currentRef get structure.data getOrElse true
|
(currentRef / key).get(structure.data) getOrElse true
|
||||||
|
|
||||||
if (get(showSuccess)) {
|
if (get(showSuccess)) {
|
||||||
if (get(showTiming)) {
|
if (get(showTiming)) {
|
||||||
val msg = timingString(start, stop, structure.data, currentRef)
|
val msg = timingString(start, stop, structure.data, currentRef)
|
||||||
|
|
@ -143,7 +146,7 @@ object Aggregation {
|
||||||
data: Settings[Scope],
|
data: Settings[Scope],
|
||||||
currentRef: ProjectRef,
|
currentRef: ProjectRef,
|
||||||
): String = {
|
): String = {
|
||||||
val format = timingFormat in currentRef get data getOrElse defaultFormat
|
val format = (currentRef / timingFormat).get(data) getOrElse defaultFormat
|
||||||
timing(format, startTime, endTime)
|
timing(format, startTime, endTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -287,6 +290,7 @@ object Aggregation {
|
||||||
ScopedKey(resolved, key.key)
|
ScopedKey(resolved, key.key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
def aggregationEnabled(key: ScopedKey[_], data: Settings[Scope]): Boolean =
|
def aggregationEnabled(key: ScopedKey[_], data: Settings[Scope]): Boolean =
|
||||||
Keys.aggregate in Scope.fillTaskAxis(key.scope, key.key) get data getOrElse true
|
Keys.aggregate in Scope.fillTaskAxis(key.scope, key.key) get data getOrElse true
|
||||||
private[sbt] val suppressShow =
|
private[sbt] val suppressShow =
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import sbt.io.syntax._
|
||||||
import sbt.internal.util.{ AttributeEntry, AttributeKey, AttributeMap, Attributed, Settings }
|
import sbt.internal.util.{ AttributeEntry, AttributeKey, AttributeMap, Attributed, Settings }
|
||||||
import sbt.internal.util.Attributed.data
|
import sbt.internal.util.Attributed.data
|
||||||
import sbt.util.Logger
|
import sbt.util.Logger
|
||||||
|
import scala.annotation.nowarn
|
||||||
|
|
||||||
final class BuildStructure(
|
final class BuildStructure(
|
||||||
val units: Map[URI, LoadedBuildUnit],
|
val units: Map[URI, LoadedBuildUnit],
|
||||||
|
|
@ -396,6 +397,8 @@ object BuildStreams {
|
||||||
|
|
||||||
def refTarget(ref: ResolvedReference, fallbackBase: File, data: Settings[Scope]): File =
|
def refTarget(ref: ResolvedReference, fallbackBase: File, data: Settings[Scope]): File =
|
||||||
refTarget(GlobalScope.copy(project = Select(ref)), fallbackBase, data)
|
refTarget(GlobalScope.copy(project = Select(ref)), fallbackBase, data)
|
||||||
|
|
||||||
|
@nowarn
|
||||||
def refTarget(scope: Scope, fallbackBase: File, data: Settings[Scope]): File =
|
def refTarget(scope: Scope, fallbackBase: File, data: Settings[Scope]): File =
|
||||||
(Keys.target in scope get data getOrElse outputDirectory(fallbackBase)) / StreamsDirectory
|
(Keys.target in scope get data getOrElse outputDirectory(fallbackBase)) / StreamsDirectory
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import java.nio.file.Path
|
||||||
|
|
||||||
import sbt.ClassLoaderLayeringStrategy._
|
import sbt.ClassLoaderLayeringStrategy._
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.internal.classpath.ClassLoaderCache
|
import sbt.internal.classpath.ClassLoaderCache
|
||||||
import sbt.internal.inc.ScalaInstance
|
import sbt.internal.inc.ScalaInstance
|
||||||
import sbt.internal.inc.classpath.ClasspathUtil
|
import sbt.internal.inc.classpath.ClasspathUtil
|
||||||
|
|
@ -36,7 +37,7 @@ private[sbt] object ClassLoaders {
|
||||||
private[sbt] def testTask: Def.Initialize[Task[ClassLoader]] = Def.task {
|
private[sbt] def testTask: Def.Initialize[Task[ClassLoader]] = Def.task {
|
||||||
val si = scalaInstance.value
|
val si = scalaInstance.value
|
||||||
val cp = fullClasspath.value.map(_.data)
|
val cp = fullClasspath.value.map(_.data)
|
||||||
val dependencyStamps = modifiedTimes((outputFileStamps in dependencyClasspathFiles).value).toMap
|
val dependencyStamps = modifiedTimes((dependencyClasspathFiles / outputFileStamps).value).toMap
|
||||||
def getLm(f: File): Long = dependencyStamps.getOrElse(f, IO.getModifiedTimeOrZero(f))
|
def getLm(f: File): Long = dependencyStamps.getOrElse(f, IO.getModifiedTimeOrZero(f))
|
||||||
val rawCP = cp.map(f => f -> getLm(f))
|
val rawCP = cp.map(f => f -> getLm(f))
|
||||||
val fullCP =
|
val fullCP =
|
||||||
|
|
@ -75,13 +76,13 @@ private[sbt] object ClassLoaders {
|
||||||
if (options.nonEmpty) {
|
if (options.nonEmpty) {
|
||||||
val mask = ScopeMask(project = false)
|
val mask = ScopeMask(project = false)
|
||||||
val showJavaOptions = Scope.displayMasked(
|
val showJavaOptions = Scope.displayMasked(
|
||||||
(javaOptions in resolvedScope).scopedKey.scope,
|
(resolvedScope / javaOptions).scopedKey.scope,
|
||||||
(javaOptions in resolvedScope).key.label,
|
(resolvedScope / javaOptions).key.label,
|
||||||
mask
|
mask
|
||||||
)
|
)
|
||||||
val showFork = Scope.displayMasked(
|
val showFork = Scope.displayMasked(
|
||||||
(fork in resolvedScope).scopedKey.scope,
|
(resolvedScope / fork).scopedKey.scope,
|
||||||
(fork in resolvedScope).key.label,
|
(resolvedScope / fork).key.label,
|
||||||
mask
|
mask
|
||||||
)
|
)
|
||||||
s.log.warn(s"$showJavaOptions will be ignored, $showFork is set to false")
|
s.log.warn(s"$showJavaOptions will be ignored, $showFork is set to false")
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ private[sbt] object ClasspathImpl {
|
||||||
def trackedExportedProducts(track: TrackLevel): Initialize[Task[Classpath]] =
|
def trackedExportedProducts(track: TrackLevel): Initialize[Task[Classpath]] =
|
||||||
Def.task {
|
Def.task {
|
||||||
val _ = (packageBin / dynamicDependency).value
|
val _ = (packageBin / dynamicDependency).value
|
||||||
val art = (artifact in packageBin).value
|
val art = (packageBin / artifact).value
|
||||||
val module = projectID.value
|
val module = projectID.value
|
||||||
val config = configuration.value
|
val config = configuration.value
|
||||||
for { (f, analysis) <- trackedExportedProductsImplTask(track).value } yield APIMappings
|
for { (f, analysis) <- trackedExportedProductsImplTask(track).value } yield APIMappings
|
||||||
|
|
@ -65,7 +65,7 @@ private[sbt] object ClasspathImpl {
|
||||||
def trackedExportedJarProducts(track: TrackLevel): Initialize[Task[Classpath]] =
|
def trackedExportedJarProducts(track: TrackLevel): Initialize[Task[Classpath]] =
|
||||||
Def.task {
|
Def.task {
|
||||||
val _ = (packageBin / dynamicDependency).value
|
val _ = (packageBin / dynamicDependency).value
|
||||||
val art = (artifact in packageBin).value
|
val art = (packageBin / artifact).value
|
||||||
val module = projectID.value
|
val module = projectID.value
|
||||||
val config = configuration.value
|
val config = configuration.value
|
||||||
for { (f, analysis) <- trackedJarProductsImplTask(track).value } yield APIMappings
|
for { (f, analysis) <- trackedJarProductsImplTask(track).value } yield APIMappings
|
||||||
|
|
@ -114,7 +114,7 @@ private[sbt] object ClasspathImpl {
|
||||||
track: TrackLevel
|
track: TrackLevel
|
||||||
): Initialize[Task[Seq[(File, CompileAnalysis)]]] =
|
): Initialize[Task[Seq[(File, CompileAnalysis)]]] =
|
||||||
Def.taskDyn {
|
Def.taskDyn {
|
||||||
val jar = (artifactPath in packageBin).value
|
val jar = (packageBin / artifactPath).value
|
||||||
TrackLevel.intersection(track, exportToInternal.value) match {
|
TrackLevel.intersection(track, exportToInternal.value) match {
|
||||||
case TrackLevel.TrackAlways =>
|
case TrackLevel.TrackAlways =>
|
||||||
Def.task {
|
Def.task {
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,14 @@ import java.nio.file.{ DirectoryNotEmptyException, Files, Path }
|
||||||
import sbt.Def._
|
import sbt.Def._
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
import sbt.Project.richInitializeTask
|
import sbt.Project.richInitializeTask
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.io.syntax._
|
import sbt.io.syntax._
|
||||||
import sbt.nio.Keys._
|
import sbt.nio.Keys._
|
||||||
import sbt.nio.file._
|
import sbt.nio.file._
|
||||||
import sbt.nio.file.syntax._
|
import sbt.nio.file.syntax._
|
||||||
import sbt.util.Level
|
import sbt.util.Level
|
||||||
import sjsonnew.JsonFormat
|
import sjsonnew.JsonFormat
|
||||||
|
import scala.annotation.nowarn
|
||||||
|
|
||||||
private[sbt] object Clean {
|
private[sbt] object Clean {
|
||||||
|
|
||||||
|
|
@ -51,16 +53,16 @@ private[sbt] object Clean {
|
||||||
}
|
}
|
||||||
|
|
||||||
private[this] def cleanFilter(scope: Scope): Def.Initialize[Task[Path => Boolean]] = Def.task {
|
private[this] def cleanFilter(scope: Scope): Def.Initialize[Task[Path => Boolean]] = Def.task {
|
||||||
val excludes = (cleanKeepFiles in scope).value.map {
|
val excludes = (scope / cleanKeepFiles).value.map {
|
||||||
// This mimics the legacy behavior of cleanFilesTask
|
// This mimics the legacy behavior of cleanFilesTask
|
||||||
case f if f.isDirectory => Glob(f, AnyPath)
|
case f if f.isDirectory => Glob(f, AnyPath)
|
||||||
case f => f.toGlob
|
case f => f.toGlob
|
||||||
} ++ (cleanKeepGlobs in scope).value
|
} ++ (scope / cleanKeepGlobs).value
|
||||||
p: Path => excludes.exists(_.matches(p))
|
p: Path => excludes.exists(_.matches(p))
|
||||||
}
|
}
|
||||||
private[this] def cleanDelete(scope: Scope): Def.Initialize[Task[Path => Unit]] = Def.task {
|
private[this] def cleanDelete(scope: Scope): Def.Initialize[Task[Path => Unit]] = Def.task {
|
||||||
// Don't use a regular logger because the logger actually writes to the target directory.
|
// Don't use a regular logger because the logger actually writes to the target directory.
|
||||||
val debug = (logLevel in scope).?.value.orElse(state.value.get(logLevel.key)) match {
|
val debug = (scope / logLevel).?.value.orElse(state.value.get(logLevel.key)) match {
|
||||||
case Some(Level.Debug) =>
|
case Some(Level.Debug) =>
|
||||||
(string: String) => println(s"[debug] $string")
|
(string: String) => println(s"[debug] $string")
|
||||||
case _ =>
|
case _ =>
|
||||||
|
|
@ -83,15 +85,15 @@ private[sbt] object Clean {
|
||||||
Def.taskDyn {
|
Def.taskDyn {
|
||||||
val state = Keys.state.value
|
val state = Keys.state.value
|
||||||
val extracted = Project.extract(state)
|
val extracted = Project.extract(state)
|
||||||
val view = (fileTreeView in scope).value
|
val view = (scope / fileTreeView).value
|
||||||
val manager = streamsManager.value
|
val manager = streamsManager.value
|
||||||
Def.task {
|
Def.task {
|
||||||
val excludeFilter = cleanFilter(scope).value
|
val excludeFilter = cleanFilter(scope).value
|
||||||
val delete = cleanDelete(scope).value
|
val delete = cleanDelete(scope).value
|
||||||
val targetDir = (target in scope).?.value.map(_.toPath)
|
val targetDir = (scope / target).?.value.map(_.toPath)
|
||||||
|
|
||||||
targetDir.filter(_ => full).foreach(deleteContents(_, excludeFilter, view, delete))
|
targetDir.filter(_ => full).foreach(deleteContents(_, excludeFilter, view, delete))
|
||||||
(cleanFiles in scope).?.value.getOrElse(Nil).foreach { f =>
|
(scope / cleanFiles).?.value.getOrElse(Nil).foreach { f =>
|
||||||
deleteContents(f.toPath, excludeFilter, view, delete)
|
deleteContents(f.toPath, excludeFilter, view, delete)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,7 +107,7 @@ private[sbt] object Clean {
|
||||||
}
|
}
|
||||||
val streamsGlobs =
|
val streamsGlobs =
|
||||||
(streamsKey.toSeq ++ stampsKey).map(k => manager(k).cacheDirectory.toGlob / **)
|
(streamsKey.toSeq ++ stampsKey).map(k => manager(k).cacheDirectory.toGlob / **)
|
||||||
((fileOutputs in scope).value.filter(g => targetDir.fold(true)(g.base.startsWith)) ++ streamsGlobs)
|
((scope / fileOutputs).value.filter(g => targetDir.fold(true)(g.base.startsWith)) ++ streamsGlobs)
|
||||||
.foreach { g =>
|
.foreach { g =>
|
||||||
val filter: Path => Boolean = { path =>
|
val filter: Path => Boolean = { path =>
|
||||||
!g.matches(path) || excludeFilter(path)
|
!g.matches(path) || excludeFilter(path)
|
||||||
|
|
@ -127,18 +129,20 @@ private[sbt] object Clean {
|
||||||
private[this] implicit class ToSeqPathOps[T](val t: T) extends AnyVal {
|
private[this] implicit class ToSeqPathOps[T](val t: T) extends AnyVal {
|
||||||
def toSeqPath(implicit toSeqPath: ToSeqPath[T]): Seq[Path] = toSeqPath(t)
|
def toSeqPath(implicit toSeqPath: ToSeqPath[T]): Seq[Path] = toSeqPath(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
private[sbt] def cleanFileOutputTask[T: JsonFormat: ToSeqPath](
|
private[sbt] def cleanFileOutputTask[T: JsonFormat: ToSeqPath](
|
||||||
taskKey: TaskKey[T]
|
taskKey: TaskKey[T]
|
||||||
): Def.Initialize[Task[Unit]] =
|
): Def.Initialize[Task[Unit]] =
|
||||||
Def.taskDyn {
|
Def.taskDyn {
|
||||||
val scope = taskKey.scope in taskKey.key
|
val scope = taskKey.scope in taskKey.key
|
||||||
Def.task {
|
Def.task {
|
||||||
val targetDir = (target in scope).value.toPath
|
val targetDir = (scope / target).value.toPath
|
||||||
val filter = cleanFilter(scope).value
|
val filter = cleanFilter(scope).value
|
||||||
// We do not want to inadvertently delete files that are not in the target directory.
|
// We do not want to inadvertently delete files that are not in the target directory.
|
||||||
val excludeFilter: Path => Boolean = path => !path.startsWith(targetDir) || filter(path)
|
val excludeFilter: Path => Boolean = path => !path.startsWith(targetDir) || filter(path)
|
||||||
val delete = cleanDelete(scope).value
|
val delete = cleanDelete(scope).value
|
||||||
val st = streams.in(scope).value
|
val st = (scope / streams).value
|
||||||
taskKey.previous.foreach(_.toSeqPath.foreach(p => if (!excludeFilter(p)) delete(p)))
|
taskKey.previous.foreach(_.toSeqPath.foreach(p => if (!excludeFilter(p)) delete(p)))
|
||||||
delete(st.cacheDirectory.toPath / Previous.DependencyDirectory)
|
delete(st.cacheDirectory.toPath / Previous.DependencyDirectory)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
package sbt
|
package sbt
|
||||||
package internal
|
package internal
|
||||||
|
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.internal.classpath.AlternativeZincUtil
|
import sbt.internal.classpath.AlternativeZincUtil
|
||||||
import sbt.internal.inc.{ ScalaInstance, ZincLmUtil }
|
import sbt.internal.inc.{ ScalaInstance, ZincLmUtil }
|
||||||
import sbt.internal.util.Terminal
|
import sbt.internal.util.Terminal
|
||||||
|
|
@ -25,7 +26,7 @@ object ConsoleProject {
|
||||||
val (state1, dependencyResolution) =
|
val (state1, dependencyResolution) =
|
||||||
extracted.runTask(Keys.dependencyResolution, state)
|
extracted.runTask(Keys.dependencyResolution, state)
|
||||||
val (_, scalaCompilerBridgeBinaryJar) =
|
val (_, scalaCompilerBridgeBinaryJar) =
|
||||||
extracted.runTask(Keys.scalaCompilerBridgeBinaryJar.in(Keys.consoleProject), state1)
|
extracted.runTask(Keys.consoleProject / Keys.scalaCompilerBridgeBinaryJar, state1)
|
||||||
val scalaInstance = {
|
val scalaInstance = {
|
||||||
val scalaProvider = state.configuration.provider.scalaProvider
|
val scalaProvider = state.configuration.provider.scalaProvider
|
||||||
ScalaInstance(scalaProvider.version, scalaProvider)
|
ScalaInstance(scalaProvider.version, scalaProvider)
|
||||||
|
|
@ -50,8 +51,7 @@ object ConsoleProject {
|
||||||
componentProvider = app.provider.components,
|
componentProvider = app.provider.components,
|
||||||
secondaryCacheDir = Option(zincDir),
|
secondaryCacheDir = Option(zincDir),
|
||||||
dependencyResolution = dependencyResolution,
|
dependencyResolution = dependencyResolution,
|
||||||
compilerBridgeSource =
|
compilerBridgeSource = extracted.get(Keys.consoleProject / Keys.scalaCompilerBridgeSource),
|
||||||
extracted.get(Keys.scalaCompilerBridgeSource.in(Keys.consoleProject)),
|
|
||||||
scalaJarsTarget = zincDir,
|
scalaJarsTarget = zincDir,
|
||||||
classLoaderCache = state1.get(BasicKeys.classLoaderCache),
|
classLoaderCache = state1.get(BasicKeys.classLoaderCache),
|
||||||
log = log
|
log = log
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import java.util.concurrent.atomic.{ AtomicBoolean, AtomicInteger }
|
||||||
import sbt.BasicCommandStrings._
|
import sbt.BasicCommandStrings._
|
||||||
import sbt.Def._
|
import sbt.Def._
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.internal.Continuous.{ ContinuousState, FileStampRepository }
|
import sbt.internal.Continuous.{ ContinuousState, FileStampRepository }
|
||||||
import sbt.internal.LabeledFunctions._
|
import sbt.internal.LabeledFunctions._
|
||||||
import sbt.internal.io.WatchState
|
import sbt.internal.io.WatchState
|
||||||
|
|
@ -379,18 +380,18 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
||||||
(settings.inputOptionsMessage, parser, alt)
|
(settings.inputOptionsMessage, parser, alt)
|
||||||
case _ =>
|
case _ =>
|
||||||
val options =
|
val options =
|
||||||
extracted.getOpt(watchInputOptions in ThisBuild).getOrElse(Watch.defaultInputOptions)
|
extracted.getOpt((ThisBuild / watchInputOptions)).getOrElse(Watch.defaultInputOptions)
|
||||||
val message = extracted
|
val message = extracted
|
||||||
.getOpt(watchInputOptionsMessage in ThisBuild)
|
.getOpt((ThisBuild / watchInputOptionsMessage))
|
||||||
.getOrElse(Watch.defaultInputOptionsMessage(options))
|
.getOrElse(Watch.defaultInputOptionsMessage(options))
|
||||||
val parser = extracted
|
val parser = extracted
|
||||||
.getOpt(watchInputParser in ThisBuild)
|
.getOpt((ThisBuild / watchInputParser))
|
||||||
.getOrElse(Watch.defaultInputParser(options))
|
.getOrElse(Watch.defaultInputParser(options))
|
||||||
val alt = extracted
|
val alt = extracted
|
||||||
.getOpt(watchInputStream in ThisBuild)
|
.getOpt((ThisBuild / watchInputStream))
|
||||||
.map { _ =>
|
.map { _ =>
|
||||||
(watchInputStream in ThisBuild) -> extracted
|
(ThisBuild / watchInputStream) -> extracted
|
||||||
.getOpt(watchInputHandler in ThisBuild)
|
.getOpt((ThisBuild / watchInputHandler))
|
||||||
.getOrElse(defaultInputHandler(parser))
|
.getOrElse(defaultInputHandler(parser))
|
||||||
}
|
}
|
||||||
(message, parser, alt)
|
(message, parser, alt)
|
||||||
|
|
@ -425,7 +426,7 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
||||||
// Print the default watch message if there are multiple tasks
|
// Print the default watch message if there are multiple tasks
|
||||||
if (configs.size > 1) {
|
if (configs.size > 1) {
|
||||||
val onStartWatch =
|
val onStartWatch =
|
||||||
extracted.getOpt(watchStartMessage in project).getOrElse(Watch.defaultStartWatch)
|
extracted.getOpt((project / watchStartMessage)).getOrElse(Watch.defaultStartWatch)
|
||||||
onStartWatch(count, project, commands).foreach(logger.info(_))
|
onStartWatch(count, project, commands).foreach(logger.info(_))
|
||||||
}
|
}
|
||||||
res
|
res
|
||||||
|
|
@ -442,7 +443,7 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
||||||
)(implicit extracted: Extracted): (Int => Option[(Watch.Event, Watch.Action)], () => Unit) = {
|
)(implicit extracted: Extracted): (Int => Option[(Watch.Event, Watch.Action)], () => Unit) = {
|
||||||
val trackMetaBuild = configs.forall(_.watchSettings.trackMetaBuild)
|
val trackMetaBuild = configs.forall(_.watchSettings.trackMetaBuild)
|
||||||
val buildGlobs =
|
val buildGlobs =
|
||||||
if (trackMetaBuild) extracted.getOpt(fileInputs in checkBuildSources).getOrElse(Nil)
|
if (trackMetaBuild) extracted.getOpt((checkBuildSources / fileInputs)).getOrElse(Nil)
|
||||||
else Nil
|
else Nil
|
||||||
|
|
||||||
val retentionPeriod = configs.map(_.watchSettings.antiEntropyRetentionPeriod).max
|
val retentionPeriod = configs.map(_.watchSettings.antiEntropyRetentionPeriod).max
|
||||||
|
|
@ -1041,9 +1042,9 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
||||||
lazy val taskScope = Project.fillTaskAxis(scopedKey).scope
|
lazy val taskScope = Project.fillTaskAxis(scopedKey).scope
|
||||||
scopedKey.scope match {
|
scopedKey.scope match {
|
||||||
case scope if scope.task.toOption.isDefined =>
|
case scope if scope.task.toOption.isDefined =>
|
||||||
extracted.getOpt(settingKey in scope) orElse extracted.getOpt(settingKey in taskScope)
|
extracted.getOpt((scope / settingKey)) orElse extracted.getOpt((taskScope / settingKey))
|
||||||
case scope =>
|
case scope =>
|
||||||
extracted.getOpt(settingKey in taskScope) orElse extracted.getOpt(settingKey in scope)
|
extracted.getOpt((taskScope / settingKey)) orElse extracted.getOpt((scope / settingKey))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1063,12 +1064,12 @@ private[sbt] object Continuous extends DeprecatedContinuous {
|
||||||
lazy val taskScope = Project.fillTaskAxis(scopedKey).scope
|
lazy val taskScope = Project.fillTaskAxis(scopedKey).scope
|
||||||
scopedKey.scope match {
|
scopedKey.scope match {
|
||||||
case scope if scope.task.toOption.isDefined =>
|
case scope if scope.task.toOption.isDefined =>
|
||||||
if (extracted.getOpt(taskKey in scope).isDefined) Some(taskKey in scope)
|
if (extracted.getOpt((scope / taskKey)).isDefined) Some((scope / taskKey))
|
||||||
else if (extracted.getOpt(taskKey in taskScope).isDefined) Some(taskKey in taskScope)
|
else if (extracted.getOpt((taskScope / taskKey)).isDefined) Some((taskScope / taskKey))
|
||||||
else None
|
else None
|
||||||
case scope =>
|
case scope =>
|
||||||
if (extracted.getOpt(taskKey in taskScope).isDefined) Some(taskKey in taskScope)
|
if (extracted.getOpt((taskScope / taskKey)).isDefined) Some((taskScope / taskKey))
|
||||||
else if (extracted.getOpt(taskKey in scope).isDefined) Some(taskKey in scope)
|
else if (extracted.getOpt((scope / taskKey)).isDefined) Some((scope / taskKey))
|
||||||
else None
|
else None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import sbt.io.Path
|
||||||
import sbt.io.syntax._
|
import sbt.io.syntax._
|
||||||
import sbt.Cross._
|
import sbt.Cross._
|
||||||
import sbt.Def.{ ScopedKey, Setting }
|
import sbt.Def.{ ScopedKey, Setting }
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.internal.util.complete.DefaultParsers._
|
import sbt.internal.util.complete.DefaultParsers._
|
||||||
import sbt.internal.util.AttributeKey
|
import sbt.internal.util.AttributeKey
|
||||||
import sbt.internal.util.complete.{ DefaultParsers, Parser }
|
import sbt.internal.util.complete.{ DefaultParsers, Parser }
|
||||||
|
|
@ -169,7 +170,7 @@ private[sbt] object CrossJava {
|
||||||
proj: ResolvedReference
|
proj: ResolvedReference
|
||||||
): Map[String, File] = {
|
): Map[String, File] = {
|
||||||
import extracted._
|
import extracted._
|
||||||
(Keys.fullJavaHomes in proj get structure.data).get
|
((proj / Keys.fullJavaHomes) get structure.data).get
|
||||||
}
|
}
|
||||||
|
|
||||||
private def getJavaHomesTyped(
|
private def getJavaHomesTyped(
|
||||||
|
|
@ -185,14 +186,14 @@ private[sbt] object CrossJava {
|
||||||
): Seq[String] = {
|
): Seq[String] = {
|
||||||
import extracted._
|
import extracted._
|
||||||
import Keys._
|
import Keys._
|
||||||
(crossJavaVersions in proj get structure.data).getOrElse(Nil)
|
((proj / crossJavaVersions) get structure.data).getOrElse(Nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
private def getCrossJavaHomes(extracted: Extracted, proj: ResolvedReference): Seq[File] = {
|
private def getCrossJavaHomes(extracted: Extracted, proj: ResolvedReference): Seq[File] = {
|
||||||
import extracted._
|
import extracted._
|
||||||
import Keys._
|
import Keys._
|
||||||
val fjh = (fullJavaHomes in proj get structure.data).get
|
val fjh = ((proj / fullJavaHomes) get structure.data).get
|
||||||
(crossJavaVersions in proj get structure.data) map { jvs =>
|
((proj / crossJavaVersions) get structure.data) map { jvs =>
|
||||||
jvs map { jv =>
|
jvs map { jv =>
|
||||||
lookupJavaHome(jv, fjh)
|
lookupJavaHome(jv, fjh)
|
||||||
}
|
}
|
||||||
|
|
@ -235,7 +236,7 @@ private[sbt] object CrossJava {
|
||||||
}
|
}
|
||||||
val scope = Scope(Select(proj), Zero, Zero, Zero)
|
val scope = Scope(Select(proj), Zero, Zero, Zero)
|
||||||
Seq(
|
Seq(
|
||||||
javaHome in scope := Some(home)
|
(scope / javaHome) := Some(home)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import java.util.concurrent.atomic.{ AtomicLong, AtomicReference }
|
||||||
|
|
||||||
import sbt.Def.{ Classpath, ScopedKey, Setting }
|
import sbt.Def.{ Classpath, ScopedKey, Setting }
|
||||||
import sbt.Scope.GlobalScope
|
import sbt.Scope.GlobalScope
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.internal.inc.classpath.ClasspathFilter
|
import sbt.internal.inc.classpath.ClasspathFilter
|
||||||
import sbt.internal.util.{ Attributed, ManagedLogger }
|
import sbt.internal.util.{ Attributed, ManagedLogger }
|
||||||
import sbt.io.syntax._
|
import sbt.io.syntax._
|
||||||
|
|
@ -514,9 +515,9 @@ private[sbt] object DefaultBackgroundJobService {
|
||||||
backgroundJobServices.clear()
|
backgroundJobServices.clear()
|
||||||
}
|
}
|
||||||
private[sbt] lazy val backgroundJobServiceSetting: Setting[_] =
|
private[sbt] lazy val backgroundJobServiceSetting: Setting[_] =
|
||||||
(Keys.bgJobService in GlobalScope) := {
|
(GlobalScope / Keys.bgJobService) := {
|
||||||
val path = (sbt.Keys.bgJobServiceDirectory in GlobalScope).value
|
val path = (GlobalScope / sbt.Keys.bgJobServiceDirectory).value
|
||||||
val useLog4J = (Keys.useLog4J in GlobalScope).value
|
val useLog4J = (GlobalScope / Keys.useLog4J).value
|
||||||
val newService = new DefaultBackgroundJobService(path, useLog4J)
|
val newService = new DefaultBackgroundJobService(path, useLog4J)
|
||||||
backgroundJobServices.putIfAbsent(path, newService) match {
|
backgroundJobServices.putIfAbsent(path, newService) match {
|
||||||
case null => newService
|
case null => newService
|
||||||
|
|
@ -526,7 +527,7 @@ private[sbt] object DefaultBackgroundJobService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private[sbt] lazy val backgroundJobServiceSettings: Seq[Def.Setting[_]] = Def.settings(
|
private[sbt] lazy val backgroundJobServiceSettings: Seq[Def.Setting[_]] = Def.settings(
|
||||||
Keys.bgJobServiceDirectory in GlobalScope := {
|
(GlobalScope / Keys.bgJobServiceDirectory) := {
|
||||||
sbt.Keys.appConfiguration.value.baseDirectory / "target" / "bg-jobs"
|
sbt.Keys.appConfiguration.value.baseDirectory / "target" / "bg-jobs"
|
||||||
},
|
},
|
||||||
backgroundJobServiceSetting
|
backgroundJobServiceSetting
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import compiler.{ Eval, EvalImports }
|
||||||
import sbt.internal.util.complete.DefaultParsers.validID
|
import sbt.internal.util.complete.DefaultParsers.validID
|
||||||
import Def.{ ScopedKey, Setting }
|
import Def.{ ScopedKey, Setting }
|
||||||
import Scope.GlobalScope
|
import Scope.GlobalScope
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.internal.parser.SbtParser
|
import sbt.internal.parser.SbtParser
|
||||||
|
|
||||||
import sbt.io.IO
|
import sbt.io.IO
|
||||||
|
|
@ -389,7 +390,7 @@ object Index {
|
||||||
case _ => ()
|
case _ => ()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
val onComplete = Keys.onComplete in GlobalScope get ss getOrElse (() => ())
|
val onComplete = (GlobalScope / Keys.onComplete) get ss getOrElse (() => ())
|
||||||
new Triggers[Task](runBefore, triggeredBy, map => { onComplete(); map })
|
new Triggers[Task](runBefore, triggeredBy, map => { onComplete(); map })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,11 @@ import sbt.internal.util.Attributed
|
||||||
import Def.{ ScopedKey, Setting }
|
import Def.{ ScopedKey, Setting }
|
||||||
import Keys._
|
import Keys._
|
||||||
import Configurations.{ Compile, Runtime }
|
import Configurations.{ Compile, Runtime }
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import org.apache.ivy.core.module.{ descriptor, id }
|
import org.apache.ivy.core.module.{ descriptor, id }
|
||||||
import descriptor.ModuleDescriptor, id.ModuleRevisionId
|
import descriptor.ModuleDescriptor, id.ModuleRevisionId
|
||||||
|
import scala.annotation.nowarn
|
||||||
|
|
||||||
object GlobalPlugin {
|
object GlobalPlugin {
|
||||||
// constructs a sequence of settings that may be appended to a project's settings to
|
// constructs a sequence of settings that may be appended to a project's settings to
|
||||||
|
|
@ -45,7 +47,7 @@ object GlobalPlugin {
|
||||||
config: Configuration,
|
config: Configuration,
|
||||||
cp: Seq[Attributed[File]]
|
cp: Seq[Attributed[File]]
|
||||||
): Setting[_] =
|
): Setting[_] =
|
||||||
internalDependencyClasspath in config ~= { prev =>
|
(config / internalDependencyClasspath) ~= { prev =>
|
||||||
(prev ++ cp).distinct
|
(prev ++ cp).distinct
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,13 +68,15 @@ object GlobalPlugin {
|
||||||
Project.runUnloadHooks(newS) // discard state
|
Project.runUnloadHooks(newS) // discard state
|
||||||
GlobalPlugin(data, structure, inject(data), base)
|
GlobalPlugin(data, structure, inject(data), base)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
def extract(state: State, structure: BuildStructure): (State, GlobalPluginData) = {
|
def extract(state: State, structure: BuildStructure): (State, GlobalPluginData) = {
|
||||||
import structure.{ data, root, rootProject }
|
import structure.{ data, root, rootProject }
|
||||||
val p: Scope = Scope.GlobalScope in ProjectRef(root, rootProject(root))
|
val p: Scope = Scope.GlobalScope in ProjectRef(root, rootProject(root))
|
||||||
|
|
||||||
val taskInit = Def.task {
|
val taskInit = Def.task {
|
||||||
val intcp = (internalDependencyClasspath in Runtime).value
|
val intcp = (Runtime / internalDependencyClasspath).value
|
||||||
val prods = (exportedProducts in Runtime).value
|
val prods = (Runtime / exportedProducts).value
|
||||||
val depMap = projectDescriptors.value + ivyModule.value.dependencyMapping(state.log)
|
val depMap = projectDescriptors.value + ivyModule.value.dependencyMapping(state.log)
|
||||||
// If we reference it directly (if it's an executionRoot) then it forces an update, which is not what we want.
|
// If we reference it directly (if it's an executionRoot) then it forces an update, which is not what we want.
|
||||||
val updateReport = Def.taskDyn { Def.task { update.value } }.value
|
val updateReport = Def.taskDyn { Def.task { update.value } }.value
|
||||||
|
|
@ -82,7 +86,7 @@ object GlobalPlugin {
|
||||||
projectDependencies.value,
|
projectDependencies.value,
|
||||||
depMap,
|
depMap,
|
||||||
resolvers.value.toVector,
|
resolvers.value.toVector,
|
||||||
(fullClasspath in Runtime).value,
|
(Runtime / fullClasspath).value,
|
||||||
(prods ++ intcp).distinct
|
(prods ++ intcp).distinct
|
||||||
)(updateReport)
|
)(updateReport)
|
||||||
}
|
}
|
||||||
|
|
@ -105,6 +109,8 @@ object GlobalPlugin {
|
||||||
(newS, processResult2(result))
|
(newS, processResult2(result))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
val globalPluginSettings = Project.inScope(Scope.GlobalScope in LocalRootProject)(
|
val globalPluginSettings = Project.inScope(Scope.GlobalScope in LocalRootProject)(
|
||||||
Seq(
|
Seq(
|
||||||
organization := SbtArtifacts.Organization,
|
organization := SbtArtifacts.Organization,
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import Configurations.Compile
|
||||||
import Def.Setting
|
import Def.Setting
|
||||||
import Keys._
|
import Keys._
|
||||||
import Scope.Global
|
import Scope.Global
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
|
|
||||||
import sbt.io.IO
|
import sbt.io.IO
|
||||||
|
|
||||||
|
|
@ -46,9 +47,9 @@ object IvyConsole {
|
||||||
val depSettings: Seq[Setting[_]] = Seq(
|
val depSettings: Seq[Setting[_]] = Seq(
|
||||||
libraryDependencies ++= managed.reverse,
|
libraryDependencies ++= managed.reverse,
|
||||||
resolvers ++= repos.reverse.toVector,
|
resolvers ++= repos.reverse.toVector,
|
||||||
unmanagedJars in Compile ++= Attributed blankSeq unmanaged.reverse,
|
Compile / unmanagedJars ++= Attributed blankSeq unmanaged.reverse,
|
||||||
logLevel in Global := Level.Warn,
|
Global / logLevel := Level.Warn,
|
||||||
showSuccess in Global := false
|
Global / showSuccess := false
|
||||||
)
|
)
|
||||||
val append = Load.transformSettings(
|
val append = Load.transformSettings(
|
||||||
Load.projectScope(currentRef),
|
Load.projectScope(currentRef),
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ package internal
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.concurrent.Callable
|
import java.util.concurrent.Callable
|
||||||
|
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.internal.librarymanagement._
|
import sbt.internal.librarymanagement._
|
||||||
import sbt.librarymanagement._
|
import sbt.librarymanagement._
|
||||||
import sbt.librarymanagement.syntax._
|
import sbt.librarymanagement.syntax._
|
||||||
|
|
@ -265,7 +266,7 @@ private[sbt] object LibraryManagement {
|
||||||
val updateConf = {
|
val updateConf = {
|
||||||
import UpdateLogging.{ Full, DownloadOnly, Default }
|
import UpdateLogging.{ Full, DownloadOnly, Default }
|
||||||
val conf = updateConfiguration.value
|
val conf = updateConfiguration.value
|
||||||
val maybeUpdateLevel = (logLevel in update).?.value
|
val maybeUpdateLevel = (update / logLevel).?.value
|
||||||
val conf1 = maybeUpdateLevel.orElse(state0.get(logLevel.key)) match {
|
val conf1 = maybeUpdateLevel.orElse(state0.get(logLevel.key)) match {
|
||||||
case Some(Level.Debug) if conf.logging == Default => conf.withLogging(logging = Full)
|
case Some(Level.Debug) if conf.logging == Default => conf.withLogging(logging = Full)
|
||||||
case Some(_) if conf.logging == Default => conf.withLogging(logging = DownloadOnly)
|
case Some(_) if conf.logging == Default => conf.withLogging(logging = DownloadOnly)
|
||||||
|
|
@ -283,10 +284,10 @@ private[sbt] object LibraryManagement {
|
||||||
Reference.display(thisProjectRef.value),
|
Reference.display(thisProjectRef.value),
|
||||||
updateConf,
|
updateConf,
|
||||||
identity,
|
identity,
|
||||||
skip = (skip in update).value,
|
skip = (update / skip).value,
|
||||||
force = shouldForce,
|
force = shouldForce,
|
||||||
depsUpdated = transitiveUpdate.value.exists(!_.stats.cached),
|
depsUpdated = transitiveUpdate.value.exists(!_.stats.cached),
|
||||||
uwConfig = (unresolvedWarningConfiguration in update).value,
|
uwConfig = (update / unresolvedWarningConfiguration).value,
|
||||||
evictionLevel = Level.Debug,
|
evictionLevel = Level.Debug,
|
||||||
versionSchemeOverrides = Nil,
|
versionSchemeOverrides = Nil,
|
||||||
assumedEvictionErrorLevel = Level.Debug,
|
assumedEvictionErrorLevel = Level.Debug,
|
||||||
|
|
@ -310,7 +311,7 @@ private[sbt] object LibraryManagement {
|
||||||
val app = appConfiguration.value
|
val app = appConfiguration.value
|
||||||
val srcTypes = sourceArtifactTypes.value
|
val srcTypes = sourceArtifactTypes.value
|
||||||
val docTypes = docArtifactTypes.value
|
val docTypes = docArtifactTypes.value
|
||||||
val uwConfig = (unresolvedWarningConfiguration in update).value
|
val uwConfig = (update / unresolvedWarningConfiguration).value
|
||||||
val out = is.withIvy(s.log)(_.getSettings.getDefaultIvyUserDir)
|
val out = is.withIvy(s.log)(_.getSettings.getDefaultIvyUserDir)
|
||||||
withExcludes(out, mod.classifiers, lock(app)) { excludes =>
|
withExcludes(out, mod.classifiers, lock(app)) { excludes =>
|
||||||
lm.updateClassifiers(
|
lm.updateClassifiers(
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import Def.{ Setting, ScopedKey }
|
||||||
import sbt.internal.util.{ FilePosition, NoPosition, SourcePosition }
|
import sbt.internal.util.{ FilePosition, NoPosition, SourcePosition }
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import Scope.Global
|
import Scope.Global
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.Def._
|
import sbt.Def._
|
||||||
|
|
||||||
object LintUnused {
|
object LintUnused {
|
||||||
|
|
@ -63,8 +64,8 @@ object LintUnused {
|
||||||
val _ = Def.spaceDelimited().parsed // not used yet
|
val _ = Def.spaceDelimited().parsed // not used yet
|
||||||
val state = Keys.state.value
|
val state = Keys.state.value
|
||||||
val log = streams.value.log
|
val log = streams.value.log
|
||||||
val includeKeys = (lintIncludeFilter in Global).value
|
val includeKeys = (Global / lintIncludeFilter).value
|
||||||
val excludeKeys = (lintExcludeFilter in Global).value
|
val excludeKeys = (Global / lintExcludeFilter).value
|
||||||
val result = lintUnused(state, includeKeys, excludeKeys)
|
val result = lintUnused(state, includeKeys, excludeKeys)
|
||||||
if (result.isEmpty) log.success("ok")
|
if (result.isEmpty) log.success("ok")
|
||||||
else lintResultLines(result) foreach { log.warn(_) }
|
else lintResultLines(result) foreach { log.warn(_) }
|
||||||
|
|
@ -74,9 +75,9 @@ object LintUnused {
|
||||||
def lintUnusedFunc(s: State): State = {
|
def lintUnusedFunc(s: State): State = {
|
||||||
val log = s.log
|
val log = s.log
|
||||||
val extracted = Project.extract(s)
|
val extracted = Project.extract(s)
|
||||||
val includeKeys = extracted.get(lintIncludeFilter in Global)
|
val includeKeys = extracted.get((Global / lintIncludeFilter))
|
||||||
val excludeKeys = extracted.get(lintExcludeFilter in Global)
|
val excludeKeys = extracted.get((Global / lintExcludeFilter))
|
||||||
if (extracted.get(lintUnusedKeysOnLoad in Global)) {
|
if (extracted.get((Global / lintUnusedKeysOnLoad))) {
|
||||||
val result = lintUnused(s, includeKeys, excludeKeys)
|
val result = lintUnused(s, includeKeys, excludeKeys)
|
||||||
lintResultLines(result) foreach { log.warn(_) }
|
lintResultLines(result) foreach { log.warn(_) }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import sbt.Def.{ ScopeLocal, ScopedKey, Setting, isDummy }
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
import sbt.Project.inScope
|
import sbt.Project.inScope
|
||||||
import sbt.Scope.GlobalScope
|
import sbt.Scope.GlobalScope
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.compiler.Eval
|
import sbt.compiler.Eval
|
||||||
import sbt.internal.BuildStreams._
|
import sbt.internal.BuildStreams._
|
||||||
import sbt.internal.inc.classpath.ClasspathUtil
|
import sbt.internal.inc.classpath.ClasspathUtil
|
||||||
|
|
@ -30,7 +31,7 @@ import sbt.nio.Settings
|
||||||
import sbt.util.{ Logger, Show }
|
import sbt.util.{ Logger, Show }
|
||||||
import xsbti.compile.{ ClasspathOptionsUtil, Compilers }
|
import xsbti.compile.{ ClasspathOptionsUtil, Compilers }
|
||||||
|
|
||||||
import scala.annotation.tailrec
|
import scala.annotation.{ nowarn, tailrec }
|
||||||
import scala.collection.mutable
|
import scala.collection.mutable
|
||||||
import scala.tools.nsc.reporters.ConsoleReporter
|
import scala.tools.nsc.reporters.ConsoleReporter
|
||||||
|
|
||||||
|
|
@ -128,7 +129,7 @@ private[sbt] object Load {
|
||||||
}
|
}
|
||||||
|
|
||||||
def injectGlobal(state: State): Seq[Setting[_]] =
|
def injectGlobal(state: State): Seq[Setting[_]] =
|
||||||
(appConfiguration in GlobalScope :== state.configuration) +:
|
((GlobalScope / appConfiguration) :== state.configuration) +:
|
||||||
LogManager.settingsLogger(state) +:
|
LogManager.settingsLogger(state) +:
|
||||||
EvaluateTask.injectSettings
|
EvaluateTask.injectSettings
|
||||||
|
|
||||||
|
|
@ -375,7 +376,7 @@ private[sbt] object Load {
|
||||||
rootProject: URI => String,
|
rootProject: URI => String,
|
||||||
injectSettings: InjectSettings
|
injectSettings: InjectSettings
|
||||||
): Seq[Setting[_]] = {
|
): Seq[Setting[_]] = {
|
||||||
((loadedBuild in GlobalScope :== loaded) +:
|
(((GlobalScope / loadedBuild) :== loaded) +:
|
||||||
transformProjectOnly(loaded.root, rootProject, injectSettings.global)) ++
|
transformProjectOnly(loaded.root, rootProject, injectSettings.global)) ++
|
||||||
inScope(GlobalScope)(loaded.autos.globalSettings) ++
|
inScope(GlobalScope)(loaded.autos.globalSettings) ++
|
||||||
loaded.units.toSeq.flatMap {
|
loaded.units.toSeq.flatMap {
|
||||||
|
|
@ -386,7 +387,7 @@ private[sbt] object Load {
|
||||||
val ref = ProjectRef(uri, id)
|
val ref = ProjectRef(uri, id)
|
||||||
val defineConfig: Seq[Setting[_]] =
|
val defineConfig: Seq[Setting[_]] =
|
||||||
for (c <- project.configurations)
|
for (c <- project.configurations)
|
||||||
yield ((configuration in (ref, ConfigKey(c.name))) :== c)
|
yield ((ref / ConfigKey(c.name) / configuration) :== c)
|
||||||
val builtin: Seq[Setting[_]] =
|
val builtin: Seq[Setting[_]] =
|
||||||
(thisProject :== project) +: (thisProjectRef :== ref) +: defineConfig
|
(thisProject :== project) +: (thisProjectRef :== ref) +: defineConfig
|
||||||
val settings = builtin ++ project.settings ++ injectSettings.project
|
val settings = builtin ++ project.settings ++ injectSettings.project
|
||||||
|
|
@ -1154,14 +1155,15 @@ private[sbt] object Load {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** These are the settings defined when loading a project "meta" build. */
|
/** These are the settings defined when loading a project "meta" build. */
|
||||||
|
@nowarn
|
||||||
val autoPluginSettings: Seq[Setting[_]] = inScope(GlobalScope in LocalRootProject)(
|
val autoPluginSettings: Seq[Setting[_]] = inScope(GlobalScope in LocalRootProject)(
|
||||||
Seq(
|
Seq(
|
||||||
sbtPlugin :== true,
|
sbtPlugin :== true,
|
||||||
isMetaBuild :== true,
|
isMetaBuild :== true,
|
||||||
pluginData := {
|
pluginData := {
|
||||||
val prod = (exportedProducts in Configurations.Runtime).value
|
val prod = (Configurations.Runtime / exportedProducts).value
|
||||||
val cp = (fullClasspath in Configurations.Runtime).value
|
val cp = (Configurations.Runtime / fullClasspath).value
|
||||||
val opts = (scalacOptions in Configurations.Compile).value
|
val opts = (Configurations.Compile / scalacOptions).value
|
||||||
PluginData(
|
PluginData(
|
||||||
removeEntries(cp, prod),
|
removeEntries(cp, prod),
|
||||||
prod,
|
prod,
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,13 @@ import java.io.PrintWriter
|
||||||
|
|
||||||
import sbt.Def.ScopedKey
|
import sbt.Def.ScopedKey
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
import sbt.Scope.GlobalScope
|
import sbt.Scope.Global
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt.internal.util.MainAppender._
|
import sbt.internal.util.MainAppender._
|
||||||
import sbt.internal.util.{ Terminal => ITerminal, _ }
|
import sbt.internal.util.{ Terminal => ITerminal, _ }
|
||||||
import sbt.util.{ Level, LogExchange, Logger, LoggerContext }
|
import sbt.util.{ Level, LogExchange, Logger, LoggerContext }
|
||||||
import org.apache.logging.log4j.core.{ Appender => XAppender }
|
import org.apache.logging.log4j.core.{ Appender => XAppender }
|
||||||
|
import scala.annotation.nowarn
|
||||||
|
|
||||||
sealed abstract class LogManager {
|
sealed abstract class LogManager {
|
||||||
def apply(
|
def apply(
|
||||||
|
|
@ -59,6 +61,7 @@ object LogManager {
|
||||||
|
|
||||||
// This is called by mkStreams
|
// This is called by mkStreams
|
||||||
//
|
//
|
||||||
|
@nowarn
|
||||||
def construct(
|
def construct(
|
||||||
data: Settings[Scope],
|
data: Settings[Scope],
|
||||||
state: State
|
state: State
|
||||||
|
|
@ -70,6 +73,7 @@ object LogManager {
|
||||||
manager(data, state, task, to, context)
|
manager(data, state, task, to, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
def constructBackgroundLog(
|
def constructBackgroundLog(
|
||||||
data: Settings[Scope],
|
data: Settings[Scope],
|
||||||
state: State
|
state: State
|
||||||
|
|
@ -309,7 +313,7 @@ object LogManager {
|
||||||
|
|
||||||
private[sbt] def settingsLogger(state: State): Def.Setting[_] =
|
private[sbt] def settingsLogger(state: State): Def.Setting[_] =
|
||||||
// strict to avoid retaining a reference to `state`
|
// strict to avoid retaining a reference to `state`
|
||||||
sLog in GlobalScope :== globalWrapper(state)
|
Global / sLog :== globalWrapper(state)
|
||||||
|
|
||||||
// construct a Logger that delegates to the global logger, but only holds a weak reference
|
// construct a Logger that delegates to the global logger, but only holds a weak reference
|
||||||
// this is an approximation to the ideal that would invalidate the delegate after loading completes
|
// this is an approximation to the ideal that would invalidate the delegate after loading completes
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import sbt.internal.util.{ AttributeKey, Dag, Relation, Util }
|
||||||
import sbt.util.Logger
|
import sbt.util.Logger
|
||||||
|
|
||||||
import Def.Setting
|
import Def.Setting
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import Plugins._
|
import Plugins._
|
||||||
import PluginsDebug._
|
import PluginsDebug._
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
|
|
@ -169,7 +170,7 @@ private[sbt] object PluginsDebug {
|
||||||
val extracted = Project.extract(s)
|
val extracted = Project.extract(s)
|
||||||
import extracted._
|
import extracted._
|
||||||
def definesPlugin(p: ResolvedProject): Boolean = p.autoPlugins.contains(plugin)
|
def definesPlugin(p: ResolvedProject): Boolean = p.autoPlugins.contains(plugin)
|
||||||
def projectForRef(ref: ProjectRef): ResolvedProject = get(Keys.thisProject in ref)
|
def projectForRef(ref: ProjectRef): ResolvedProject = get(ref / Keys.thisProject)
|
||||||
val perBuild: Map[URI, Set[AutoPlugin]] =
|
val perBuild: Map[URI, Set[AutoPlugin]] =
|
||||||
structure.units.mapValues(unit => availableAutoPlugins(unit).toSet).toMap
|
structure.units.mapValues(unit => availableAutoPlugins(unit).toSet).toMap
|
||||||
val pluginsThisBuild = perBuild.getOrElse(currentRef.build, Set.empty).toList
|
val pluginsThisBuild = perBuild.getOrElse(currentRef.build, Set.empty).toList
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import sbt.internal.remotecache._
|
||||||
import sbt.internal.inc.{ HashUtil, JarUtils }
|
import sbt.internal.inc.{ HashUtil, JarUtils }
|
||||||
import sbt.util.InterfaceUtil.toOption
|
import sbt.util.InterfaceUtil.toOption
|
||||||
import sbt.util.Logger
|
import sbt.util.Logger
|
||||||
|
import scala.annotation.nowarn
|
||||||
|
|
||||||
object RemoteCache {
|
object RemoteCache {
|
||||||
final val cachedCompileClassifier = "cached-compile"
|
final val cachedCompileClassifier = "cached-compile"
|
||||||
|
|
@ -151,6 +152,7 @@ object RemoteCache {
|
||||||
) ++ inConfig(Compile)(configCacheSettings(compileArtifact(Compile, cachedCompileClassifier)))
|
) ++ inConfig(Compile)(configCacheSettings(compileArtifact(Compile, cachedCompileClassifier)))
|
||||||
++ inConfig(Test)(configCacheSettings(testArtifact(Test, cachedTestClassifier))))
|
++ inConfig(Test)(configCacheSettings(testArtifact(Test, cachedTestClassifier))))
|
||||||
|
|
||||||
|
@nowarn
|
||||||
def configCacheSettings[A <: RemoteCacheArtifact](
|
def configCacheSettings[A <: RemoteCacheArtifact](
|
||||||
cacheArtifactTask: Def.Initialize[Task[A]]
|
cacheArtifactTask: Def.Initialize[Task[A]]
|
||||||
): Seq[Def.Setting[_]] =
|
): Seq[Def.Setting[_]] =
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import Keys._
|
||||||
import EvaluateConfigurations.{ evaluateConfiguration => evaluate }
|
import EvaluateConfigurations.{ evaluateConfiguration => evaluate }
|
||||||
import Configurations.Compile
|
import Configurations.Compile
|
||||||
import Scope.Global
|
import Scope.Global
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
|
|
||||||
import sbt.io.{ Hash, IO }
|
import sbt.io.{ Hash, IO }
|
||||||
|
|
||||||
|
|
@ -50,13 +51,13 @@ object Script {
|
||||||
val embeddedSettings = blocks(script).flatMap { block =>
|
val embeddedSettings = blocks(script).flatMap { block =>
|
||||||
evaluate(eval(), script, block.lines, currentUnit.imports, block.offset + 1)(currentLoader)
|
evaluate(eval(), script, block.lines, currentUnit.imports, block.offset + 1)(currentLoader)
|
||||||
}
|
}
|
||||||
val scriptAsSource = sources in Compile := script :: Nil
|
val scriptAsSource = (Compile / sources) := script :: Nil
|
||||||
val asScript = scalacOptions ++= Seq("-Xscript", script.getName.stripSuffix(".scala"))
|
val asScript = scalacOptions ++= Seq("-Xscript", script.getName.stripSuffix(".scala"))
|
||||||
val scriptSettings = Seq(
|
val scriptSettings = Seq(
|
||||||
asScript,
|
asScript,
|
||||||
scriptAsSource,
|
scriptAsSource,
|
||||||
logLevel in Global := Level.Warn,
|
(Global / logLevel) := Level.Warn,
|
||||||
showSuccess in Global := false
|
(Global / showSuccess) := false
|
||||||
)
|
)
|
||||||
val append = Load.transformSettings(
|
val append = Load.transformSettings(
|
||||||
Load.projectScope(currentRef),
|
Load.projectScope(currentRef),
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import Scope.Global
|
||||||
import Types.idFun
|
import Types.idFun
|
||||||
import complete._
|
import complete._
|
||||||
import DefaultParsers._
|
import DefaultParsers._
|
||||||
|
import scala.annotation.nowarn
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The resulting `session` and verbose and quiet summaries of the result of a set operation.
|
* The resulting `session` and verbose and quiet summaries of the result of a set operation.
|
||||||
|
|
@ -53,6 +54,8 @@ private[sbt] object SettingCompletions {
|
||||||
val projectScope = Load.projectScope(currentRef)
|
val projectScope = Load.projectScope(currentRef)
|
||||||
def resolve(s: Setting[_]): Seq[Setting[_]] =
|
def resolve(s: Setting[_]): Seq[Setting[_]] =
|
||||||
Load.transformSettings(projectScope, currentRef.build, rootProject, s :: Nil)
|
Load.transformSettings(projectScope, currentRef.build, rootProject, s :: Nil)
|
||||||
|
|
||||||
|
@nowarn
|
||||||
def rescope[T](setting: Setting[T]): Seq[Setting[_]] = {
|
def rescope[T](setting: Setting[T]): Seq[Setting[_]] = {
|
||||||
val akey = setting.key.key
|
val akey = setting.key.key
|
||||||
val global = ScopedKey(Global, akey)
|
val global = ScopedKey(Global, akey)
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import sbt.nio.FileStamper
|
||||||
import sbt.nio.Keys._
|
import sbt.nio.Keys._
|
||||||
import sbt.nio.file.Glob
|
import sbt.nio.file.Glob
|
||||||
|
|
||||||
import scala.annotation.tailrec
|
import scala.annotation.{ nowarn, tailrec }
|
||||||
|
|
||||||
private[sbt] object WatchTransitiveDependencies {
|
private[sbt] object WatchTransitiveDependencies {
|
||||||
private implicit class SourceOps(val source: Source) {
|
private implicit class SourceOps(val source: Source) {
|
||||||
|
|
@ -53,6 +53,8 @@ private[sbt] object WatchTransitiveDependencies {
|
||||||
def structure: BuildStructure = extracted.structure
|
def structure: BuildStructure = extracted.structure
|
||||||
def data: Map[Scope, AttributeMap] = extracted.structure.data.data
|
def data: Map[Scope, AttributeMap] = extracted.structure.data.data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
private def argumentsImpl(
|
private def argumentsImpl(
|
||||||
scopedKey: ScopedKey[_],
|
scopedKey: ScopedKey[_],
|
||||||
extracted: Extracted,
|
extracted: Extracted,
|
||||||
|
|
@ -127,6 +129,7 @@ private[sbt] object WatchTransitiveDependencies {
|
||||||
(inputGlobs ++ triggerGlobs ++ legacy(keys :+ scopedKey, args)).distinct.sorted
|
(inputGlobs ++ triggerGlobs ++ legacy(keys :+ scopedKey, args)).distinct.sorted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
private def legacy(keys: Seq[ScopedKey[_]], args: Arguments): Seq[DynamicInput] = {
|
private def legacy(keys: Seq[ScopedKey[_]], args: Arguments): Seq[DynamicInput] = {
|
||||||
import args._
|
import args._
|
||||||
val projectScopes =
|
val projectScopes =
|
||||||
|
|
@ -160,6 +163,8 @@ private[sbt] object WatchTransitiveDependencies {
|
||||||
case Right(globs) => globs.map(toDynamicInput)
|
case Right(globs) => globs.map(toDynamicInput)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
@tailrec
|
@tailrec
|
||||||
private def collectKeys(
|
private def collectKeys(
|
||||||
arguments: Arguments,
|
arguments: Arguments,
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,10 @@ import sbt.util.Logger
|
||||||
import sjsonnew.shaded.scalajson.ast.unsafe.{ JNull, JValue }
|
import sjsonnew.shaded.scalajson.ast.unsafe.{ JNull, JValue }
|
||||||
import sjsonnew.support.scalajson.unsafe.{ CompactPrinter, Converter, Parser => JsonParser }
|
import sjsonnew.support.scalajson.unsafe.{ CompactPrinter, Converter, Parser => JsonParser }
|
||||||
|
|
||||||
|
// import scala.annotation.nowarn
|
||||||
import scala.util.control.NonFatal
|
import scala.util.control.NonFatal
|
||||||
import scala.util.{ Failure, Success, Try }
|
import scala.util.{ Failure, Success, Try }
|
||||||
|
import scala.annotation.nowarn
|
||||||
|
|
||||||
object BuildServerProtocol {
|
object BuildServerProtocol {
|
||||||
import sbt.internal.bsp.codec.JsonProtocol._
|
import sbt.internal.bsp.codec.JsonProtocol._
|
||||||
|
|
@ -369,6 +371,7 @@ object BuildServerProtocol {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@nowarn
|
||||||
private def bspWorkspaceSetting: Def.Initialize[Map[BuildTargetIdentifier, Scope]] =
|
private def bspWorkspaceSetting: Def.Initialize[Map[BuildTargetIdentifier, Scope]] =
|
||||||
Def.settingDyn {
|
Def.settingDyn {
|
||||||
val loadedBuild = Keys.loadedBuild.value
|
val loadedBuild = Keys.loadedBuild.value
|
||||||
|
|
@ -417,7 +420,7 @@ object BuildServerProtocol {
|
||||||
(dep, configs) <- Keys.bspInternalDependencyConfigurations.value
|
(dep, configs) <- Keys.bspInternalDependencyConfigurations.value
|
||||||
config <- configs
|
config <- configs
|
||||||
if dep != thisProjectRef || config.name != thisConfig.name
|
if dep != thisProjectRef || config.name != thisConfig.name
|
||||||
} yield Keys.bspTargetIdentifier.in(dep, config)
|
} yield (dep / config / Keys.bspTargetIdentifier)
|
||||||
val capabilities = BuildTargetCapabilities(canCompile = true, canTest = true, canRun = true)
|
val capabilities = BuildTargetCapabilities(canCompile = true, canTest = true, canRun = true)
|
||||||
val tags = BuildTargetTag.fromConfig(configuration.name)
|
val tags = BuildTargetTag.fromConfig(configuration.name)
|
||||||
Def.task {
|
Def.task {
|
||||||
|
|
@ -444,7 +447,7 @@ object BuildServerProtocol {
|
||||||
val internalDependencyClasspath = for {
|
val internalDependencyClasspath = for {
|
||||||
(ref, configs) <- bspInternalDependencyConfigurations.value
|
(ref, configs) <- bspInternalDependencyConfigurations.value
|
||||||
config <- configs
|
config <- configs
|
||||||
} yield Keys.classDirectory.in(ref, config)
|
} yield ref / config / Keys.classDirectory
|
||||||
|
|
||||||
Def.task {
|
Def.task {
|
||||||
val classpath = internalDependencyClasspath.join.value.distinct ++
|
val classpath = internalDependencyClasspath.join.value.distinct ++
|
||||||
|
|
@ -596,6 +599,7 @@ object BuildServerProtocol {
|
||||||
state.respondEvent(RunResult(originId, statusCode))
|
state.respondEvent(RunResult(originId, statusCode))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
private def internalDependencyConfigurationsSetting = Def.settingDyn {
|
private def internalDependencyConfigurationsSetting = Def.settingDyn {
|
||||||
val allScopes = bspWorkspace.value.map { case (_, scope) => scope }.toSet
|
val allScopes = bspWorkspace.value.map { case (_, scope) => scope }.toSet
|
||||||
val directDependencies = Keys.internalDependencyConfigurations.value
|
val directDependencies = Keys.internalDependencyConfigurations.value
|
||||||
|
|
@ -618,7 +622,7 @@ object BuildServerProtocol {
|
||||||
val transitiveDependencies = for {
|
val transitiveDependencies = for {
|
||||||
(dep, configs) <- directDependencies
|
(dep, configs) <- directDependencies
|
||||||
config <- configs if dep != ref || config.name != thisConfig.name
|
config <- configs if dep != ref || config.name != thisConfig.name
|
||||||
} yield Keys.bspInternalDependencyConfigurations.in(dep, config)
|
} yield dep / config / Keys.bspInternalDependencyConfigurations
|
||||||
Def.setting {
|
Def.setting {
|
||||||
val allDependencies = directDependencies ++
|
val allDependencies = directDependencies ++
|
||||||
transitiveDependencies.join.value.flatten
|
transitiveDependencies.join.value.flatten
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import sbt.internal.util.complete.{ Parser, Parsers }
|
||||||
import sbt.protocol._
|
import sbt.protocol._
|
||||||
import sbt.util.Logger
|
import sbt.util.Logger
|
||||||
|
|
||||||
import scala.annotation.tailrec
|
import scala.annotation.{ nowarn, tailrec }
|
||||||
import scala.collection.mutable
|
import scala.collection.mutable
|
||||||
import scala.concurrent.duration._
|
import scala.concurrent.duration._
|
||||||
import scala.util.Try
|
import scala.util.Try
|
||||||
|
|
@ -418,6 +418,7 @@ final class NetworkChannel(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
protected def onCompletionRequest(execId: Option[String], cp: CompletionParams) = {
|
protected def onCompletionRequest(execId: Option[String], cp: CompletionParams) = {
|
||||||
if (initialized) {
|
if (initialized) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ private[sbt] object Settings {
|
||||||
* @param fileOutputScopes the set of scopes for which the fileOutputs setting is defined
|
* @param fileOutputScopes the set of scopes for which the fileOutputs setting is defined
|
||||||
* @return the injected settings
|
* @return the injected settings
|
||||||
*/
|
*/
|
||||||
|
@nowarn
|
||||||
private[this] def maybeAddOutputsAndFileStamps(
|
private[this] def maybeAddOutputsAndFileStamps(
|
||||||
setting: Def.Setting[_],
|
setting: Def.Setting[_],
|
||||||
fileOutputScopes: Set[Scope]
|
fileOutputScopes: Set[Scope]
|
||||||
|
|
@ -104,6 +105,8 @@ private[sbt] object Settings {
|
||||||
case _ => Nil
|
case _ => Nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
private[sbt] val inject: Def.ScopedKey[_] => Seq[Def.Setting[_]] = scopedKey =>
|
private[sbt] val inject: Def.ScopedKey[_] => Seq[Def.Setting[_]] = scopedKey =>
|
||||||
scopedKey.key match {
|
scopedKey.key match {
|
||||||
case transitiveDynamicInputs.key =>
|
case transitiveDynamicInputs.key =>
|
||||||
|
|
@ -138,6 +141,7 @@ private[sbt] object Settings {
|
||||||
* @return a task definition that retrieves the file input files and their attributes scoped
|
* @return a task definition that retrieves the file input files and their attributes scoped
|
||||||
* to a particular task.
|
* to a particular task.
|
||||||
*/
|
*/
|
||||||
|
@nowarn
|
||||||
private[sbt] def inputPathSettings(setting: Def.Setting[_]): Seq[Def.Setting[_]] = {
|
private[sbt] def inputPathSettings(setting: Def.Setting[_]): Seq[Def.Setting[_]] = {
|
||||||
val scopedKey = setting.key
|
val scopedKey = setting.key
|
||||||
val scope = scopedKey.scope
|
val scope = scopedKey.scope
|
||||||
|
|
@ -168,6 +172,7 @@ private[sbt] object Settings {
|
||||||
* @param scope the key whose file inputs we are seeking
|
* @param scope the key whose file inputs we are seeking
|
||||||
* @return a task definition that retrieves all of the input paths scoped to the input key.
|
* @return a task definition that retrieves all of the input paths scoped to the input key.
|
||||||
*/
|
*/
|
||||||
|
@nowarn
|
||||||
private[this] def allFilesImpl(scope: Scope): Def.Setting[_] = {
|
private[this] def allFilesImpl(scope: Scope): Def.Setting[_] = {
|
||||||
addTaskDefinition(Keys.allInputFiles in scope := {
|
addTaskDefinition(Keys.allInputFiles in scope := {
|
||||||
val filter =
|
val filter =
|
||||||
|
|
@ -187,6 +192,7 @@ private[sbt] object Settings {
|
||||||
* @param scope the scope corresponding to the task whose fileInputs we are seeking
|
* @param scope the scope corresponding to the task whose fileInputs we are seeking
|
||||||
* @return a task definition that retrieves the changed input files scoped to the key.
|
* @return a task definition that retrieves the changed input files scoped to the key.
|
||||||
*/
|
*/
|
||||||
|
@nowarn
|
||||||
private[this] def changedInputFilesImpl(scope: Scope): List[Def.Setting[_]] =
|
private[this] def changedInputFilesImpl(scope: Scope): List[Def.Setting[_]] =
|
||||||
changedFilesImpl(scope, changedInputFiles, inputFileStamps) ::
|
changedFilesImpl(scope, changedInputFiles, inputFileStamps) ::
|
||||||
(watchForceTriggerOnAnyChange in scope := {
|
(watchForceTriggerOnAnyChange in scope := {
|
||||||
|
|
@ -195,6 +201,8 @@ private[sbt] object Settings {
|
||||||
case None => false
|
case None => false
|
||||||
}
|
}
|
||||||
}) :: Nil
|
}) :: Nil
|
||||||
|
|
||||||
|
@nowarn
|
||||||
private[this] def changedFilesImpl(
|
private[this] def changedFilesImpl(
|
||||||
scope: Scope,
|
scope: Scope,
|
||||||
changeKey: TaskKey[Seq[(Path, FileStamp)] => FileChanges],
|
changeKey: TaskKey[Seq[(Path, FileStamp)] => FileChanges],
|
||||||
|
|
@ -242,6 +250,7 @@ private[sbt] object Settings {
|
||||||
* @param scope the scope to add the custom clean
|
* @param scope the scope to add the custom clean
|
||||||
* @return a task specific clean implementation
|
* @return a task specific clean implementation
|
||||||
*/
|
*/
|
||||||
|
@nowarn
|
||||||
private[sbt] def cleanImpl(scope: Scope): Def.Setting[_] = addTaskDefinition {
|
private[sbt] def cleanImpl(scope: Scope): Def.Setting[_] = addTaskDefinition {
|
||||||
sbt.Keys.clean in scope := Clean.task(scope, full = false).value
|
sbt.Keys.clean in scope := Clean.task(scope, full = false).value
|
||||||
}
|
}
|
||||||
|
|
@ -252,6 +261,7 @@ private[sbt] object Settings {
|
||||||
* @param taskKey the task for which we add a custom clean implementation
|
* @param taskKey the task for which we add a custom clean implementation
|
||||||
* @return a task specificic clean implementation
|
* @return a task specificic clean implementation
|
||||||
*/
|
*/
|
||||||
|
@nowarn
|
||||||
private[sbt] def cleanImpl[T: JsonFormat: ToSeqPath](taskKey: TaskKey[T]): Def.Setting[_] = {
|
private[sbt] def cleanImpl[T: JsonFormat: ToSeqPath](taskKey: TaskKey[T]): Def.Setting[_] = {
|
||||||
val taskScope = taskKey.scope in taskKey.key
|
val taskScope = taskKey.scope in taskKey.key
|
||||||
addTaskDefinition(sbt.Keys.clean in taskScope := Def.taskDyn {
|
addTaskDefinition(sbt.Keys.clean in taskScope := Def.taskDyn {
|
||||||
|
|
@ -299,6 +309,7 @@ private[sbt] object Settings {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
private[this] def outputsAndStamps[T: JsonFormat: ToSeqPath](
|
private[this] def outputsAndStamps[T: JsonFormat: ToSeqPath](
|
||||||
taskKey: TaskKey[T]
|
taskKey: TaskKey[T]
|
||||||
): List[Def.Setting[_]] = {
|
): List[Def.Setting[_]] = {
|
||||||
|
|
@ -306,6 +317,8 @@ private[sbt] object Settings {
|
||||||
val changes = changedFilesImpl(scope, changedOutputFiles, outputFileStamps) :: Nil
|
val changes = changedFilesImpl(scope, changedOutputFiles, outputFileStamps) :: Nil
|
||||||
allOutputPathsImpl(scope) :: outputFileStampsImpl(scope) :: cleanImpl(taskKey) :: changes
|
allOutputPathsImpl(scope) :: outputFileStampsImpl(scope) :: cleanImpl(taskKey) :: changes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nowarn
|
||||||
private[this] def allOutputPathsImpl(scope: Scope): Def.Setting[_] =
|
private[this] def allOutputPathsImpl(scope: Scope): Def.Setting[_] =
|
||||||
addTaskDefinition(allOutputFiles in scope := {
|
addTaskDefinition(allOutputFiles in scope := {
|
||||||
val filter =
|
val filter =
|
||||||
|
|
@ -331,6 +344,8 @@ private[sbt] object Settings {
|
||||||
fileOutputGlobs.exists(_.matches(p)) || !attributeFilter(p)
|
fileOutputGlobs.exists(_.matches(p)) || !attributeFilter(p)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@nowarn
|
||||||
private[this] def outputFileStampsImpl(scope: Scope): Def.Setting[_] =
|
private[this] def outputFileStampsImpl(scope: Scope): Def.Setting[_] =
|
||||||
addTaskDefinition(outputFileStamps in scope := {
|
addTaskDefinition(outputFileStamps in scope := {
|
||||||
val stamper: Path => Option[FileStamp] = (outputFileStamper in scope).value match {
|
val stamper: Path => Option[FileStamp] = (outputFileStamper in scope).value match {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import java.util.Locale
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
import sbt.BasicCommandStrings.{ ContinuousExecutePrefix, TerminateAction }
|
import sbt.BasicCommandStrings.{ ContinuousExecutePrefix, TerminateAction }
|
||||||
|
import sbt.SlashSyntax0._
|
||||||
import sbt._
|
import sbt._
|
||||||
import sbt.internal.LabeledFunctions._
|
import sbt.internal.LabeledFunctions._
|
||||||
import sbt.internal.nio.FileEvent
|
import sbt.internal.nio.FileEvent
|
||||||
|
|
@ -620,7 +621,7 @@ object Watch {
|
||||||
watchStartMessage :== Watch.defaultStartWatch,
|
watchStartMessage :== Watch.defaultStartWatch,
|
||||||
watchTriggeredMessage :== Watch.defaultOnTriggerMessage,
|
watchTriggeredMessage :== Watch.defaultOnTriggerMessage,
|
||||||
watchForceTriggerOnAnyChange :== false,
|
watchForceTriggerOnAnyChange :== false,
|
||||||
watchPersistFileStamps := (sbt.Keys.turbo in ThisBuild).value,
|
watchPersistFileStamps := (ThisBuild / sbt.Keys.turbo).value,
|
||||||
watchTriggers :== Nil,
|
watchTriggers :== Nil,
|
||||||
watchAntiEntropyPollPeriod := Watch.defaultAntiEntropyPollPeriod,
|
watchAntiEntropyPollPeriod := Watch.defaultAntiEntropyPollPeriod,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ object DependencyTreeSettings {
|
||||||
// concatenating & inlining ivySbt & ivyModule default task implementations, as `SbtAccess.inTask` does
|
// concatenating & inlining ivySbt & ivyModule default task implementations, as `SbtAccess.inTask` does
|
||||||
// NOT correctly force the scope when applied to `TaskKey.toTask` instances (as opposed to raw
|
// NOT correctly force the scope when applied to `TaskKey.toTask` instances (as opposed to raw
|
||||||
// implementations like `Classpaths.mkIvyConfiguration` or `Classpaths.updateTask`)
|
// implementations like `Classpaths.mkIvyConfiguration` or `Classpaths.updateTask`)
|
||||||
val is = new IvySbt((ivyConfiguration in dependencyTreeIgnoreMissingUpdate).value)
|
val is = new IvySbt((dependencyTreeIgnoreMissingUpdate / ivyConfiguration).value)
|
||||||
new is.Module(moduleSettings.value)
|
new is.Module(moduleSettings.value)
|
||||||
},
|
},
|
||||||
// don't fail on missing dependencies
|
// don't fail on missing dependencies
|
||||||
|
|
@ -161,7 +161,7 @@ object DependencyTreeSettings {
|
||||||
key / asString := renderer(dependencyTreeModuleGraph0.value),
|
key / asString := renderer(dependencyTreeModuleGraph0.value),
|
||||||
key / toFile := {
|
key / toFile := {
|
||||||
val (targetFile, force) = targetFileAndForceParser.parsed
|
val (targetFile, force) = targetFileAndForceParser.parsed
|
||||||
writeToFile(key.key.label, (asString in key).value, targetFile, force, streams.value)
|
writeToFile(key.key.label, (key / asString).value, targetFile, force, streams.value)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue