From ca48f968b09f7cb455ba28d6dcf8f69aef764bbd Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Wed, 8 Nov 2023 08:36:11 +0100 Subject: [PATCH 1/7] Ensure, we end comment paragraphs with a newline. --- build.sc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build.sc b/build.sc index 34dd901eecd..f11127b6391 100644 --- a/build.sc +++ b/build.sc @@ -1025,7 +1025,10 @@ object example extends MillScalaModule { def compile = example.compile() def forkEnv = super.forkEnv() ++ Map("MILL_EXAMPLE_PARSED" -> upickle.default.write(parsed())) - def parsed = T { + /** + * Parses a `build.sc` for specific comments and return the split-by-type content + */ + def parsed: T[Seq[(String, String)]] = T { val states = collection.mutable.Buffer("scala") val chunks = collection.mutable.Buffer(collection.mutable.Buffer.empty[String]) @@ -1047,7 +1050,7 @@ object example extends MillScalaModule { restOpt.foreach(r => chunks.last.append(r)) } - states.zip(chunks.map(_.mkString("\n").trim)).filter(_._2.nonEmpty) + states.zip(chunks.map(_.mkString("\n").trim)).filter(_._2.nonEmpty).toSeq } def rendered = T { @@ -1084,7 +1087,7 @@ object example extends MillScalaModule { |$txt |---- |""".stripMargin - case ("comment", txt) => txt + case ("comment", txt) => txt + "\n" case ("example", txt) => s""" |[source,bash,subs="attributes,verbatim"] From 4dfbb5fc61b6b56dbbf83b05f9f214a3f6cfb496 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Wed, 8 Nov 2023 09:02:21 +0100 Subject: [PATCH 2/7] Reworked the built-in command section --- docs/modules/ROOT/pages/Builtin_Commands.adoc | 5 +- example/basic/4-builtin-commands/build.sc | 87 ++++++++++--------- 2 files changed, 51 insertions(+), 41 deletions(-) diff --git a/docs/modules/ROOT/pages/Builtin_Commands.adoc b/docs/modules/ROOT/pages/Builtin_Commands.adoc index d48385c9ab2..01cc9b2af36 100644 --- a/docs/modules/ROOT/pages/Builtin_Commands.adoc +++ b/docs/modules/ROOT/pages/Builtin_Commands.adoc @@ -9,11 +9,13 @@ Mill's built-in commands are typically not directly related to building your application code, but instead are utilities that help you understand and work with your Mill build. +include::example/basic/4-builtin-commands.adoc[] + == init [source,bash] ---- -$ mill -i init com-lihaoyi/mill-scala-hello.g8 +> mill -i init com-lihaoyi/mill-scala-hello.g8 .... A minimal Scala project. @@ -27,7 +29,6 @@ It prompts you to enter project name and creates a folder with that name. You can use it to quickly generate a starter project. There are lots of templates out there for many frameworks and tools! -include::example/basic/4-builtin-commands.adoc[] == visualize diff --git a/example/basic/4-builtin-commands/build.sc b/example/basic/4-builtin-commands/build.sc index 8550d9a5a5e..e2ada7be5ff 100644 --- a/example/basic/4-builtin-commands/build.sc +++ b/example/basic/4-builtin-commands/build.sc @@ -1,3 +1,5 @@ +// == Example `build.sc` +// // The following examples will be assuming the `build.sc` file given below: import mill._, scalalib._ @@ -17,6 +19,11 @@ object bar extends MyModule { // == resolve +// `resolve` lists the tasks that match a particular query, without running them. +// This is useful for "dry running" an `mill` command to see what would be run +// before you run them, or to explore what modules or tasks are available +// from the command line using `+resolve _+`, `+resolve foo._+`, etc. + /** Usage > ./mill resolve _ @@ -47,10 +54,9 @@ foo.artifactName */ -// `resolve` lists the tasks that match a particular query, without running them. -// This is useful for "dry running" an `mill` command to see what would be run -// before you run them, or to explore what modules or tasks are available -// from the command line using `+resolve _+`, `+resolve foo._+`, etc. +// You can also use the special wildcards `+_+` as a placeholder for a single segment and `+__+`as a placeholder for many segments. +// Lists within curly braces (`{`, `}`) are also supported. + /** Usage @@ -67,6 +73,11 @@ foo.artifactName // == inspect +// `inspect` is a more verbose version of <<_resolve>>. In addition to printing +// out the name of one-or-more tasks, it also displays its source location and a +// list of input tasks. This is very useful for debugging and interactively +// exploring the structure of your build from the command line. + /** Usage > ./mill inspect foo.run @@ -81,17 +92,18 @@ Inputs: */ -// `inspect` is a more verbose version of <<_resolve>>. In addition to printing -// out the name of one-or-more tasks, it also displays its source location and a -// list of input tasks. This is very useful for debugging and interactively -// exploring the structure of your build from the command line. -// -// While `inspect` also works with the same `+_+`/`+__+` wildcard/query syntaxes +// While `inspect` also works with the same `+_+`/`+__+` wildcard/query syntax // that <<_resolve>> do, the most common use case is to inspect one task at a // time. // == show +// By default, Mill does not print out the metadata from evaluating a task. +// Most people would not be interested in e.g. viewing the metadata related to +// incremental compilation: they just want to compile their code! However, if you +// want to inspect the build to debug problems, you can make Mill show you the +// metadata output for a task using the `show` command: + /** Usage > ./mill show foo.scalaVersion @@ -99,15 +111,10 @@ Inputs: */ -// By default, Mill does not print out the metadata from evaluating a task. Most -// people would not be interested in e.g. viewing the metadata related to -// incremental compilation: they just want to compile their code! However, if you -// want to inspect the build to debug problems, you can make Mill show you the -// metadata output for a task using the `show` command: -// // `show` is not just for showing configuration values. All tasks return values -// that can be shown with `show`. E.g. `compile` returns the paths to the -// `classes` folder and `analysisFile` file produced by the compilation: +// that can be shown with `show`. +// E.g. `compile` returns the paths to the `classes` folder and `analysisFile` +// file produced by the compilation: /** Usage @@ -181,6 +188,12 @@ Inputs: // == path +// `mill path` prints out a dependency chain between the first task and the +// second. It is very useful for exploring the build graph and trying to figure +// out how data gets from one task to another, or trying to figure out why +// running `./mill foo` ends up running another task `bar` that you didn't +// expect it to. + /** Usage > ./mill path foo.assembly foo.sources @@ -193,17 +206,18 @@ foo.assembly */ -// `mill path` prints out a dependency chain between the first task and the -// second. It is very useful for exploring the build graph and trying to figure -// out how data gets from one task to another, or trying to figure out why -// running `./mill foo` ends up running another task `bar` that you didn't -// expect it to. -// // If there are multiple possible dependency chains, one of them is picked // arbitrarily. -// + // == plan +// `mill plan foo` shows which tasks would be evaluated if you ran `mill foo`, +// and in what order, but without actually running them. This is a useful tool for +// debugging your build: e.g. if you suspect a task `foo` is running things that +// it shouldn't be running, a quick `mill plan` will list out all the upstream +// tasks that `foo` needs to run, and you can then follow up with `mill path` on +// any individual upstream task to see exactly how `foo` depends on it. + /** Usage > ./mill plan foo.compileClasspath @@ -221,23 +235,18 @@ foo.compileClasspath */ -// `mill plan foo` shows which tasks would be evaluated if you ran `mill foo`, -// and in what order, but without actually running them. This is a useful tool for -// debugging your build: e.g. if you suspect a task `foo` is running things that -// it shouldn't be running, a quick `mill plan` will list out all the upstream -// tasks that `foo` needs to run, and you can then follow up with `mill path` on -// any individual upstream task to see exactly how `foo` depends on it. -// // == clean +// `clean` deletes all the cached outputs of previously executed tasks. + /** Usage > ./mill clean */ -// `clean` deletes all the cached outputs of previously executed tasks. It can -// apply to the entire project, entire modules, or specific tasks. +// `clean` without arguments cleans the entire project. +// It also accepts arguments to clean entire modules, or specific tasks. /** Usage @@ -254,6 +263,11 @@ foo.compileClasspath // == Search for dependency updates +// Mill can search for updated versions of your project's dependencies, if +// available from your project's configured repositories. Note that it uses +// heuristics based on common versioning schemes, so it may not work as expected for +// dependencies with particularly weird version numbers. + /** Usage > ./mill mill.scalalib.Dependency/showUpdates @@ -262,11 +276,6 @@ foo.compileClasspath */ -// Mill can search for updated versions of your project's dependencies, if -// available from your project's configured repositories. Note that it uses -// heuristics based on common versioning schemes, so it may not work as expected for -// dependencies with particularly weird version numbers. -// // Current limitations: // // * Only works for `JavaModule` modules (including ``ScalaModule``s, From 7de4824c3102f718358de3f1c4d9d7630a35edc8 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Wed, 8 Nov 2023 09:19:15 +0100 Subject: [PATCH 3/7] ExampleTestSuite: Also support `mill` command in addition to `./mill` --- .../mill/integration/ExampleTestSuite.scala | 53 ++++++++++--------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/example/src/mill/integration/ExampleTestSuite.scala b/example/src/mill/integration/ExampleTestSuite.scala index 142e83dc325..d83e147f3b3 100644 --- a/example/src/mill/integration/ExampleTestSuite.scala +++ b/example/src/mill/integration/ExampleTestSuite.scala @@ -84,29 +84,8 @@ object ExampleTestSuite extends IntegrationTestSuite { workspaceRoot: os.Path, expectedSnippets: Vector[String], commandStr: String - ) = { + ): Unit = { BashTokenizer.tokenize(commandStr) match { - case Seq(s"./$command", rest @ _*) => - val evalResult = command match { - case "mill" => evalStdout(rest) - case cmd => - val tokens = cmd +: rest - val executable = workspaceRoot / os.SubPath(tokens.head) - if (!os.exists(executable)) { - throw new Exception( - s"Executable $executable not found.\n" + - s"Other files present include ${os.list(executable / os.up)}" - ) - } - val res = os - .proc(executable, tokens.tail) - .call(stdout = os.Pipe, stderr = os.Pipe, cwd = workspaceRoot) - - IntegrationTestSuite.EvalResult(res.exitCode == 0, res.out.text(), res.err.text()) - } - - validateEval(expectedSnippets, evalResult) - case Seq("cp", "-r", from, to) => os.copy(os.Path(from, workspaceRoot), os.Path(to, workspaceRoot)) @@ -128,7 +107,7 @@ object ExampleTestSuite extends IntegrationTestSuite { IntegrationTestSuite.EvalResult(true, res, "") ) - case Seq("node", rest @ _*) => + case Seq("node", rest@_*) => val res = os .proc("node", rest) .call(stdout = os.Pipe, stderr = os.Pipe, cwd = workspaceRoot) @@ -137,7 +116,7 @@ object ExampleTestSuite extends IntegrationTestSuite { IntegrationTestSuite.EvalResult(res.exitCode == 0, res.out.text(), res.err.text()) ) - case Seq("git", rest @ _*) => + case Seq("git", rest@_*) => val res = os .proc("git", rest) .call(stdout = os.Pipe, stderr = os.Pipe, cwd = workspaceRoot) @@ -146,7 +125,7 @@ object ExampleTestSuite extends IntegrationTestSuite { IntegrationTestSuite.EvalResult(res.exitCode == 0, res.out.text(), res.err.text()) ) - case Seq("java", "-jar", rest @ _*) => + case Seq("java", "-jar", rest@_*) => val res = os .proc("java", "-jar", rest) .call(stdout = os.Pipe, stderr = os.Pipe, cwd = workspaceRoot) @@ -164,11 +143,33 @@ object ExampleTestSuite extends IntegrationTestSuite { expectedSnippets, IntegrationTestSuite.EvalResult(true, boas.toString("UTF-8"), "") ) - } finally { zipFile.close() } + } finally { + zipFile.close() + } case Seq("printf", literal, ">>", path) => mangleFile(os.Path(path, workspacePath), _ + ujson.read(s""""${literal}"""").str) + case Seq(command, rest @ _*) => + val evalResult = command match { + case "./mill" | "mill" => evalStdout(rest) + case s"./$cmd" => + val tokens = cmd +: rest + val executable = workspaceRoot / os.SubPath(tokens.head) + if (!os.exists(executable)) { + throw new Exception( + s"Executable $executable not found.\n" + + s"Other files present include ${os.list(executable / os.up)}" + ) + } + val res = os + .proc(executable, tokens.tail) + .call(stdout = os.Pipe, stderr = os.Pipe, cwd = workspaceRoot) + + IntegrationTestSuite.EvalResult(res.exitCode == 0, res.out.text(), res.err.text()) + } + + validateEval(expectedSnippets, evalResult) } } From c110f970297461dad48c8f8f856ccda2fa3c7725 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Wed, 8 Nov 2023 09:58:27 +0100 Subject: [PATCH 4/7] Replace `./mill` with `mill` in most examples --- example/basic/2-custom-build-logic/build.sc | 8 +-- example/basic/3-multi-module/build.sc | 6 +- example/basic/4-builtin-commands/build.sc | 64 +++++++++---------- example/cross/1-simple/build.sc | 12 ++-- example/cross/10-static-blog/build.sc | 6 +- .../cross/11-default-cross-module/build.sc | 6 +- example/cross/2-cross-source-path/build.sc | 6 +- example/cross/3-outside-dependency/build.sc | 6 +- example/cross/4-cross-dependencies/build.sc | 4 +- example/cross/5-multiple-cross-axes/build.sc | 4 +- example/cross/6-axes-extension/build.sc | 12 ++-- example/cross/7-inner-cross-module/build.sc | 6 +- example/cross/8-resolvers/build.sc | 2 +- .../cross/9-dynamic-cross-modules/build.sc | 10 +-- example/misc/3-import-file-ivy/build.sc | 6 +- example/misc/4-mill-build-folder/build.sc | 14 ++-- example/misc/5-module-run-task/build.sc | 2 +- example/misc/6-contrib-import/build.sc | 2 +- example/scalabuilds/1-common-config/build.sc | 6 +- .../scalabuilds/10-scala-realistic/build.sc | 16 ++--- example/scalabuilds/2-custom-tasks/build.sc | 6 +- example/scalabuilds/3-override-tasks/build.sc | 2 +- example/scalabuilds/4-nested-modules/build.sc | 8 +-- example/scalabuilds/5-test-suite/build.sc | 18 +++--- example/scalabuilds/6-publish-module/build.sc | 2 +- .../7-cross-scala-version/build.sc | 8 +-- .../scalabuilds/8-sbt-compat-modules/build.sc | 12 ++-- example/scalabuilds/9-java-modules/build.sc | 8 +-- 28 files changed, 131 insertions(+), 131 deletions(-) diff --git a/example/basic/2-custom-build-logic/build.sc b/example/basic/2-custom-build-logic/build.sc index 025a2f7d28a..aa15c6a0e7d 100644 --- a/example/basic/2-custom-build-logic/build.sc +++ b/example/basic/2-custom-build-logic/build.sc @@ -22,14 +22,14 @@ object foo extends RootModule with ScalaModule { /** Usage -> ./mill run +> mill run ... Line Count: 11 -> ./mill show lineCount +> mill show lineCount 11 -> ./mill inspect lineCount +> mill inspect lineCount lineCount(build.sc:12) Total number of lines in module's source files Inputs: @@ -39,7 +39,7 @@ Inputs: // Above, `def lineCount` is a new build target we define, which makes use of // `allSourceFiles` (an existing target) and is in-turn used in our override of // `resources` (also an existing target). This generated file can then be -// loaded and used at runtime, as see in the output of `./mill run` +// loaded and used at runtime, as see in the output of `mill run` // // While this is a toy example, it shows how easy it is to customize your Mill // build to include the kinds of custom logic common in the build config of diff --git a/example/basic/3-multi-module/build.sc b/example/basic/3-multi-module/build.sc index 53198966d85..f8e1c39c13b 100644 --- a/example/basic/3-multi-module/build.sc +++ b/example/basic/3-multi-module/build.sc @@ -55,15 +55,15 @@ object bar extends MyModule { /** Usage -> ./mill resolve __.run +> mill resolve __.run foo.run bar.run -> ./mill foo.run --foo-text hello --bar-text world +> mill foo.run --foo-text hello --bar-text world Foo.value: hello Bar.value:

world

-> ./mill bar.run world +> mill bar.run world Bar.value:

world

*/ diff --git a/example/basic/4-builtin-commands/build.sc b/example/basic/4-builtin-commands/build.sc index e2ada7be5ff..f9e46441dec 100644 --- a/example/basic/4-builtin-commands/build.sc +++ b/example/basic/4-builtin-commands/build.sc @@ -26,7 +26,7 @@ object bar extends MyModule { /** Usage -> ./mill resolve _ +> mill resolve _ foo bar clean @@ -40,10 +40,10 @@ version visualize visualizePlan -> ./mill resolve _.compile +> mill resolve _.compile foo.compile -> ./mill resolve foo._ +> mill resolve foo._ foo.allSourceFiles foo.allSources foo.ammoniteReplClasspath @@ -60,14 +60,14 @@ foo.artifactName /** Usage -> ./mill resolve foo.{compile,run} -> ./mill resolve "foo.{compile,run}" -> ./mill resolve foo.compile foo.run -> ./mill resolve _.compile # list the compile tasks for every top-level module -> ./mill resolve __.compile # list the compile tasks for every module -> ./mill resolve _ # list every top level module and task -> ./mill resolve foo._ # list every task directly within the foo module -> ./mill resolve __ # list every module and task recursively +> mill resolve foo.{compile,run} +> mill resolve "foo.{compile,run}" +> mill resolve foo.compile foo.run +> mill resolve _.compile # list the compile tasks for every top-level module +> mill resolve __.compile # list the compile tasks for every module +> mill resolve _ # list every top level module and task +> mill resolve foo._ # list every task directly within the foo module +> mill resolve __ # list every module and task recursively */ @@ -80,7 +80,7 @@ foo.artifactName /** Usage -> ./mill inspect foo.run +> mill inspect foo.run foo.run(JavaModule.scala:...) Runs this module's code in a subprocess and waits for it to finish Inputs: @@ -106,7 +106,7 @@ Inputs: /** Usage -> ./mill show foo.scalaVersion +> mill show foo.scalaVersion "2.13.11" */ @@ -118,7 +118,7 @@ Inputs: /** Usage -> ./mill show foo.compile +> mill show foo.compile { "analysisFile": ".../out/foo/compile.dest/zinc", "classes": ".../out/foo/compile.dest/classes" @@ -129,12 +129,12 @@ Inputs: /** Usage -> ./mill show foo.sources +> mill show foo.sources [ ".../foo/src" ] -> ./mill show foo.compileClasspath +> mill show foo.compileClasspath [ ".../org/scala-lang/scala-library/2.13.11/scala-library-2.13.11.jar", ... @@ -151,7 +151,7 @@ Inputs: /** Usage -> ./mill show "foo.{sources,compileClasspath}" +> mill show "foo.{sources,compileClasspath}" { "foo.sources": [ ".../foo/src" @@ -172,7 +172,7 @@ Inputs: /** Usage -> ./mill showNamed "foo.{sources,compileClasspath}" +> mill showNamed "foo.{sources,compileClasspath}" { "foo.sources": [ ".../foo/src" @@ -191,12 +191,12 @@ Inputs: // `mill path` prints out a dependency chain between the first task and the // second. It is very useful for exploring the build graph and trying to figure // out how data gets from one task to another, or trying to figure out why -// running `./mill foo` ends up running another task `bar` that you didn't +// running `mill foo` ends up running another task `bar` that you didn't // expect it to. /** Usage -> ./mill path foo.assembly foo.sources +> mill path foo.assembly foo.sources foo.sources foo.allSources foo.allSourceFiles @@ -220,7 +220,7 @@ foo.assembly /** Usage -> ./mill plan foo.compileClasspath +> mill plan foo.compileClasspath foo.transitiveCompileClasspath foo.compileResources foo.unmanagedClasspath @@ -241,7 +241,7 @@ foo.compileClasspath /** Usage -> ./mill clean +> mill clean */ @@ -250,14 +250,14 @@ foo.compileClasspath /** Usage -> ./mill clean # clean all outputs -> ./mill clean foo # clean all outputs for module 'foo' (including nested modules) -> ./mill clean foo.compile # only clean outputs for task 'compile' in module 'foo' -> ./mill clean foo.{compile,run} -> ./mill clean "foo.{compile,run}" -> ./mill clean foo.compile foo.run -> ./mill clean _.compile -> ./mill clean __.compile +> mill clean # clean all outputs +> mill clean foo # clean all outputs for module 'foo' (including nested modules) +> mill clean foo.compile # only clean outputs for task 'compile' in module 'foo' +> mill clean foo.{compile,run} +> mill clean "foo.{compile,run}" +> mill clean foo.compile foo.run +> mill clean _.compile +> mill clean __.compile */ @@ -270,9 +270,9 @@ foo.compileClasspath /** Usage -> ./mill mill.scalalib.Dependency/showUpdates +> mill mill.scalalib.Dependency/showUpdates -> ./mill mill.scalalib.Dependency/showUpdates --allowPreRelease true # also show pre-release versions +> mill mill.scalalib.Dependency/showUpdates --allowPreRelease true # also show pre-release versions */ diff --git a/example/cross/1-simple/build.sc b/example/cross/1-simple/build.sc index 11542fba78f..f1c51073895 100644 --- a/example/cross/1-simple/build.sc +++ b/example/cross/1-simple/build.sc @@ -23,24 +23,24 @@ trait FooModule extends Cross.Module[String] { /** Usage -> ./mill show foo[2.10].suffix +> mill show foo[2.10].suffix "_2.10" -> ./mill show foo[2.10].bigSuffix +> mill show foo[2.10].bigSuffix "[[[_2.10]]]" -> ./mill show foo[2.10].sources +> mill show foo[2.10].sources [ ".../foo" ] -> ./mill show foo[2.12].suffix +> mill show foo[2.12].suffix "_2.12" -> ./mill show foo[2.12].bigSuffix +> mill show foo[2.12].bigSuffix "[[[_2.12]]]" -> ./mill show foo[2.12].sources +> mill show foo[2.12].sources [ ".../foo" ] diff --git a/example/cross/10-static-blog/build.sc b/example/cross/10-static-blog/build.sc index b9038fa0da4..fbcf6850c3b 100644 --- a/example/cross/10-static-blog/build.sc +++ b/example/cross/10-static-blog/build.sc @@ -79,7 +79,7 @@ def dist = T { /** Usage -> ./mill dist +> mill dist > cat out/dist.dest/index.html # root index page ... @@ -100,14 +100,14 @@ def dist = T { // `post/` folder, and when you edit your posts it only re-parses and // re-renders the markdown files that you changed. You can use `-w` to watch // the posts folder to automatically re-run the `dist` command if a post -// changes, or `-j` e.g. `./mill -j 4 dist` to enable parallelism if there are +// changes, or `-j` e.g. `mill -j 4 dist` to enable parallelism if there are // enough posts that the build is becoming noticeably slow. // // You can also build each individual post directly: /** Usage -> ./mill show "post[1-My-First-Post.md].render" +> mill show "post[1-My-First-Post.md].render" ".../out/post/1-My-First-Post.md/render.dest/1-my-first-post.html" > cat out/post/1-My-First-Post.md/render.dest/1-my-first-post.html diff --git a/example/cross/11-default-cross-module/build.sc b/example/cross/11-default-cross-module/build.sc index 4e7d2a631f2..4ddbdc1800d 100644 --- a/example/cross/11-default-cross-module/build.sc +++ b/example/cross/11-default-cross-module/build.sc @@ -16,13 +16,13 @@ object bar extends Cross[FooModule]("2.10", "2.11", "2.12") { /** Usage -> ./mill show foo[2.10].suffix +> mill show foo[2.10].suffix "_2.10" -> ./mill show foo[].suffix +> mill show foo[].suffix "_2.10" -> ./mill show bar[].suffix +> mill show bar[].suffix "_2.12" */ diff --git a/example/cross/2-cross-source-path/build.sc b/example/cross/2-cross-source-path/build.sc index 5b5c2a2cc37..7c821159800 100644 --- a/example/cross/2-cross-source-path/build.sc +++ b/example/cross/2-cross-source-path/build.sc @@ -17,17 +17,17 @@ trait FooModule extends Cross.Module[String] { /** Usage -> ./mill show foo[2.10].sources +> mill show foo[2.10].sources [ ".../foo/2.10" ] -> ./mill show foo[2.11].sources +> mill show foo[2.11].sources [ ".../foo/2.11" ] -> ./mill show foo[2.12].sources +> mill show foo[2.12].sources [ ".../foo/2.12" ] diff --git a/example/cross/3-outside-dependency/build.sc b/example/cross/3-outside-dependency/build.sc index 9c695f68309..7bca911409d 100644 --- a/example/cross/3-outside-dependency/build.sc +++ b/example/cross/3-outside-dependency/build.sc @@ -18,13 +18,13 @@ def qux = T { s"hello ${foo("2.10").suffix()} world ${foo("2.12").suffix()}" } /** Usage -> ./mill show foo[2.10].suffix +> mill show foo[2.10].suffix "_2.10" -> ./mill show bar +> mill show bar "hello _2.10" -> ./mill show qux +> mill show qux "hello _2.10 world _2.12" */ \ No newline at end of file diff --git a/example/cross/4-cross-dependencies/build.sc b/example/cross/4-cross-dependencies/build.sc index 43af0c8bcee..339d2d4218d 100644 --- a/example/cross/4-cross-dependencies/build.sc +++ b/example/cross/4-cross-dependencies/build.sc @@ -21,14 +21,14 @@ trait BarModule extends Cross.Module[String] { /** Usage -> ./mill showNamed foo[__].suffix +> mill showNamed foo[__].suffix { "foo[2.10].suffix": "_2.10", "foo[2.11].suffix": "_2.11", "foo[2.12].suffix": "_2.12" } -> ./mill showNamed bar[__].bigSuffix +> mill showNamed bar[__].bigSuffix { "bar[2.10].bigSuffix": "[[[_2.10]]]", "bar[2.11].bigSuffix": "[[[_2.11]]]", diff --git a/example/cross/5-multiple-cross-axes/build.sc b/example/cross/5-multiple-cross-axes/build.sc index b0b606e73ad..d007f3c24ea 100644 --- a/example/cross/5-multiple-cross-axes/build.sc +++ b/example/cross/5-multiple-cross-axes/build.sc @@ -28,10 +28,10 @@ def bar = T { s"hello ${foo("2.10", "jvm").suffix()}" } /** Usage -> ./mill show foo[2.10,jvm].suffix +> mill show foo[2.10,jvm].suffix "_2.10_jvm" -> ./mill showNamed foo[__].suffix +> mill showNamed foo[__].suffix { "foo[2.10,jvm].suffix": "_2.10_jvm", "foo[2.10,js].suffix": "_2.10_js", diff --git a/example/cross/6-axes-extension/build.sc b/example/cross/6-axes-extension/build.sc index bd146804eb1..81e557099b6 100644 --- a/example/cross/6-axes-extension/build.sc +++ b/example/cross/6-axes-extension/build.sc @@ -34,26 +34,26 @@ trait FooModule3 extends FooModule2 with Cross.Module3[String, Int, Boolean] { /** Usage -> ./mill show foo[a].param1 +> mill show foo[a].param1 "Param Value: a" -> ./mill show foo[b].param1 +> mill show foo[b].param1 "Param Value: b" -> ./mill show foo2[a,1].param1 +> mill show foo2[a,1].param1 "Param Value: a" -> ./mill show foo2[b,2].param2 +> mill show foo2[b,2].param2 "Param Value: 2" -> ./mill show foo3[b,2,false].param3 +> mill show foo3[b,2,false].param3 "Param Value: false" > sed -i 's/, true//g' build.sc > sed -i 's/, false//g' build.sc -> ./mill show foo3[b,2,false].param3 +> mill show foo3[b,2,false].param3 error: ...object foo3 extends Cross[FooModule3](("a", 1), ("b", 2)) error: ... ^ error: ...value _3 is not a member of (String, Int) diff --git a/example/cross/7-inner-cross-module/build.sc b/example/cross/7-inner-cross-module/build.sc index 81ecd1e5f50..c11e0d09741 100644 --- a/example/cross/7-inner-cross-module/build.sc +++ b/example/cross/7-inner-cross-module/build.sc @@ -31,13 +31,13 @@ def baz = T { s"hello ${foo("a").bar.param()}" } /** Usage -> ./mill show foo[a].bar.param +> mill show foo[a].bar.param "Bar Param Value: a" -> ./mill show foo[b].qux.param +> mill show foo[b].qux.param "Qux Param Value: b" -> ./mill show baz +> mill show baz "hello Bar Param Value: a" */ \ No newline at end of file diff --git a/example/cross/8-resolvers/build.sc b/example/cross/8-resolvers/build.sc index 4c14b8980a2..76c76db5b7f 100644 --- a/example/cross/8-resolvers/build.sc +++ b/example/cross/8-resolvers/build.sc @@ -29,7 +29,7 @@ trait BarModule extends MyModule { /** Usage -> ./mill show bar[2.10].bigSuffix +> mill show bar[2.10].bigSuffix ... "[[[_2.10]]]" diff --git a/example/cross/9-dynamic-cross-modules/build.sc b/example/cross/9-dynamic-cross-modules/build.sc index 6be561c2bcb..9f76d4ebca0 100644 --- a/example/cross/9-dynamic-cross-modules/build.sc +++ b/example/cross/9-dynamic-cross-modules/build.sc @@ -20,28 +20,28 @@ trait FolderModule extends ScalaModule with Cross.Module[String]{ /** Usage -> ./mill resolve modules[_] +> mill resolve modules[_] modules[bar] modules[foo] modules[qux] -> ./mill modules[bar].run +> mill modules[bar].run Hello World Bar -> ./mill modules[new].run +> mill modules[new].run error: Cannot resolve modules[new]... > cp -r modules/bar modules/new > sed -i 's/Bar/New/g' modules/new/src/Example.scala -> ./mill resolve modules[_] +> mill resolve modules[_] modules[bar] modules[foo] modules[qux] modules[new] -> ./mill modules[new].run +> mill modules[new].run Hello World New */ diff --git a/example/misc/3-import-file-ivy/build.sc b/example/misc/3-import-file-ivy/build.sc index 3ae2328d512..97fab9d34e0 100644 --- a/example/misc/3-import-file-ivy/build.sc +++ b/example/misc/3-import-file-ivy/build.sc @@ -33,14 +33,14 @@ object foo extends RootModule with ScalaModule { /** Usage -> ./mill compile +> mill compile compiling 1 Scala source... ... -> ./mill run +> mill run generated snippet.txt resource:

hello

world

-> ./mill show assembly +> mill show assembly ".../out/assembly.dest/out.jar" > ./out/assembly.dest/out.jar # mac/linux diff --git a/example/misc/4-mill-build-folder/build.sc b/example/misc/4-mill-build-folder/build.sc index 5e153dbaa76..986682f44a4 100644 --- a/example/misc/4-mill-build-folder/build.sc +++ b/example/misc/4-mill-build-folder/build.sc @@ -46,15 +46,15 @@ object foo extends RootModule with ScalaModule { /** Usage -> ./mill compile +> mill compile compiling 1 Scala source... ... -> ./mill run +> mill run Foo.value:

hello

scalatagsVersion: 0.12.0 -> ./mill show assembly +> mill show assembly ".../out/assembly.dest/out.jar" > ./out/assembly.dest/out.jar # mac/linux @@ -68,14 +68,14 @@ scalatagsVersion: 0.12.0 /** Usage -> ./mill --meta-level 1 show sources +> mill --meta-level 1 show sources [ .../build.sc", -.../mill-build/src" +..mill-build/src" ] -> ./mill --meta-level 2 show sources -.../mill-build/build.sc" +> mill --meta-level 2 show sources +..mill-build/build.sc" */ \ No newline at end of file diff --git a/example/misc/5-module-run-task/build.sc b/example/misc/5-module-run-task/build.sc index 73f0c2a362d..96ff9bf060d 100644 --- a/example/misc/5-module-run-task/build.sc +++ b/example/misc/5-module-run-task/build.sc @@ -27,7 +27,7 @@ object bar extends ScalaModule{ /** Usage -> ./mill foo.run +> mill foo.run ... Foo.value: HELLO diff --git a/example/misc/6-contrib-import/build.sc b/example/misc/6-contrib-import/build.sc index f77e7977381..740838a904c 100644 --- a/example/misc/6-contrib-import/build.sc +++ b/example/misc/6-contrib-import/build.sc @@ -17,7 +17,7 @@ object foo extends ScalaModule with BuildInfo { /** Usage -> ./mill foo.run +> mill foo.run ... foo.BuildInfo.scalaVersion: 2.13.10 diff --git a/example/scalabuilds/1-common-config/build.sc b/example/scalabuilds/1-common-config/build.sc index 5decb64d493..886c86fb053 100644 --- a/example/scalabuilds/1-common-config/build.sc +++ b/example/scalabuilds/1-common-config/build.sc @@ -74,7 +74,7 @@ object foo extends RootModule with ScalaModule { /** Usage -> ./mill run +> mill run Foo2.value:

hello2

Foo.value:

hello

FooA.value: hello A @@ -85,7 +85,7 @@ MyOtherResource: My Other Resource Contents my.custom.property: my-prop-value MY_CUSTOM_ENV: my-env-value -> ./mill show assembly +> mill show assembly ".../out/assembly.dest/out.jar" > ./out/assembly.dest/out.jar # mac/linux @@ -100,7 +100,7 @@ my.custom.property: my-prop-value > sed -i 's/Foo2 {/Foo2 { println(this + "hello")/g' custom-src/Foo2.scala -> ./mill compile # demonstrate -deprecation/-Xfatal-warnings flags +> mill compile # demonstrate -deprecation/-Xfatal-warnings flags error: object Foo2 { println(this + "hello") error: ^ error: ...Implicit injection of + is deprecated. Convert to String to call +... diff --git a/example/scalabuilds/10-scala-realistic/build.sc b/example/scalabuilds/10-scala-realistic/build.sc index f9d6eab5be6..bab450804bb 100644 --- a/example/scalabuilds/10-scala-realistic/build.sc +++ b/example/scalabuilds/10-scala-realistic/build.sc @@ -79,7 +79,7 @@ object qux extends JavaModule with MyModule /** Usage -> ./mill resolve __.run +> mill resolve __.run bar[2.13.8].run bar[2.13.8].test.run bar[3.2.2].run @@ -90,34 +90,34 @@ foo[3.2.2].run foo[3.2.2].test.run qux.run -> ./mill foo[2.13.8].run +> mill foo[2.13.8].run foo version 0.0.1 Foo.value:

hello

Bar.value:

world Specific code for Scala 2.x

Qux.value: 31337 -> ./mill bar[3.2.2].test +> mill bar[3.2.2].test + bar.BarTests.test ...

world Specific code for Scala 3.x

-> ./mill qux.run +> mill qux.run Qux.value: 31337 -> ./mill __.compile +> mill __.compile -> ./mill __.test +> mill __.test + bar.BarTests.test ...

world Specific code for Scala 2.x

+ bar.BarTests.test ...

world Specific code for Scala 3.x

+ foo.FooTests.test ...

hello

+ foo.FooTests.test ...

hello

-> ./mill __.publishLocal +> mill __.publishLocal Publishing Artifact(com.lihaoyi,foo_2.13,0.0.1) to ivy repo... Publishing Artifact(com.lihaoyi,bar_2.13,0.0.1) to ivy repo... Publishing Artifact(com.lihaoyi,foo_3,0.0.1) to ivy repo... Publishing Artifact(com.lihaoyi,bar_3,0.0.1) to ivy repo... Publishing Artifact(com.lihaoyi,qux,0.0.1) to ivy repo... -> ./mill show foo[2.13.8].assembly # mac/linux +> mill show foo[2.13.8].assembly # mac/linux ".../out/foo/2.13.8/assembly.dest/out.jar" > ./out/foo/2.13.8/assembly.dest/out.jar # mac/linux diff --git a/example/scalabuilds/2-custom-tasks/build.sc b/example/scalabuilds/2-custom-tasks/build.sc index e8f372a16ad..00f59871f67 100644 --- a/example/scalabuilds/2-custom-tasks/build.sc +++ b/example/scalabuilds/2-custom-tasks/build.sc @@ -66,15 +66,15 @@ object foo extends RootModule with ScalaModule { /** Usage -> ./mill run --text hello +> mill run --text hello text: hello MyDeps.value: List((com.lihaoyi,mainargs,0.4.0)) my.line.count: 12 -> ./mill show lineCount +> mill show lineCount 12 -> ./mill printLineCount +> mill printLineCount 12 */ diff --git a/example/scalabuilds/3-override-tasks/build.sc b/example/scalabuilds/3-override-tasks/build.sc index 1dab13a11cc..a88f1f00305 100644 --- a/example/scalabuilds/3-override-tasks/build.sc +++ b/example/scalabuilds/3-override-tasks/build.sc @@ -60,7 +60,7 @@ object foo3 extends ScalaModule { /** Usage -> ./mill foo.run +> mill foo.run Compiling... Running... Hello World diff --git a/example/scalabuilds/4-nested-modules/build.sc b/example/scalabuilds/4-nested-modules/build.sc index 7e20e3e281c..8931377dcbe 100644 --- a/example/scalabuilds/4-nested-modules/build.sc +++ b/example/scalabuilds/4-nested-modules/build.sc @@ -34,23 +34,23 @@ object baz extends MyModule { /** Usage -> ./mill resolve __.run +> mill resolve __.run foo.bar.run foo.qux.run baz.run -> ./mill foo.run --bar-text hello --qux-text world --foo-text today +> mill foo.run --bar-text hello --qux-text world --foo-text today Bar.value:

hello

Qux.value:

world

Foo.value:

today

-> ./mill baz.run --bar-text hello --qux-text world --foo-text today --baz-text yay +> mill baz.run --bar-text hello --qux-text world --foo-text today --baz-text yay Bar.value:

hello

Qux.value:

world

Foo.value:

today

Baz.value:

yay

-> ./mill foo.qux.run --bar-text hello --qux-text world +> mill foo.qux.run --bar-text hello --qux-text world Bar.value:

hello

Qux.value:

world

diff --git a/example/scalabuilds/5-test-suite/build.sc b/example/scalabuilds/5-test-suite/build.sc index 547acbc0ad0..a2b722b17ef 100644 --- a/example/scalabuilds/5-test-suite/build.sc +++ b/example/scalabuilds/5-test-suite/build.sc @@ -17,17 +17,17 @@ object foo extends ScalaModule { /** Usage -> ./mill foo.compile +> mill foo.compile compiling 1 Scala source... -> ./mill foo.test.compile +> mill foo.test.compile compiling 1 Scala source... -> ./mill foo.test.test +> mill foo.test.test + foo.FooTests.hello ... + foo.FooTests.world ... -> ./mill foo.test +> mill foo.test + foo.FooTests.hello ... + foo.FooTests.world ... @@ -54,7 +54,7 @@ object bar extends ScalaModule { /** Usage -> ./mill bar.test +> mill bar.test + bar.BarTests.hello ... + bar.BarTests.world ... @@ -77,7 +77,7 @@ object bar extends ScalaModule { /** Usage -> ./mill bar.test bar.BarTests.hello +> mill bar.test bar.BarTests.hello + bar.BarTests.hello ... */ @@ -100,14 +100,14 @@ object qux extends ScalaModule { /** Usage -> ./mill qux.test +> mill qux.test + qux.QuxTests.hello ... + qux.QuxTests.world ... -> ./mill qux.integration +> mill qux.integration + qux.QuxIntegrationTests.helloworld ... -> ./mill qux.{test,integration} +> mill qux.{test,integration} + qux.QuxTests.hello ... + qux.QuxTests.world ... + qux.QuxIntegrationTests.helloworld ... diff --git a/example/scalabuilds/6-publish-module/build.sc b/example/scalabuilds/6-publish-module/build.sc index b48735c3ba7..f55fad145a9 100644 --- a/example/scalabuilds/6-publish-module/build.sc +++ b/example/scalabuilds/6-publish-module/build.sc @@ -24,7 +24,7 @@ object foo extends ScalaModule with PublishModule { /** Usage -> ./mill foo.publishLocal +> mill foo.publishLocal Publishing Artifact(com.lihaoyi,foo_2.13,0.0.1) to ivy repo... */ diff --git a/example/scalabuilds/7-cross-scala-version/build.sc b/example/scalabuilds/7-cross-scala-version/build.sc index 3e89e93b250..3d8418a365d 100644 --- a/example/scalabuilds/7-cross-scala-version/build.sc +++ b/example/scalabuilds/7-cross-scala-version/build.sc @@ -23,25 +23,25 @@ trait BarModule extends CrossScalaModule /** Usage -> ./mill resolve __.run +> mill resolve __.run foo[2.12.17].run foo[2.13.8].run bar[2.12.17].run bar[2.13.8].run -> ./mill foo[2.12.17].run +> mill foo[2.12.17].run Foo.value: Hello World Scala library version 2.12.17... Bar.value: bar-value Specific code for Scala 2.x Specific code for Scala 2.12.x -> ./mill foo[2.13.8].run +> mill foo[2.13.8].run Foo.value: Hello World Scala library version 2.13.8... Bar.value: bar-value Specific code for Scala 2.x Specific code for Scala 2.13.x -> ./mill bar[2.13.8].run +> mill bar[2.13.8].run Bar.value: bar-value */ diff --git a/example/scalabuilds/8-sbt-compat-modules/build.sc b/example/scalabuilds/8-sbt-compat-modules/build.sc index dd005376827..f5592847158 100644 --- a/example/scalabuilds/8-sbt-compat-modules/build.sc +++ b/example/scalabuilds/8-sbt-compat-modules/build.sc @@ -39,22 +39,22 @@ trait BarModule extends CrossSbtModule { /** Usage -> ./mill foo.compile +> mill foo.compile compiling 1 Scala source... -> ./mill foo.test.compile +> mill foo.test.compile compiling 1 Scala source... -> ./mill foo.test.test +> mill foo.test.test + foo.FooTests.hello ... -> ./mill foo.test +> mill foo.test + foo.FooTests.hello ... -> ./mill bar[2.13.8].run +> mill bar[2.13.8].run Bar.value: Hello World Scala library version 2.13.8... -> ./mill bar[2.12.17].run +> mill bar[2.12.17].run Bar.value: Hello World Scala library version 2.12.17... */ \ No newline at end of file diff --git a/example/scalabuilds/9-java-modules/build.sc b/example/scalabuilds/9-java-modules/build.sc index 1294a6dc51c..d876daeb642 100644 --- a/example/scalabuilds/9-java-modules/build.sc +++ b/example/scalabuilds/9-java-modules/build.sc @@ -17,18 +17,18 @@ object bar extends JavaModule /** Usage -> ./mill resolve __.run +> mill resolve __.run foo.run bar.run -> ./mill foo.compile +> mill foo.compile compiling 1 Java source... -> ./mill foo.run +> mill foo.run Foo.value: 31337 Bar.value: 271828 -> ./mill foo.test +> mill foo.test Test run started ... Test run finished: 0 failed, 0 ignored, 2 total... From e084314d2146db931e86d3a4017b9dda33486b32 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Wed, 8 Nov 2023 10:21:00 +0100 Subject: [PATCH 5/7] scalafmt --- example/src/mill/integration/ExampleTestSuite.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example/src/mill/integration/ExampleTestSuite.scala b/example/src/mill/integration/ExampleTestSuite.scala index d83e147f3b3..2a12357c460 100644 --- a/example/src/mill/integration/ExampleTestSuite.scala +++ b/example/src/mill/integration/ExampleTestSuite.scala @@ -107,7 +107,7 @@ object ExampleTestSuite extends IntegrationTestSuite { IntegrationTestSuite.EvalResult(true, res, "") ) - case Seq("node", rest@_*) => + case Seq("node", rest @ _*) => val res = os .proc("node", rest) .call(stdout = os.Pipe, stderr = os.Pipe, cwd = workspaceRoot) @@ -116,7 +116,7 @@ object ExampleTestSuite extends IntegrationTestSuite { IntegrationTestSuite.EvalResult(res.exitCode == 0, res.out.text(), res.err.text()) ) - case Seq("git", rest@_*) => + case Seq("git", rest @ _*) => val res = os .proc("git", rest) .call(stdout = os.Pipe, stderr = os.Pipe, cwd = workspaceRoot) @@ -125,7 +125,7 @@ object ExampleTestSuite extends IntegrationTestSuite { IntegrationTestSuite.EvalResult(res.exitCode == 0, res.out.text(), res.err.text()) ) - case Seq("java", "-jar", rest@_*) => + case Seq("java", "-jar", rest @ _*) => val res = os .proc("java", "-jar", rest) .call(stdout = os.Pipe, stderr = os.Pipe, cwd = workspaceRoot) From 5786eb33ea76e57bae372e798fe4e5632587e87b Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Wed, 8 Nov 2023 10:33:58 +0100 Subject: [PATCH 6/7] Fixes --- example/basic/4-builtin-commands/build.sc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example/basic/4-builtin-commands/build.sc b/example/basic/4-builtin-commands/build.sc index e2ada7be5ff..b9450941952 100644 --- a/example/basic/4-builtin-commands/build.sc +++ b/example/basic/4-builtin-commands/build.sc @@ -54,7 +54,8 @@ foo.artifactName */ -// You can also use the special wildcards `+_+` as a placeholder for a single segment and `+__+`as a placeholder for many segments. +// You can also use the special wildcards `+_+` as a placeholder for a single segment +// and `+__+` as a placeholder for many segments. // Lists within curly braces (`{`, `}`) are also supported. From 13a11e8552b5f52b7c1cb6c021c4cb10370ad3c8 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Wed, 8 Nov 2023 14:15:02 +0100 Subject: [PATCH 7/7] Fix expected output --- example/misc/4-mill-build-folder/build.sc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/misc/4-mill-build-folder/build.sc b/example/misc/4-mill-build-folder/build.sc index 986682f44a4..eac7f4b71d2 100644 --- a/example/misc/4-mill-build-folder/build.sc +++ b/example/misc/4-mill-build-folder/build.sc @@ -71,11 +71,11 @@ scalatagsVersion: 0.12.0 > mill --meta-level 1 show sources [ .../build.sc", -..mill-build/src" +.../mill-build/src" ] > mill --meta-level 2 show sources -..mill-build/build.sc" +.../mill-build/build.sc" */ \ No newline at end of file