Permalink
Browse files

Address more warnings

  • Loading branch information...
alexarchambault committed May 16, 2017
1 parent 6e0c6c3 commit f23fbda1bad487e334e27e470d9b3197d437f6ac
@@ -64,33 +64,34 @@ object Tasks {
}
def coursierRecursiveResolversTask: Def.Initialize[sbt.Task[Seq[Resolver]]] =
(
sbt.Keys.state,
sbt.Keys.thisProjectRef
).flatMap { (state, projectRef) =>
Def.taskDyn {
val state = sbt.Keys.state.value
val projectRef = sbt.Keys.thisProjectRef.value
val projects = allRecursiveInterDependencies(state, projectRef)
coursierResolvers
val t = coursierResolvers
.forAllProjects(state, projectRef +: projects)
.map(_.values.toVector.flatten)
Def.task(t.value)
}
def coursierFallbackDependenciesTask: Def.Initialize[sbt.Task[Seq[(Module, String, URL, Boolean)]]] =
(
sbt.Keys.state,
sbt.Keys.thisProjectRef
).flatMap { (state, projectRef) =>
Def.taskDyn {
val state = sbt.Keys.state.value
val projectRef = sbt.Keys.thisProjectRef.value
val projects = allRecursiveInterDependencies(state, projectRef)
val allDependenciesTask = allDependencies
.forAllProjects(state, projectRef +: projects)
.map(_.values.toVector.flatten)
for {
allDependencies <- allDependenciesTask
} yield {
Def.task {
val allDependencies = allDependenciesTask.value
FromSbt.fallbackDependencies(
allDependencies,
@@ -101,10 +102,10 @@ object Tasks {
}
def coursierProjectTask: Def.Initialize[sbt.Task[Project]] =
(
sbt.Keys.state,
sbt.Keys.thisProjectRef
).flatMap { (state, projectRef) =>
Def.taskDyn {
val state = sbt.Keys.state.value
val projectRef = sbt.Keys.thisProjectRef.value
// should projectID.configurations be used instead?
val configurations = ivyConfigurations.in(projectRef).get(state)
@@ -140,9 +141,9 @@ object Tasks {
res
}
for {
allDependencies <- allDependenciesTask
} yield {
Def.task {
val allDependencies = allDependenciesTask.value
val configMap = configurations.map(cfg => cfg.name -> cfg.extendsConfigs.map(_.name)).toMap
@@ -164,14 +165,16 @@ object Tasks {
}
def coursierInterProjectDependenciesTask: Def.Initialize[sbt.Task[Seq[Project]]] =
(
sbt.Keys.state,
sbt.Keys.thisProjectRef
).flatMap { (state, projectRef) =>
Def.taskDyn {
val state = sbt.Keys.state.value
val projectRef = sbt.Keys.thisProjectRef.value
val projects = allRecursiveInterDependencies(state, projectRef)
coursierProject.forAllProjects(state, projects).map(_.values.toVector)
val t = coursierProject.forAllProjects(state, projects).map(_.values.toVector)
Def.task(t.value)
}
def coursierPublicationsTask(
@@ -405,8 +408,10 @@ object Tasks {
}
def parentProjectCacheTask: Def.Initialize[sbt.Task[Map[Seq[sbt.Resolver],Seq[coursier.ProjectCache]]]] =
(sbt.Keys.state,
sbt.Keys.thisProjectRef).flatMap{ (state, projectRef) =>
Def.taskDyn {
val state = sbt.Keys.state.value
val projectRef = sbt.Keys.thisProjectRef.value
val projectDeps = structure(state).allProjects
.find(_.id == projectRef.project)
@@ -415,14 +420,22 @@ object Tasks {
val projects = structure(state).allProjectRefs.filter(p => projectDeps(p.project))
coursierRecursiveResolvers.forAllProjects(state, projects).flatMap{ m =>
coursierResolution.forAllProjects(state, m.keys.toSeq).map{ n =>
n.foldLeft(Map.empty[Seq[Resolver], Seq[ProjectCache]]){ case (caches, (ref, resolution)) =>
m.get(ref).fold(caches)(resolvers =>
caches.updated(resolvers, resolution.projectCache +: caches.getOrElse(resolvers, Seq.empty)))
val t =
for {
m <- coursierRecursiveResolvers.forAllProjects(state, projects)
n <- coursierResolution.forAllProjects(state, m.keys.toSeq)
} yield
n.foldLeft(Map.empty[Seq[Resolver], Seq[ProjectCache]]) {
case (caches, (ref, resolution)) =>
m.get(ref).fold(caches) { resolvers =>
caches.updated(
resolvers,
resolution.projectCache +: caches.getOrElse(resolvers, Nil)
)
}
}
}
}
Def.task(t.value)
}
private val noOptionalFilter: Option[Dependency => Boolean] = Some(dep => !dep.optional)
@@ -239,8 +239,16 @@ object ResolutionTests extends TestSuite {
Set(dep)
))
// A missing POM dependency is not reported correctly. That's why the method is deprecated.
assert(res.errors == Seq.empty)
val directDependencyErrors =
for {
dep <- res.dependencies.toSeq
err <- res.errorCache
.get(dep.moduleVersion)
.toSeq
} yield (dep, err)
// Error originates from a dependency import, not directly from a dependency
assert(directDependencyErrors.isEmpty)
// metadataErrors have that
assert(res.metadataErrors == Seq((Module("acme", "missing-pom"), "1.0.0") -> List("Not found")))
@@ -126,7 +126,7 @@ <h1>Coursier</h1>
</script>
<script>
coursier.web.Main().main();
CoursierWeb.main();
</script>
</body>
@@ -1,10 +1,11 @@
package coursier.web
import japgolly.scalajs.react.React
import scala.scalajs.js.annotation.JSExport
import scala.scalajs.js.annotation.{JSExport, JSExportTopLevel}
import org.scalajs.dom.document
@JSExport
@JSExportTopLevel("CoursierWeb")
object Main {
@JSExport
def main(): Unit = {

0 comments on commit f23fbda

Please sign in to comment.