Skip to content

Commit

Permalink
ExampleTestSuite: Also support mill command in addition to ./mill (
Browse files Browse the repository at this point in the history
…#2865)

Replace `./mill` with `mill` in most examples, as this is easier to
read. I kept the `./mill` in the first simple scala project, which also
describes that there is a `./mill` script in each example archive.

Pull request: #2865
  • Loading branch information
lefou authored Nov 8, 2023
1 parent 22077be commit c12d024
Show file tree
Hide file tree
Showing 29 changed files with 153 additions and 152 deletions.
8 changes: 4 additions & 4 deletions example/basic/2-custom-build-logic/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions example/basic/3-multi-module/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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: <p>world</p>
> ./mill bar.run world
> mill bar.run world
Bar.value: <p>world</p>
*/
Expand Down
64 changes: 32 additions & 32 deletions example/basic/4-builtin-commands/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object bar extends MyModule {

/** Usage
> ./mill resolve _
> mill resolve _
foo
bar
clean
Expand All @@ -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
Expand All @@ -61,14 +61,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
*/

Expand All @@ -81,7 +81,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:
Expand All @@ -107,7 +107,7 @@ Inputs:

/** Usage
> ./mill show foo.scalaVersion
> mill show foo.scalaVersion
"2.13.11"
*/
Expand All @@ -119,7 +119,7 @@ Inputs:

/** Usage
> ./mill show foo.compile
> mill show foo.compile
{
"analysisFile": ".../out/foo/compile.dest/zinc",
"classes": ".../out/foo/compile.dest/classes"
Expand All @@ -130,12 +130,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",
...
Expand All @@ -152,7 +152,7 @@ Inputs:

/** Usage
> ./mill show "foo.{sources,compileClasspath}"
> mill show "foo.{sources,compileClasspath}"
{
"foo.sources": [
".../foo/src"
Expand All @@ -173,7 +173,7 @@ Inputs:

/** Usage
> ./mill showNamed "foo.{sources,compileClasspath}"
> mill showNamed "foo.{sources,compileClasspath}"
{
"foo.sources": [
".../foo/src"
Expand All @@ -192,12 +192,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
Expand All @@ -221,7 +221,7 @@ foo.assembly

/** Usage
> ./mill plan foo.compileClasspath
> mill plan foo.compileClasspath
foo.transitiveCompileClasspath
foo.compileResources
foo.unmanagedClasspath
Expand All @@ -242,7 +242,7 @@ foo.compileClasspath

/** Usage
> ./mill clean
> mill clean
*/

Expand All @@ -251,14 +251,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
*/

Expand All @@ -271,9 +271,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
*/

Expand Down
12 changes: 6 additions & 6 deletions example/cross/1-simple/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand Down
6 changes: 3 additions & 3 deletions example/cross/10-static-blog/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def dist = T {

/** Usage
> ./mill dist
> mill dist
> cat out/dist.dest/index.html # root index page
...
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions example/cross/11-default-cross-module/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
*/
Expand Down
6 changes: 3 additions & 3 deletions example/cross/2-cross-source-path/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand Down
6 changes: 3 additions & 3 deletions example/cross/3-outside-dependency/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
*/
4 changes: 2 additions & 2 deletions example/cross/4-cross-dependencies/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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]]]",
Expand Down
4 changes: 2 additions & 2 deletions example/cross/5-multiple-cross-axes/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions example/cross/6-axes-extension/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit c12d024

Please sign in to comment.