diff --git a/.config/mill-version b/.config/mill-version index 0c2f86dd728..62ac386106c 100644 --- a/.config/mill-version +++ b/.config/mill-version @@ -1 +1 @@ -0.12.3-41-d21946 +0.12.3-51-24ba0d \ No newline at end of file diff --git a/contrib/buildinfo/src/mill/contrib/buildinfo/BuildInfo.scala b/contrib/buildinfo/src/mill/contrib/buildinfo/BuildInfo.scala index dcd6f0d8bce..fbab5932054 100644 --- a/contrib/buildinfo/src/mill/contrib/buildinfo/BuildInfo.scala +++ b/contrib/buildinfo/src/mill/contrib/buildinfo/BuildInfo.scala @@ -36,8 +36,8 @@ trait BuildInfo extends JavaModule { def buildInfoMembers: T[Seq[BuildInfo.Value]] = Seq.empty[BuildInfo.Value] def resources: T[Seq[PathRef]] = - if (buildInfoStaticCompiled) super.resources - else Task.Sources { super.resources() ++ Seq(buildInfoResources()) } + if (buildInfoStaticCompiled) Task { super.resources() } + else Task { super.resources() ++ Seq(buildInfoResources()) } def buildInfoResources = Task { val p = new java.util.Properties diff --git a/integration/invalidation/selective-execution/resources/build.mill b/integration/invalidation/selective-execution/resources/build.mill index b304caea468..36866986943 100644 --- a/integration/invalidation/selective-execution/resources/build.mill +++ b/integration/invalidation/selective-execution/resources/build.mill @@ -12,7 +12,8 @@ object foo extends Module { fooHelper(fooTask().path) } } -object bar extends Module { + +object bar extends mill.define.TaskModule { def barTask = Task.Source(millSourcePath / "bar.txt") def barHelper(p: os.Path) = { @@ -23,4 +24,6 @@ object bar extends Module { System.out.println("Computing barCommand") barHelper(barTask().path) } + + def defaultCommandName(): String = "barCommand" } \ No newline at end of file diff --git a/integration/invalidation/selective-execution/src/SelectiveExecutionTests.scala b/integration/invalidation/selective-execution/src/SelectiveExecutionTests.scala index 7b3cc808c51..eee8905dac8 100644 --- a/integration/invalidation/selective-execution/src/SelectiveExecutionTests.scala +++ b/integration/invalidation/selective-execution/src/SelectiveExecutionTests.scala @@ -17,8 +17,8 @@ object SelectiveExecutionTests extends UtestIntegrationTestSuite { eval(("selective.prepare", "{foo.fooCommand,bar.barCommand}"), check = true) modifyFile(workspacePath / "bar/bar.txt", _ + "!") - val plan = eval(("selective.resolve", "{foo.fooCommand,bar.barCommand}"), check = true) - assert(plan.out == "bar.barCommand") + val resolve = eval(("selective.resolve", "{foo.fooCommand,bar.barCommand}"), check = true) + assert(resolve.out == "bar.barCommand") val cached = eval( @@ -30,6 +30,23 @@ object SelectiveExecutionTests extends UtestIntegrationTestSuite { assert(!cached.out.contains("Computing fooCommand")) assert(cached.out.contains("Computing barCommand")) } + test("default-command") - integrationTest { tester => + import tester._ + + eval(("selective.prepare", "bar"), check = true) + + val resolve = eval(("selective.resolve", "bar"), check = true) + assert(resolve.out == "") + + modifyFile(workspacePath / "bar/bar.txt", _ + "!") + val resolve2 = eval(("selective.resolve", "bar"), check = true) + assert(resolve2.out != "") + + val cached = eval(("selective.run", "bar"), check = true, stderr = os.Inherit) + + assert(!cached.out.contains("Computing fooCommand")) + assert(cached.out.contains("Computing barCommand")) + } test("changed-code") - integrationTest { tester => import tester._ diff --git a/main/src/mill/main/SelectiveExecution.scala b/main/src/mill/main/SelectiveExecution.scala index d95d42da1c1..de3f5bd6b66 100644 --- a/main/src/mill/main/SelectiveExecution.scala +++ b/main/src/mill/main/SelectiveExecution.scala @@ -103,7 +103,8 @@ private[mill] object SelectiveExecution { computeHashCodeSignatures(terminals, newHashes.methodCodeHashSignatures) ) - val changedRootTasks = (changedInputNames ++ changedCodeNames).map(namesToTasks(_): Task[_]) + val changedRootTasks = (changedInputNames ++ changedCodeNames) + .flatMap(namesToTasks.get(_): Option[Task[_]]) val allNodes = breadthFirst(terminals.map(_.task: Task[_]))(_.inputs) val downstreamEdgeMap = allNodes @@ -133,7 +134,7 @@ private[mill] object SelectiveExecution { def saveMetadata(evaluator: Evaluator, metadata: SelectiveExecution.Metadata): Unit = { os.write.over( evaluator.outPath / OutFiles.millSelectiveExecution, - upickle.default.write(metadata) + upickle.default.write(metadata, indent = 2) ) } diff --git a/main/src/mill/main/SelectiveExecutionModule.scala b/main/src/mill/main/SelectiveExecutionModule.scala index 09d336e4bd7..f61e4d3667a 100644 --- a/main/src/mill/main/SelectiveExecutionModule.scala +++ b/main/src/mill/main/SelectiveExecutionModule.scala @@ -34,9 +34,9 @@ trait SelectiveExecutionModule extends mill.define.Module { def resolve(evaluator: Evaluator, tasks: String*): Command[Array[String]] = Task.Command(exclusive = true) { val result = for { - resolved <- Resolve.Segments.resolve(evaluator.rootModule, tasks, SelectMode.Multi) + resolved <- Resolve.Tasks.resolve(evaluator.rootModule, tasks, SelectMode.Multi) diffed <- SelectiveExecution.diffMetadata(evaluator, tasks) - } yield resolved.map(_.render).toSet.intersect(diffed).toArray.sorted + } yield resolved.map(_.ctx.segments.render).toSet.intersect(diffed).toArray.sorted result match { case Left(err) => Result.Failure(err) diff --git a/mill-build/build.sc b/mill-build/build.sc index 50160ced149..63c18f09970 100644 --- a/mill-build/build.sc +++ b/mill-build/build.sc @@ -4,7 +4,7 @@ import mill.scalalib._ object `package` extends MillBuildRootModule { override def ivyDeps = Agg( - ivy"de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0", + ivy"de.tototec::de.tobiasroeser.mill.vcs.version::0.4.1", ivy"com.github.lolgab::mill-mima::0.1.1", ivy"net.sourceforge.htmlcleaner:htmlcleaner:2.29", // TODO: implement empty version for ivy deps as we do in import parser