Skip to content

Commit 38f7f4b

Browse files
committed
Part 6 - use mill-moduledefs 0.11.0-M1 (with scala 3 port)
- clean up classpath, resolve scala-library
1 parent 858087f commit 38f7f4b

File tree

9 files changed

+18
-95
lines changed

9 files changed

+18
-95
lines changed

build.mill

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,11 @@ trait MillScalaModule extends ScalaModule with MillJavaModule with ScalafixModul
403403
def scalacPluginIvyDeps =
404404
super.scalacPluginIvyDeps() ++
405405
Agg.when(!scalaVersion().startsWith("3."))(Deps.acyclic) ++
406-
Agg.when(scalaVersion().startsWith("2.13."))(Deps.millModuledefsPlugin)
406+
Agg(Deps.millModuledefsPlugin)
407407

408408
def mandatoryIvyDeps =
409409
super.mandatoryIvyDeps() ++
410-
Agg.when(scalaVersion().startsWith("2.13."))(Deps.millModuledefs)
410+
Agg(Deps.millModuledefs)
411411

412412
/** Default tests module. */
413413
lazy val test: MillScalaTests = new MillScalaTests {}

contrib/buildinfo/src/mill/contrib/buildinfo/BuildInfo.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ trait BuildInfo extends JavaModule {
3535
*/
3636
def buildInfoMembers: T[Seq[BuildInfo.Value]] = Seq.empty[BuildInfo.Value]
3737

38-
// TODO: remove override when mill-moduledefs is ported to Scala 3
39-
override def resources: T[Seq[PathRef]] =
38+
def resources: T[Seq[PathRef]] =
4039
if (buildInfoStaticCompiled) super.resources
4140
else T.sources { super.resources() ++ Seq(buildInfoResources()) }
4241

main/define/src/mill/moduledefs/Cacher.scala

Lines changed: 0 additions & 68 deletions
This file was deleted.

main/define/src/mill/moduledefs/Scaladoc.java

Lines changed: 0 additions & 10 deletions
This file was deleted.

main/util/src/mill/util/Util.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ object Util {
7979
repositories: Seq[Repository],
8080
resolveFilter: os.Path => Boolean = _ => true,
8181
// this should correspond to the mill runtime Scala version
82-
artifactSuffix: String = "_2.13"
82+
artifactSuffix: String = "_3"
8383
): Result[Agg[PathRef]] = {
8484

8585
mill.util.Jvm.resolveDependencies(

runner/src/mill/runner/MillBuildRootModule.scala

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,9 @@ abstract class MillBuildRootModule()(implicit
219219
* We exclude them to avoid incompatible or duplicate artifacts on the classpath.
220220
*/
221221
protected def resolveDepsExclusions: T[Seq[(String, String)]] = T {
222-
Lib.millAssemblyEmbeddedDeps.toSeq.map(d =>
223-
(d.dep.module.organization.value, d.dep.module.name.value)
222+
Lib.millAssemblyEmbeddedDeps.toSeq.flatMap(d =>
223+
if d.dep.module.name.value == "scala-library" && scalaVersion().startsWith("3.") then None
224+
else Some((d.dep.module.organization.value, d.dep.module.name.value))
224225
)
225226
}
226227

@@ -239,20 +240,21 @@ abstract class MillBuildRootModule()(implicit
239240
override def scalacOptions: T[Seq[String]] = T {
240241
super.scalacOptions() ++
241242
Seq(
242-
"-Xplugin:" + lineNumberPluginClasspath().map(_.path).mkString(","),
243+
// "-Xplugin:" + lineNumberPluginClasspath().map(_.path).mkString(","),
243244
"-deprecation",
244245
// Make sure we abort of the plugin is not found, to ensure any
245246
// classpath/plugin-discovery issues are surfaced early rather than
246247
// after hours of debugging
247-
"-Xplugin-require:mill-linenumber-plugin"
248+
// "-Xplugin-require:mill-linenumber-plugin"
248249
)
249250
}
250251

251252
override def scalacPluginClasspath: T[Agg[PathRef]] =
252253
super.scalacPluginClasspath() ++ lineNumberPluginClasspath()
253254

254255
def lineNumberPluginClasspath: T[Agg[PathRef]] = T {
255-
millProjectModule("mill-runner-linenumbers", repositoriesTask())
256+
// millProjectModule("mill-runner-linenumbers", repositoriesTask())
257+
Agg.empty
256258
}
257259

258260
/** Used in BSP IntelliJ, which can only work with directories */

scalalib/src/mill/scalalib/CoursierModule.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import coursier.cache.FileCache
44
import coursier.{Dependency, Repository, Resolve}
55
import coursier.core.Resolution
66
import mill.T
7+
import mill.api.Result
78
import mill.define.Task
89
import mill.api.PathRef
910

scalalib/src/mill/scalalib/Dependency.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ object Dependency extends ExternalModule {
1616
T.command {
1717
DependencyUpdatesImpl(
1818
ev,
19-
???,// implicitly,
19+
implicitly,
2020
ev.rootModule,
2121
ev.rootModule.millDiscover,
2222
allowPreRelease

scalalib/src/mill/scalalib/JavaModule.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ trait JavaModule
9696
* If none is specified, the classpath is searched for an appropriate main
9797
* class to use if one exists
9898
*/
99-
override def mainClass: T[Option[String]] = None // TODO: remove override with mill-moduledefs
99+
def mainClass: T[Option[String]] = None
100100

101-
override def finalMainClassOpt: T[Either[String, String]] = T { // TODO: remove override with mill-moduledefs
101+
def finalMainClassOpt: T[Either[String, String]] = T {
102102
mainClass() match {
103103
case Some(m) => Right(m)
104104
case None =>
@@ -115,7 +115,7 @@ trait JavaModule
115115
}
116116
}
117117

118-
override def finalMainClass: T[String] = T { // TODO: remove override with mill-moduledefs
118+
def finalMainClass: T[String] = T {
119119
finalMainClassOpt() match {
120120
case Right(main) => Result.Success(main)
121121
case Left(msg) => Result.Failure(msg)
@@ -133,7 +133,7 @@ trait JavaModule
133133
* ivy"org::name:version" for Scala dependencies or ivy"org:name:version"
134134
* for Java dependencies
135135
*/
136-
override def ivyDeps: T[Agg[Dep]] = T { Agg.empty[Dep] } // TODO: remove override with mill-moduledefs
136+
def ivyDeps: T[Agg[Dep]] = T { Agg.empty[Dep] }
137137

138138
/**
139139
* Aggregation of mandatoryIvyDeps and ivyDeps.
@@ -369,8 +369,7 @@ trait JavaModule
369369
* The folders where the resource files for this module live.
370370
* If you need resources to be seen by the compiler, use [[compileResources]].
371371
*/
372-
// TODO: remove override when mill-moduledefs is ported to scala 3
373-
override def resources: T[Seq[PathRef]] = T.sources { millSourcePath / "resources" }
372+
def resources: T[Seq[PathRef]] = T.sources { millSourcePath / "resources" }
374373

375374
/**
376375
* The folders where the compile time resource files for this module live.

0 commit comments

Comments
 (0)