From 84c802a9f9e08a16d1b9bd4f35d805bb897ec8f6 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Wed, 15 Sep 2021 21:24:59 +0200 Subject: [PATCH 1/2] Deprecated toolsClasspath targets in favor of uniquely named new ones --- .../src/mill/playlib/RouterModule.scala | 21 +++++---- contrib/scoverage/src/ScoverageModule.scala | 7 ++- contrib/scoverage/src/ScoverageReport.scala | 2 +- scalajslib/src/ScalaJSModule.scala | 47 ++++++++++--------- 4 files changed, 46 insertions(+), 31 deletions(-) diff --git a/contrib/playlib/src/mill/playlib/RouterModule.scala b/contrib/playlib/src/mill/playlib/RouterModule.scala index a23d6fc4804..c578095b6aa 100644 --- a/contrib/playlib/src/mill/playlib/RouterModule.scala +++ b/contrib/playlib/src/mill/playlib/RouterModule.scala @@ -64,14 +64,14 @@ trait RouterModule extends ScalaModule with Version { def compileRouter: T[CompilationResult] = T.persistent { T.log.debug(s"compiling play routes with ${playVersion()} worker") routeCompilerWorker.routeCompilerWorker().compile( - toolsClasspath().map(_.path), - routeFiles().map(_.path), - routesAdditionalImport, - generateForwardsRouter, - generateReverseRouter, - namespaceReverseRouter, - generatorType, - T.dest + routerClasspath = playRouterToolsClasspath().map(_.path), + files = routeFiles().map(_.path), + additionalImports = routesAdditionalImport, + forwardsRouter = generateForwardsRouter, + reverseRouter = generateReverseRouter, + namespaceReverseRouter = namespaceReverseRouter, + generatorType = generatorType, + dest = T.dest ) } @@ -90,7 +90,12 @@ trait RouterModule extends ScalaModule with Version { ) } + @deprecated("Use playRouterToolsClasspath instead", "mill after 0.10.0-M1") def toolsClasspath = T { + playRouterToolsClasspath() + } + + def playRouterToolsClasspath = T { playRouteCompilerWorkerClasspath() ++ routerClasspath() } diff --git a/contrib/scoverage/src/ScoverageModule.scala b/contrib/scoverage/src/ScoverageModule.scala index 4758a6de0df..049172e281b 100644 --- a/contrib/scoverage/src/ScoverageModule.scala +++ b/contrib/scoverage/src/ScoverageModule.scala @@ -63,7 +63,12 @@ trait ScoverageModule extends ScalaModule { outer: ScalaModule => ivy"org.scoverage:::scalac-scoverage-plugin:${outer.scoverageVersion()}" } + @deprecated("Use scoverageToolsClasspath instead.", "mill after 0.10.0-M1") def toolsClasspath: T[Agg[PathRef]] = T { + scoverageToolsClasspath() + } + + def scoverageToolsClasspath: T[Agg[PathRef]] = T { scoverageReportWorkerClasspath() ++ resolveDeps(T.task { Agg(ivy"org.scoverage:scalac-scoverage-plugin_${mill.BuildInfo.scalaVersion}:${outer.scoverageVersion()}") @@ -90,7 +95,7 @@ trait ScoverageModule extends ScalaModule { outer: ScalaModule => def doReport(reportType: ReportType): Task[Unit] = T.task { ScoverageReportWorker .scoverageReportWorker() - .bridge(toolsClasspath().map(_.path)) + .bridge(scoverageToolsClasspath().map(_.path)) .report(reportType, allSources().map(_.path), Seq(data().path)) } diff --git a/contrib/scoverage/src/ScoverageReport.scala b/contrib/scoverage/src/ScoverageReport.scala index 31e95460190..fb85ec88cd1 100644 --- a/contrib/scoverage/src/ScoverageReport.scala +++ b/contrib/scoverage/src/ScoverageReport.scala @@ -104,7 +104,7 @@ trait ScoverageReport extends Module { val dataPaths: Seq[Path] = T.sequence(dataTasks)().map(_.path) scoverageReportWorkerModule .scoverageReportWorker() - .bridge(workerModule.toolsClasspath().map(_.path)) + .bridge(workerModule.scoverageToolsClasspath().map(_.path)) .report(reportType, sourcePaths, dataPaths) PathRef(T.dest) } diff --git a/scalajslib/src/ScalaJSModule.scala b/scalajslib/src/ScalaJSModule.scala index ed8db829279..d944a429366 100644 --- a/scalajslib/src/ScalaJSModule.scala +++ b/scalajslib/src/ScalaJSModule.scala @@ -64,31 +64,34 @@ trait ScalaJSModule extends scalalib.ScalaModule { outer => ) } - def toolsClasspath = T { scalaJSWorkerClasspath() ++ scalaJSLinkerClasspath() } + @deprecated("Use scalaJsToolsClasspath instead", "mill after 0.10.0-M1") + def toolsClasspath = T { scalaJsToolsClasspath() } + + def scalaJsToolsClasspath = T { scalaJSWorkerClasspath() ++ scalaJSLinkerClasspath() } def fastOpt = T { link( - ScalaJSWorkerApi.scalaJSWorker(), - toolsClasspath(), - runClasspath(), - finalMainClassOpt().toOption, + worker = ScalaJSWorkerApi.scalaJSWorker(), + toolsClasspath = scalaJsToolsClasspath(), + runClasspath = runClasspath(), + mainClass = finalMainClassOpt().toOption, testBridgeInit = false, - FastOpt, - moduleKind(), - useECMAScript2015() + mode = FastOpt, + moduleKind = moduleKind(), + useECMAScript2015 = useECMAScript2015() ) } def fullOpt = T { link( - ScalaJSWorkerApi.scalaJSWorker(), - toolsClasspath(), - runClasspath(), - finalMainClassOpt().toOption, + worker = ScalaJSWorkerApi.scalaJSWorker(), + toolsClasspath = scalaJsToolsClasspath(), + runClasspath = runClasspath(), + mainClass = finalMainClassOpt().toOption, testBridgeInit = false, - FullOpt, - moduleKind(), - useECMAScript2015() + mode = FullOpt, + moduleKind = moduleKind(), + useECMAScript2015 = useECMAScript2015() ) } @@ -99,7 +102,7 @@ trait ScalaJSModule extends scalalib.ScalaModule { outer => case Left(err) => Result.Failure(err) case Right(_) => ScalaJSWorkerApi.scalaJSWorker().run( - toolsClasspath().map(_.path), + scalaJsToolsClasspath().map(_.path), jsEnvConfig(), fastOpt().path.toIO ) @@ -150,9 +153,11 @@ trait ScalaJSModule extends scalalib.ScalaModule { outer => ).map(PathRef(_)) } - override def mandatoryScalacOptions = super.mandatoryScalacOptions() ++ { - if (isScala3(scalaVersion())) Seq("-scalajs") - else Seq.empty + override def mandatoryScalacOptions = T { + super.mandatoryScalacOptions() ++ { + if (isScala3(scalaVersion())) Seq("-scalajs") + else Seq.empty + } } override def scalacPluginIvyDeps = T { @@ -204,7 +209,7 @@ trait TestScalaJSModule extends ScalaJSModule with TestModule { def fastOptTest = T { link( ScalaJSWorkerApi.scalaJSWorker(), - toolsClasspath(), + scalaJsToolsClasspath(), scalaJSTestDeps() ++ runClasspath(), None, testBridgeInit = true, @@ -222,7 +227,7 @@ trait TestScalaJSModule extends ScalaJSModule with TestModule { ): Task[(String, Seq[TestRunner.Result])] = T.task { val (close, framework) = mill.scalajslib.ScalaJSWorkerApi.scalaJSWorker().getFramework( - toolsClasspath().map(_.path), + scalaJsToolsClasspath().map(_.path), jsEnvConfig(), testFramework(), fastOptTest().path.toIO, From 50d6f89b2bbdcbd085be2cee38a19840849e7809 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Thu, 16 Sep 2021 07:41:05 +0200 Subject: [PATCH 2/2] Renamed new target to be more consistent --- scalajslib/src/ScalaJSModule.scala | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scalajslib/src/ScalaJSModule.scala b/scalajslib/src/ScalaJSModule.scala index d944a429366..3d155e229a9 100644 --- a/scalajslib/src/ScalaJSModule.scala +++ b/scalajslib/src/ScalaJSModule.scala @@ -64,15 +64,15 @@ trait ScalaJSModule extends scalalib.ScalaModule { outer => ) } - @deprecated("Use scalaJsToolsClasspath instead", "mill after 0.10.0-M1") - def toolsClasspath = T { scalaJsToolsClasspath() } + @deprecated("Use scalaJSToolsClasspath instead", "mill after 0.10.0-M1") + def toolsClasspath = T { scalaJSToolsClasspath() } - def scalaJsToolsClasspath = T { scalaJSWorkerClasspath() ++ scalaJSLinkerClasspath() } + def scalaJSToolsClasspath = T { scalaJSWorkerClasspath() ++ scalaJSLinkerClasspath() } def fastOpt = T { link( worker = ScalaJSWorkerApi.scalaJSWorker(), - toolsClasspath = scalaJsToolsClasspath(), + toolsClasspath = scalaJSToolsClasspath(), runClasspath = runClasspath(), mainClass = finalMainClassOpt().toOption, testBridgeInit = false, @@ -85,7 +85,7 @@ trait ScalaJSModule extends scalalib.ScalaModule { outer => def fullOpt = T { link( worker = ScalaJSWorkerApi.scalaJSWorker(), - toolsClasspath = scalaJsToolsClasspath(), + toolsClasspath = scalaJSToolsClasspath(), runClasspath = runClasspath(), mainClass = finalMainClassOpt().toOption, testBridgeInit = false, @@ -102,7 +102,7 @@ trait ScalaJSModule extends scalalib.ScalaModule { outer => case Left(err) => Result.Failure(err) case Right(_) => ScalaJSWorkerApi.scalaJSWorker().run( - scalaJsToolsClasspath().map(_.path), + scalaJSToolsClasspath().map(_.path), jsEnvConfig(), fastOpt().path.toIO ) @@ -209,7 +209,7 @@ trait TestScalaJSModule extends ScalaJSModule with TestModule { def fastOptTest = T { link( ScalaJSWorkerApi.scalaJSWorker(), - scalaJsToolsClasspath(), + scalaJSToolsClasspath(), scalaJSTestDeps() ++ runClasspath(), None, testBridgeInit = true, @@ -227,7 +227,7 @@ trait TestScalaJSModule extends ScalaJSModule with TestModule { ): Task[(String, Seq[TestRunner.Result])] = T.task { val (close, framework) = mill.scalajslib.ScalaJSWorkerApi.scalaJSWorker().getFramework( - scalaJsToolsClasspath().map(_.path), + scalaJSToolsClasspath().map(_.path), jsEnvConfig(), testFramework(), fastOptTest().path.toIO,