diff options
-rw-r--r-- | scalalib/src/mill/scalalib/JavaModule.scala | 9 | ||||
-rw-r--r-- | scalalib/src/mill/scalalib/ScalaModule.scala | 6 | ||||
-rw-r--r-- | scalalib/test/src/mill/scalalib/HelloWorldTests.scala | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/scalalib/src/mill/scalalib/JavaModule.scala b/scalalib/src/mill/scalalib/JavaModule.scala index ac162db7..3907b6a6 100644 --- a/scalalib/src/mill/scalalib/JavaModule.scala +++ b/scalalib/src/mill/scalalib/JavaModule.scala @@ -78,7 +78,7 @@ trait JavaModule extends mill.Module with TaskModule { outer => )().flatten } - def mapDependencies(d: coursier.Dependency) = d + def mapDependencies = T.task{ d: coursier.Dependency => d } def resolveDeps(deps: Task[Agg[Dep]], sources: Boolean = false) = T.task{ resolveDependencies( @@ -86,7 +86,7 @@ trait JavaModule extends mill.Module with TaskModule { outer => resolveCoursierDependency().apply(_), deps(), sources, - mapDependencies = Some(mapDependencies) + mapDependencies = Some(mapDependencies()) ) } @@ -241,7 +241,10 @@ trait JavaModule extends mill.Module with TaskModule { outer => def ivyDepsTree(inverse: Boolean = false) = T.command { val (flattened, resolution) = Lib.resolveDependenciesMetadata( - repositories, resolveCoursierDependency().apply(_), transitiveIvyDeps(), Some(mapDependencies) + repositories, + resolveCoursierDependency().apply(_), + transitiveIvyDeps(), + Some(mapDependencies()) ) println(coursier.util.Print.dependencyTree(flattened, resolution, diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala index 35ffbbdd..9262b6e0 100644 --- a/scalalib/src/mill/scalalib/ScalaModule.scala +++ b/scalalib/src/mill/scalalib/ScalaModule.scala @@ -27,6 +27,12 @@ trait ScalaModule extends JavaModule { outer => } def scalaVersion: T[String] + override def mapDependencies = T.task{ d: coursier.Dependency => + val artifacts = Set("scala-library", "scala-compiler", "scala-reflect") + if (d.module.organization != "org.scala-lang" || !artifacts(d.module.name)) d + else d.copy(version = scalaVersion()) + } + override def resolveCoursierDependency: Task[Dep => coursier.Dependency] = T.task{ Lib.depToDependency(_: Dep, scalaVersion(), platformSuffix()) } diff --git a/scalalib/test/src/mill/scalalib/HelloWorldTests.scala b/scalalib/test/src/mill/scalalib/HelloWorldTests.scala index 81a5b8a6..7a1dd6df 100644 --- a/scalalib/test/src/mill/scalalib/HelloWorldTests.scala +++ b/scalalib/test/src/mill/scalalib/HelloWorldTests.scala @@ -190,7 +190,7 @@ object HelloWorldTests extends TestSuite { object HelloWorldTypeLevel extends HelloBase{ object foo extends ScalaModule { def scalaVersion = "2.11.8" - override def mapDependencies(d: coursier.Dependency) = { + override def mapDependencies = T.task{ d: coursier.Dependency => val artifacts = Set("scala-library", "scala-compiler", "scala-reflect") if (d.module.organization != "org.scala-lang" || !artifacts(d.module.name)) d else d.copy(module = d.module.copy(organization = "org.typelevel")) |