Skip to content

Commit

Permalink
Deprecated toolsClasspath targets in favor of uniquely named new ones
Browse files Browse the repository at this point in the history
  • Loading branch information
lefou committed Sep 15, 2021
1 parent 73a5c02 commit 4b49946
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 31 deletions.
21 changes: 13 additions & 8 deletions contrib/playlib/src/mill/playlib/RouterModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}

Expand All @@ -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()
}

Expand Down
7 changes: 6 additions & 1 deletion contrib/scoverage/src/ScoverageModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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() ++ scoverageClasspath()
}

Expand Down Expand Up @@ -92,7 +97,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))
}

Expand Down
2 changes: 1 addition & 1 deletion contrib/scoverage/src/ScoverageReport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
47 changes: 26 additions & 21 deletions scalajslib/src/ScalaJSModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
}

Expand All @@ -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
)
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -204,7 +209,7 @@ trait TestScalaJSModule extends ScalaJSModule with TestModule {
def fastOptTest = T {
link(
ScalaJSWorkerApi.scalaJSWorker(),
toolsClasspath(),
scalaJsToolsClasspath(),
scalaJSTestDeps() ++ runClasspath(),
None,
testBridgeInit = true,
Expand All @@ -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,
Expand Down

0 comments on commit 4b49946

Please sign in to comment.