Skip to content

Commit 38ba5e8

Browse files
committed
Part 11 - Tweaks to fix more classpath and syntax errors with Scala 3
- use scala 3 version of scalatags in test Note: scalatags brings in scala 2 version of sourcecode transitively, which then fails to summon sourcecode.Enclosing. - re-enable jmh, bsp and testkit modules in integration tests - fix giter8 module resolution with scala 3 - fix compilation of scalalib tests - derive ReadWriter for PomSettings - fix compilation of scalajslib tests - fix compilation of scalanativelib tests - move things-outside-top-level-module to integration.feature
1 parent 28310f6 commit 38ba5e8

File tree

26 files changed

+124
-77
lines changed

26 files changed

+124
-77
lines changed

bsp/worker/src/mill/bsp/worker/MillBuildServer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ private class MillBuildServer(
636636
State
637637
) => V): CompletableFuture[V] = {
638638
val prefix = hint.split(" ").head
639-
completable(hint) { state: State =>
639+
completable(hint) { (state: State) =>
640640
val ids = state.filterNonSynthetic(targetIds(state).asJava).asScala
641641
val tasksSeq = ids.flatMap { id =>
642642
val (m, ev) = state.bspModulesById(id)

bsp/worker/src/mill/bsp/worker/Utils.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private object Utils {
3434
originId: String,
3535
bspIdsByModule: Map[BspModule, BuildTargetIdentifier],
3636
client: BuildClient
37-
): Int => Option[CompileProblemReporter] = { moduleHashCode: Int =>
37+
): Int => Option[CompileProblemReporter] = { (moduleHashCode: Int) =>
3838
bspIdsByModule.find(_._1.hashCode == moduleHashCode).map {
3939
case (module: JavaModule, targetId) =>
4040
val buildTarget = module.bspBuildTarget

build.mill

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -745,19 +745,18 @@ object dist0 extends MillPublishJavaModule {
745745

746746
def testTransitiveDeps = build.runner.testTransitiveDeps() ++ Seq(
747747
build.main.graphviz.testDep(),
748-
// build.runner.linenumbers.testDep(),
749748
build.scalalib.backgroundwrapper.testDep(),
750749
build.contrib.bloop.testDep(),
751750
build.contrib.buildinfo.testDep(),
752-
// build.contrib.scoverage.testDep(),
753-
// build.contrib.scoverage.worker2.testDep(),
754-
// build.contrib.jmh.testDep(),
755-
// build.contrib.playlib.testDep(),
756-
// build.contrib.playlib.worker("2.8").testDep(),
757-
// build.contrib.errorprone.testDep(),
758-
// build.contrib.checkstyle.testDep(),
759-
// build.bsp.worker.testDep(),
760-
// build.testkit.testDep()
751+
build.contrib.scoverage.testDep(),
752+
build.contrib.scoverage.worker2.testDep(),
753+
build.contrib.jmh.testDep(),
754+
build.contrib.playlib.testDep(),
755+
build.contrib.playlib.worker("2.8").testDep(),
756+
build.contrib.errorprone.testDep(),
757+
build.contrib.checkstyle.testDep(),
758+
build.bsp.worker.testDep(),
759+
build.testkit.testDep()
761760
)
762761
}
763762

contrib/playlib/src/mill/playlib/Version.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ private[playlib] trait Version extends Module {
1414

1515
private[playlib] def playOrganization: T[String] = Task.Anon {
1616
if (playVersion().startsWith("2.")) "com.typesafe.play" else "org.playframework"
17-
}
17+
}()
1818

1919
private[playlib] def component(id: String) = Task.Anon {
2020
ivy"${playOrganization()}::$id::${playVersion()}"

contrib/twirllib/src/mill/twirllib/TwirlModule.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ trait TwirlModule extends mill.Module { twirlModule =>
3636
private def scalaParserCombinatorsVersion: T[String] = twirlScalaVersion.map {
3737
case v if v.startsWith("2.") => "1.1.2"
3838
case _ => "2.3.0"
39-
}
39+
}()
4040

4141
/**
4242
* @since Mill after 0.10.5
@@ -57,7 +57,7 @@ trait TwirlModule extends mill.Module { twirlModule =>
5757
* @since Mill after 0.10.5
5858
*/
5959
trait TwirlResolver extends CoursierModule {
60-
override def resolveCoursierDependency: Task[Dep => Dependency] = Task.Anon { d: Dep =>
60+
override def resolveCoursierDependency: Task[Dep => Dependency] = Task.Anon { (d: Dep) =>
6161
Lib.depToDependency(d, twirlScalaVersion())
6262
}
6363

example/extending/plugins/7-writing-mill-plugins/build.mill

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import mill._, scalalib._, publish._
88
import mill.main.BuildInfo.millVersion
99

1010
object myplugin extends ScalaModule with PublishModule {
11-
def scalaVersion = "2.13.8"
11+
def scalaVersion = "3.5.0"
1212

1313
def ivyDeps = Agg(ivy"com.lihaoyi:mill-dist:$millVersion")
1414

@@ -48,7 +48,7 @@ object myplugin extends ScalaModule with PublishModule {
4848
//
4949
// The above `build.mill` file sets up a `object myplugin extends ScalaModule` not just to
5050
// compile your Mill plugin project, but also to run automated tests using `mill-testkit`,
51-
// and to configure it for publishing to Maven Central via `PublishModule`.
51+
// and to configure it for publishing to Maven Central via `PublishModule`.
5252
// It looks like any other Scala project, except for a few things to take note:
5353
//
5454
// * A dependency on `com.lihaoyi:mill-dist:$millVersion`
@@ -184,12 +184,11 @@ compiling 1 Scala source...
184184
> sed -i.bak 's/0.0.1/0.0.2/g' build.mill
185185

186186
> ./mill myplugin.publishLocal
187-
Publishing Artifact(com.lihaoyi,myplugin_2.13,0.0.2) to ivy repo...
187+
Publishing Artifact(com.lihaoyi,myplugin_3,0.0.2) to ivy repo...
188188

189189
*/
190190
// Mill plugins are JVM libraries like any other library written in Java or Scala. Thus they
191191
// are published the same way: by extending `PublishModule` and defining the module's `publishVersion`
192192
// and `pomSettings`. Once done, you can publish the plugin locally via `publishLocal` below,
193193
// or to Maven Central via `mill.scalalib.public.PublishModule/`for other developers to
194194
// use.
195-

example/thirdparty/netty/build.mill

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ object common extends NettyModule{
253253
val shell = new groovy.lang.GroovyShell()
254254

255255
val context = new java.util.HashMap[String, Object]
256-
context.put("collection.template.dir", Task.workspace + "/common/src/main/templates")
257-
context.put("collection.template.test.dir", Task.workspace + "/common/src/test/templates")
256+
context.put("collection.template.dir", s"${Task.workspace}/common/src/main/templates")
257+
context.put("collection.template.test.dir", s"${Task.workspace}/common/src/test/templates")
258258
context.put("collection.src.dir", (Task.dest / "src").toString)
259259
context.put("collection.testsrc.dir", (Task.dest / "testsrc").toString)
260260
shell.setProperty("properties", context)

integration/feature/things-outside-top-level-module/src/ThingsOutsideTopLevelModuleTests.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import mill.testkit.IntegrationTestSuite
2-
import utest.{assert, *}
1+
package mill.integration
32

4-
object ThingsOutsideTopLevelModuleTests extends IntegrationTestSuite {
5-
val tests: Tests = Tests {
6-
initWorkspace()
3+
import mill.testkit.UtestIntegrationTestSuite
4+
5+
import utest._
76

8-
test("success") {
7+
object ThingsOutsideTopLevelModuleTests extends UtestIntegrationTestSuite {
8+
val tests: Tests = Tests {
9+
test("success") - integrationTest { tester =>
10+
import tester._
911
val res = eval(("resolve", "_"))
1012
assert(res.isSuccess)
1113
}

integration/invalidation/multi-level-editing/resources/build.mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import mill._, scalalib._
44
import scalatags.Text.all._
55

66
object foo extends ScalaModule {
7-
def scalaVersion = "2.13.8"
7+
def scalaVersion = "3.3.3"
88

99
def forkEnv = Map(
1010
"snippet" -> frag(h1("hello"), p("world"), p(constant.Constant.scalatagsVersion)).render

integration/invalidation/multi-level-editing/resources/mill-build/build.mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import $meta._
33
import mill._, scalalib._
44

55
object `package` extends MillBuildRootModule {
6-
def ivyDeps = Agg(ivy"com.lihaoyi:scalatags_2.13:${constant.MetaConstant.scalatagsVersion}")
6+
def ivyDeps = Agg(ivy"com.lihaoyi:scalatags_3:${constant.MetaConstant.scalatagsVersion}")
77

88
def generatedSources = Task {
99
os.write(

0 commit comments

Comments
 (0)