summaryrefslogtreecommitdiff
path: root/scalalib/src/mill/scalalib/ScalaModule.scala
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-04-06 19:40:03 -0700
committerLi Haoyi <haoyi.sg@gmail.com>2018-04-06 19:40:03 -0700
commitb9e9b6827da900a1c3565ebbd4a18f1657d6114c (patch)
tree5bf2e1239f9fed2490a6af791b6f1fb81b76e3d3 /scalalib/src/mill/scalalib/ScalaModule.scala
parent26865c6623d57b7a5d774c7bbfe5897609e11acf (diff)
downloadmill-b9e9b6827da900a1c3565ebbd4a18f1657d6114c.tar.gz
mill-b9e9b6827da900a1c3565ebbd4a18f1657d6114c.tar.bz2
mill-b9e9b6827da900a1c3565ebbd4a18f1657d6114c.zip
basic support for version pinning (used by default for scala-library/compiler) and for typelevel scala
Diffstat (limited to 'scalalib/src/mill/scalalib/ScalaModule.scala')
-rw-r--r--scalalib/src/mill/scalalib/ScalaModule.scala27
1 files changed, 17 insertions, 10 deletions
diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala
index ed176269..562b60d6 100644
--- a/scalalib/src/mill/scalalib/ScalaModule.scala
+++ b/scalalib/src/mill/scalalib/ScalaModule.scala
@@ -2,7 +2,7 @@ package mill
package scalalib
import ammonite.ops._
-import coursier.Repository
+import coursier.{Dependency, Repository}
import mill.define.Task
import mill.define.TaskModule
import mill.eval.{PathRef, Result}
@@ -86,13 +86,16 @@ trait ScalaModule extends mill.Module with TaskModule { outer =>
)().flatten
}
+ def mapDependencies(d: coursier.Dependency) = d
+
def resolveDeps(deps: Task[Agg[Dep]], sources: Boolean = false) = T.task{
resolveDependencies(
repositories,
scalaVersion(),
deps(),
platformSuffix(),
- sources
+ sources,
+ mapDependencies = Some(mapDependencies)
)
}
@@ -263,12 +266,9 @@ trait ScalaModule extends mill.Module with TaskModule { outer =>
}
def ivyDepsTree(inverse: Boolean = false) = T.command {
- import coursier.{Cache, Fetch, Resolution}
-
- val flattened = ivyDeps().map(depToDependency(_, scalaVersion(), platformSuffix())).toSeq
- val start = Resolution(flattened.toSet)
- val fetch = Fetch.from(repositories, Cache.fetch())
- val resolution = start.process.run(fetch).unsafePerformSync
+ val (flattened, resolution) = Lib.resolveDependenciesMetadata(
+ repositories, scalaVersion(), ivyDeps(), platformSuffix(), Some(mapDependencies)
+ )
println(coursier.util.Print.dependencyTree(flattened, resolution,
printExclusions = false, reverse = inverse))
@@ -330,15 +330,22 @@ trait ScalaModule extends mill.Module with TaskModule { outer =>
}
def ammoniteReplClasspath = T{
- resolveDeps(T.task{Agg(ivy"com.lihaoyi:::ammonite:1.1.0-7-33b728c")})()
+ localClasspath() ++
+ transitiveLocalClasspath() ++
+ unmanagedClasspath() ++
+ resolveDeps(T.task{
+ runIvyDeps() ++ scalaLibraryIvyDeps() ++ transitiveIvyDeps() ++
+ Agg(ivy"com.lihaoyi:::ammonite:1.1.0-7-33b728c")
+ })()
}
+
def repl() = T.command{
if (T.ctx().log.inStream == DummyInputStream){
Result.Failure("repl needs to be run with the -i/--interactive flag")
}else{
Jvm.interactiveSubprocess(
mainClass = "ammonite.Main",
- classPath = runClasspath().map(_.path) ++ ammoniteReplClasspath().map(_.path),
+ classPath = ammoniteReplClasspath().map(_.path),
mainArgs = Nil,
workingDir = pwd
)