mirror of https://github.com/sbt/sbt.git
[2.x] test: Use new wildcard syntax in test build files (#8844)
This commit is contained in:
parent
677a6cf7a6
commit
75d9834dec
|
|
@ -9,7 +9,7 @@ object MyPlugin extends AutoPlugin {
|
||||||
|
|
||||||
val FooConfig = config("foo")
|
val FooConfig = config("foo")
|
||||||
|
|
||||||
override def projectSettings = Seq[Setting[_]](
|
override def projectSettings = Seq[Setting[?]](
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"org.slf4j" % "slf4j-api" % "1.7.0",
|
"org.slf4j" % "slf4j-api" % "1.7.0",
|
||||||
"ch.qos.logback" % "logback-classic" % "1.1.7"
|
"ch.qos.logback" % "logback-classic" % "1.1.7"
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@ object HydraPlugin extends AutoPlugin {
|
||||||
resolvers += "Triplequote Maven Releases" at "https://repo.triplequote.com/artifactory/libs-release/",
|
resolvers += "Triplequote Maven Releases" at "https://repo.triplequote.com/artifactory/libs-release/",
|
||||||
) ++ inConfig(Compile)(compileSettings) ++ inConfig(Test)(compileSettings)
|
) ++ inConfig(Compile)(compileSettings) ++ inConfig(Test)(compileSettings)
|
||||||
|
|
||||||
private lazy val compileSettings: Seq[Def.Setting[_]] = inTask(compile)(compileInputsSettings)
|
private lazy val compileSettings: Seq[Def.Setting[?]] = inTask(compile)(compileInputsSettings)
|
||||||
|
|
||||||
private def compileInputsSettings: Seq[Setting[_]] = Seq(
|
private def compileInputsSettings: Seq[Setting[?]] = Seq(
|
||||||
scalaCompilerBridgeSource := {
|
scalaCompilerBridgeSource := {
|
||||||
ModuleID("com.triplequote", "hydra-bridge_1_0", "2.1.4")
|
ModuleID("com.triplequote", "hydra-bridge_1_0", "2.1.4")
|
||||||
.withConfigurations(Some(Configurations.Compile.name))
|
.withConfigurations(Some(Configurations.Compile.name))
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,13 @@ object TwirlPlugin extends AutoPlugin {
|
||||||
val twirlCompileTemplates = taskKey[Seq[File]]("Compile twirl templates into scala source files")
|
val twirlCompileTemplates = taskKey[Seq[File]]("Compile twirl templates into scala source files")
|
||||||
}
|
}
|
||||||
|
|
||||||
override def projectSettings: Seq[Setting[_]] =
|
override def projectSettings: Seq[Setting[?]] =
|
||||||
inConfig(Compile)(twirlSettings) ++
|
inConfig(Compile)(twirlSettings) ++
|
||||||
inConfig(Test)(twirlSettings)
|
inConfig(Test)(twirlSettings)
|
||||||
|
|
||||||
import autoImport._
|
import autoImport._
|
||||||
|
|
||||||
def twirlSettings: Seq[Setting[_]] = Seq(
|
def twirlSettings: Seq[Setting[?]] = Seq(
|
||||||
twirlCompileTemplates / includeFilter := "*.scala.*",
|
twirlCompileTemplates / includeFilter := "*.scala.*",
|
||||||
twirlCompileTemplates / excludeFilter := HiddenFileFilter,
|
twirlCompileTemplates / excludeFilter := HiddenFileFilter,
|
||||||
twirlCompileTemplates / sourceDirectories := Seq(sourceDirectory.value / "twirl"),
|
twirlCompileTemplates / sourceDirectories := Seq(sourceDirectory.value / "twirl"),
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ package name.example {
|
||||||
}
|
}
|
||||||
|
|
||||||
import autoImport._
|
import autoImport._
|
||||||
override def projectSettings = Seq[Setting[_]](
|
override def projectSettings = Seq[Setting[?]](
|
||||||
checkMaxErrors := (Keys.maxErrors map { me => assert(me == xyz, "Expected maxErrors to be " + xyz + ", but it was " + me ) }).value,
|
checkMaxErrors := (Keys.maxErrors map { me => assert(me == xyz, "Expected maxErrors to be " + xyz + ", but it was " + me ) }).value,
|
||||||
checkName := (Keys.name map { n => assert(n == "Demo", "Expected name to be 'Demo', but it was '" + n + "'" ) }).value
|
checkName := (Keys.name map { n => assert(n == "Demo", "Expected name to be 'Demo', but it was '" + n + "'" ) }).value
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import sbt._, Keys._
|
import sbt._, Keys._
|
||||||
|
|
||||||
object TestP extends AutoPlugin {
|
object TestP extends AutoPlugin {
|
||||||
override def projectSettings: Seq[Setting[_]] = Seq(
|
override def projectSettings: Seq[Setting[?]] = Seq(
|
||||||
Compile / resourceGenerators += Def.task {
|
Compile / resourceGenerators += Def.task {
|
||||||
streams.value.log.info("resource generated in plugin")
|
streams.value.log.info("resource generated in plugin")
|
||||||
Seq.empty[File]
|
Seq.empty[File]
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ object TopA extends AutoPlugin {
|
||||||
|
|
||||||
override def trigger = AllRequirements
|
override def trigger = AllRequirements
|
||||||
|
|
||||||
override def projectSettings: scala.Seq[sbt.Setting[_]] = Seq(
|
override def projectSettings: scala.Seq[sbt.Setting[?]] = Seq(
|
||||||
topLevelDemo := s"TopA: topLevelDemo project ${name.value}",
|
topLevelDemo := s"TopA: topLevelDemo project ${name.value}",
|
||||||
demo := s"TopA: demo project ${name.value}"
|
demo := s"TopA: demo project ${name.value}"
|
||||||
)
|
)
|
||||||
|
|
@ -31,7 +31,7 @@ object TopB extends AutoPlugin {
|
||||||
|
|
||||||
val autoImport = TopLevelImports
|
val autoImport = TopLevelImports
|
||||||
|
|
||||||
override def projectSettings: Seq[Setting[_]] = Seq(
|
override def projectSettings: Seq[Setting[?]] = Seq(
|
||||||
topLevelDemo := s"TopB: topLevelDemo project ${name.value}"
|
topLevelDemo := s"TopB: topLevelDemo project ${name.value}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,16 +48,16 @@ object Q extends AutoPlugin {
|
||||||
Quux ::
|
Quux ::
|
||||||
Nil
|
Nil
|
||||||
|
|
||||||
override def projectSettings: Seq[Setting[_]] =
|
override def projectSettings: Seq[Setting[?]] =
|
||||||
(demo := s"project ${name.value}") ::
|
(demo := s"project ${name.value}") ::
|
||||||
(Quux / del := " Q") ::
|
(Quux / del := " Q") ::
|
||||||
Nil
|
Nil
|
||||||
|
|
||||||
override def buildSettings: Seq[Setting[_]] =
|
override def buildSettings: Seq[Setting[?]] =
|
||||||
(demo := s"build ${buildCount.getAndIncrement}") ::
|
(demo := s"build ${buildCount.getAndIncrement}") ::
|
||||||
Nil
|
Nil
|
||||||
|
|
||||||
override def globalSettings: Seq[Setting[_]] =
|
override def globalSettings: Seq[Setting[?]] =
|
||||||
(demo := s"global ${globalCount.getAndIncrement}") ::
|
(demo := s"global ${globalCount.getAndIncrement}") ::
|
||||||
Nil
|
Nil
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ object DatabasePlugin extends AutoPlugin {
|
||||||
lazy val databaseName = settingKey[String]("name of the database")
|
lazy val databaseName = settingKey[String]("name of the database")
|
||||||
}
|
}
|
||||||
import autoImport._
|
import autoImport._
|
||||||
override def projectSettings: Seq[Setting[_]] =
|
override def projectSettings: Seq[Setting[?]] =
|
||||||
Seq(
|
Seq(
|
||||||
databaseName := "something"
|
databaseName := "something"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ object ExtraProjectPluginExample2 extends AutoPlugin {
|
||||||
override def requires: Plugins = sbt.plugins.CorePlugin
|
override def requires: Plugins = sbt.plugins.CorePlugin
|
||||||
override def trigger = allRequirements
|
override def trigger = allRequirements
|
||||||
|
|
||||||
override def derivedProjects(proj: ProjectDefinition[_]): Seq[Project] =
|
override def derivedProjects(proj: ProjectDefinition[?]): Seq[Project] =
|
||||||
// Make sure to exclude project extras to avoid recursive generation
|
// Make sure to exclude project extras to avoid recursive generation
|
||||||
if (proj.projectOrigin != ProjectOrigin.DerivedProject) {
|
if (proj.projectOrigin != ProjectOrigin.DerivedProject) {
|
||||||
val id = proj.id + "1"
|
val id = proj.id + "1"
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ case object MyPlugin extends AutoPlugin {
|
||||||
val helloWorld = Def.taskKey[String]("log and return hello world")
|
val helloWorld = Def.taskKey[String]("log and return hello world")
|
||||||
}
|
}
|
||||||
import autoImport._
|
import autoImport._
|
||||||
override def projectSettings: Seq[Def.Setting[_]] = Seq(
|
override def projectSettings: Seq[Def.Setting[?]] = Seq(
|
||||||
// should not produce a "@nowarn annotation does not suppress any warnings" warning
|
// should not produce a "@nowarn annotation does not suppress any warnings" warning
|
||||||
helloWorld := {
|
helloWorld := {
|
||||||
streams.value.log("Hello world")
|
streams.value.log("Hello world")
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,11 @@ object A extends AutoPlugin {
|
||||||
import autoImport._
|
import autoImport._
|
||||||
override def trigger = allRequirements
|
override def trigger = allRequirements
|
||||||
|
|
||||||
override def buildSettings: Seq[Setting[_]] =
|
override def buildSettings: Seq[Setting[?]] =
|
||||||
(foo := s"build ${buildCount.getAndIncrement}") ::
|
(foo := s"build ${buildCount.getAndIncrement}") ::
|
||||||
Nil
|
Nil
|
||||||
|
|
||||||
override def globalSettings: Seq[Setting[_]] =
|
override def globalSettings: Seq[Setting[?]] =
|
||||||
(foo := s"global ${globalCount.getAndIncrement}") ::
|
(foo := s"global ${globalCount.getAndIncrement}") ::
|
||||||
(commands += setUpScripted) ::
|
(commands += setUpScripted) ::
|
||||||
Nil
|
Nil
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import java.nio.file._
|
||||||
import sbt.nio.Keys._
|
import sbt.nio.Keys._
|
||||||
|
|
||||||
object Stamps {
|
object Stamps {
|
||||||
def check(key: TaskKey[_]): Def.Initialize[Task[Unit]] = Def.task {
|
def check(key: TaskKey[?]): Def.Initialize[Task[Unit]] = Def.task {
|
||||||
(key / inputFileStamps).value.map {
|
(key / inputFileStamps).value.map {
|
||||||
case (p, FileStamp.Hash(_)) =>
|
case (p, FileStamp.Hash(_)) =>
|
||||||
case (p, _) =>
|
case (p, _) =>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue