diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-03-26 20:16:43 -0700 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-03-26 20:16:43 -0700 |
commit | 25b321ea9431590d5852366585f1691717651fea (patch) | |
tree | 7416fc038f41fbb0c4b7493f6a4827d0cf53e000 /scalalib/src | |
parent | c27a29058e990c5aa965bf71e19290de7f9793b4 (diff) | |
download | mill-25b321ea9431590d5852366585f1691717651fea.tar.gz mill-25b321ea9431590d5852366585f1691717651fea.tar.bz2 mill-25b321ea9431590d5852366585f1691717651fea.zip |
Ensure that transitive ivy jars are not directly aggregated under a module's `runClasspath`; only the ivy coordinates are aggregated, and every module resolves it's own set of ivy jars using coursier, which avoids duplicate jars entering the classpath through ivy
Fixes https://github.com/lihaoyi/mill/issues/211
Diffstat (limited to 'scalalib/src')
-rw-r--r-- | scalalib/src/mill/scalalib/ScalaModule.scala | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala index 08e87909..fdc83cbf 100644 --- a/scalalib/src/mill/scalalib/ScalaModule.scala +++ b/scalalib/src/mill/scalalib/ScalaModule.scala @@ -79,8 +79,10 @@ trait ScalaModule extends mill.Module with TaskModule { outer => Task.traverse(moduleDeps)(_.compile) } - def upstreamRunClasspath: T[Agg[PathRef]] = T{ - Task.traverse(moduleDeps)(_.runClasspath)().flatten + def transitiveLocalClasspath: T[Agg[PathRef]] = T{ + Task.traverse(moduleDeps)(m => + T.task{m.localClasspath() ++ m.transitiveLocalClasspath()} + )().flatten } def resolveDeps(deps: Task[Agg[Dep]], sources: Boolean = false) = T.task{ @@ -170,25 +172,25 @@ trait ScalaModule extends mill.Module with TaskModule { outer => upstreamCompileOutput() ) } - + def localClasspath = T{ + resources() ++ Agg(compile().classes) + } def compileClasspath = T{ - upstreamRunClasspath() ++ + transitiveLocalClasspath() ++ resources() ++ unmanagedClasspath() ++ resolveDeps(T.task{compileIvyDeps() ++ scalaLibraryIvyDeps() ++ transitiveIvyDeps()})() } def upstreamAssemblyClasspath = T{ - upstreamRunClasspath() ++ + transitiveLocalClasspath() ++ unmanagedClasspath() ++ resolveDeps(T.task{runIvyDeps() ++ scalaLibraryIvyDeps() ++ transitiveIvyDeps()})() } def runClasspath = T{ - Agg(compile().classes) ++ - resources() ++ + localClasspath() ++ upstreamAssemblyClasspath() - } /** @@ -203,7 +205,7 @@ trait ScalaModule extends mill.Module with TaskModule { outer => def assembly = T{ createAssembly( - Agg.from(resources().map(_.path)) ++ Agg(compile().classes.path), + Agg.from(localClasspath().map(_.path)), mainClass(), prependShellScript(), Some(upstreamAssembly().path) @@ -213,7 +215,7 @@ trait ScalaModule extends mill.Module with TaskModule { outer => def jar = T{ createJar( - (resources() ++ Seq(compile().classes)).map(_.path).filter(exists), + localClasspath().map(_.path).filter(exists), mainClass() ) } |