diff options
Diffstat (limited to 'scalalib/src')
-rw-r--r-- | scalalib/src/mill/scalalib/JavaModule.scala | 9 | ||||
-rw-r--r-- | scalalib/src/mill/scalalib/ScalaModule.scala | 6 |
2 files changed, 12 insertions, 3 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()) } |