mirror of https://github.com/sbt/sbt.git
Drop deprecated InputTask apply method
This commit is contained in:
parent
01b19f0218
commit
91354497ab
|
|
@ -91,10 +91,6 @@ object InputTask {
|
|||
separate(p)(act)
|
||||
}
|
||||
|
||||
@deprecated("Use another InputTask constructor or the `Def.inputTask` macro.", "0.13.0")
|
||||
def apply[I, T](p: State => Parser[I])(action: TaskKey[I] => Initialize[Task[T]]): Initialize[InputTask[T]] =
|
||||
apply(Def.value(p))(action)
|
||||
|
||||
/**
|
||||
* The proper solution is to have a Manifest context bound and accept slight source incompatibility,
|
||||
* The affected InputTask construction methods are all deprecated and so it is better to keep complete
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@ import complete.DefaultParsers._
|
|||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
resolvers ++= Seq(local, Resolver.sonatypeRepo("releases"), Resolver.sonatypeRepo("snapshots")),
|
||||
InputKey[Unit]("checkPom") := (InputTask(_ => spaceDelimited("<args>")) { result => (makePom, result, streams) map checkPomRepositories }).evaluated,
|
||||
InputKey[Unit]("checkPom") := {
|
||||
val result = spaceDelimited("<args>").parsed
|
||||
checkPomRepositories(makePom.value, result, streams.value)
|
||||
},
|
||||
makePomConfiguration := ((makePomConfiguration, baseDirectory) { (conf, base) =>
|
||||
conf.copy(filterRepositories = pomIncludeRepository(base, conf.filterRepositories) )
|
||||
}).value,
|
||||
|
|
|
|||
|
|
@ -9,17 +9,17 @@ lazy val root = (project in file(".")).
|
|||
managedClasspath in Provided := ((classpathTypes, update) map { (cpts, report) => Classpaths.managedJars(Provided, cpts, report) }).value
|
||||
)
|
||||
|
||||
def checkTask = InputTask(_ => parser ) { result =>
|
||||
(result, managedClasspath in Provided, fullClasspath in Compile, fullClasspath in Test, fullClasspath in Runtime) map { case ((conf, names), p, c, t, r) =>
|
||||
println("Checking: " + conf.name)
|
||||
checkClasspath(conf match {
|
||||
case Provided => p
|
||||
case Compile => c
|
||||
case Test => t
|
||||
case Runtime => r
|
||||
}, names.toSet)
|
||||
}
|
||||
}
|
||||
def checkTask = Def.inputTask {
|
||||
val result = parser.parsed
|
||||
val (conf, names) = result
|
||||
println("Checking: " + conf.name)
|
||||
checkClasspath(conf match {
|
||||
case Provided => managedClasspath in Provided value
|
||||
case Compile => fullClasspath in Compile value
|
||||
case Test => fullClasspath in Test value
|
||||
case Runtime => fullClasspath in Runtime value
|
||||
}, names.toSet)
|
||||
}
|
||||
|
||||
lazy val check = InputKey[Unit]("check")
|
||||
def parser: Parser[(Configuration,Seq[String])] = (Space ~> token(cp(Compile) | cp(Runtime) | cp(Provided) | cp(Test))) ~ spaceDelimited("<module-names>")
|
||||
|
|
|
|||
|
|
@ -5,26 +5,30 @@ val check = InputKey[Unit]("check")
|
|||
|
||||
lazy val root = (project in file(".")).
|
||||
settings(
|
||||
provided := baseDirectory(_ / "useProvided" exists).value,
|
||||
configuration := provided(p => if(p) Provided else Compile).value,
|
||||
libraryDependencies += configuration(c => "javax.servlet" % "servlet-api" % "2.5" % c.name).value,
|
||||
managedClasspath in Provided := ((classpathTypes, update) map { (cpts, report) => Classpaths.managedJars(Provided, cpts, report) }).value,
|
||||
check := (InputTask(_ => Space ~> token(Compile.name.id | Runtime.name | Provided.name | Test.name) ~ token(Space ~> Bool)) { result =>
|
||||
(result, managedClasspath in Provided, fullClasspath in Runtime, fullClasspath in Compile, fullClasspath in Test) map { case ((conf, expected), p, r, c, t) =>
|
||||
val cp = if(conf == Compile.name) c else if(conf == Runtime.name) r else if(conf == Provided.name) p else if(conf == Test.name) t else sys.error("Invalid config: " + conf)
|
||||
checkServletAPI(cp.files, expected, conf)
|
||||
provided := (baseDirectory.value / "useProvided" exists),
|
||||
configuration := (if (provided.value) Provided else Compile),
|
||||
libraryDependencies += "javax.servlet" % "servlet-api" % "2.5" % configuration.value.name,
|
||||
managedClasspath in Provided := Classpaths.managedJars(Provided, classpathTypes.value, update.value),
|
||||
check := {
|
||||
val result = (
|
||||
Space ~> token(Compile.name.id | Runtime.name | Provided.name | Test.name) ~ token(Space ~> Bool)
|
||||
).parsed
|
||||
val (conf, expected) = result
|
||||
val cp = conf match {
|
||||
case Compile.name => (fullClasspath in Compile).value
|
||||
case Runtime.name => (fullClasspath in Runtime).value
|
||||
case Provided.name => (managedClasspath in Provided).value
|
||||
case Test.name => (fullClasspath in Test).value
|
||||
case _ => sys.error(s"Invalid config: $conf")
|
||||
}
|
||||
}).evaluated
|
||||
checkServletAPI(cp.files, expected, conf)
|
||||
}
|
||||
)
|
||||
|
||||
def checkServletAPI(paths: Seq[File], shouldBeIncluded: Boolean, label: String) =
|
||||
{
|
||||
val servletAPI = paths.find(_.getName contains "servlet-api")
|
||||
if(shouldBeIncluded)
|
||||
{
|
||||
if(servletAPI.isEmpty)
|
||||
sys.error("Servlet API should have been included in " + label + ".")
|
||||
}
|
||||
else
|
||||
servletAPI.foreach(s => sys.error(s + " incorrectly included in " + label + "."))
|
||||
}
|
||||
def checkServletAPI(paths: Seq[File], shouldBeIncluded: Boolean, label: String) = {
|
||||
val servletAPI = paths.find(_.getName contains "servlet-api")
|
||||
if (shouldBeIncluded) {
|
||||
if (servletAPI.isEmpty) sys.error(s"Servlet API should have been included in $label.")
|
||||
} else
|
||||
servletAPI foreach (s => sys.error(s"$s incorrectly included in $label."))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue