From c820e54a2c5bab47627f9ddcc05252660f9ce8e7 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 11 Feb 2018 02:03:49 -0800 Subject: more tidying up --- build.sc | 6 +++--- integration/test/resources/ammonite/build.sc | 2 +- scalalib/src/mill/scalalib/ScalaModule.scala | 23 +++++++++++----------- scalalib/src/mill/scalalib/ScalaWorkerApi.scala | 1 - scalaworker/src/mill/scalaworker/ScalaWorker.scala | 5 ++--- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/build.sc b/build.sc index 80a0db03..b55e0ca0 100755 --- a/build.sc +++ b/build.sc @@ -72,7 +72,7 @@ object core extends MillModule { ivy"com.lihaoyi:::ammonite:1.0.3-21-05b5d32" ) - def generatedSources = T.sources { + def generatedSources = T { shared.generateCoreSources(T.ctx().dest) } } @@ -84,13 +84,13 @@ object main extends MillModule { ivy"org.scala-lang:scala-reflect:${scalaVersion()}" ) - def generatedSources = T.sources { + def generatedSources = T { shared.generateCoreSources(T.ctx().dest) } val test = new Tests(implicitly) class Tests(ctx0: mill.define.Ctx) extends super.Tests(ctx0){ - def generatedSources = T.sources { + def generatedSources = T { shared.generateCoreTestSources(T.ctx().dest) } } diff --git a/integration/test/resources/ammonite/build.sc b/integration/test/resources/ammonite/build.sc index 4f67604b..fd802ddf 100644 --- a/integration/test/resources/ammonite/build.sc +++ b/integration/test/resources/ammonite/build.sc @@ -56,7 +56,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions:_*){ ivy"org.scalaj::scalaj-http:2.3.0" ) - def generatedSources = T.sources{ + def generatedSources = T{ import ammonite.ops._ cp(build.millSourcePath/'project/"Constants.scala", T.ctx().dest/"Constants.scala") T.ctx().dest diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala index 339c6623..b7810246 100644 --- a/scalalib/src/mill/scalalib/ScalaModule.scala +++ b/scalalib/src/mill/scalalib/ScalaModule.scala @@ -33,12 +33,9 @@ trait ScalaModule extends mill.Module with TaskModule { outer => def scalacOptions = T{ Seq.empty[String] } def javacOptions = T{ Seq.empty[String] } - def repositories: Seq[Repository] = Seq( - Cache.ivy2Local, - MavenRepository("https://repo1.maven.org/maven2") - ) - def moduleDeps = Seq.empty[ScalaModule] + + def transitiveModuleDeps: Seq[ScalaModule] = { Seq(this) ++ moduleDeps.flatMap(_.transitiveModuleDeps).distinct } @@ -66,9 +63,15 @@ trait ScalaModule extends mill.Module with TaskModule { outer => ) } + + def repositories: Seq[Repository] = Seq( + Cache.ivy2Local, + MavenRepository("https://repo1.maven.org/maven2") + ) + def platformSuffix = T{ "" } - def compilerBridgeSources = T{ + def scalaCompilerBridgeSources = T{ resolveDependencies( repositories, scalaVersion(), @@ -96,17 +99,16 @@ trait ScalaModule extends mill.Module with TaskModule { outer => def sources = T.sources{ millSourcePath / 'src } def resources = T.sources{ millSourcePath / 'resources } - def generatedSources = T.sources() + def generatedSources = T{ Seq.empty[PathRef] } def allSources = T{ sources() ++ generatedSources() } def compile: T[CompilationResult] = T.persistent{ mill.scalalib.ScalaWorkerApi.scalaWorker().compileScala( scalaVersion(), allSources().map(_.path), - compilerBridgeSources().map(_.path), + scalaCompilerBridgeSources().map(_.path), compileClasspath().map(_.path), scalaCompilerClasspath().map(_.path), - scalacPluginClasspath().map(_.path), scalacOptions(), scalacPluginClasspath().map(_.path), javacOptions(), @@ -137,11 +139,10 @@ trait ScalaModule extends mill.Module with TaskModule { outer => ) } - def localClasspath = T{ resources() ++ Seq(compile().classes) } def jar = T{ createJar( - localClasspath().map(_.path).filter(exists), + (resources() ++ Seq(compile().classes)).map(_.path).filter(exists), mainClass() ) } diff --git a/scalalib/src/mill/scalalib/ScalaWorkerApi.scala b/scalalib/src/mill/scalalib/ScalaWorkerApi.scala index b01409c1..03cd7d9d 100644 --- a/scalalib/src/mill/scalalib/ScalaWorkerApi.scala +++ b/scalalib/src/mill/scalalib/ScalaWorkerApi.scala @@ -51,7 +51,6 @@ trait ScalaWorkerApi { compileBridgeSources: Agg[Path], compileClasspath: Agg[Path], compilerClasspath: Agg[Path], - pluginClasspath: Agg[Path], scalacOptions: Seq[String], scalacPluginClasspath: Agg[Path], javacOptions: Seq[String], diff --git a/scalaworker/src/mill/scalaworker/ScalaWorker.scala b/scalaworker/src/mill/scalaworker/ScalaWorker.scala index 4430f710..3990d9dc 100644 --- a/scalaworker/src/mill/scalaworker/ScalaWorker.scala +++ b/scalaworker/src/mill/scalaworker/ScalaWorker.scala @@ -104,7 +104,6 @@ class ScalaWorker(ctx0: mill.util.Ctx, compileBridgeSources: Agg[Path], compileClasspath: Agg[Path], compilerClasspath: Agg[Path], - pluginClasspath: Agg[Path], scalacOptions: Seq[String], scalacPluginClasspath: Agg[Path], javacOptions: Seq[String], @@ -115,11 +114,11 @@ class ScalaWorker(ctx0: mill.util.Ctx, val compilerBridge = compileZincBridge(scalaVersion, compileBridgeSources, compilerJars) - val pluginJars = pluginClasspath.toArray.map(_.toIO) + val pluginJars = scalacPluginClasspath.toArray.map(_.toIO) val compilerClassloaderSig = compilerClasspath.map(p => p.toString().hashCode + p.mtime.toMillis).sum val scalaInstanceSig = - compilerClassloaderSig + pluginClasspath.map(p => p.toString().hashCode + p.mtime.toMillis).sum + compilerClassloaderSig + scalacPluginClasspath.map(p => p.toString().hashCode + p.mtime.toMillis).sum val compilerClassLoader = scalaClassloaderCache match{ case Some((k, v)) if k == compilerClassloaderSig => v -- cgit v1.2.3