mirror of https://github.com/sbt/sbt.git
Implemented clean task + added integration test. Fixes #685
This commit is contained in:
parent
86de793517
commit
ebb7e66a26
|
|
@ -9,7 +9,7 @@ object CoursierPlugin extends AutoPlugin {
|
|||
|
||||
override def trigger = allRequirements
|
||||
|
||||
override def requires = sbt.plugins.IvyPlugin
|
||||
override def requires = sbt.plugins.JvmPlugin
|
||||
|
||||
object autoImport {
|
||||
val coursierParallelDownloads = Keys.coursierParallelDownloads
|
||||
|
|
@ -153,6 +153,11 @@ object CoursierPlugin extends AutoPlugin {
|
|||
shadedConfigOpt: Option[(String, String)],
|
||||
packageConfigs: Seq[(Configuration, String)]
|
||||
) = hackHack ++ Seq(
|
||||
clean := {
|
||||
clean.value
|
||||
Tasks.resolutionsCache.clear()
|
||||
Tasks.reportsCache.clear()
|
||||
},
|
||||
coursierResolvers := Tasks.coursierResolversTask.value,
|
||||
coursierRecursiveResolvers := Tasks.coursierRecursiveResolversTask.value,
|
||||
coursierSbtResolvers := {
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ object Tasks {
|
|||
}
|
||||
}
|
||||
|
||||
private final case class ResolutionCacheKey(
|
||||
private[coursier] final case class ResolutionCacheKey(
|
||||
project: Project,
|
||||
repositories: Seq[Repository],
|
||||
userEnabledProfiles: Set[String],
|
||||
|
|
@ -406,7 +406,7 @@ object Tasks {
|
|||
sbtClassifiers: Boolean
|
||||
)
|
||||
|
||||
private final case class ReportCacheKey(
|
||||
private[coursier] final case class ReportCacheKey(
|
||||
project: Project,
|
||||
resolution: Map[Set[String], Resolution],
|
||||
withClassifiers: Boolean,
|
||||
|
|
@ -414,10 +414,10 @@ object Tasks {
|
|||
ignoreArtifactErrors: Boolean
|
||||
)
|
||||
|
||||
private val resolutionsCache = new mutable.HashMap[ResolutionCacheKey, Map[Set[String], Resolution]]
|
||||
private[coursier] val resolutionsCache = new mutable.HashMap[ResolutionCacheKey, Map[Set[String], Resolution]]
|
||||
// these may actually not need to be cached any more, now that the resolutions
|
||||
// are cached
|
||||
private val reportsCache = new mutable.HashMap[ReportCacheKey, UpdateReport]
|
||||
private[coursier] val reportsCache = new mutable.HashMap[ReportCacheKey, UpdateReport]
|
||||
|
||||
private def forcedScalaModules(
|
||||
scalaOrganization: String,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
scalaVersion := "2.11.8"
|
||||
|
||||
val checkEmpty = TaskKey[Unit]("checkEmpty")
|
||||
|
||||
checkEmpty := {
|
||||
assert(coursier.Helper.checkEmpty)
|
||||
}
|
||||
|
||||
val checkNotEmpty = TaskKey[Unit]("checkNotEmpty")
|
||||
|
||||
checkNotEmpty := {
|
||||
assert(!coursier.Helper.checkEmpty)
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package coursier
|
||||
|
||||
object Helper {
|
||||
|
||||
def checkEmpty(): Boolean = {
|
||||
Tasks.resolutionsCache.isEmpty && Tasks.reportsCache.isEmpty
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
val pluginVersion = sys.props.getOrElse(
|
||||
"plugin.version",
|
||||
throw new RuntimeException(
|
||||
"""|The system property 'plugin.version' is not defined.
|
||||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
|
||||
)
|
||||
)
|
||||
|
||||
addSbtPlugin("io.get-coursier" % "sbt-coursier" % pluginVersion)
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
> checkEmpty
|
||||
> update
|
||||
> checkNotEmpty
|
||||
> clean
|
||||
> checkEmpty
|
||||
Loading…
Reference in New Issue