@@ -37,10 +37,12 @@ trait MillIntegrationTestModule extends TaskModule with ExtraCoursierSupport wit
3737 * Derived from [[sources]].
3838 */
3939 def testCases: T[Seq[PathRef]] = T {
40+ val buildFiles = Seq("build.mill", "build.mill.scala", "build.mill.yaml", "build.sc")
4041 for {
41- src <- sources() if src.path.toIO.isDirectory
42+ src <- sources()
43+ if os.exists(src.path) && os.isDir(src.path)
4244 d <- os.list(src.path)
43- if (d / "build.sc").toIO .isFile
45+ if buildFiles.map (d / _).exists(os .isFile)
4446 } yield PathRef(d)
4547 }
4648
@@ -100,7 +102,7 @@ trait MillIntegrationTestModule extends TaskModule with ExtraCoursierSupport wit
100102 val millTestVersion_ = millTestVersion()
101103 println(s"Mill version: ${millTestVersion_}")
102104
103- val importFileContents = {
105+ lazy val importFileContents = {
104106 val imports = artifactMetadata.map { dep =>
105107 s"import $$ivy.`${dep.group}:${dep.id}:${dep.version}`"
106108 }
@@ -110,11 +112,35 @@ trait MillIntegrationTestModule extends TaskModule with ExtraCoursierSupport wit
110112 |""".stripMargin
111113 }
112114
115+ lazy val metaBuildContents = {
116+ val mvnDeps = artifactMetadata.map { dep =>
117+ s"""mvn"${dep.group}:${dep.id}:${dep.version}""""
118+ }
119+
120+ s"""import mill._, mill.api._, mill.meta._, mill.scalalib._
121+ |
122+ |object `package` extends MillBuildRootModule {
123+ | def mvnDeps = Seq(
124+ | // the plugin under test
125+ | ${mvnDeps.mkString(",\n ")}
126+ | )
127+ |
128+ | def compile = {
129+ | BuildCtx.withFilesystemCheckerDisabled {
130+ | os.remove(BuildCtx.workspaceRoot / os.up / "plugins.sc")
131+ | }
132+ | super.compile()
133+ | }
134+ |}
135+ |""".stripMargin
136+ }
113137
114- val noServerOpt = parseVersion(millTestVersion_).get match {
138+ val millVersion = parseVersion(millTestVersion_).get
139+ val noServerOpt = millVersion match {
115140 case MillVersion(0, 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7, _, _, _, _) => "--interactive"
116141 case _ => "--no-server"
117142 }
143+ val isMill0 = millVersion.major == 0
118144
119145 val testCases = testInvocations()
120146 // val testInvocationsMap: Map[PathRef, TestInvocation.Targets] = testCases.toMap
@@ -145,8 +171,13 @@ trait MillIntegrationTestModule extends TaskModule with ExtraCoursierSupport wit
145171 copyWithMerge(from = src, to = testPath, createFolders = true, mergeFolders = true)
146172 }
147173
148- // Write the plugins.sc file
149- os.write(testPath / "plugins.sc", importFileContents)
174+ if (isMill0) {
175+ // Write the plugins.sc file
176+ os.write(testPath / "plugins.sc", importFileContents)
177+ } else {
178+ // Write a meta build
179+ os.write(testPath / "mill-build" / "build.mill", metaBuildContents, createFolders = true)
180+ }
150181
151182 val millExe = downloadMillTestVersion().path
152183
0 commit comments