From 2d1f46213dfcd1a86e777571c83dddda93316931 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 10:05:43 +0800 Subject: [PATCH 01/24] . --- example/misc/7-publish-mill-plugin/build.sc | 33 +++++++++++++++++++ .../myplugin/src/LineCountJavaModule.scala | 18 ++++++++++ .../example-test-example-project/build.sc | 12 +++++++ .../src/foo/Foo.java | 17 ++++++++++ .../integration-test-example-project/build.sc | 4 +++ .../src/foo/Foo.java | 17 ++++++++++ .../src/foo/Foo.java | 17 ++++++++++ .../test/src/mill/testkit/ExampleTests.scala | 17 ++++++++++ .../src/mill/testkit/IntegrationTests.scala | 30 +++++++++++++++++ .../test/src/mill/testkit/UnitTests.scala | 24 ++++++++++++++ 10 files changed, 189 insertions(+) create mode 100644 example/misc/7-publish-mill-plugin/build.sc create mode 100644 example/misc/7-publish-mill-plugin/myplugin/src/LineCountJavaModule.scala create mode 100644 example/misc/7-publish-mill-plugin/myplugin/test/resources/example-test-example-project/build.sc create mode 100644 example/misc/7-publish-mill-plugin/myplugin/test/resources/example-test-example-project/src/foo/Foo.java create mode 100644 example/misc/7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project/build.sc create mode 100644 example/misc/7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project/src/foo/Foo.java create mode 100644 example/misc/7-publish-mill-plugin/myplugin/test/resources/unit-test-example-project/src/foo/Foo.java create mode 100644 example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/ExampleTests.scala create mode 100644 example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/IntegrationTests.scala create mode 100644 example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/UnitTests.scala diff --git a/example/misc/7-publish-mill-plugin/build.sc b/example/misc/7-publish-mill-plugin/build.sc new file mode 100644 index 00000000000..c52420f1d80 --- /dev/null +++ b/example/misc/7-publish-mill-plugin/build.sc @@ -0,0 +1,33 @@ + +import mill._, scalalib._, publish._ +import mill.main.BuildInfo.millVersion +import mill.util.Util.millProjectModule + +object myplugin extends ScalaModule with PublishModule { + def scalaVersion = "2.13.8" + def publishVersion = "0.0.1" + + def pomSettings = PomSettings( + description = "Line Count Mill Plugin", + organization = "com.lihaoyi", + url = "https://github.com/lihaoyi/example", + licenses = Seq(License.MIT), + versionControl = VersionControl.github("lihaoyi", "example"), + developers = Seq( + Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi") + ) + ) + + def ivyDeps = Agg( + ivy"com.lihaoyi::mill-testkit:$millVersion", + ivy"com.lihaoyi::mill-scalalib:$millVersion" + ) + + object test extends ScalaTests with TestModule.Utest{ + def forkEnv = Map( + "MILL_EXECUTABLE_PATH" -> + defaultResolver().resolveDeps(Seq(ivy"com.lihaoyi:mill-dist:$millVersion")) + .head.path.toString + ) + } +} diff --git a/example/misc/7-publish-mill-plugin/myplugin/src/LineCountJavaModule.scala b/example/misc/7-publish-mill-plugin/myplugin/src/LineCountJavaModule.scala new file mode 100644 index 00000000000..5100a2e285b --- /dev/null +++ b/example/misc/7-publish-mill-plugin/myplugin/src/LineCountJavaModule.scala @@ -0,0 +1,18 @@ +package myplugin +import mill._ +/** + * Example Mill plugin trait that adds a `line-count.txt` + * to the resources of your `JavaModule` + */ +trait LineCountJavaModule extends mill.javalib.JavaModule{ + /** Total number of lines in module's source files */ + def lineCount = T{ + allSourceFiles().map(f => os.read.lines(f.path).size).sum + } + + /** Generate resources using lineCount of sources */ + override def resources = T{ + os.write(T.dest / "line-count.txt", "" + lineCount()) + super.resources() ++ Seq(PathRef(T.dest)) + } +} \ No newline at end of file diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/resources/example-test-example-project/build.sc b/example/misc/7-publish-mill-plugin/myplugin/test/resources/example-test-example-project/build.sc new file mode 100644 index 00000000000..3495b59a82a --- /dev/null +++ b/example/misc/7-publish-mill-plugin/myplugin/test/resources/example-test-example-project/build.sc @@ -0,0 +1,12 @@ +import mill._, myplugin._ + +object foo extends RootModule with LineCountJavaModule + + +/** Usage + +> ./mill run +Line Count: 17 +... + +*/ \ No newline at end of file diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/resources/example-test-example-project/src/foo/Foo.java b/example/misc/7-publish-mill-plugin/myplugin/test/resources/example-test-example-project/src/foo/Foo.java new file mode 100644 index 00000000000..12dcba2b7ab --- /dev/null +++ b/example/misc/7-publish-mill-plugin/myplugin/test/resources/example-test-example-project/src/foo/Foo.java @@ -0,0 +1,17 @@ +package foo; + +public class Foo { + public static String getLineCount(){ + try{ + return new String( + Foo.class.getClassLoader().getResourceAsStream("line-count.txt").readAllBytes() + ); + }catch(java.io.IOException e){ return null; } + } + + static String lineCount = getLineCount(); + + public static void main(String[] args) throws Exception { + System.out.println("Line Count: " + lineCount); + } +} diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project/build.sc b/example/misc/7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project/build.sc new file mode 100644 index 00000000000..aaabedbb6b0 --- /dev/null +++ b/example/misc/7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project/build.sc @@ -0,0 +1,4 @@ +import mill._, myplugin._ + +object foo extends RootModule with LineCountJavaModule + diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project/src/foo/Foo.java b/example/misc/7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project/src/foo/Foo.java new file mode 100644 index 00000000000..12dcba2b7ab --- /dev/null +++ b/example/misc/7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project/src/foo/Foo.java @@ -0,0 +1,17 @@ +package foo; + +public class Foo { + public static String getLineCount(){ + try{ + return new String( + Foo.class.getClassLoader().getResourceAsStream("line-count.txt").readAllBytes() + ); + }catch(java.io.IOException e){ return null; } + } + + static String lineCount = getLineCount(); + + public static void main(String[] args) throws Exception { + System.out.println("Line Count: " + lineCount); + } +} diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/resources/unit-test-example-project/src/foo/Foo.java b/example/misc/7-publish-mill-plugin/myplugin/test/resources/unit-test-example-project/src/foo/Foo.java new file mode 100644 index 00000000000..12dcba2b7ab --- /dev/null +++ b/example/misc/7-publish-mill-plugin/myplugin/test/resources/unit-test-example-project/src/foo/Foo.java @@ -0,0 +1,17 @@ +package foo; + +public class Foo { + public static String getLineCount(){ + try{ + return new String( + Foo.class.getClassLoader().getResourceAsStream("line-count.txt").readAllBytes() + ); + }catch(java.io.IOException e){ return null; } + } + + static String lineCount = getLineCount(); + + public static void main(String[] args) throws Exception { + System.out.println("Line Count: " + lineCount); + } +} diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/ExampleTests.scala b/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/ExampleTests.scala new file mode 100644 index 00000000000..5428488eb8d --- /dev/null +++ b/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/ExampleTests.scala @@ -0,0 +1,17 @@ +package mill.testkit + +import utest._ + +object ExampleTests extends TestSuite { + + def tests: Tests = Tests { + test("example") { + val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) + ExampleTester.run( + clientServerMode = true, + workspaceSourcePath = resourceFolder / "example-test-example-project", + millExecutable = os.Path(sys.env("MILL_EXECUTABLE_PATH")) + ) + } + } +} diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/IntegrationTests.scala b/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/IntegrationTests.scala new file mode 100644 index 00000000000..e3ca313beff --- /dev/null +++ b/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/IntegrationTests.scala @@ -0,0 +1,30 @@ +package mill.testkit + +import utest._ + +object IntegrationTests extends TestSuite { + + def tests: Tests = Tests { + + test("integration") { + val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) + val tester = new IntegrationTester( + clientServerMode = true, + workspaceSourcePath = resourceFolder / "integration-test-example-project", + millExecutable = os.Path(sys.env("MILL_EXECUTABLE_PATH")) + ) + + val res1 = tester.eval("run") + assert(res1.isSuccess) + assert(res1.err.contains("compiling 1 Scala source")) // compiling the `build.sc` + assert(res1.out.contains("Line Count: 17")) + assert(tester.outJson("lineCount").value[Int] == 17) + + tester.modifyFile(tester.workspacePath / "source-file.txt", _ + "!!!") + + val res2 = tester.eval("run") + assert(!res2.err.contains("compiling 1 Scala source")) // no need to re-compile `build.sc` + assert(res1.out.contains("Line Count: 17")) + } + } +} diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/UnitTests.scala b/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/UnitTests.scala new file mode 100644 index 00000000000..2fee237d51f --- /dev/null +++ b/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/UnitTests.scala @@ -0,0 +1,24 @@ +package myplugin + +//import mill._ +import mill.testkit.{TestBaseModule, UnitTester} +import utest._ + +object UnitTests extends TestSuite { + + def tests: Tests = Tests { + test("simple") { + object build extends TestBaseModule with LineCountJavaModule + + val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) + val eval = UnitTester(build, resourceFolder/ "unit-test-example-project") + val Right(result) = eval(build.resources) + assert( + result.value.exists(pref => + os.exists(pref.path / "line-count.txt") && + os.read(pref.path / "line-count.txt") == "17" + ) + ) + } + } +} From c24fb8cd41b102a8024943fb1b71400e6501ee27 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 10:35:39 +0800 Subject: [PATCH 02/24] . --- example/misc/7-publish-mill-plugin/build.sc | 1 - 1 file changed, 1 deletion(-) diff --git a/example/misc/7-publish-mill-plugin/build.sc b/example/misc/7-publish-mill-plugin/build.sc index c52420f1d80..65bb2ffa331 100644 --- a/example/misc/7-publish-mill-plugin/build.sc +++ b/example/misc/7-publish-mill-plugin/build.sc @@ -1,7 +1,6 @@ import mill._, scalalib._, publish._ import mill.main.BuildInfo.millVersion -import mill.util.Util.millProjectModule object myplugin extends ScalaModule with PublishModule { def scalaVersion = "2.13.8" From 1e3fb6d8728c94dd047ddf004d0a4ff0985a307a Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 11:00:39 +0800 Subject: [PATCH 03/24] . --- build.sc | 4 ++-- example/javabuilds/6-publish-module/build.sc | 4 +--- example/misc/7-publish-mill-plugin/build.sc | 20 +++++++++++-------- example/scalabuilds/6-publish-module/build.sc | 4 +--- example/thirdparty/acyclic/build.sc | 4 +--- example/thirdparty/fansi/build.sc | 4 +--- 6 files changed, 18 insertions(+), 22 deletions(-) diff --git a/build.sc b/build.sc index 822175dca4f..0ec50ebf6a7 100644 --- a/build.sc +++ b/build.sc @@ -1522,7 +1522,6 @@ object idea extends MillPublishScalaModule { object dist extends MillPublishJavaModule { def jar = dev.assembly() - def moduleDeps = Seq(runner, idea) } object dev extends MillPublishScalaModule { @@ -1540,7 +1539,8 @@ object dev extends MillPublishScalaModule { contrib.jmh.testDep(), contrib.playlib.testDep(), contrib.playlib.worker("2.8").testDep(), - bsp.worker.testDep() + bsp.worker.testDep(), + testkit.testDep(), ) def genTask(m: ScalaModule) = T.task { Seq(m.jar(), m.sourceJar()) ++ m.runClasspath() } diff --git a/example/javabuilds/6-publish-module/build.sc b/example/javabuilds/6-publish-module/build.sc index dae3bdc2b5e..94582759296 100644 --- a/example/javabuilds/6-publish-module/build.sc +++ b/example/javabuilds/6-publish-module/build.sc @@ -10,9 +10,7 @@ object foo extends JavaModule with PublishModule { url = "https://github.com/lihaoyi/example", licenses = Seq(License.MIT), versionControl = VersionControl.github("lihaoyi", "example"), - developers = Seq( - Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi") - ) + developers = Seq(Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")) ) } diff --git a/example/misc/7-publish-mill-plugin/build.sc b/example/misc/7-publish-mill-plugin/build.sc index 65bb2ffa331..64b7fa06e0f 100644 --- a/example/misc/7-publish-mill-plugin/build.sc +++ b/example/misc/7-publish-mill-plugin/build.sc @@ -12,9 +12,7 @@ object myplugin extends ScalaModule with PublishModule { url = "https://github.com/lihaoyi/example", licenses = Seq(License.MIT), versionControl = VersionControl.github("lihaoyi", "example"), - developers = Seq( - Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi") - ) + developers = Seq(Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")) ) def ivyDeps = Agg( @@ -23,10 +21,16 @@ object myplugin extends ScalaModule with PublishModule { ) object test extends ScalaTests with TestModule.Utest{ - def forkEnv = Map( - "MILL_EXECUTABLE_PATH" -> - defaultResolver().resolveDeps(Seq(ivy"com.lihaoyi:mill-dist:$millVersion")) - .head.path.toString - ) + def forkEnv = T{ + pprint.log(defaultResolver().resolveDeps(Seq(ivy"com.lihaoyi:mill-dist:$millVersion"))) + Map( + "MILL_EXECUTABLE_PATH" -> + defaultResolver().resolveDeps(Seq(ivy"com.lihaoyi:mill-dist:$millVersion")) + .map(_.path) + .find(_.segments.contains("mill-dist")) + .get + .toString + ) + } } } diff --git a/example/scalabuilds/6-publish-module/build.sc b/example/scalabuilds/6-publish-module/build.sc index e705af93680..82756ba1a99 100644 --- a/example/scalabuilds/6-publish-module/build.sc +++ b/example/scalabuilds/6-publish-module/build.sc @@ -11,9 +11,7 @@ object foo extends ScalaModule with PublishModule { url = "https://github.com/lihaoyi/example", licenses = Seq(License.MIT), versionControl = VersionControl.github("lihaoyi", "example"), - developers = Seq( - Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi") - ) + developers = Seq(Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")) ) } diff --git a/example/thirdparty/acyclic/build.sc b/example/thirdparty/acyclic/build.sc index e855e905b2c..c8216888f87 100644 --- a/example/thirdparty/acyclic/build.sc +++ b/example/thirdparty/acyclic/build.sc @@ -32,9 +32,7 @@ trait AcyclicModule extends CrossScalaModule with PublishModule { url = "https://github.com/com-lihaoyi/acyclic", licenses = Seq(License.MIT), versionControl = VersionControl.github(owner = "com-lihaoyi", repo = "acyclic"), - developers = Seq( - Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi") - ) + developers = Seq(Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")) ) def compileIvyDeps = Agg(Deps.scalaCompiler(crossScalaVersion)) diff --git a/example/thirdparty/fansi/build.sc b/example/thirdparty/fansi/build.sc index 5f59e649555..ef1de921bac 100644 --- a/example/thirdparty/fansi/build.sc +++ b/example/thirdparty/fansi/build.sc @@ -13,9 +13,7 @@ trait FansiModule extends PublishModule with CrossScalaModule with PlatformScala url = "https://github.com/com-lihaoyi/Fansi", licenses = Seq(License.MIT), versionControl = VersionControl.github(owner = "com-lihaoyi", repo = "fansi"), - developers = Seq( - Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi") - ) + developers = Seq(Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")) ) def ivyDeps = Agg(ivy"com.lihaoyi::sourcecode::0.3.0") From 581840ea7bd503a2cff3c7d6b676ee44532aeeea Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 15:18:22 +0800 Subject: [PATCH 04/24] . --- build.sc | 10 +- docs/modules/ROOT/nav.adoc | 1 + .../ROOT/pages/Writing_Mill_Plugins.adoc | 3 + example/misc/7-publish-mill-plugin/build.sc | 36 ---- .../example-test-example-project/build.sc | 12 -- .../integration-test-example-project/build.sc | 4 - .../src/mill/testkit/IntegrationTests.scala | 30 --- .../test/src/mill/testkit/UnitTests.scala | 24 --- example/misc/7-writing-mill-plugins/build.sc | 183 ++++++++++++++++++ .../myplugin/src/LineCountJavaModule.scala | 5 +- .../resources/example-test-project/build.sc | 20 ++ .../example-test-project}/src/foo/Foo.java | 0 .../integration-test-project/build.sc | 7 + .../src/foo/Foo.java | 0 .../unit-test-project}/src/foo/Foo.java | 0 .../test/src/mill/testkit/ExampleTests.scala | 6 +- .../src/mill/testkit/IntegrationTests.scala | 36 ++++ .../test/src/mill/testkit/UnitTests.scala | 36 ++++ .../test/src/DocAnnotationsTests.scala | 10 +- .../hygiene/test/src/HygieneTests.scala | 2 +- .../test/src/MillPluginClasspathTest.scala | 4 +- .../src/mill/testkit/IntegrationTester.scala | 4 +- .../mill/testkit/IntegrationTesterTests.scala | 4 +- 23 files changed, 312 insertions(+), 125 deletions(-) create mode 100644 docs/modules/ROOT/pages/Writing_Mill_Plugins.adoc delete mode 100644 example/misc/7-publish-mill-plugin/build.sc delete mode 100644 example/misc/7-publish-mill-plugin/myplugin/test/resources/example-test-example-project/build.sc delete mode 100644 example/misc/7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project/build.sc delete mode 100644 example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/IntegrationTests.scala delete mode 100644 example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/UnitTests.scala create mode 100644 example/misc/7-writing-mill-plugins/build.sc rename example/misc/{7-publish-mill-plugin => 7-writing-mill-plugins}/myplugin/src/LineCountJavaModule.scala (70%) create mode 100644 example/misc/7-writing-mill-plugins/myplugin/test/resources/example-test-project/build.sc rename example/misc/{7-publish-mill-plugin/myplugin/test/resources/example-test-example-project => 7-writing-mill-plugins/myplugin/test/resources/example-test-project}/src/foo/Foo.java (100%) create mode 100644 example/misc/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/build.sc rename example/misc/{7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project => 7-writing-mill-plugins/myplugin/test/resources/integration-test-project}/src/foo/Foo.java (100%) rename example/misc/{7-publish-mill-plugin/myplugin/test/resources/unit-test-example-project => 7-writing-mill-plugins/myplugin/test/resources/unit-test-project}/src/foo/Foo.java (100%) rename example/misc/{7-publish-mill-plugin => 7-writing-mill-plugins}/myplugin/test/src/mill/testkit/ExampleTests.scala (72%) create mode 100644 example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala create mode 100644 example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala diff --git a/build.sc b/build.sc index 0ec50ebf6a7..332bca61392 100644 --- a/build.sc +++ b/build.sc @@ -1521,7 +1521,7 @@ object idea extends MillPublishScalaModule { } object dist extends MillPublishJavaModule { - def jar = dev.assembly() + def jar = dev.rawAssembly() } object dev extends MillPublishScalaModule { @@ -1530,6 +1530,7 @@ object dev extends MillPublishScalaModule { def moduleDeps = Seq(runner, idea) def testTransitiveDeps = super.testTransitiveDeps() ++ Seq( + dist.testDep(), runner.linenumbers.testDep(), scalalib.backgroundwrapper.testDep(), contrib.bloop.testDep(), @@ -1586,8 +1587,7 @@ object dev extends MillPublishScalaModule { case m: PublishModule if (m ne this) && (m ne dist) => m } - def assembly = T { - T.traverse(allPublishModules)(m => m.publishLocalCached)() + def rawAssembly = T{ val version = millVersion() val devRunClasspath = runClasspath().map(_.path) val filename = if (scala.util.Properties.isWin) "mill.bat" else "mill" @@ -1608,6 +1608,10 @@ object dev extends MillPublishScalaModule { ) PathRef(T.dest / filename) } + def assembly = T { + T.traverse(allPublishModules)(m => m.publishLocalCached)() + rawAssembly() + } def prependShellScript = T { val (millArgs, otherArgs) = diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index 8b79dafbe54..e7f33e68d81 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -63,6 +63,7 @@ ** xref:contrib/twirllib.adoc[] ** xref:contrib/versionfile.adoc[] * xref:Thirdparty_Plugins.adoc[] +* xref:Writing_Mill_Plugins.adoc[] * xref:The_Mill_Meta_Build.adoc[] // Reference pages that a typical user would not typically read top-to-bottom, diff --git a/docs/modules/ROOT/pages/Writing_Mill_Plugins.adoc b/docs/modules/ROOT/pages/Writing_Mill_Plugins.adoc new file mode 100644 index 00000000000..6dcae256b25 --- /dev/null +++ b/docs/modules/ROOT/pages/Writing_Mill_Plugins.adoc @@ -0,0 +1,3 @@ += Writing Mill Plugins + +include::example/misc/7-writing-mill-plugins.adoc[] \ No newline at end of file diff --git a/example/misc/7-publish-mill-plugin/build.sc b/example/misc/7-publish-mill-plugin/build.sc deleted file mode 100644 index 64b7fa06e0f..00000000000 --- a/example/misc/7-publish-mill-plugin/build.sc +++ /dev/null @@ -1,36 +0,0 @@ - -import mill._, scalalib._, publish._ -import mill.main.BuildInfo.millVersion - -object myplugin extends ScalaModule with PublishModule { - def scalaVersion = "2.13.8" - def publishVersion = "0.0.1" - - def pomSettings = PomSettings( - description = "Line Count Mill Plugin", - organization = "com.lihaoyi", - url = "https://github.com/lihaoyi/example", - licenses = Seq(License.MIT), - versionControl = VersionControl.github("lihaoyi", "example"), - developers = Seq(Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")) - ) - - def ivyDeps = Agg( - ivy"com.lihaoyi::mill-testkit:$millVersion", - ivy"com.lihaoyi::mill-scalalib:$millVersion" - ) - - object test extends ScalaTests with TestModule.Utest{ - def forkEnv = T{ - pprint.log(defaultResolver().resolveDeps(Seq(ivy"com.lihaoyi:mill-dist:$millVersion"))) - Map( - "MILL_EXECUTABLE_PATH" -> - defaultResolver().resolveDeps(Seq(ivy"com.lihaoyi:mill-dist:$millVersion")) - .map(_.path) - .find(_.segments.contains("mill-dist")) - .get - .toString - ) - } - } -} diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/resources/example-test-example-project/build.sc b/example/misc/7-publish-mill-plugin/myplugin/test/resources/example-test-example-project/build.sc deleted file mode 100644 index 3495b59a82a..00000000000 --- a/example/misc/7-publish-mill-plugin/myplugin/test/resources/example-test-example-project/build.sc +++ /dev/null @@ -1,12 +0,0 @@ -import mill._, myplugin._ - -object foo extends RootModule with LineCountJavaModule - - -/** Usage - -> ./mill run -Line Count: 17 -... - -*/ \ No newline at end of file diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project/build.sc b/example/misc/7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project/build.sc deleted file mode 100644 index aaabedbb6b0..00000000000 --- a/example/misc/7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project/build.sc +++ /dev/null @@ -1,4 +0,0 @@ -import mill._, myplugin._ - -object foo extends RootModule with LineCountJavaModule - diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/IntegrationTests.scala b/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/IntegrationTests.scala deleted file mode 100644 index e3ca313beff..00000000000 --- a/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/IntegrationTests.scala +++ /dev/null @@ -1,30 +0,0 @@ -package mill.testkit - -import utest._ - -object IntegrationTests extends TestSuite { - - def tests: Tests = Tests { - - test("integration") { - val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) - val tester = new IntegrationTester( - clientServerMode = true, - workspaceSourcePath = resourceFolder / "integration-test-example-project", - millExecutable = os.Path(sys.env("MILL_EXECUTABLE_PATH")) - ) - - val res1 = tester.eval("run") - assert(res1.isSuccess) - assert(res1.err.contains("compiling 1 Scala source")) // compiling the `build.sc` - assert(res1.out.contains("Line Count: 17")) - assert(tester.outJson("lineCount").value[Int] == 17) - - tester.modifyFile(tester.workspacePath / "source-file.txt", _ + "!!!") - - val res2 = tester.eval("run") - assert(!res2.err.contains("compiling 1 Scala source")) // no need to re-compile `build.sc` - assert(res1.out.contains("Line Count: 17")) - } - } -} diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/UnitTests.scala b/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/UnitTests.scala deleted file mode 100644 index 2fee237d51f..00000000000 --- a/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/UnitTests.scala +++ /dev/null @@ -1,24 +0,0 @@ -package myplugin - -//import mill._ -import mill.testkit.{TestBaseModule, UnitTester} -import utest._ - -object UnitTests extends TestSuite { - - def tests: Tests = Tests { - test("simple") { - object build extends TestBaseModule with LineCountJavaModule - - val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) - val eval = UnitTester(build, resourceFolder/ "unit-test-example-project") - val Right(result) = eval(build.resources) - assert( - result.value.exists(pref => - os.exists(pref.path / "line-count.txt") && - os.read(pref.path / "line-count.txt") == "17" - ) - ) - } - } -} diff --git a/example/misc/7-writing-mill-plugins/build.sc b/example/misc/7-writing-mill-plugins/build.sc new file mode 100644 index 00000000000..b0e65dc8bec --- /dev/null +++ b/example/misc/7-writing-mill-plugins/build.sc @@ -0,0 +1,183 @@ +// This example demonstrates how to write and test Mill plugin, and publish it to +// Sonatype's Maven Central so it can be used by other developers over the internet +// via xref:Import_File_And_Import_Ivy.adoc[import $ivy]. + +import mill._, scalalib._, publish._ +import mill.main.BuildInfo.millVersion + +object myplugin extends ScalaModule with PublishModule { + def scalaVersion = "2.13.8" + + def ivyDeps = Agg(ivy"com.lihaoyi::mill-scalalib:$millVersion") + + // Testing Config + object test extends ScalaTests with TestModule.Utest{ + def ivyDeps = Agg(ivy"com.lihaoyi::mill-testkit:$millVersion") + def forkEnv = Map("MILL_EXECUTABLE_PATH" -> testMill.assembly().path.toString) + + object testMill extends JavaModule{ + def ivyDeps = Agg(ivy"com.lihaoyi:mill-dist:$millVersion") + def mainClass = Some("mill.runner.client.MillClientMain") + def resources = T{ + val p = T.dest / "mill" / "local-test-overrides" / s"com.lihaoyi-${myplugin.artifactId()}" + os.write(p, myplugin.runClasspath().map(_.path).mkString("\n"), createFolders = true) + Seq(PathRef(T.dest)) + } + } + } + + // Publishing Config + def publishVersion = "0.0.1" + + def pomSettings = PomSettings( + description = "Line Count Mill Plugin", + organization = "com.lihaoyi", + url = "https://github.com/lihaoyi/myplugin", + licenses = Seq(License.MIT), + versionControl = VersionControl.github("lihaoyi", "myplugin"), + developers = Seq(Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")) + ) +} + +// Mill plugins are fundamentally just JVM libraries that depend on Mill. Any vanilla JVM +// library (whether written in Java or Scala) can be used in a Mill `build.sc` file via +// `import $ivy`, but Mill plugins tend to integrate with Mill by defining a +// xref:Modules.adoc#_trait_modules[trait for modules in your `build.sc` to inherit from]. +// +// The above `build.sc` file sets up a `object myplugin extends ScalaModule` not just to +// compile your Mill plugin project, but also to run automated tests using `mill-testkit`, +// and to configure it for publishing to Maven Central via `PublishModule` +// +// Like any other `trait`, a Mill plugin's traits modules allow you to: +// +// * Add additional tasks to an existing module +// * Override existing tasks, possibly referencing the old task via `super` +// * Define abstract tasks that the final module must implement +// +// In this example, we define a `LineCountJavaModule` that does all of the above: +// it defines an abstract `def lineCountResourceFileName` task, it adds an additional +// `def lineCount` task, and it overrides the `def resources`: + +/** See Also: myplugin/src/LineCountJavaModule.scala */ + +// This is a synthetic example, but it serves to illustrate how Mill plugins are typically +// defined. The plugin can be compiled via: + +/** Usage + +> ./mill myplugin.compile +compiling 1 Scala source... + +*/ + +// === Testing + + +// Mill provides the `mill-testkit` library to make it easy for you to test your Mill +// plugin. The example project above has set up tests that can be run via the normal `.test` +// command, as shown below: + +/** Usage + +> ./mill myplugin.test ++ myplugin.ExampleTests.example... ++ myplugin.IntegrationTests.integration... ++ myplugin.UnitTests.simple... +... +*/ + +// `mill-testkit` is the same set of helpers that Mill uses internally for its +// own testing, and covers three approaches: +// +// ==== Unit tests +// +// These are tests that run in-process, with the Mill `build.sc` defined as a `TestBaseModule`, +// and using a `UnitTester` to run its tasks and inspect their output. `UnitTester` is provided +// a path to a folder on disk containing the files that are to be built with the given `TestBaseModule`, +// and can be used to evaluate tasks (by direct reference or by string-selector) and inspect +// the results in-memory: + +/** See Also: myplugin/test/src/mill/testkit/UnitTests.scala */ +/** See Also: myplugin/test/resources/unit-test-project/src/foo/Foo.java */ + +// Mill Unit tests are good for exercising most kinds of business logic in Mill plugins. Their +// main limitation is that they do not exercise the Mill subprocess-launch and bootstrap process, +// but that should not be a concern for most Mill plugins. +// +// ==== Integration tests +// +// Integration tests are one step up from Unit tests: they are significantly slower to run due +// to running Mill in a subprocess, but are able to exercise the end-to-end lifecycle of a Mill +// command. Unlike unit tests which define a `TestRootModule` in-memory as part of the test code, +// Mill's integration tests rely on a `build.sc` that is processed and compiled as part of the +// test initialization, and can only perform assertions on the four things that are returned from +// any subprocess: +// +// 1. `.isSuccess: Boolean`, whether or the Mill subprocess returned with exit code 0 +// 2. `.out: String`, the standard output captured by the Mill process +// 3. `.err: String`, the standard error captured by the Mill process +// 4. Any files that are generated on disk. In particular, files generated by tasks +// can be fetched via the `tester.out("...").*` APIs to be read as JSON strings (via `.text`), +// parsed `ujson.Value` ASTs (`.json`), or parsed into a typed Scala value (`.value[T]`) + +/** See Also: myplugin/test/src/mill/testkit/IntegrationTests.scala */ +/** See Also: myplugin/test/resources/integration-test-project/src/foo/Foo.java */ +/** See Also: myplugin/test/resources/integration-test-project/build.sc */ + +// Integration tests are generally used sparingly, but they are handy for scenarios where +// your Mill plugin logic prints to standard output or standard error, and you want to assert +// that the printed output is as expected. +// +// ==== Example tests +// +// Example tests are a variant of the integration tests mentioned above, but instead of +// having the testing logic defined as part of the test suite in a `.scala` file, the testing +// logic is instead defined as a `/** Usage */` comment in the `build.sc`. These tests are +// a great way of documenting expected usage of your plugin: a user can glance at a single +// file to see how the plugin is imported (via `import $ivy`) how it is used (e.g. by being +// extended by a module) and what commands they can run exercising the plugin and the resultant +// output they should expect: + +/** See Also: myplugin/test/src/mill/testkit/ExampleTests.scala */ +/** See Also: myplugin/test/resources/example-test-project/src/foo/Foo.java */ +/** See Also: myplugin/test/resources/example-test-project/build.sc */ + +// The `/** Usage */` comment is of the following format: +// +// * Each line prefixed with `>` is a command that is to be run +// * Following lines after commands are expected output, until the next blank line +// * If the command is expected to fail, the following lines should be prefixed by `error: ` +// * Expected output lines can contain `...` wildcards to match against parts of the output +// which are unstable or unnecessary for someone reading through the `build.sc`. +// * A `...` wildcard on its own line can be used to match against any number of additional +// lines of output +// +// The line-matching for example tests is intentionally fuzzy: it does not assert that the +// ordering of the lines printed by the command matches the ordering given, as long as every +// line printed is given and every line given is printed. `...` wildcards intentionally add +// additional fuzziness to the matching. The point of example tests is not to match +// character-for-character exactly what the output must be, but to match on the "important" +// parts of the output while simultaneously emphasizing these important parts to someone who +// may be reading the `build.sc` +// +// Example tests are similar to integration tests in that they exercise the full Mill bootstrapping +// process, and are thus much slower and more expensive to run than unit tests. However, it is +// usually a good idea to have at least one example test for your Mill plugin, so a user who +// wishes to use it can take the `build.sc` and associated files and immediately have a Mill +// build that is runnable using your plugin, along with a list of commands they can run and +// what output they should expect. +// +// === Publishing + +/** Usage + +> ./mill myplugin.publishLocal +Publishing Artifact(com.lihaoyi,myplugin_2.13,0.0.1) to ivy repo... + +*/ +// Mill plugins are JVM libraries like any other library written in Java or Scala. Thus they +// are published the same way: by extending `PublishModule` and defining the module's `publishVersion` +// and `pomSettings`. Once done, you can publish the plugin locally via `publishLocal` below, +// or to Maven Central via `mill.scalalib.public.PublishModule/publishAll`for other developers to +// use. + diff --git a/example/misc/7-publish-mill-plugin/myplugin/src/LineCountJavaModule.scala b/example/misc/7-writing-mill-plugins/myplugin/src/LineCountJavaModule.scala similarity index 70% rename from example/misc/7-publish-mill-plugin/myplugin/src/LineCountJavaModule.scala rename to example/misc/7-writing-mill-plugins/myplugin/src/LineCountJavaModule.scala index 5100a2e285b..f8fbc2ca147 100644 --- a/example/misc/7-publish-mill-plugin/myplugin/src/LineCountJavaModule.scala +++ b/example/misc/7-writing-mill-plugins/myplugin/src/LineCountJavaModule.scala @@ -5,6 +5,9 @@ import mill._ * to the resources of your `JavaModule` */ trait LineCountJavaModule extends mill.javalib.JavaModule{ + /** Name of the file containing the line count that we create in the resource path */ + def lineCountResourceFileName: T[String] + /** Total number of lines in module's source files */ def lineCount = T{ allSourceFiles().map(f => os.read.lines(f.path).size).sum @@ -12,7 +15,7 @@ trait LineCountJavaModule extends mill.javalib.JavaModule{ /** Generate resources using lineCount of sources */ override def resources = T{ - os.write(T.dest / "line-count.txt", "" + lineCount()) + os.write(T.dest / lineCountResourceFileName(), "" + lineCount()) super.resources() ++ Seq(PathRef(T.dest)) } } \ No newline at end of file diff --git a/example/misc/7-writing-mill-plugins/myplugin/test/resources/example-test-project/build.sc b/example/misc/7-writing-mill-plugins/myplugin/test/resources/example-test-project/build.sc new file mode 100644 index 00000000000..0e803401a82 --- /dev/null +++ b/example/misc/7-writing-mill-plugins/myplugin/test/resources/example-test-project/build.sc @@ -0,0 +1,20 @@ +import $ivy.`com.lihaoyi::myplugin:0.0.1` +import mill._, myplugin._ + +object foo extends RootModule with LineCountJavaModule{ + def lineCountResourceFileName = "line-count.txt" +} + +/** Usage + +> ./mill run +Line Count: 17 +... + +> printf "\n" >> src/foo/Foo.java + +> ./mill run +Line Count: 18 +... + +*/ \ No newline at end of file diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/resources/example-test-example-project/src/foo/Foo.java b/example/misc/7-writing-mill-plugins/myplugin/test/resources/example-test-project/src/foo/Foo.java similarity index 100% rename from example/misc/7-publish-mill-plugin/myplugin/test/resources/example-test-example-project/src/foo/Foo.java rename to example/misc/7-writing-mill-plugins/myplugin/test/resources/example-test-project/src/foo/Foo.java diff --git a/example/misc/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/build.sc b/example/misc/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/build.sc new file mode 100644 index 00000000000..2385b83a044 --- /dev/null +++ b/example/misc/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/build.sc @@ -0,0 +1,7 @@ +import $ivy.`com.lihaoyi::myplugin:0.0.1` +import mill._, myplugin._ + +object foo extends RootModule with LineCountJavaModule{ + def lineCountResourceFileName = "line-count.txt" +} + diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project/src/foo/Foo.java b/example/misc/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/src/foo/Foo.java similarity index 100% rename from example/misc/7-publish-mill-plugin/myplugin/test/resources/integration-test-example-project/src/foo/Foo.java rename to example/misc/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/src/foo/Foo.java diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/resources/unit-test-example-project/src/foo/Foo.java b/example/misc/7-writing-mill-plugins/myplugin/test/resources/unit-test-project/src/foo/Foo.java similarity index 100% rename from example/misc/7-publish-mill-plugin/myplugin/test/resources/unit-test-example-project/src/foo/Foo.java rename to example/misc/7-writing-mill-plugins/myplugin/test/resources/unit-test-project/src/foo/Foo.java diff --git a/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/ExampleTests.scala b/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala similarity index 72% rename from example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/ExampleTests.scala rename to example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala index 5428488eb8d..c5e7ed8dec9 100644 --- a/example/misc/7-publish-mill-plugin/myplugin/test/src/mill/testkit/ExampleTests.scala +++ b/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala @@ -1,5 +1,5 @@ -package mill.testkit - +package myplugin +import mill.testkit.ExampleTester import utest._ object ExampleTests extends TestSuite { @@ -9,7 +9,7 @@ object ExampleTests extends TestSuite { val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) ExampleTester.run( clientServerMode = true, - workspaceSourcePath = resourceFolder / "example-test-example-project", + workspaceSourcePath = resourceFolder / "example-test-project", millExecutable = os.Path(sys.env("MILL_EXECUTABLE_PATH")) ) } diff --git a/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala b/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala new file mode 100644 index 00000000000..652f5c8feae --- /dev/null +++ b/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala @@ -0,0 +1,36 @@ +package myplugin +import mill.testkit.IntegrationTester +import utest._ + +object IntegrationTests extends TestSuite { + + def tests: Tests = Tests { + + test("integration") { + val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) + val tester = new IntegrationTester( + clientServerMode = true, + workspaceSourcePath = resourceFolder / "integration-test-project", + millExecutable = os.Path(sys.env("MILL_EXECUTABLE_PATH")) + ) + + val res1 = tester.eval("run") + assert(res1.isSuccess) + assert(res1.err.contains("compiling 1 Java source")) // compiling the `build.sc` + assert(res1.out.contains("Line Count: 17")) + assert(tester.out("lineCount").value[Int] == 17) + + val res2 = tester.eval("run") // No need to recompile when nothing changed + assert(!res2.err.contains("compiling 1 Java source")) + assert(res2.out.contains("Line Count: 17")) + assert(tester.out("lineCount").value[Int] == 17) + + tester.modifyFile(tester.workspacePath / "src" / "foo" / "Foo.java", _ + "\n") + + val res3 = tester.eval("run") // Additional newline forces recompile and increases line count + assert(res3.err.contains("compiling 1 Java source")) + assert(res3.out.contains("Line Count: 18")) + assert(tester.out("lineCount").value[Int] == 18) + } + } +} diff --git a/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala b/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala new file mode 100644 index 00000000000..7fc0e055d70 --- /dev/null +++ b/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala @@ -0,0 +1,36 @@ +package myplugin + +import mill.testkit.{TestBaseModule, UnitTester} +import utest._ + +object UnitTests extends TestSuite { + def tests: Tests = Tests { + test("simple") { + object build extends TestBaseModule with LineCountJavaModule{ + def lineCountResourceFileName = "line-count.txt" + } + + val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) + val eval = UnitTester(build, resourceFolder/ "unit-test-project") + + // Evaluating tasks by direct reference + val Right(result) = eval(build.resources) + assert( + result.value.exists(pathref => + os.exists(pathref.path / "line-count.txt") && + os.read(pathref.path / "line-count.txt") == "17" + ) + ) + + // Evaluating tasks by passing in their Mill selector + val Right(result2) = eval("resources") + val Seq(pathrefs: Seq[mill.api.PathRef]) = result2.value + assert( + pathrefs.exists(pathref => + os.exists(pathref.path / "line-count.txt") && + os.read(pathref.path / "line-count.txt") == "17" + ) + ) + } + } +} diff --git a/integration/feature/docannotations/test/src/DocAnnotationsTests.scala b/integration/feature/docannotations/test/src/DocAnnotationsTests.scala index a1ea10271fe..a3f19764499 100644 --- a/integration/feature/docannotations/test/src/DocAnnotationsTests.scala +++ b/integration/feature/docannotations/test/src/DocAnnotationsTests.scala @@ -21,7 +21,7 @@ object DocAnnotationsTests extends IntegrationTestSuite { val res = eval(("inspect", "core.test.ivyDeps")) assert(res.isSuccess == true) - val inheritedIvyDeps = outJson("inspect").json.str + val inheritedIvyDeps = out("inspect").json.str assert( globMatches( """core.test.ivyDeps(build.sc:...) @@ -38,7 +38,7 @@ object DocAnnotationsTests extends IntegrationTestSuite { ) assert(eval(("inspect", "core.target")).isSuccess) - val target = outJson("inspect").json.str + val target = out("inspect").json.str assert( globMatches( """core.target(build.sc:...) @@ -51,7 +51,7 @@ object DocAnnotationsTests extends IntegrationTestSuite { ) assert(eval(("inspect", "inspect")).isSuccess) - val doc = outJson("inspect").json.str + val doc = out("inspect").json.str assert( globMatches( """inspect(MainModule.scala:...) @@ -64,7 +64,7 @@ object DocAnnotationsTests extends IntegrationTestSuite { ) assert(eval(("inspect", "core.run")).isSuccess) - val run = outJson("inspect").json.str + val run = out("inspect").json.str assert( globMatches( @@ -87,7 +87,7 @@ object DocAnnotationsTests extends IntegrationTestSuite { assert(eval(("inspect", "core.ivyDepsTree")).isSuccess) - val ivyDepsTree = outJson("inspect").json.str + val ivyDepsTree = out("inspect").json.str assert( globMatches( diff --git a/integration/feature/hygiene/test/src/HygieneTests.scala b/integration/feature/hygiene/test/src/HygieneTests.scala index 62bc86b2da5..f805400b1ec 100644 --- a/integration/feature/hygiene/test/src/HygieneTests.scala +++ b/integration/feature/hygiene/test/src/HygieneTests.scala @@ -11,7 +11,7 @@ object HygieneTests extends IntegrationTestSuite { test { val res = eval("scala.foo") assert(res.isSuccess == true) - val output = outJson("scala.foo").text + val output = out("scala.foo").text assert(output.contains("\"fooValue\"")) } } diff --git a/integration/feature/plugin-classpath/test/src/MillPluginClasspathTest.scala b/integration/feature/plugin-classpath/test/src/MillPluginClasspathTest.scala index 9a96c0e7cb4..c7062ff0a35 100644 --- a/integration/feature/plugin-classpath/test/src/MillPluginClasspathTest.scala +++ b/integration/feature/plugin-classpath/test/src/MillPluginClasspathTest.scala @@ -35,7 +35,7 @@ object MillPluginClasspathTest extends IntegrationTestSuite { val res1 = eval(("--meta-level", "1", "resolveDepsExclusions")) assert(res1.isSuccess) - val exclusions = outJson("mill-build.resolveDepsExclusions").value[Seq[(String, String)]] + val exclusions = out("mill-build.resolveDepsExclusions").value[Seq[(String, String)]] val expectedExclusions = embeddedModules val diff = expectedExclusions.toSet.diff(exclusions.toSet) @@ -47,7 +47,7 @@ object MillPluginClasspathTest extends IntegrationTestSuite { val res1 = eval(("--meta-level", "1", "runClasspath")) assert(res1.isSuccess) - val runClasspath = outJson("mill-build.runClasspath").value[Seq[String]] + val runClasspath = out("mill-build.runClasspath").value[Seq[String]] val unexpectedArtifacts = embeddedModules.map { case (o, n) => s"${o.replaceAll("[.]", "/")}/${n}" diff --git a/testkit/src/mill/testkit/IntegrationTester.scala b/testkit/src/mill/testkit/IntegrationTester.scala index 12e7935e85b..bfb4a89768c 100644 --- a/testkit/src/mill/testkit/IntegrationTester.scala +++ b/testkit/src/mill/testkit/IntegrationTester.scala @@ -9,7 +9,7 @@ import scala.util.control.NonFatal /** * Helper meant for executing Mill integration tests, which runs Mill in a subprocess * against a folder with a `build.sc` and project files. Provides APIs such as [[eval]] - * to run Mill commands and [[outJson]] to inspect the results on disk. You can use + * to run Mill commands and [[out]] to inspect the results on disk. You can use * [[modifyFile]] or any of the OS-Lib `os.*` APIs on the [[workspacePath]] to modify * project files in the course of the test. * @@ -111,7 +111,7 @@ object IntegrationTester { * Helpers to read the `.json` metadata files belonging to a particular task * (specified by [[selector0]]) from the `out/` folder. */ - def outJson(selector0: String): Meta = new Meta(selector0) + def out(selector0: String): Meta = new Meta(selector0) class Meta(selector0: String) { diff --git a/testkit/test/src/mill/testkit/IntegrationTesterTests.scala b/testkit/test/src/mill/testkit/IntegrationTesterTests.scala index 1df414d8c41..be2451353d7 100644 --- a/testkit/test/src/mill/testkit/IntegrationTesterTests.scala +++ b/testkit/test/src/mill/testkit/IntegrationTesterTests.scala @@ -17,13 +17,13 @@ object IntegrationTesterTests extends TestSuite { val res1 = tester.eval("testTask") assert(res1.isSuccess) assert(res1.err.contains("compiling 1 Scala source")) // compiling the `build.sc` - assert(tester.outJson("testTask").value[String] == "HELLO WORLD SOURCE FILE") + assert(tester.out("testTask").value[String] == "HELLO WORLD SOURCE FILE") tester.modifyFile(tester.workspacePath / "source-file.txt", _ + "!!!") val res2 = tester.eval("testTask") assert(!res2.err.contains("compiling 1 Scala source")) // no need to re-compile `build.sc` - assert(tester.outJson("testTask").value[String] == "HELLO WORLD SOURCE FILE!!!") + assert(tester.out("testTask").value[String] == "HELLO WORLD SOURCE FILE!!!") } } } From 9d2740790e7c81a27bbf94b86193e37411bb4bbf Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 21:19:44 +0800 Subject: [PATCH 05/24] fix --- .github/workflows/actions.yml | 10 +- build.sc | 60 +- docs/modules/ROOT/pages/Contrib_Plugins.adoc | 2 +- docs/modules/ROOT/pages/Cross_Builds.adoc | 22 +- .../pages/Import_File_And_Import_Ivy.adoc | 2 +- .../ROOT/pages/Java_Build_Examples.adoc | 14 +- .../ROOT/pages/Java_Builtin_Commands.adoc | 2 +- .../ROOT/pages/Java_Intro_to_Mill.adoc | 6 +- .../ROOT/pages/Java_Module_Config.adoc | 24 +- .../modules/ROOT/pages/Java_Web_Examples.adoc | 10 +- docs/modules/ROOT/pages/Modules.adoc | 8 +- .../ROOT/pages/Scala_Build_Examples.adoc | 16 +- .../ROOT/pages/Scala_Builtin_Commands.adoc | 2 +- .../ROOT/pages/Scala_Intro_to_Mill.adoc | 6 +- .../ROOT/pages/Scala_Module_Config.adoc | 26 +- .../ROOT/pages/Scala_Web_Examples.adoc | 14 +- docs/modules/ROOT/pages/Tasks.adoc | 14 +- .../ROOT/pages/Testing_Java_Projects.adoc | 6 +- .../ROOT/pages/Testing_Scala_Projects.adoc | 6 +- .../ROOT/pages/The_Mill_Meta_Build.adoc | 4 +- .../ROOT/pages/Writing_Mill_Plugins.adoc | 2 +- example/{ => depth}/cross/1-simple/build.sc | 0 .../{ => depth}/cross/10-static-blog/build.sc | 0 .../10-static-blog/post/1-My-First-Post.md | 0 .../10-static-blog/post/2-My-Second-Post.md | 0 .../10-static-blog/post/3-My-Third-Post.md | 0 .../cross/11-default-cross-module/build.sc | 0 .../cross/2-cross-source-path/build.sc | 0 .../cross/3-outside-dependency/build.sc | 0 .../cross/4-cross-dependencies/build.sc | 0 .../cross/5-multiple-cross-axes/build.sc | 0 .../cross/6-axes-extension/build.sc | 0 .../cross/7-inner-cross-module/build.sc | 0 .../{ => depth}/cross/8-resolvers/build.sc | 0 .../cross/9-dynamic-cross-modules/build.sc | 0 .../modules/bar/src/Example.scala | 0 .../modules/foo/src/Example.scala | 0 .../modules/qux/src/Example.scala | 0 .../{ => depth}/tasks/1-task-graph/build.sc | 0 .../tasks/1-task-graph/resources/foo.txt | 0 .../tasks/1-task-graph/src/Foo.java | 0 .../tasks/10-module-sc/bar/module.sc | 0 .../tasks/10-module-sc/bar/qux/module.sc | 0 .../bar/qux/module/src/BarQux.scala | 0 .../{ => depth}/tasks/10-module-sc/build.sc | 0 .../tasks/10-module-sc/foo/module.sc | 0 .../tasks/10-module-sc/foo/src/Foo.scala | 0 .../11-module-run-task/bar/src/Bar.scala | 0 .../tasks/11-module-run-task/build.sc | 0 .../11-module-run-task/foo/src/Foo.scala | 0 .../tasks/2-primary-tasks/bar/src/file.txt | 0 .../tasks/2-primary-tasks/bar/src2/file.txt | 0 .../tasks/2-primary-tasks/build.sc | 0 .../tasks/2-primary-tasks/resources/foo.txt | 0 .../tasks/2-primary-tasks/src/foo/Foo.java | 0 .../tasks/3-anonymous-tasks/build.sc | 0 .../tasks/3-anonymous-tasks/data/hello.txt | 0 .../tasks/3-anonymous-tasks/data/world.txt | 0 example/{ => depth}/tasks/4-inputs/build.sc | 0 .../{ => depth}/tasks/4-inputs/data/hello.txt | 0 .../{ => depth}/tasks/4-inputs/data/world.txt | 0 .../tasks/5-persistent-targets/build.sc | 0 .../tasks/5-persistent-targets/data/hello.txt | 0 .../tasks/5-persistent-targets/data/world.txt | 0 example/{ => depth}/tasks/6-workers/build.sc | 0 .../tasks/6-workers/data/hello.txt | 0 .../tasks/6-workers/data/world.txt | 0 example/{ => depth}/tasks/7-modules/build.sc | 0 .../outer/inner/sources/inner-source.txt | 0 .../7-modules/outer/sources/outer-source.txt | 0 .../nested/inner/sources/inner-source.txt | 0 .../outer2/nested/sources/outer-source.txt | 0 .../tasks/8-diy-java-modules/build.sc | 0 .../8-diy-java-modules/foo/bar/src/Bar.java | 0 .../tasks/8-diy-java-modules/foo/src/Foo.java | 0 .../tasks/8-diy-java-modules/qux/src/Qux.java | 0 .../tasks/9-backticked-names/build.sc | 0 .../imports}/3-import-file-ivy/build.sc | 0 .../3-import-file-ivy/scalaversion.sc | 0 .../imports}/3-import-file-ivy/src/Foo.scala | 0 .../imports}/6-contrib-import/build.sc | 0 .../6-contrib-import/foo/src/Foo.scala | 0 .../metabuild}/4-meta-build/build.sc | 0 .../4-meta-build/mill-build/build.sc | 0 .../metabuild}/4-meta-build/src/Foo.scala | 0 .../metabuild}/5-meta-shared-sources/build.sc | 0 .../5-meta-shared-sources/mill-build/build.sc | 0 .../mill-build/src/ScalaVersion.scala | 0 .../5-meta-shared-sources/src/Foo.scala | 0 .../plugins}/7-writing-mill-plugins/build.sc | 2 - .../myplugin/src/LineCountJavaModule.scala | 0 .../resources/example-test-project/build.sc | 0 .../example-test-project}/src/foo/Foo.java | 0 .../integration-test-project/build.sc | 0 .../src/foo/Foo.java | 0 .../unit-test-project}/src/foo/Foo.java | 0 .../test/src/mill/testkit/ExampleTests.scala | 17 + .../src/mill/testkit/IntegrationTests.scala | 1 + .../test/src/mill/testkit/UnitTests.scala | 36 + .../basic}/1-simple/build.sc | 0 .../basic}/1-simple/src/foo/Foo.java | 0 .../basic}/1-simple/test/src/foo/FooTest.java | 0 .../basic}/2-custom-build-logic/build.sc | 0 .../2-custom-build-logic}/src/foo/Foo.java | 0 .../test/src/foo/FooTests.java | 0 .../3-multi-module/bar/src/bar/Bar.java | 0 .../bar/test/src/bar/BarTests.java | 0 .../basic}/3-multi-module/build.sc | 0 .../3-multi-module/foo/src/foo/Foo.java | 0 .../4-builtin-commands/bar/src/bar/Bar.java | 0 .../bar/test/src/bar/BarTest.java | 0 .../basic}/4-builtin-commands/build.sc | 0 .../4-builtin-commands/foo/src/foo/Foo.java | 0 .../builds}/1-common-config/build.sc | 0 .../custom-resources/MyOtherResource.txt | 0 .../1-common-config/custom-src/Foo2.java | 0 .../1-common-config/resources/MyResource.txt | 0 .../builds}/1-common-config/src/foo/Foo.java | 0 .../builds}/2-custom-tasks/build.sc | 0 .../builds}/2-custom-tasks/src/foo/Foo.java | 0 .../builds}/3-override-tasks/build.sc | 0 .../4-nested-modules/baz/src/baz/Baz.java | 0 .../builds}/4-nested-modules/build.sc | 0 .../4-nested-modules/foo/bar/src/bar/Bar.java | 0 .../4-nested-modules/foo/qux/src/qux/Qux.java | 0 .../4-nested-modules/foo/src/foo/Foo.java | 0 .../builds}/6-publish-module/build.sc | 0 .../6-publish-module/foo/src/foo/Foo.java | 0 .../bar/src/main/java/bar/Bar.java | 0 .../builds}/8-compat-modules/build.sc | 0 .../foo/src/main/java/foo/Foo.java | 0 .../foo/src/test/java/foo/FooTests.java | 0 .../builds}/9-realistic/bar/src/bar/Bar.java | 0 .../bar/test/src/bar/BarTests.java | 0 .../builds}/9-realistic/build.sc | 0 .../builds}/9-realistic/foo/src/foo/Foo.java | 0 .../foo/test/src/foo/FooTests.java | 0 .../builds}/9-realistic/qux/src/qux/Qux.java | 0 .../1-compilation-execution-flags/build.sc | 0 .../src/foo/Foo.java | 0 .../10-downloading-non-maven-jars/build.sc | 0 .../src/foo/Foo.java | 0 .../textfile.txt | 0 .../bar/resources/application.conf | 0 .../module}/11-assembly-config/build.sc | 0 .../foo/resources/application.conf | 0 .../11-assembly-config/foo/src/foo/Foo.java | 0 .../module}/12-repository-config/build.sc | 0 .../12-repository-config/foo/src/foo/Foo.java | 0 .../module}/13-jni/build.sc | 0 .../module}/13-jni/native-src/HelloWorld.c | 0 .../module}/13-jni/src/foo/HelloWorld.java | 0 .../13-jni/test/src/foo/HelloWorldTest.java | 0 .../module}/2-ivy-deps/build.sc | 0 .../module}/2-ivy-deps/src/foo/Foo.java | 0 .../3-run-compile-deps/bar/src/bar/Bar.java | 0 .../module}/3-run-compile-deps/build.sc | 0 .../3-run-compile-deps/foo/src/foo/Foo.java | 0 .../module}/5-resources/build.sc | 0 .../5-resources/foo/resources/file.txt | 0 .../module}/5-resources/foo/src/Foo.java | 0 .../foo/test/other-files/other-file.txt | 0 .../foo/test/resources/test-file-a.txt | 0 .../foo/test/resources/test-file-b.txt | 0 .../5-resources/foo/test/src/FooTests.java | 0 .../bar/src/bar/GetterSetterExample.java | 0 .../bar/test/src/bar/HelloWorldTest.java | 0 .../module}/6-annotation-processors/build.sc | 0 .../foo/src/foo/GetterSetterExample.java | 0 .../foo/test/src/foo/HelloWorldTest.java | 0 .../module}/7-docjar/build.sc | 0 .../module}/7-docjar/foo/src/foo/Foo.java | 0 .../module}/8-unmanaged-jars/build.sc | 0 .../8-unmanaged-jars/lib/nanojson-1.8.jar | Bin .../module}/8-unmanaged-jars/src/foo/Foo.java | 0 .../module}/9-main-class/build.sc | 0 .../module}/9-main-class/src/foo/Bar.java | 0 .../module}/9-main-class/src/foo/Foo.java | 0 .../module}/9-main-class/src/foo/Qux.java | 0 .../1-test-suite/bar/src/bar/Bar.java | 0 .../bar/test/src/bar/BarTests.java | 0 .../testing}/1-test-suite/build.sc | 0 .../1-test-suite/foo/src/foo/Foo.java | 0 .../foo/test/src/foo/FooTests.java | 0 .../testing}/2-test-deps/baz/src/baz/Baz.java | 0 .../baz/test/src/baz/BazTestUtils.java | 0 .../baz/test/src/baz/BazTests.java | 0 .../testing}/2-test-deps/build.sc | 0 .../testing}/2-test-deps/qux/src/qux/Qux.java | 0 .../qux/test/src/qux/QuxTests.java | 0 .../testing}/3-integration-suite/build.sc | 0 .../src/qux/QuxIntegrationTests.java | 0 .../3-integration-suite/qux/src/qux/Qux.java | 0 .../qux/test/src/qux/QuxTests.java | 0 .../web}/1-hello-jetty/build.sc | 0 .../resources/application.properties | 0 .../src/com/example/HelloJetty.java | 0 .../test/src/com/example/HelloJettyTest.java | 0 .../web}/2-hello-spring-boot/build.sc | 0 .../resources/application.properties | 0 .../src/com/example/HelloSpringBoot.java | 0 .../src/com/example/HelloSpringBootTest.java | 0 .../web}/3-todo-spring-boot/build.sc | 0 .../resources/application.properties | 0 .../com/example/TodomvcIntegrationTests.java | 0 .../resources/templates/fragments.html | 0 .../resources/templates/index.html | 0 .../src/com/example/TodomvcApplication.java | 0 .../src/com/example/todoitem/TodoItem.java | 0 .../todoitem/TodoItemNotFoundException.java | 0 .../example/todoitem/TodoItemRepository.java | 0 .../todoitem/web/TodoItemController.java | 0 .../todoitem/web/TodoItemFormData.java | 0 .../test/resources/application.properties | 0 .../test/src/com/example/TodomvcTests.java | 0 .../web}/4-hello-micronaut/build.sc | 0 .../java/example/micronaut/Application.java | 0 .../example/micronaut/HelloController.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/logback.xml | 0 .../java/example/micronaut/DefaultTest.java | 0 .../micronaut/HelloControllerTest.java | 0 .../web}/5-todo-micronaut/build.sc | 0 .../java/example/micronaut/Application.java | 0 .../micronaut/LoggingHeadersFilter.java | 0 .../main/java/example/micronaut/TodoItem.java | 0 .../example/micronaut/TodoItemController.java | 0 .../example/micronaut/TodoItemFormData.java | 0 .../example/micronaut/TodoItemMapper.java | 0 .../micronaut/TodoItemNotFoundException.java | 0 .../TodoItemNotFoundExceptionHandler.java | 0 .../example/micronaut/TodoItemRepository.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/public/learn.json | 0 .../main/resources/templates/fragments.html | 0 .../src/main/resources/templates/index.html | 0 .../example/micronaut/HtmxWebJarsTest.java | 0 .../java/example/micronaut/LearnJsonTest.java | 0 .../micronaut/TodoItemControllerTest.java | 0 .../example/micronaut/TodoItemMapperTest.java | 0 .../test/java/example/micronaut/TodoTest.java | 0 .../test/src/mill/testkit/ExampleTests.scala | 17 - .../test/src/mill/testkit/UnitTests.scala | 36 - .../{ => scalalib}/basic/1-simple/build.sc | 0 .../basic/1-simple/src/Foo.scala | 0 .../basic/1-simple/test/src/FooTests.scala | 3 +- .../basic/2-custom-build-logic/build.sc | 0 .../basic/2-custom-build-logic/src/Foo.scala | 0 .../test/src/FooTests.scala | 3 +- .../basic/3-multi-module/bar/src/Bar.scala | 0 .../bar/test/src/BarTests.scala | 0 .../basic/3-multi-module/build.sc | 0 .../basic/3-multi-module/foo/src/Foo.scala | 0 .../4-builtin-commands/bar/src/Bar.scala | 0 .../basic/4-builtin-commands/build.sc | 0 .../4-builtin-commands/foo/src/Foo.scala | 0 .../basic/5-multiple-test-frameworks/build.sc | 0 .../5-multiple-test-frameworks/src/Foo.scala | 0 .../test/src/FooScalaTests.scala | 2 - .../test/src/FooTests.scala | 3 +- .../builds}/1-common-config/build.sc | 0 .../custom-resources/MyOtherResource.txt | 0 .../1-common-config/custom-src/Foo2.scala | 0 .../1-common-config/resources/MyResource.txt | 0 .../builds}/1-common-config/src/Foo.scala | 0 .../builds}/2-custom-tasks/build.sc | 0 .../builds}/2-custom-tasks/src/Foo.scala | 0 .../builds}/3-override-tasks/build.sc | 0 .../4-nested-modules/baz/src/Baz.scala | 0 .../builds}/4-nested-modules/build.sc | 0 .../4-nested-modules/foo/bar/src/Bar.scala | 0 .../4-nested-modules/foo/qux/src/Qux.scala | 0 .../4-nested-modules/foo/src/Foo.scala | 0 .../builds}/6-publish-module/build.sc | 0 .../6-publish-module/foo/src/Foo.scala | 0 .../7-cross-scala-version/bar/src/Bar.scala | 0 .../builds}/7-cross-scala-version/build.sc | 0 .../foo/src-2.12/MinorVersionSpecific.scala | 0 .../foo/src-2.13/MinorVersionSpecific.scala | 0 .../foo/src-2/MajorVersionSpecific.scala | 0 .../foo/src-3.2/MinorVersionSpecific.scala | 0 .../foo/src-3/MajorVersionSpecific.scala | 0 .../7-cross-scala-version/foo/src/Foo.scala | 0 .../scala-2.12/MinorVersionSpecific.scala | 0 .../scala-2.13/MinorVersionSpecific.scala | 0 .../bar/src/main/scala/Bar.scala | 0 .../builds}/8-compat-modules/build.sc | 0 .../foo/src/main/scala/Foo.scala | 0 .../foo/src/test/scala/FooTests.scala | 0 .../bar/src-2/BarVersionSpecific.scala | 0 .../bar/src-3/BarVersionSpecific.scala | 0 .../builds}/9-realistic/bar/src/Bar.scala | 0 .../test/src-2/BarVersionSpecificTests.scala | 0 .../test/src-3/BarVersionSpecificTests.scala | 0 .../9-realistic/bar/test/src/BarTests.scala | 0 .../builds}/9-realistic/build.sc | 0 .../builds}/9-realistic/foo/src/Foo.scala | 0 .../9-realistic/foo/test/src/FooTests.scala | 0 .../builds}/9-realistic/qux/src/Qux.java | 0 .../1-compilation-execution-flags/build.sc | 0 .../src/Foo.scala | 0 .../10-downloading-non-maven-jars/build.sc | 0 .../src/Foo.scala | 0 .../textfile.txt | 0 .../bar/resources/application.conf | 0 .../module}/11-assembly-config/build.sc | 0 .../foo/resources/application.conf | 0 .../11-assembly-config/foo/src/Foo.scala | 0 .../module}/12-repository-config/build.sc | 0 .../12-repository-config/foo/src/Foo.scala | 0 .../module}/13-contrib-scoverage/build.sc | 0 .../13-contrib-scoverage/src/Foo.scala | 0 .../test/src/FooTests.scala | 3 +- .../module}/14-unidoc/build.sc | 0 .../module}/14-unidoc/foo/bar/src/Bar.scala | 0 .../module}/14-unidoc/foo/qux/src/Qux.scala | 0 .../module}/14-unidoc/foo/src/Foo.scala | 0 .../module}/2-ivy-deps/build.sc | 0 .../module}/2-ivy-deps/src/Foo.scala | 0 .../3-run-compile-deps/bar/src/Bar.scala | 0 .../module}/3-run-compile-deps/build.sc | 0 .../3-run-compile-deps/foo/src/Foo.scala | 0 .../module}/5-resources/build.sc | 0 .../5-resources/foo/resources/file.txt | 0 .../module}/5-resources/foo/src/Foo.scala | 0 .../foo/test/other-files/other-file.txt | 0 .../foo/test/resources/test-file-a.txt | 0 .../foo/test/resources/test-file-b.txt | 0 .../5-resources/foo/test/src/FooTests.scala | 0 .../module}/6-scala-compiler-plugins/build.sc | 0 .../6-scala-compiler-plugins/src/Bar.scala | 0 .../6-scala-compiler-plugins/src/Foo.scala | 0 .../module}/7-docjar/bar/src/Bar.scala | 0 .../module}/7-docjar/build.sc | 0 .../module}/7-docjar/foo/src/Foo.scala | 0 .../module}/8-unmanaged-jars/build.sc | 0 .../8-unmanaged-jars/lib/nanojson-1.8.jar | Bin .../module}/8-unmanaged-jars/src/Foo.scala | 0 .../module}/9-main-class/build.sc | 0 .../module}/9-main-class/src/Bar.scala | 0 .../module}/9-main-class/src/Foo.scala | 0 .../module}/9-main-class/src/Qux.scala | 0 .../testing}/1-test-suite/bar/src/Bar.scala | 0 .../1-test-suite/bar/test/src/BarTests.scala | 0 .../testing}/1-test-suite/build.sc | 0 .../testing}/1-test-suite/foo/src/Foo.scala | 0 .../1-test-suite/foo/test/src/FooTests.scala | 0 .../testing}/2-test-deps/baz/src/Baz.scala | 0 .../baz/test/src/BazTestUtils.scala | 0 .../2-test-deps/baz/test/src/BazTests.scala | 0 .../testing}/2-test-deps/build.sc | 0 .../testing}/2-test-deps/qux/src/Qux.scala | 0 .../2-test-deps/qux/test/src/QuxTests.scala | 0 .../testing}/3-integration-suite/build.sc | 0 .../qux/integration/src/QuxTests.scala | 0 .../3-integration-suite/qux/src/Qux.scala | 0 .../qux/test/src/QuxTests.scala | 0 .../{ => scalalib}/web/1-todo-webapp/build.sc | 0 .../1-todo-webapp/resources/webapp/index.css | 0 .../1-todo-webapp/resources/webapp/main.js | 0 .../web/1-todo-webapp/src/WebApp.scala | 0 .../1-todo-webapp/test/src/WebAppTests.scala | 2 - .../web/2-webapp-cache-busting/build.sc | 0 .../resources/webapp/index.css | 0 .../resources/webapp/main.js | 0 .../2-webapp-cache-busting/src/WebApp.scala | 0 .../test/src/WebAppTests.scala | 2 - .../web/3-scalajs-module/build.sc | 0 .../web/3-scalajs-module/foo/src/Foo.scala | 0 .../foo/test/src/FooTests.scala | 0 .../web/4-webapp-scalajs/build.sc | 0 .../client/src/ClientApp.scala | 0 .../resources/webapp/index.css | 0 .../web/4-webapp-scalajs/src/WebApp.scala | 0 .../test/src/WebAppTests.scala | 2 - .../web/5-webapp-scalajs-shared/build.sc | 0 .../client/src/ClientApp.scala | 0 .../resources/webapp/index.css | 0 .../shared/src/Shared.scala | 0 .../5-webapp-scalajs-shared/src/WebApp.scala | 0 .../test/src/WebAppTests.scala | 2 - .../build.sc | 0 .../foo/bar/src-2/BarVersionSpecific.scala | 0 .../foo/bar/src-3/BarVersionSpecific.scala | 0 .../foo/bar/src/Bar.scala | 0 .../foo/bar/test/src/BarTests.scala | 0 .../foo/qux/src-js/QuxPlatformSpecific.scala | 0 .../foo/qux/src-jvm/QuxPlatformSpecific.scala | 0 .../foo/qux/src/Qux.scala | 0 .../foo/qux/test/src/QuxTests.scala | 0 .../bar/src-2/BarVersionSpecific.scala | 0 .../bar/src-3/BarVersionSpecific.scala | 0 .../bar/src/Bar.scala | 0 .../bar/test/src/BarTests.scala | 0 .../build.sc | 0 .../qux/src-js/QuxPlatformSpecific.scala | 0 .../qux/src-jvm/QuxPlatformSpecific.scala | 0 .../qux/src/Qux.scala | 0 .../qux/test/src/QuxTests.scala | 0 example/thirdparty/acyclic/build.sc | 84 --- example/thirdparty/commons-io/build.sc | 71 -- example/thirdparty/fansi/build.sc | 94 --- example/thirdparty/jimfs/build.sc | 63 -- example/thirdparty/mockito/build.sc | 275 -------- example/thirdparty/netty/build.sc | 626 ------------------ 406 files changed, 197 insertions(+), 1403 deletions(-) rename example/{ => depth}/cross/1-simple/build.sc (100%) rename example/{ => depth}/cross/10-static-blog/build.sc (100%) rename example/{ => depth}/cross/10-static-blog/post/1-My-First-Post.md (100%) rename example/{ => depth}/cross/10-static-blog/post/2-My-Second-Post.md (100%) rename example/{ => depth}/cross/10-static-blog/post/3-My-Third-Post.md (100%) rename example/{ => depth}/cross/11-default-cross-module/build.sc (100%) rename example/{ => depth}/cross/2-cross-source-path/build.sc (100%) rename example/{ => depth}/cross/3-outside-dependency/build.sc (100%) rename example/{ => depth}/cross/4-cross-dependencies/build.sc (100%) rename example/{ => depth}/cross/5-multiple-cross-axes/build.sc (100%) rename example/{ => depth}/cross/6-axes-extension/build.sc (100%) rename example/{ => depth}/cross/7-inner-cross-module/build.sc (100%) rename example/{ => depth}/cross/8-resolvers/build.sc (100%) rename example/{ => depth}/cross/9-dynamic-cross-modules/build.sc (100%) rename example/{ => depth}/cross/9-dynamic-cross-modules/modules/bar/src/Example.scala (100%) rename example/{ => depth}/cross/9-dynamic-cross-modules/modules/foo/src/Example.scala (100%) rename example/{ => depth}/cross/9-dynamic-cross-modules/modules/qux/src/Example.scala (100%) rename example/{ => depth}/tasks/1-task-graph/build.sc (100%) rename example/{ => depth}/tasks/1-task-graph/resources/foo.txt (100%) rename example/{ => depth}/tasks/1-task-graph/src/Foo.java (100%) rename example/{ => depth}/tasks/10-module-sc/bar/module.sc (100%) rename example/{ => depth}/tasks/10-module-sc/bar/qux/module.sc (100%) rename example/{ => depth}/tasks/10-module-sc/bar/qux/module/src/BarQux.scala (100%) rename example/{ => depth}/tasks/10-module-sc/build.sc (100%) rename example/{ => depth}/tasks/10-module-sc/foo/module.sc (100%) rename example/{ => depth}/tasks/10-module-sc/foo/src/Foo.scala (100%) rename example/{ => depth}/tasks/11-module-run-task/bar/src/Bar.scala (100%) rename example/{ => depth}/tasks/11-module-run-task/build.sc (100%) rename example/{ => depth}/tasks/11-module-run-task/foo/src/Foo.scala (100%) rename example/{ => depth}/tasks/2-primary-tasks/bar/src/file.txt (100%) rename example/{ => depth}/tasks/2-primary-tasks/bar/src2/file.txt (100%) rename example/{ => depth}/tasks/2-primary-tasks/build.sc (100%) rename example/{ => depth}/tasks/2-primary-tasks/resources/foo.txt (100%) rename example/{ => depth}/tasks/2-primary-tasks/src/foo/Foo.java (100%) rename example/{ => depth}/tasks/3-anonymous-tasks/build.sc (100%) rename example/{ => depth}/tasks/3-anonymous-tasks/data/hello.txt (100%) rename example/{ => depth}/tasks/3-anonymous-tasks/data/world.txt (100%) rename example/{ => depth}/tasks/4-inputs/build.sc (100%) rename example/{ => depth}/tasks/4-inputs/data/hello.txt (100%) rename example/{ => depth}/tasks/4-inputs/data/world.txt (100%) rename example/{ => depth}/tasks/5-persistent-targets/build.sc (100%) rename example/{ => depth}/tasks/5-persistent-targets/data/hello.txt (100%) rename example/{ => depth}/tasks/5-persistent-targets/data/world.txt (100%) rename example/{ => depth}/tasks/6-workers/build.sc (100%) rename example/{ => depth}/tasks/6-workers/data/hello.txt (100%) rename example/{ => depth}/tasks/6-workers/data/world.txt (100%) rename example/{ => depth}/tasks/7-modules/build.sc (100%) rename example/{ => depth}/tasks/7-modules/outer/inner/sources/inner-source.txt (100%) rename example/{ => depth}/tasks/7-modules/outer/sources/outer-source.txt (100%) rename example/{ => depth}/tasks/7-modules/outer2/nested/inner/sources/inner-source.txt (100%) rename example/{ => depth}/tasks/7-modules/outer2/nested/sources/outer-source.txt (100%) rename example/{ => depth}/tasks/8-diy-java-modules/build.sc (100%) rename example/{ => depth}/tasks/8-diy-java-modules/foo/bar/src/Bar.java (100%) rename example/{ => depth}/tasks/8-diy-java-modules/foo/src/Foo.java (100%) rename example/{ => depth}/tasks/8-diy-java-modules/qux/src/Qux.java (100%) rename example/{ => depth}/tasks/9-backticked-names/build.sc (100%) rename example/{misc => extending/imports}/3-import-file-ivy/build.sc (100%) rename example/{misc => extending/imports}/3-import-file-ivy/scalaversion.sc (100%) rename example/{misc => extending/imports}/3-import-file-ivy/src/Foo.scala (100%) rename example/{misc => extending/imports}/6-contrib-import/build.sc (100%) rename example/{misc => extending/imports}/6-contrib-import/foo/src/Foo.scala (100%) rename example/{misc => extending/metabuild}/4-meta-build/build.sc (100%) rename example/{misc => extending/metabuild}/4-meta-build/mill-build/build.sc (100%) rename example/{misc => extending/metabuild}/4-meta-build/src/Foo.scala (100%) rename example/{misc => extending/metabuild}/5-meta-shared-sources/build.sc (100%) rename example/{misc => extending/metabuild}/5-meta-shared-sources/mill-build/build.sc (100%) rename example/{misc => extending/metabuild}/5-meta-shared-sources/mill-build/src/ScalaVersion.scala (100%) rename example/{misc => extending/metabuild}/5-meta-shared-sources/src/Foo.scala (100%) rename example/{misc => extending/plugins}/7-writing-mill-plugins/build.sc (99%) rename example/{misc => extending/plugins}/7-writing-mill-plugins/myplugin/src/LineCountJavaModule.scala (100%) rename example/{misc => extending/plugins}/7-writing-mill-plugins/myplugin/test/resources/example-test-project/build.sc (100%) rename example/{basicjava/2-custom-build-logic => extending/plugins/7-writing-mill-plugins/myplugin/test/resources/example-test-project}/src/foo/Foo.java (100%) rename example/{misc => extending/plugins}/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/build.sc (100%) rename example/{misc/7-writing-mill-plugins/myplugin/test/resources/example-test-project => extending/plugins/7-writing-mill-plugins/myplugin/test/resources/integration-test-project}/src/foo/Foo.java (100%) rename example/{misc/7-writing-mill-plugins/myplugin/test/resources/integration-test-project => extending/plugins/7-writing-mill-plugins/myplugin/test/resources/unit-test-project}/src/foo/Foo.java (100%) create mode 100644 example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala rename example/{misc => extending/plugins}/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala (96%) create mode 100644 example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala rename example/{basicjava => javalib/basic}/1-simple/build.sc (100%) rename example/{basicjava => javalib/basic}/1-simple/src/foo/Foo.java (100%) rename example/{basicjava => javalib/basic}/1-simple/test/src/foo/FooTest.java (100%) rename example/{basicjava => javalib/basic}/2-custom-build-logic/build.sc (100%) rename example/{misc/7-writing-mill-plugins/myplugin/test/resources/unit-test-project => javalib/basic/2-custom-build-logic}/src/foo/Foo.java (100%) rename example/{basicjava => javalib/basic}/2-custom-build-logic/test/src/foo/FooTests.java (100%) rename example/{basicjava => javalib/basic}/3-multi-module/bar/src/bar/Bar.java (100%) rename example/{basicjava => javalib/basic}/3-multi-module/bar/test/src/bar/BarTests.java (100%) rename example/{basicjava => javalib/basic}/3-multi-module/build.sc (100%) rename example/{basicjava => javalib/basic}/3-multi-module/foo/src/foo/Foo.java (100%) rename example/{basicjava => javalib/basic}/4-builtin-commands/bar/src/bar/Bar.java (100%) rename example/{basicjava => javalib/basic}/4-builtin-commands/bar/test/src/bar/BarTest.java (100%) rename example/{basicjava => javalib/basic}/4-builtin-commands/build.sc (100%) rename example/{basicjava => javalib/basic}/4-builtin-commands/foo/src/foo/Foo.java (100%) rename example/{javabuilds => javalib/builds}/1-common-config/build.sc (100%) rename example/{javabuilds => javalib/builds}/1-common-config/custom-resources/MyOtherResource.txt (100%) rename example/{javabuilds => javalib/builds}/1-common-config/custom-src/Foo2.java (100%) rename example/{javabuilds => javalib/builds}/1-common-config/resources/MyResource.txt (100%) rename example/{javabuilds => javalib/builds}/1-common-config/src/foo/Foo.java (100%) rename example/{javabuilds => javalib/builds}/2-custom-tasks/build.sc (100%) rename example/{javabuilds => javalib/builds}/2-custom-tasks/src/foo/Foo.java (100%) rename example/{javabuilds => javalib/builds}/3-override-tasks/build.sc (100%) rename example/{javabuilds => javalib/builds}/4-nested-modules/baz/src/baz/Baz.java (100%) rename example/{javabuilds => javalib/builds}/4-nested-modules/build.sc (100%) rename example/{javabuilds => javalib/builds}/4-nested-modules/foo/bar/src/bar/Bar.java (100%) rename example/{javabuilds => javalib/builds}/4-nested-modules/foo/qux/src/qux/Qux.java (100%) rename example/{javabuilds => javalib/builds}/4-nested-modules/foo/src/foo/Foo.java (100%) rename example/{javabuilds => javalib/builds}/6-publish-module/build.sc (100%) rename example/{javabuilds => javalib/builds}/6-publish-module/foo/src/foo/Foo.java (100%) rename example/{javabuilds => javalib/builds}/8-compat-modules/bar/src/main/java/bar/Bar.java (100%) rename example/{javabuilds => javalib/builds}/8-compat-modules/build.sc (100%) rename example/{javabuilds => javalib/builds}/8-compat-modules/foo/src/main/java/foo/Foo.java (100%) rename example/{javabuilds => javalib/builds}/8-compat-modules/foo/src/test/java/foo/FooTests.java (100%) rename example/{javabuilds => javalib/builds}/9-realistic/bar/src/bar/Bar.java (100%) rename example/{javabuilds => javalib/builds}/9-realistic/bar/test/src/bar/BarTests.java (100%) rename example/{javabuilds => javalib/builds}/9-realistic/build.sc (100%) rename example/{javabuilds => javalib/builds}/9-realistic/foo/src/foo/Foo.java (100%) rename example/{javabuilds => javalib/builds}/9-realistic/foo/test/src/foo/FooTests.java (100%) rename example/{javabuilds => javalib/builds}/9-realistic/qux/src/qux/Qux.java (100%) rename example/{javamodule => javalib/module}/1-compilation-execution-flags/build.sc (100%) rename example/{javamodule => javalib/module}/1-compilation-execution-flags/src/foo/Foo.java (100%) rename example/{javamodule => javalib/module}/10-downloading-non-maven-jars/build.sc (100%) rename example/{javamodule => javalib/module}/10-downloading-non-maven-jars/src/foo/Foo.java (100%) rename example/{javamodule => javalib/module}/10-downloading-non-maven-jars/textfile.txt (100%) rename example/{javamodule => javalib/module}/11-assembly-config/bar/resources/application.conf (100%) rename example/{javamodule => javalib/module}/11-assembly-config/build.sc (100%) rename example/{javamodule => javalib/module}/11-assembly-config/foo/resources/application.conf (100%) rename example/{javamodule => javalib/module}/11-assembly-config/foo/src/foo/Foo.java (100%) rename example/{javamodule => javalib/module}/12-repository-config/build.sc (100%) rename example/{javamodule => javalib/module}/12-repository-config/foo/src/foo/Foo.java (100%) rename example/{javamodule => javalib/module}/13-jni/build.sc (100%) rename example/{javamodule => javalib/module}/13-jni/native-src/HelloWorld.c (100%) rename example/{javamodule => javalib/module}/13-jni/src/foo/HelloWorld.java (100%) rename example/{javamodule => javalib/module}/13-jni/test/src/foo/HelloWorldTest.java (100%) rename example/{javamodule => javalib/module}/2-ivy-deps/build.sc (100%) rename example/{javamodule => javalib/module}/2-ivy-deps/src/foo/Foo.java (100%) rename example/{javamodule => javalib/module}/3-run-compile-deps/bar/src/bar/Bar.java (100%) rename example/{javamodule => javalib/module}/3-run-compile-deps/build.sc (100%) rename example/{javamodule => javalib/module}/3-run-compile-deps/foo/src/foo/Foo.java (100%) rename example/{javamodule => javalib/module}/5-resources/build.sc (100%) rename example/{javamodule => javalib/module}/5-resources/foo/resources/file.txt (100%) rename example/{javamodule => javalib/module}/5-resources/foo/src/Foo.java (100%) rename example/{javamodule => javalib/module}/5-resources/foo/test/other-files/other-file.txt (100%) rename example/{javamodule => javalib/module}/5-resources/foo/test/resources/test-file-a.txt (100%) rename example/{javamodule => javalib/module}/5-resources/foo/test/resources/test-file-b.txt (100%) rename example/{javamodule => javalib/module}/5-resources/foo/test/src/FooTests.java (100%) rename example/{javamodule => javalib/module}/6-annotation-processors/bar/src/bar/GetterSetterExample.java (100%) rename example/{javamodule => javalib/module}/6-annotation-processors/bar/test/src/bar/HelloWorldTest.java (100%) rename example/{javamodule => javalib/module}/6-annotation-processors/build.sc (100%) rename example/{javamodule => javalib/module}/6-annotation-processors/foo/src/foo/GetterSetterExample.java (100%) rename example/{javamodule => javalib/module}/6-annotation-processors/foo/test/src/foo/HelloWorldTest.java (100%) rename example/{javamodule => javalib/module}/7-docjar/build.sc (100%) rename example/{javamodule => javalib/module}/7-docjar/foo/src/foo/Foo.java (100%) rename example/{javamodule => javalib/module}/8-unmanaged-jars/build.sc (100%) rename example/{javamodule => javalib/module}/8-unmanaged-jars/lib/nanojson-1.8.jar (100%) rename example/{javamodule => javalib/module}/8-unmanaged-jars/src/foo/Foo.java (100%) rename example/{javamodule => javalib/module}/9-main-class/build.sc (100%) rename example/{javamodule => javalib/module}/9-main-class/src/foo/Bar.java (100%) rename example/{javamodule => javalib/module}/9-main-class/src/foo/Foo.java (100%) rename example/{javamodule => javalib/module}/9-main-class/src/foo/Qux.java (100%) rename example/{javatesting => javalib/testing}/1-test-suite/bar/src/bar/Bar.java (100%) rename example/{javatesting => javalib/testing}/1-test-suite/bar/test/src/bar/BarTests.java (100%) rename example/{javatesting => javalib/testing}/1-test-suite/build.sc (100%) rename example/{javatesting => javalib/testing}/1-test-suite/foo/src/foo/Foo.java (100%) rename example/{javatesting => javalib/testing}/1-test-suite/foo/test/src/foo/FooTests.java (100%) rename example/{javatesting => javalib/testing}/2-test-deps/baz/src/baz/Baz.java (100%) rename example/{javatesting => javalib/testing}/2-test-deps/baz/test/src/baz/BazTestUtils.java (100%) rename example/{javatesting => javalib/testing}/2-test-deps/baz/test/src/baz/BazTests.java (100%) rename example/{javatesting => javalib/testing}/2-test-deps/build.sc (100%) rename example/{javatesting => javalib/testing}/2-test-deps/qux/src/qux/Qux.java (100%) rename example/{javatesting => javalib/testing}/2-test-deps/qux/test/src/qux/QuxTests.java (100%) rename example/{javatesting => javalib/testing}/3-integration-suite/build.sc (100%) rename example/{javatesting => javalib/testing}/3-integration-suite/qux/integration/src/qux/QuxIntegrationTests.java (100%) rename example/{javatesting => javalib/testing}/3-integration-suite/qux/src/qux/Qux.java (100%) rename example/{javatesting => javalib/testing}/3-integration-suite/qux/test/src/qux/QuxTests.java (100%) rename example/{javaweb => javalib/web}/1-hello-jetty/build.sc (100%) rename example/{javaweb => javalib/web}/1-hello-jetty/resources/application.properties (100%) rename example/{javaweb => javalib/web}/1-hello-jetty/src/com/example/HelloJetty.java (100%) rename example/{javaweb => javalib/web}/1-hello-jetty/test/src/com/example/HelloJettyTest.java (100%) rename example/{javaweb => javalib/web}/2-hello-spring-boot/build.sc (100%) rename example/{javaweb => javalib/web}/2-hello-spring-boot/resources/application.properties (100%) rename example/{javaweb => javalib/web}/2-hello-spring-boot/src/com/example/HelloSpringBoot.java (100%) rename example/{javaweb => javalib/web}/2-hello-spring-boot/test/src/com/example/HelloSpringBootTest.java (100%) rename example/{javaweb => javalib/web}/3-todo-spring-boot/build.sc (100%) rename example/{javaweb => javalib/web}/3-todo-spring-boot/integration/resources/application.properties (100%) rename example/{javaweb => javalib/web}/3-todo-spring-boot/integration/src/com/example/TodomvcIntegrationTests.java (100%) rename example/{javaweb => javalib/web}/3-todo-spring-boot/resources/templates/fragments.html (100%) rename example/{javaweb => javalib/web}/3-todo-spring-boot/resources/templates/index.html (100%) rename example/{javaweb => javalib/web}/3-todo-spring-boot/src/com/example/TodomvcApplication.java (100%) rename example/{javaweb => javalib/web}/3-todo-spring-boot/src/com/example/todoitem/TodoItem.java (100%) rename example/{javaweb => javalib/web}/3-todo-spring-boot/src/com/example/todoitem/TodoItemNotFoundException.java (100%) rename example/{javaweb => javalib/web}/3-todo-spring-boot/src/com/example/todoitem/TodoItemRepository.java (100%) rename example/{javaweb => javalib/web}/3-todo-spring-boot/src/com/example/todoitem/web/TodoItemController.java (100%) rename example/{javaweb => javalib/web}/3-todo-spring-boot/src/com/example/todoitem/web/TodoItemFormData.java (100%) rename example/{javaweb => javalib/web}/3-todo-spring-boot/test/resources/application.properties (100%) rename example/{javaweb => javalib/web}/3-todo-spring-boot/test/src/com/example/TodomvcTests.java (100%) rename example/{javaweb => javalib/web}/4-hello-micronaut/build.sc (100%) rename example/{javaweb => javalib/web}/4-hello-micronaut/src/main/java/example/micronaut/Application.java (100%) rename example/{javaweb => javalib/web}/4-hello-micronaut/src/main/java/example/micronaut/HelloController.java (100%) rename example/{javaweb => javalib/web}/4-hello-micronaut/src/main/resources/application.properties (100%) rename example/{javaweb => javalib/web}/4-hello-micronaut/src/main/resources/logback.xml (100%) rename example/{javaweb => javalib/web}/4-hello-micronaut/src/test/java/example/micronaut/DefaultTest.java (100%) rename example/{javaweb => javalib/web}/4-hello-micronaut/src/test/java/example/micronaut/HelloControllerTest.java (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/build.sc (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/main/java/example/micronaut/Application.java (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/main/java/example/micronaut/LoggingHeadersFilter.java (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/main/java/example/micronaut/TodoItem.java (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/main/java/example/micronaut/TodoItemController.java (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/main/java/example/micronaut/TodoItemFormData.java (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/main/java/example/micronaut/TodoItemMapper.java (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/main/java/example/micronaut/TodoItemNotFoundException.java (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/main/java/example/micronaut/TodoItemNotFoundExceptionHandler.java (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/main/java/example/micronaut/TodoItemRepository.java (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/main/resources/application.properties (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/main/resources/logback.xml (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/main/resources/public/learn.json (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/main/resources/templates/fragments.html (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/main/resources/templates/index.html (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/test/java/example/micronaut/HtmxWebJarsTest.java (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/test/java/example/micronaut/LearnJsonTest.java (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/test/java/example/micronaut/TodoItemControllerTest.java (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/test/java/example/micronaut/TodoItemMapperTest.java (100%) rename example/{javaweb => javalib/web}/5-todo-micronaut/src/test/java/example/micronaut/TodoTest.java (100%) delete mode 100644 example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala delete mode 100644 example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala rename example/{ => scalalib}/basic/1-simple/build.sc (100%) rename example/{ => scalalib}/basic/1-simple/src/Foo.scala (100%) rename example/{ => scalalib}/basic/1-simple/test/src/FooTests.scala (92%) rename example/{ => scalalib}/basic/2-custom-build-logic/build.sc (100%) rename example/{ => scalalib}/basic/2-custom-build-logic/src/Foo.scala (100%) rename example/{ => scalalib}/basic/2-custom-build-logic/test/src/FooTests.scala (82%) rename example/{ => scalalib}/basic/3-multi-module/bar/src/Bar.scala (100%) rename example/{ => scalalib}/basic/3-multi-module/bar/test/src/BarTests.scala (100%) rename example/{ => scalalib}/basic/3-multi-module/build.sc (100%) rename example/{ => scalalib}/basic/3-multi-module/foo/src/Foo.scala (100%) rename example/{ => scalalib}/basic/4-builtin-commands/bar/src/Bar.scala (100%) rename example/{ => scalalib}/basic/4-builtin-commands/build.sc (100%) rename example/{ => scalalib}/basic/4-builtin-commands/foo/src/Foo.scala (100%) rename example/{ => scalalib}/basic/5-multiple-test-frameworks/build.sc (100%) rename example/{ => scalalib}/basic/5-multiple-test-frameworks/src/Foo.scala (100%) rename example/{ => scalalib}/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala (87%) rename example/{scalamodule/13-contrib-scoverage => scalalib/basic/5-multiple-test-frameworks}/test/src/FooTests.scala (92%) rename example/{scalabuilds => scalalib/builds}/1-common-config/build.sc (100%) rename example/{scalabuilds => scalalib/builds}/1-common-config/custom-resources/MyOtherResource.txt (100%) rename example/{scalabuilds => scalalib/builds}/1-common-config/custom-src/Foo2.scala (100%) rename example/{scalabuilds => scalalib/builds}/1-common-config/resources/MyResource.txt (100%) rename example/{scalabuilds => scalalib/builds}/1-common-config/src/Foo.scala (100%) rename example/{scalabuilds => scalalib/builds}/2-custom-tasks/build.sc (100%) rename example/{scalabuilds => scalalib/builds}/2-custom-tasks/src/Foo.scala (100%) rename example/{scalabuilds => scalalib/builds}/3-override-tasks/build.sc (100%) rename example/{scalabuilds => scalalib/builds}/4-nested-modules/baz/src/Baz.scala (100%) rename example/{scalabuilds => scalalib/builds}/4-nested-modules/build.sc (100%) rename example/{scalabuilds => scalalib/builds}/4-nested-modules/foo/bar/src/Bar.scala (100%) rename example/{scalabuilds => scalalib/builds}/4-nested-modules/foo/qux/src/Qux.scala (100%) rename example/{scalabuilds => scalalib/builds}/4-nested-modules/foo/src/Foo.scala (100%) rename example/{scalabuilds => scalalib/builds}/6-publish-module/build.sc (100%) rename example/{scalabuilds => scalalib/builds}/6-publish-module/foo/src/Foo.scala (100%) rename example/{scalabuilds => scalalib/builds}/7-cross-scala-version/bar/src/Bar.scala (100%) rename example/{scalabuilds => scalalib/builds}/7-cross-scala-version/build.sc (100%) rename example/{scalabuilds => scalalib/builds}/7-cross-scala-version/foo/src-2.12/MinorVersionSpecific.scala (100%) rename example/{scalabuilds => scalalib/builds}/7-cross-scala-version/foo/src-2.13/MinorVersionSpecific.scala (100%) rename example/{scalabuilds => scalalib/builds}/7-cross-scala-version/foo/src-2/MajorVersionSpecific.scala (100%) rename example/{scalabuilds => scalalib/builds}/7-cross-scala-version/foo/src-3.2/MinorVersionSpecific.scala (100%) rename example/{scalabuilds => scalalib/builds}/7-cross-scala-version/foo/src-3/MajorVersionSpecific.scala (100%) rename example/{scalabuilds => scalalib/builds}/7-cross-scala-version/foo/src/Foo.scala (100%) rename example/{scalabuilds => scalalib/builds}/8-compat-modules/bar/src/main/scala-2.12/MinorVersionSpecific.scala (100%) rename example/{scalabuilds => scalalib/builds}/8-compat-modules/bar/src/main/scala-2.13/MinorVersionSpecific.scala (100%) rename example/{scalabuilds => scalalib/builds}/8-compat-modules/bar/src/main/scala/Bar.scala (100%) rename example/{scalabuilds => scalalib/builds}/8-compat-modules/build.sc (100%) rename example/{scalabuilds => scalalib/builds}/8-compat-modules/foo/src/main/scala/Foo.scala (100%) rename example/{scalabuilds => scalalib/builds}/8-compat-modules/foo/src/test/scala/FooTests.scala (100%) rename example/{scalabuilds => scalalib/builds}/9-realistic/bar/src-2/BarVersionSpecific.scala (100%) rename example/{scalabuilds => scalalib/builds}/9-realistic/bar/src-3/BarVersionSpecific.scala (100%) rename example/{scalabuilds => scalalib/builds}/9-realistic/bar/src/Bar.scala (100%) rename example/{scalabuilds => scalalib/builds}/9-realistic/bar/test/src-2/BarVersionSpecificTests.scala (100%) rename example/{scalabuilds => scalalib/builds}/9-realistic/bar/test/src-3/BarVersionSpecificTests.scala (100%) rename example/{scalabuilds => scalalib/builds}/9-realistic/bar/test/src/BarTests.scala (100%) rename example/{scalabuilds => scalalib/builds}/9-realistic/build.sc (100%) rename example/{scalabuilds => scalalib/builds}/9-realistic/foo/src/Foo.scala (100%) rename example/{scalabuilds => scalalib/builds}/9-realistic/foo/test/src/FooTests.scala (100%) rename example/{scalabuilds => scalalib/builds}/9-realistic/qux/src/Qux.java (100%) rename example/{scalamodule => scalalib/module}/1-compilation-execution-flags/build.sc (100%) rename example/{scalamodule => scalalib/module}/1-compilation-execution-flags/src/Foo.scala (100%) rename example/{scalamodule => scalalib/module}/10-downloading-non-maven-jars/build.sc (100%) rename example/{scalamodule => scalalib/module}/10-downloading-non-maven-jars/src/Foo.scala (100%) rename example/{scalamodule => scalalib/module}/10-downloading-non-maven-jars/textfile.txt (100%) rename example/{scalamodule => scalalib/module}/11-assembly-config/bar/resources/application.conf (100%) rename example/{scalamodule => scalalib/module}/11-assembly-config/build.sc (100%) rename example/{scalamodule => scalalib/module}/11-assembly-config/foo/resources/application.conf (100%) rename example/{scalamodule => scalalib/module}/11-assembly-config/foo/src/Foo.scala (100%) rename example/{scalamodule => scalalib/module}/12-repository-config/build.sc (100%) rename example/{scalamodule => scalalib/module}/12-repository-config/foo/src/Foo.scala (100%) rename example/{scalamodule => scalalib/module}/13-contrib-scoverage/build.sc (100%) rename example/{scalamodule => scalalib/module}/13-contrib-scoverage/src/Foo.scala (100%) rename example/{basic/5-multiple-test-frameworks => scalalib/module/13-contrib-scoverage}/test/src/FooTests.scala (92%) rename example/{scalamodule => scalalib/module}/14-unidoc/build.sc (100%) rename example/{scalamodule => scalalib/module}/14-unidoc/foo/bar/src/Bar.scala (100%) rename example/{scalamodule => scalalib/module}/14-unidoc/foo/qux/src/Qux.scala (100%) rename example/{scalamodule => scalalib/module}/14-unidoc/foo/src/Foo.scala (100%) rename example/{scalamodule => scalalib/module}/2-ivy-deps/build.sc (100%) rename example/{scalamodule => scalalib/module}/2-ivy-deps/src/Foo.scala (100%) rename example/{scalamodule => scalalib/module}/3-run-compile-deps/bar/src/Bar.scala (100%) rename example/{scalamodule => scalalib/module}/3-run-compile-deps/build.sc (100%) rename example/{scalamodule => scalalib/module}/3-run-compile-deps/foo/src/Foo.scala (100%) rename example/{scalamodule => scalalib/module}/5-resources/build.sc (100%) rename example/{scalamodule => scalalib/module}/5-resources/foo/resources/file.txt (100%) rename example/{scalamodule => scalalib/module}/5-resources/foo/src/Foo.scala (100%) rename example/{scalamodule => scalalib/module}/5-resources/foo/test/other-files/other-file.txt (100%) rename example/{scalamodule => scalalib/module}/5-resources/foo/test/resources/test-file-a.txt (100%) rename example/{scalamodule => scalalib/module}/5-resources/foo/test/resources/test-file-b.txt (100%) rename example/{scalamodule => scalalib/module}/5-resources/foo/test/src/FooTests.scala (100%) rename example/{scalamodule => scalalib/module}/6-scala-compiler-plugins/build.sc (100%) rename example/{scalamodule => scalalib/module}/6-scala-compiler-plugins/src/Bar.scala (100%) rename example/{scalamodule => scalalib/module}/6-scala-compiler-plugins/src/Foo.scala (100%) rename example/{scalamodule => scalalib/module}/7-docjar/bar/src/Bar.scala (100%) rename example/{scalamodule => scalalib/module}/7-docjar/build.sc (100%) rename example/{scalamodule => scalalib/module}/7-docjar/foo/src/Foo.scala (100%) rename example/{scalamodule => scalalib/module}/8-unmanaged-jars/build.sc (100%) rename example/{scalamodule => scalalib/module}/8-unmanaged-jars/lib/nanojson-1.8.jar (100%) rename example/{scalamodule => scalalib/module}/8-unmanaged-jars/src/Foo.scala (100%) rename example/{scalamodule => scalalib/module}/9-main-class/build.sc (100%) rename example/{scalamodule => scalalib/module}/9-main-class/src/Bar.scala (100%) rename example/{scalamodule => scalalib/module}/9-main-class/src/Foo.scala (100%) rename example/{scalamodule => scalalib/module}/9-main-class/src/Qux.scala (100%) rename example/{scalatesting => scalalib/testing}/1-test-suite/bar/src/Bar.scala (100%) rename example/{scalatesting => scalalib/testing}/1-test-suite/bar/test/src/BarTests.scala (100%) rename example/{scalatesting => scalalib/testing}/1-test-suite/build.sc (100%) rename example/{scalatesting => scalalib/testing}/1-test-suite/foo/src/Foo.scala (100%) rename example/{scalatesting => scalalib/testing}/1-test-suite/foo/test/src/FooTests.scala (100%) rename example/{scalatesting => scalalib/testing}/2-test-deps/baz/src/Baz.scala (100%) rename example/{scalatesting => scalalib/testing}/2-test-deps/baz/test/src/BazTestUtils.scala (100%) rename example/{scalatesting => scalalib/testing}/2-test-deps/baz/test/src/BazTests.scala (100%) rename example/{scalatesting => scalalib/testing}/2-test-deps/build.sc (100%) rename example/{scalatesting => scalalib/testing}/2-test-deps/qux/src/Qux.scala (100%) rename example/{scalatesting => scalalib/testing}/2-test-deps/qux/test/src/QuxTests.scala (100%) rename example/{scalatesting => scalalib/testing}/3-integration-suite/build.sc (100%) rename example/{scalatesting => scalalib/testing}/3-integration-suite/qux/integration/src/QuxTests.scala (100%) rename example/{scalatesting => scalalib/testing}/3-integration-suite/qux/src/Qux.scala (100%) rename example/{scalatesting => scalalib/testing}/3-integration-suite/qux/test/src/QuxTests.scala (100%) rename example/{ => scalalib}/web/1-todo-webapp/build.sc (100%) rename example/{ => scalalib}/web/1-todo-webapp/resources/webapp/index.css (100%) rename example/{ => scalalib}/web/1-todo-webapp/resources/webapp/main.js (100%) rename example/{ => scalalib}/web/1-todo-webapp/src/WebApp.scala (100%) rename example/{ => scalalib}/web/1-todo-webapp/test/src/WebAppTests.scala (94%) rename example/{ => scalalib}/web/2-webapp-cache-busting/build.sc (100%) rename example/{ => scalalib}/web/2-webapp-cache-busting/resources/webapp/index.css (100%) rename example/{ => scalalib}/web/2-webapp-cache-busting/resources/webapp/main.js (100%) rename example/{ => scalalib}/web/2-webapp-cache-busting/src/WebApp.scala (100%) rename example/{web/5-webapp-scalajs-shared => scalalib/web/2-webapp-cache-busting}/test/src/WebAppTests.scala (94%) rename example/{ => scalalib}/web/3-scalajs-module/build.sc (100%) rename example/{ => scalalib}/web/3-scalajs-module/foo/src/Foo.scala (100%) rename example/{ => scalalib}/web/3-scalajs-module/foo/test/src/FooTests.scala (100%) rename example/{ => scalalib}/web/4-webapp-scalajs/build.sc (100%) rename example/{ => scalalib}/web/4-webapp-scalajs/client/src/ClientApp.scala (100%) rename example/{ => scalalib}/web/4-webapp-scalajs/resources/webapp/index.css (100%) rename example/{ => scalalib}/web/4-webapp-scalajs/src/WebApp.scala (100%) rename example/{web/2-webapp-cache-busting => scalalib/web/4-webapp-scalajs}/test/src/WebAppTests.scala (94%) rename example/{ => scalalib}/web/5-webapp-scalajs-shared/build.sc (100%) rename example/{ => scalalib}/web/5-webapp-scalajs-shared/client/src/ClientApp.scala (100%) rename example/{ => scalalib}/web/5-webapp-scalajs-shared/resources/webapp/index.css (100%) rename example/{ => scalalib}/web/5-webapp-scalajs-shared/shared/src/Shared.scala (100%) rename example/{ => scalalib}/web/5-webapp-scalajs-shared/src/WebApp.scala (100%) rename example/{web/4-webapp-scalajs => scalalib/web/5-webapp-scalajs-shared}/test/src/WebAppTests.scala (94%) rename example/{ => scalalib}/web/6-cross-version-platform-publishing/build.sc (100%) rename example/{ => scalalib}/web/6-cross-version-platform-publishing/foo/bar/src-2/BarVersionSpecific.scala (100%) rename example/{ => scalalib}/web/6-cross-version-platform-publishing/foo/bar/src-3/BarVersionSpecific.scala (100%) rename example/{ => scalalib}/web/6-cross-version-platform-publishing/foo/bar/src/Bar.scala (100%) rename example/{ => scalalib}/web/6-cross-version-platform-publishing/foo/bar/test/src/BarTests.scala (100%) rename example/{ => scalalib}/web/6-cross-version-platform-publishing/foo/qux/src-js/QuxPlatformSpecific.scala (100%) rename example/{ => scalalib}/web/6-cross-version-platform-publishing/foo/qux/src-jvm/QuxPlatformSpecific.scala (100%) rename example/{ => scalalib}/web/6-cross-version-platform-publishing/foo/qux/src/Qux.scala (100%) rename example/{ => scalalib}/web/6-cross-version-platform-publishing/foo/qux/test/src/QuxTests.scala (100%) rename example/{ => scalalib}/web/7-cross-platform-version-publishing/bar/src-2/BarVersionSpecific.scala (100%) rename example/{ => scalalib}/web/7-cross-platform-version-publishing/bar/src-3/BarVersionSpecific.scala (100%) rename example/{ => scalalib}/web/7-cross-platform-version-publishing/bar/src/Bar.scala (100%) rename example/{ => scalalib}/web/7-cross-platform-version-publishing/bar/test/src/BarTests.scala (100%) rename example/{ => scalalib}/web/7-cross-platform-version-publishing/build.sc (100%) rename example/{ => scalalib}/web/7-cross-platform-version-publishing/qux/src-js/QuxPlatformSpecific.scala (100%) rename example/{ => scalalib}/web/7-cross-platform-version-publishing/qux/src-jvm/QuxPlatformSpecific.scala (100%) rename example/{ => scalalib}/web/7-cross-platform-version-publishing/qux/src/Qux.scala (100%) rename example/{ => scalalib}/web/7-cross-platform-version-publishing/qux/test/src/QuxTests.scala (100%) delete mode 100644 example/thirdparty/acyclic/build.sc delete mode 100644 example/thirdparty/commons-io/build.sc delete mode 100644 example/thirdparty/fansi/build.sc delete mode 100644 example/thirdparty/jimfs/build.sc delete mode 100644 example/thirdparty/mockito/build.sc delete mode 100644 example/thirdparty/netty/build.sc diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index c15cb8cb62e..75b5eda432b 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -74,13 +74,17 @@ jobs: # Group these tests together to try and balance out the runtimes of each job # Just running in `local` mode since they shouldn't depend on the mode - java-version: 17 - millargs: "'example.{basic,scalabuilds,scalamodule,scalatesting,web}[_].local.test'" + millargs: "'example.javalib.__.local.test'" - java-version: 17 - millargs: "'example.{basicjava,javabuilds,javamodule,javatesting,javaweb}[_].local.test'" + millargs: "'example.scalalib.__.local.test'" - java-version: 11 millargs: "'example.thirdparty[{mockito,acyclic,commons-io}].local.test'" - java-version: 17 millargs: "'example.thirdparty[{fansi,jimfs,netty}].local.test'" + - java-version: 11 + millargs: "'example.depth.__.local.test'" + - java-version: 17 + millargs: "'example.extending.__.local.test'" # Most of these integration tests should not depend on which mode they # are run in, so just run them in `local` @@ -144,7 +148,7 @@ jobs: - java-version: 17 millargs: '"scalajslib.__.test"' - java-version: 11 - millargs: '"example.basic[_].local.test"' + millargs: '"example.scalalib.basic.__.local.test"' - java-version: 17 millargs: "'integration.feature[_].fork.test'" - java-version: 11 diff --git a/build.sc b/build.sc index 332bca61392..1e2eab81027 100644 --- a/build.sc +++ b/build.sc @@ -4,6 +4,7 @@ import com.github.lolgab.mill.mima.Mima import coursier.maven.MavenRepository import de.tobiasroeser.mill.vcs.version.VcsVersion import com.goyeau.mill.scalafix.ScalafixModule +import example.millSourcePath import mill._ import mill.api.JarManifest import mill.define.NamedTask @@ -1201,30 +1202,45 @@ trait IntegrationTestCrossModule extends IntegrationTestModule with Cross.Module def listIn(path: os.Path) = interp.watchValue(os.list(path).map(_.last)) object example extends Module { - def exampleModules: Seq[ExampleCrossModule] = - millInternal.modules.collect { case m: ExampleCrossModule => m } - - object basic extends Cross[ExampleCrossModule](listIn(millSourcePath / "basic")) - object basicjava extends Cross[ExampleCrossModuleJava](listIn(millSourcePath / "basicjava")) - object scalabuilds extends Cross[ExampleCrossModule](listIn(millSourcePath / "scalabuilds")) - object scalatesting extends Cross[ExampleCrossModule](listIn(millSourcePath / "scalatesting")) - object javabuilds extends Cross[ExampleCrossModuleJava](listIn(millSourcePath / "javabuilds")) - object javatesting extends Cross[ExampleCrossModuleJava](listIn(millSourcePath / "javatesting")) - object scalamodule extends Cross[ExampleCrossModule](listIn(millSourcePath / "scalamodule")) - object javamodule extends Cross[ExampleCrossModuleJava](listIn(millSourcePath / "javamodule")) - object tasks extends Cross[ExampleCrossModule](listIn(millSourcePath / "tasks")) - object cross extends Cross[ExampleCrossModule](listIn(millSourcePath / "cross")) - object misc extends Cross[ExampleCrossModule](listIn(millSourcePath / "misc")) - object web extends Cross[ExampleCrossModule](listIn(millSourcePath / "web")) - object javaweb extends Cross[ExampleCrossModule](listIn(millSourcePath / "javaweb")) + def exampleModules: Seq[ExampleCrossModule] = millInternal + .modules + .collect { case m: ExampleCrossModule => m } + + + object javalib extends Module{ + object basic extends Cross[ExampleCrossModuleJava](listIn(millSourcePath / "basic")) + object builds extends Cross[ExampleCrossModuleJava](listIn(millSourcePath / "builds")) + object testing extends Cross[ExampleCrossModuleJava](listIn(millSourcePath / "testing")) + object module extends Cross[ExampleCrossModuleJava](listIn(millSourcePath / "module")) + object web extends Cross[ExampleCrossModule](listIn(millSourcePath / "web")) + } + object scalalib extends Module{ + object basic extends Cross[ExampleCrossModule](listIn(millSourcePath / "basic")) + object builds extends Cross[ExampleCrossModule](listIn(millSourcePath / "builds")) + object testing extends Cross[ExampleCrossModule](listIn(millSourcePath / "testing")) + object module extends Cross[ExampleCrossModule](listIn(millSourcePath / "module")) + object web extends Cross[ExampleCrossModule](listIn(millSourcePath / "web")) + } + + object depth extends Module{ + object tasks extends Cross[ExampleCrossModule](listIn(millSourcePath / "tasks")) + object cross extends Cross[ExampleCrossModule](listIn(millSourcePath / "cross")) + } + + object extending extends Module{ + object imports extends Cross[ExampleCrossModule](listIn(millSourcePath / "imports")) + object metabuild extends Cross[ExampleCrossModule](listIn(millSourcePath / "metabuild")) + object plugins extends Cross[ExampleCrossModule](listIn(millSourcePath / "plugins")) + } trait ExampleCrossModuleJava extends ExampleCrossModule { def upstreamCross(s: String) = s match { - case "basicjava" => basic - case "javabuilds" => scalabuilds - case "javamodule" => scalamodule - case "javatesting" => scalatesting + case "basic" => scalalib.basic + case "builds" => scalalib.builds + case "module" => scalalib.module + case "testing" => scalalib.testing + case "web" => scalalib.web } def testRepoRoot = T{ os.copy.over(super.testRepoRoot().path, T.dest) @@ -1268,6 +1284,7 @@ object example extends Module { } } } + trait ExampleCrossModule extends IntegrationTestCrossModule { // disable scalafix because these example modules don't have sources causing it to misbehave def fix(args: String*): Command[Unit] = T.command {} @@ -1530,7 +1547,7 @@ object dev extends MillPublishScalaModule { def moduleDeps = Seq(runner, idea) def testTransitiveDeps = super.testTransitiveDeps() ++ Seq( - dist.testDep(), + (s"com.lihaoyi-${dist.artifactId()}", rawAssembly().path.toString), runner.linenumbers.testDep(), scalalib.backgroundwrapper.testDep(), contrib.bloop.testDep(), @@ -1738,6 +1755,7 @@ object docs extends Module { } )() + pprint.log(renderedExamples.map(_._1),height=9999) for ((name, pref) <- renderedExamples) os.copy( pref.path, pagesWd / "example" / os.SubPath(s"$name.adoc"), diff --git a/docs/modules/ROOT/pages/Contrib_Plugins.adoc b/docs/modules/ROOT/pages/Contrib_Plugins.adoc index 68b20476f47..653e7739d8e 100644 --- a/docs/modules/ROOT/pages/Contrib_Plugins.adoc +++ b/docs/modules/ROOT/pages/Contrib_Plugins.adoc @@ -52,4 +52,4 @@ import $ivy.`com.lihaoyi::mill-contrib-bloop:` == Importing Contrib Modules -include::example/misc/6-contrib-import.adoc[] +include::example/extending/imports/6-contrib-import.adoc[] diff --git a/docs/modules/ROOT/pages/Cross_Builds.adoc b/docs/modules/ROOT/pages/Cross_Builds.adoc index 6fe65afefad..12d261af025 100644 --- a/docs/modules/ROOT/pages/Cross_Builds.adoc +++ b/docs/modules/ROOT/pages/Cross_Builds.adoc @@ -8,44 +8,44 @@ config and building it across a variety of source folders. == Simple Cross Modules -include::example/cross/1-simple.adoc[] +include::example/depth/cross/1-simple.adoc[] == Default Cross Modules -include::example/cross/11-default-cross-module.adoc[] +include::example/depth/cross/11-default-cross-module.adoc[] == Cross Modules Source Paths -include::example/cross/2-cross-source-path.adoc[] +include::example/depth/cross/2-cross-source-path.adoc[] == Using Cross Modules from Outside Targets -include::example/cross/3-outside-dependency.adoc[] +include::example/depth/cross/3-outside-dependency.adoc[] == Using Cross Modules from other Cross Modules -include::example/cross/4-cross-dependencies.adoc[] +include::example/depth/cross/4-cross-dependencies.adoc[] == Multiple Cross Axes -include::example/cross/5-multiple-cross-axes.adoc[] +include::example/depth/cross/5-multiple-cross-axes.adoc[] == Extending Cross Modules -include::example/cross/6-axes-extension.adoc[] +include::example/depth/cross/6-axes-extension.adoc[] == Inner Cross Modules -include::example/cross/7-inner-cross-module.adoc[] +include::example/depth/cross/7-inner-cross-module.adoc[] == Cross Resolvers -include::example/cross/8-resolvers.adoc[] +include::example/depth/cross/8-resolvers.adoc[] == Dynamic Cross Modules -include::example/cross/9-dynamic-cross-modules.adoc[] +include::example/depth/cross/9-dynamic-cross-modules.adoc[] == Use Case: Static Blog -include::example/cross/10-static-blog.adoc[] +include::example/depth/cross/10-static-blog.adoc[] diff --git a/docs/modules/ROOT/pages/Import_File_And_Import_Ivy.adoc b/docs/modules/ROOT/pages/Import_File_And_Import_Ivy.adoc index f1f373b9ede..5eabea52e84 100644 --- a/docs/modules/ROOT/pages/Import_File_And_Import_Ivy.adoc +++ b/docs/modules/ROOT/pages/Import_File_And_Import_Ivy.adoc @@ -1,4 +1,4 @@ = import $file and import $ivy -include::example/misc/3-import-file-ivy.adoc[] +include::example/extending/imports/3-import-file-ivy.adoc[] diff --git a/docs/modules/ROOT/pages/Java_Build_Examples.adoc b/docs/modules/ROOT/pages/Java_Build_Examples.adoc index 2ec46d9e02c..88d48316d05 100644 --- a/docs/modules/ROOT/pages/Java_Build_Examples.adoc +++ b/docs/modules/ROOT/pages/Java_Build_Examples.adoc @@ -23,33 +23,33 @@ Many of the APIs covered here are listed in the API documentation: == Common Configuration Overrides -include::example/javabuilds/1-common-config.adoc[] +include::example/javalib/builds/1-common-config.adoc[] == Custom Tasks -include::example/javabuilds/2-custom-tasks.adoc[] +include::example/javalib/builds/2-custom-tasks.adoc[] == Overriding Tasks -include::example/javabuilds/3-override-tasks.adoc[] +include::example/javalib/builds/3-override-tasks.adoc[] == Nesting Modules -include::example/javabuilds/4-nested-modules.adoc[] +include::example/javalib/builds/4-nested-modules.adoc[] == Publish Module -include::example/javabuilds/6-publish-module.adoc[] +include::example/javalib/builds/6-publish-module.adoc[] == Maven-Compatible Modules -include::example/javabuilds/8-compat-modules.adoc[] +include::example/javalib/builds/8-compat-modules.adoc[] == Realistic Java Example Project -include::example/javabuilds/9-realistic.adoc[] +include::example/javalib/builds/9-realistic.adoc[] == Example Builds for Real Projects diff --git a/docs/modules/ROOT/pages/Java_Builtin_Commands.adoc b/docs/modules/ROOT/pages/Java_Builtin_Commands.adoc index e60e3901759..58744430ae7 100644 --- a/docs/modules/ROOT/pages/Java_Builtin_Commands.adoc +++ b/docs/modules/ROOT/pages/Java_Builtin_Commands.adoc @@ -9,7 +9,7 @@ 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/basicjava/4-builtin-commands.adoc[] +include::example/javalib/basic/4-builtin-commands.adoc[] == visualize diff --git a/docs/modules/ROOT/pages/Java_Intro_to_Mill.adoc b/docs/modules/ROOT/pages/Java_Intro_to_Mill.adoc index 7ad784977cc..a8d8b63da33 100644 --- a/docs/modules/ROOT/pages/Java_Intro_to_Mill.adoc +++ b/docs/modules/ROOT/pages/Java_Intro_to_Mill.adoc @@ -92,14 +92,14 @@ include::partial$Intro_to_Mill_BlogVideo.adoc[] == Simple Java Module -include::example/basicjava/1-simple.adoc[] +include::example/javalib/basic/1-simple.adoc[] == Custom Build Logic -include::example/basicjava/2-custom-build-logic.adoc[] +include::example/javalib/basic/2-custom-build-logic.adoc[] == Multi-Module Project -include::example/basicjava/3-multi-module.adoc[] +include::example/javalib/basic/3-multi-module.adoc[] include::partial$Intro_to_Mill_Footer.adoc[] diff --git a/docs/modules/ROOT/pages/Java_Module_Config.adoc b/docs/modules/ROOT/pages/Java_Module_Config.adoc index d3ca590c740..f738f793134 100644 --- a/docs/modules/ROOT/pages/Java_Module_Config.adoc +++ b/docs/modules/ROOT/pages/Java_Module_Config.adoc @@ -16,47 +16,47 @@ Many of the APIs covered here are listed in the API documentation: == Compilation & Execution Flags -include::example/javamodule/1-compilation-execution-flags.adoc[] +include::example/javalib/module/1-compilation-execution-flags.adoc[] == Adding Ivy Dependencies -include::example/javamodule/2-ivy-deps.adoc[] +include::example/javalib/module/2-ivy-deps.adoc[] == Runtime and Compile-time Dependencies -include::example/javamodule/3-run-compile-deps.adoc[] +include::example/javalib/module/3-run-compile-deps.adoc[] == Classpath and Filesystem Resources -include::example/javamodule/5-resources.adoc[] +include::example/javalib/module/5-resources.adoc[] == Annotation Processors -include::example/javamodule/6-annotation-processors.adoc[] +include::example/javalib/module/6-annotation-processors.adoc[] == Javadoc Config -include::example/javamodule/7-docjar.adoc[] +include::example/javalib/module/7-docjar.adoc[] == Unmanaged Jars -include::example/javamodule/8-unmanaged-jars.adoc[] +include::example/javalib/module/8-unmanaged-jars.adoc[] == Specifying the Main Class -include::example/javamodule/9-main-class.adoc[] +include::example/javalib/module/9-main-class.adoc[] == Downloading Non-Maven Jars -include::example/javamodule/10-downloading-non-maven-jars.adoc[] +include::example/javalib/module/10-downloading-non-maven-jars.adoc[] == Customizing the Assembly -include::example/javamodule/11-assembly-config.adoc[] +include::example/javalib/module/11-assembly-config.adoc[] == Repository Config -include::example/javamodule/12-repository-config.adoc[] +include::example/javalib/module/12-repository-config.adoc[] === Maven Central: Blocked! @@ -86,5 +86,5 @@ If you are using millw, a more permanent solution could be to set the environmen == Native C Code with JNI -include::example/javamodule/13-jni.adoc[] +include::example/javalib/module/13-jni.adoc[] diff --git a/docs/modules/ROOT/pages/Java_Web_Examples.adoc b/docs/modules/ROOT/pages/Java_Web_Examples.adoc index eaa4ed817d3..8125e5279e4 100644 --- a/docs/modules/ROOT/pages/Java_Web_Examples.adoc +++ b/docs/modules/ROOT/pages/Java_Web_Examples.adoc @@ -11,21 +11,21 @@ It covers setting up a basic backend server with a variety of server frameworks == Jetty Hello World App -include::example/javaweb/1-hello-jetty.adoc[] +include::example/javalib/web/1-hello-jetty.adoc[] == Spring Boot Hello World App -include::example/javaweb/2-hello-spring-boot.adoc[] +include::example/javalib/web/2-hello-spring-boot.adoc[] == Spring Boot TodoMvc App -include::example/javaweb/3-todo-spring-boot.adoc[] +include::example/javalib/web/3-todo-spring-boot.adoc[] == Micronaut Hello World App -include::example/javaweb/4-hello-micronaut.adoc[] +include::example/javalib/web/4-hello-micronaut.adoc[] == Micronaut TodoMvc App -include::example/javaweb/5-todo-micronaut.adoc[] \ No newline at end of file +include::example/javalib/web/5-todo-micronaut.adoc[] \ No newline at end of file diff --git a/docs/modules/ROOT/pages/Modules.adoc b/docs/modules/ROOT/pages/Modules.adoc index a3807626dec..ba2636ed247 100644 --- a/docs/modules/ROOT/pages/Modules.adoc +++ b/docs/modules/ROOT/pages/Modules.adoc @@ -12,15 +12,15 @@ Mill's comes with built in modules such as `mill.scalalib.ScalaModule` and `mill.scalalib.CrossSbtModule`, but you can also define your own modules to do things that are not built-in to Mill. -include::example/tasks/7-modules.adoc[] +include::example/depth/tasks/7-modules.adoc[] == Use Case: DIY Java Modules -include::example/tasks/8-diy-java-modules.adoc[] +include::example/depth/tasks/8-diy-java-modules.adoc[] == Backticked Names -include::example/tasks/9-backticked-names.adoc[] +include::example/depth/tasks/9-backticked-names.adoc[] == External Modules @@ -61,6 +61,6 @@ needing to define your own `T.command` in your `build.sc` file == Nested `module.sc` files -include::example/tasks/10-module-sc.adoc[] +include::example/depth/tasks/10-module-sc.adoc[] diff --git a/docs/modules/ROOT/pages/Scala_Build_Examples.adoc b/docs/modules/ROOT/pages/Scala_Build_Examples.adoc index 04f7ff2dd5f..ba972d70809 100644 --- a/docs/modules/ROOT/pages/Scala_Build_Examples.adoc +++ b/docs/modules/ROOT/pages/Scala_Build_Examples.adoc @@ -26,36 +26,36 @@ Many of the APIs covered here are listed in the Scaladoc: == Common Configuration Overrides -include::example/scalabuilds/1-common-config.adoc[] +include::example/scalalib/builds/1-common-config.adoc[] == Custom Tasks -include::example/scalabuilds/2-custom-tasks.adoc[] +include::example/scalalib/builds/2-custom-tasks.adoc[] == Overriding Tasks -include::example/scalabuilds/3-override-tasks.adoc[] +include::example/scalalib/builds/3-override-tasks.adoc[] == Nesting Modules -include::example/scalabuilds/4-nested-modules.adoc[] +include::example/scalalib/builds/4-nested-modules.adoc[] == Publish Module -include::example/scalabuilds/6-publish-module.adoc[] +include::example/scalalib/builds/6-publish-module.adoc[] == Cross-Scala-Version Modules -include::example/scalabuilds/7-cross-scala-version.adoc[] +include::example/scalalib/builds/7-cross-scala-version.adoc[] == SBT-Compatible Modules -include::example/scalabuilds/8-compat-modules.adoc[] +include::example/scalalib/builds/8-compat-modules.adoc[] == Realistic Scala Example Project -include::example/scalabuilds/9-realistic.adoc[] +include::example/scalalib/builds/9-realistic.adoc[] == Example Builds for Real Projects diff --git a/docs/modules/ROOT/pages/Scala_Builtin_Commands.adoc b/docs/modules/ROOT/pages/Scala_Builtin_Commands.adoc index 4793fcc719d..1db91b269fd 100644 --- a/docs/modules/ROOT/pages/Scala_Builtin_Commands.adoc +++ b/docs/modules/ROOT/pages/Scala_Builtin_Commands.adoc @@ -11,7 +11,7 @@ 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[] +include::example/scalalib/basic/4-builtin-commands.adoc[] == init diff --git a/docs/modules/ROOT/pages/Scala_Intro_to_Mill.adoc b/docs/modules/ROOT/pages/Scala_Intro_to_Mill.adoc index cfef2da3c49..03428323f24 100644 --- a/docs/modules/ROOT/pages/Scala_Intro_to_Mill.adoc +++ b/docs/modules/ROOT/pages/Scala_Intro_to_Mill.adoc @@ -72,14 +72,14 @@ using Mill and its supporting libraries to the fullest: == Simple Scala Module -include::example/basic/1-simple.adoc[] +include::example/scalalib/basic/1-simple.adoc[] == Custom Build Logic -include::example/basic/2-custom-build-logic.adoc[] +include::example/scalalib/basic/2-custom-build-logic.adoc[] == Multi-Module Project -include::example/basic/3-multi-module.adoc[] +include::example/scalalib/basic/3-multi-module.adoc[] include::partial$Intro_to_Mill_Footer.adoc[] diff --git a/docs/modules/ROOT/pages/Scala_Module_Config.adoc b/docs/modules/ROOT/pages/Scala_Module_Config.adoc index 20ce5a9f6bf..0cf21148a7c 100644 --- a/docs/modules/ROOT/pages/Scala_Module_Config.adoc +++ b/docs/modules/ROOT/pages/Scala_Module_Config.adoc @@ -18,47 +18,47 @@ Many of the APIs covered here are listed in the Scaladoc: == Compilation & Execution Flags -include::example/scalamodule/1-compilation-execution-flags.adoc[] +include::example/scalalib/module/1-compilation-execution-flags.adoc[] == Adding Ivy Dependencies -include::example/scalamodule/2-ivy-deps.adoc[] +include::example/scalalib/module/2-ivy-deps.adoc[] == Runtime and Compile-time Dependencies -include::example/scalamodule/3-run-compile-deps.adoc[] +include::example/scalalib/module/3-run-compile-deps.adoc[] == Classpath and Filesystem Resources -include::example/scalamodule/5-resources.adoc[] +include::example/scalalib/module/5-resources.adoc[] == Scala Compiler Plugins -include::example/scalamodule/6-scala-compiler-plugins.adoc[] +include::example/scalalib/module/6-scala-compiler-plugins.adoc[] == Scaladoc Config -include::example/scalamodule/7-docjar.adoc[] +include::example/scalalib/module/7-docjar.adoc[] == Unmanaged Jars -include::example/scalamodule/8-unmanaged-jars.adoc[] +include::example/scalalib/module/8-unmanaged-jars.adoc[] == Specifying the Main Class -include::example/scalamodule/9-main-class.adoc[] +include::example/scalalib/module/9-main-class.adoc[] == Downloading Non-Maven Jars -include::example/scalamodule/10-downloading-non-maven-jars.adoc[] +include::example/scalalib/module/10-downloading-non-maven-jars.adoc[] == Customizing the Assembly -include::example/scalamodule/11-assembly-config.adoc[] +include::example/scalalib/module/11-assembly-config.adoc[] == Repository Config -include::example/scalamodule/12-repository-config.adoc[] +include::example/scalalib/module/12-repository-config.adoc[] == Maven Central: Blocked! @@ -86,11 +86,11 @@ If you are using millw, a more permanent solution could be to set the environmen == Scoverage -include::example/scalamodule/13-contrib-scoverage.adoc[] +include::example/scalalib/module/13-contrib-scoverage.adoc[] == Unidoc -include::example/scalamodule/14-unidoc.adoc[] +include::example/scalalib/module/14-unidoc.adoc[] == Reformatting your code diff --git a/docs/modules/ROOT/pages/Scala_Web_Examples.adoc b/docs/modules/ROOT/pages/Scala_Web_Examples.adoc index f602b9b6107..f329e53c3d8 100644 --- a/docs/modules/ROOT/pages/Scala_Web_Examples.adoc +++ b/docs/modules/ROOT/pages/Scala_Web_Examples.adoc @@ -15,28 +15,28 @@ integrated with your backend Scala-JVM web server. == TodoMVC Web App -include::example/web/1-todo-webapp.adoc[] +include::example/scalalib/web/1-todo-webapp.adoc[] == Webapp Cache Busting -include::example/web/2-webapp-cache-busting.adoc[] +include::example/scalalib/web/2-webapp-cache-busting.adoc[] == Scala.js Modules -include::example/web/3-scalajs-module.adoc[] +include::example/scalalib/web/3-scalajs-module.adoc[] == Scala.js Webserver Integration -include::example/web/4-webapp-scalajs.adoc[] +include::example/scalalib/web/4-webapp-scalajs.adoc[] == Scala.js/Scala-JVM Code Sharing -include::example/web/5-webapp-scalajs-shared.adoc[] +include::example/scalalib/web/5-webapp-scalajs-shared.adoc[] == Publishing Cross-Platform Scala Modules -include::example/web/6-cross-version-platform-publishing.adoc[] +include::example/scalalib/web/6-cross-version-platform-publishing.adoc[] == Publishing Cross-Platform Scala Modules Alternative -include::example/web/7-cross-platform-version-publishing.adoc[] \ No newline at end of file +include::example/scalalib/web/7-cross-platform-version-publishing.adoc[] \ No newline at end of file diff --git a/docs/modules/ROOT/pages/Tasks.adoc b/docs/modules/ROOT/pages/Tasks.adoc index c1b4898b5b6..b1416790804 100644 --- a/docs/modules/ROOT/pages/Tasks.adoc +++ b/docs/modules/ROOT/pages/Tasks.adoc @@ -26,29 +26,29 @@ different Task types: |Cached In-Memory | | | | | |X |=== -include::example/tasks/1-task-graph.adoc[] +include::example/depth/tasks/1-task-graph.adoc[] [#primitive-tasks] == Primary Tasks -include::example/tasks/2-primary-tasks.adoc[] +include::example/depth/tasks/2-primary-tasks.adoc[] == Other Tasks === Anonymous Tasks -include::example/tasks/3-anonymous-tasks.adoc[] +include::example/depth/tasks/3-anonymous-tasks.adoc[] === Inputs -include::example/tasks/4-inputs.adoc[] +include::example/depth/tasks/4-inputs.adoc[] === Persistent Targets -include::example/tasks/5-persistent-targets.adoc[] +include::example/depth/tasks/5-persistent-targets.adoc[] === Workers -include::example/tasks/6-workers.adoc[] +include::example/depth/tasks/6-workers.adoc[] === Evaluator Commands (experimental) @@ -82,4 +82,4 @@ tasks and outputs, you do so with your own evaluator command. === Using ScalaModule.run as a task -include::example/tasks/11-module-run-task.adoc[] +include::example/depth/tasks/11-module-run-task.adoc[] diff --git a/docs/modules/ROOT/pages/Testing_Java_Projects.adoc b/docs/modules/ROOT/pages/Testing_Java_Projects.adoc index 23d0b05e838..7ccf2cb4abc 100644 --- a/docs/modules/ROOT/pages/Testing_Java_Projects.adoc +++ b/docs/modules/ROOT/pages/Testing_Java_Projects.adoc @@ -10,13 +10,13 @@ This page will discuss common topics around working with test suites using the M == Defining Unit Test Suites -include::example/javatesting/1-test-suite.adoc[] +include::example/javalib/testing/1-test-suite.adoc[] == Test Dependencies -include::example/javatesting/2-test-deps.adoc[] +include::example/javalib/testing/2-test-deps.adoc[] == Defining Integration Test Suites -include::example/javatesting/3-integration-suite.adoc[] \ No newline at end of file +include::example/javalib/testing/3-integration-suite.adoc[] \ No newline at end of file diff --git a/docs/modules/ROOT/pages/Testing_Scala_Projects.adoc b/docs/modules/ROOT/pages/Testing_Scala_Projects.adoc index 9443495ecee..23736381791 100644 --- a/docs/modules/ROOT/pages/Testing_Scala_Projects.adoc +++ b/docs/modules/ROOT/pages/Testing_Scala_Projects.adoc @@ -10,13 +10,13 @@ This page will discuss common topics around working with test suites using the M == Defining Unit Test Suites -include::example/scalatesting/1-test-suite.adoc[] +include::example/scalalib/testing/1-test-suite.adoc[] == Test Dependencies -include::example/scalatesting/2-test-deps.adoc[] +include::example/scalalib/testing/2-test-deps.adoc[] == Defining Integration Test Suites -include::example/scalatesting/3-integration-suite.adoc[] \ No newline at end of file +include::example/scalalib/testing/3-integration-suite.adoc[] \ No newline at end of file diff --git a/docs/modules/ROOT/pages/The_Mill_Meta_Build.adoc b/docs/modules/ROOT/pages/The_Mill_Meta_Build.adoc index ec2df9a995e..e939694ef75 100644 --- a/docs/modules/ROOT/pages/The_Mill_Meta_Build.adoc +++ b/docs/modules/ROOT/pages/The_Mill_Meta_Build.adoc @@ -41,8 +41,8 @@ de.tototec:de.tobiasroeser.mill.vcs.version_mill0.11_2.13 : 0.3.1-> 0.4.0 == Sharing Libraries between `build.sc` and Application Code -include::example/misc/4-meta-build.adoc[] +include::example/extending/metabuild/4-meta-build.adoc[] == Sharing Source Code between `build.sc` and Application Code -include::example/misc/5-meta-shared-sources.adoc[] \ No newline at end of file +include::example/extending/metabuild/5-meta-shared-sources.adoc[] \ No newline at end of file diff --git a/docs/modules/ROOT/pages/Writing_Mill_Plugins.adoc b/docs/modules/ROOT/pages/Writing_Mill_Plugins.adoc index 6dcae256b25..2b899470ddc 100644 --- a/docs/modules/ROOT/pages/Writing_Mill_Plugins.adoc +++ b/docs/modules/ROOT/pages/Writing_Mill_Plugins.adoc @@ -1,3 +1,3 @@ = Writing Mill Plugins -include::example/misc/7-writing-mill-plugins.adoc[] \ No newline at end of file +include::example/extending/plugins/7-writing-mill-plugins.adoc[] \ No newline at end of file diff --git a/example/cross/1-simple/build.sc b/example/depth/cross/1-simple/build.sc similarity index 100% rename from example/cross/1-simple/build.sc rename to example/depth/cross/1-simple/build.sc diff --git a/example/cross/10-static-blog/build.sc b/example/depth/cross/10-static-blog/build.sc similarity index 100% rename from example/cross/10-static-blog/build.sc rename to example/depth/cross/10-static-blog/build.sc diff --git a/example/cross/10-static-blog/post/1-My-First-Post.md b/example/depth/cross/10-static-blog/post/1-My-First-Post.md similarity index 100% rename from example/cross/10-static-blog/post/1-My-First-Post.md rename to example/depth/cross/10-static-blog/post/1-My-First-Post.md diff --git a/example/cross/10-static-blog/post/2-My-Second-Post.md b/example/depth/cross/10-static-blog/post/2-My-Second-Post.md similarity index 100% rename from example/cross/10-static-blog/post/2-My-Second-Post.md rename to example/depth/cross/10-static-blog/post/2-My-Second-Post.md diff --git a/example/cross/10-static-blog/post/3-My-Third-Post.md b/example/depth/cross/10-static-blog/post/3-My-Third-Post.md similarity index 100% rename from example/cross/10-static-blog/post/3-My-Third-Post.md rename to example/depth/cross/10-static-blog/post/3-My-Third-Post.md diff --git a/example/cross/11-default-cross-module/build.sc b/example/depth/cross/11-default-cross-module/build.sc similarity index 100% rename from example/cross/11-default-cross-module/build.sc rename to example/depth/cross/11-default-cross-module/build.sc diff --git a/example/cross/2-cross-source-path/build.sc b/example/depth/cross/2-cross-source-path/build.sc similarity index 100% rename from example/cross/2-cross-source-path/build.sc rename to example/depth/cross/2-cross-source-path/build.sc diff --git a/example/cross/3-outside-dependency/build.sc b/example/depth/cross/3-outside-dependency/build.sc similarity index 100% rename from example/cross/3-outside-dependency/build.sc rename to example/depth/cross/3-outside-dependency/build.sc diff --git a/example/cross/4-cross-dependencies/build.sc b/example/depth/cross/4-cross-dependencies/build.sc similarity index 100% rename from example/cross/4-cross-dependencies/build.sc rename to example/depth/cross/4-cross-dependencies/build.sc diff --git a/example/cross/5-multiple-cross-axes/build.sc b/example/depth/cross/5-multiple-cross-axes/build.sc similarity index 100% rename from example/cross/5-multiple-cross-axes/build.sc rename to example/depth/cross/5-multiple-cross-axes/build.sc diff --git a/example/cross/6-axes-extension/build.sc b/example/depth/cross/6-axes-extension/build.sc similarity index 100% rename from example/cross/6-axes-extension/build.sc rename to example/depth/cross/6-axes-extension/build.sc diff --git a/example/cross/7-inner-cross-module/build.sc b/example/depth/cross/7-inner-cross-module/build.sc similarity index 100% rename from example/cross/7-inner-cross-module/build.sc rename to example/depth/cross/7-inner-cross-module/build.sc diff --git a/example/cross/8-resolvers/build.sc b/example/depth/cross/8-resolvers/build.sc similarity index 100% rename from example/cross/8-resolvers/build.sc rename to example/depth/cross/8-resolvers/build.sc diff --git a/example/cross/9-dynamic-cross-modules/build.sc b/example/depth/cross/9-dynamic-cross-modules/build.sc similarity index 100% rename from example/cross/9-dynamic-cross-modules/build.sc rename to example/depth/cross/9-dynamic-cross-modules/build.sc diff --git a/example/cross/9-dynamic-cross-modules/modules/bar/src/Example.scala b/example/depth/cross/9-dynamic-cross-modules/modules/bar/src/Example.scala similarity index 100% rename from example/cross/9-dynamic-cross-modules/modules/bar/src/Example.scala rename to example/depth/cross/9-dynamic-cross-modules/modules/bar/src/Example.scala diff --git a/example/cross/9-dynamic-cross-modules/modules/foo/src/Example.scala b/example/depth/cross/9-dynamic-cross-modules/modules/foo/src/Example.scala similarity index 100% rename from example/cross/9-dynamic-cross-modules/modules/foo/src/Example.scala rename to example/depth/cross/9-dynamic-cross-modules/modules/foo/src/Example.scala diff --git a/example/cross/9-dynamic-cross-modules/modules/qux/src/Example.scala b/example/depth/cross/9-dynamic-cross-modules/modules/qux/src/Example.scala similarity index 100% rename from example/cross/9-dynamic-cross-modules/modules/qux/src/Example.scala rename to example/depth/cross/9-dynamic-cross-modules/modules/qux/src/Example.scala diff --git a/example/tasks/1-task-graph/build.sc b/example/depth/tasks/1-task-graph/build.sc similarity index 100% rename from example/tasks/1-task-graph/build.sc rename to example/depth/tasks/1-task-graph/build.sc diff --git a/example/tasks/1-task-graph/resources/foo.txt b/example/depth/tasks/1-task-graph/resources/foo.txt similarity index 100% rename from example/tasks/1-task-graph/resources/foo.txt rename to example/depth/tasks/1-task-graph/resources/foo.txt diff --git a/example/tasks/1-task-graph/src/Foo.java b/example/depth/tasks/1-task-graph/src/Foo.java similarity index 100% rename from example/tasks/1-task-graph/src/Foo.java rename to example/depth/tasks/1-task-graph/src/Foo.java diff --git a/example/tasks/10-module-sc/bar/module.sc b/example/depth/tasks/10-module-sc/bar/module.sc similarity index 100% rename from example/tasks/10-module-sc/bar/module.sc rename to example/depth/tasks/10-module-sc/bar/module.sc diff --git a/example/tasks/10-module-sc/bar/qux/module.sc b/example/depth/tasks/10-module-sc/bar/qux/module.sc similarity index 100% rename from example/tasks/10-module-sc/bar/qux/module.sc rename to example/depth/tasks/10-module-sc/bar/qux/module.sc diff --git a/example/tasks/10-module-sc/bar/qux/module/src/BarQux.scala b/example/depth/tasks/10-module-sc/bar/qux/module/src/BarQux.scala similarity index 100% rename from example/tasks/10-module-sc/bar/qux/module/src/BarQux.scala rename to example/depth/tasks/10-module-sc/bar/qux/module/src/BarQux.scala diff --git a/example/tasks/10-module-sc/build.sc b/example/depth/tasks/10-module-sc/build.sc similarity index 100% rename from example/tasks/10-module-sc/build.sc rename to example/depth/tasks/10-module-sc/build.sc diff --git a/example/tasks/10-module-sc/foo/module.sc b/example/depth/tasks/10-module-sc/foo/module.sc similarity index 100% rename from example/tasks/10-module-sc/foo/module.sc rename to example/depth/tasks/10-module-sc/foo/module.sc diff --git a/example/tasks/10-module-sc/foo/src/Foo.scala b/example/depth/tasks/10-module-sc/foo/src/Foo.scala similarity index 100% rename from example/tasks/10-module-sc/foo/src/Foo.scala rename to example/depth/tasks/10-module-sc/foo/src/Foo.scala diff --git a/example/tasks/11-module-run-task/bar/src/Bar.scala b/example/depth/tasks/11-module-run-task/bar/src/Bar.scala similarity index 100% rename from example/tasks/11-module-run-task/bar/src/Bar.scala rename to example/depth/tasks/11-module-run-task/bar/src/Bar.scala diff --git a/example/tasks/11-module-run-task/build.sc b/example/depth/tasks/11-module-run-task/build.sc similarity index 100% rename from example/tasks/11-module-run-task/build.sc rename to example/depth/tasks/11-module-run-task/build.sc diff --git a/example/tasks/11-module-run-task/foo/src/Foo.scala b/example/depth/tasks/11-module-run-task/foo/src/Foo.scala similarity index 100% rename from example/tasks/11-module-run-task/foo/src/Foo.scala rename to example/depth/tasks/11-module-run-task/foo/src/Foo.scala diff --git a/example/tasks/2-primary-tasks/bar/src/file.txt b/example/depth/tasks/2-primary-tasks/bar/src/file.txt similarity index 100% rename from example/tasks/2-primary-tasks/bar/src/file.txt rename to example/depth/tasks/2-primary-tasks/bar/src/file.txt diff --git a/example/tasks/2-primary-tasks/bar/src2/file.txt b/example/depth/tasks/2-primary-tasks/bar/src2/file.txt similarity index 100% rename from example/tasks/2-primary-tasks/bar/src2/file.txt rename to example/depth/tasks/2-primary-tasks/bar/src2/file.txt diff --git a/example/tasks/2-primary-tasks/build.sc b/example/depth/tasks/2-primary-tasks/build.sc similarity index 100% rename from example/tasks/2-primary-tasks/build.sc rename to example/depth/tasks/2-primary-tasks/build.sc diff --git a/example/tasks/2-primary-tasks/resources/foo.txt b/example/depth/tasks/2-primary-tasks/resources/foo.txt similarity index 100% rename from example/tasks/2-primary-tasks/resources/foo.txt rename to example/depth/tasks/2-primary-tasks/resources/foo.txt diff --git a/example/tasks/2-primary-tasks/src/foo/Foo.java b/example/depth/tasks/2-primary-tasks/src/foo/Foo.java similarity index 100% rename from example/tasks/2-primary-tasks/src/foo/Foo.java rename to example/depth/tasks/2-primary-tasks/src/foo/Foo.java diff --git a/example/tasks/3-anonymous-tasks/build.sc b/example/depth/tasks/3-anonymous-tasks/build.sc similarity index 100% rename from example/tasks/3-anonymous-tasks/build.sc rename to example/depth/tasks/3-anonymous-tasks/build.sc diff --git a/example/tasks/3-anonymous-tasks/data/hello.txt b/example/depth/tasks/3-anonymous-tasks/data/hello.txt similarity index 100% rename from example/tasks/3-anonymous-tasks/data/hello.txt rename to example/depth/tasks/3-anonymous-tasks/data/hello.txt diff --git a/example/tasks/3-anonymous-tasks/data/world.txt b/example/depth/tasks/3-anonymous-tasks/data/world.txt similarity index 100% rename from example/tasks/3-anonymous-tasks/data/world.txt rename to example/depth/tasks/3-anonymous-tasks/data/world.txt diff --git a/example/tasks/4-inputs/build.sc b/example/depth/tasks/4-inputs/build.sc similarity index 100% rename from example/tasks/4-inputs/build.sc rename to example/depth/tasks/4-inputs/build.sc diff --git a/example/tasks/4-inputs/data/hello.txt b/example/depth/tasks/4-inputs/data/hello.txt similarity index 100% rename from example/tasks/4-inputs/data/hello.txt rename to example/depth/tasks/4-inputs/data/hello.txt diff --git a/example/tasks/4-inputs/data/world.txt b/example/depth/tasks/4-inputs/data/world.txt similarity index 100% rename from example/tasks/4-inputs/data/world.txt rename to example/depth/tasks/4-inputs/data/world.txt diff --git a/example/tasks/5-persistent-targets/build.sc b/example/depth/tasks/5-persistent-targets/build.sc similarity index 100% rename from example/tasks/5-persistent-targets/build.sc rename to example/depth/tasks/5-persistent-targets/build.sc diff --git a/example/tasks/5-persistent-targets/data/hello.txt b/example/depth/tasks/5-persistent-targets/data/hello.txt similarity index 100% rename from example/tasks/5-persistent-targets/data/hello.txt rename to example/depth/tasks/5-persistent-targets/data/hello.txt diff --git a/example/tasks/5-persistent-targets/data/world.txt b/example/depth/tasks/5-persistent-targets/data/world.txt similarity index 100% rename from example/tasks/5-persistent-targets/data/world.txt rename to example/depth/tasks/5-persistent-targets/data/world.txt diff --git a/example/tasks/6-workers/build.sc b/example/depth/tasks/6-workers/build.sc similarity index 100% rename from example/tasks/6-workers/build.sc rename to example/depth/tasks/6-workers/build.sc diff --git a/example/tasks/6-workers/data/hello.txt b/example/depth/tasks/6-workers/data/hello.txt similarity index 100% rename from example/tasks/6-workers/data/hello.txt rename to example/depth/tasks/6-workers/data/hello.txt diff --git a/example/tasks/6-workers/data/world.txt b/example/depth/tasks/6-workers/data/world.txt similarity index 100% rename from example/tasks/6-workers/data/world.txt rename to example/depth/tasks/6-workers/data/world.txt diff --git a/example/tasks/7-modules/build.sc b/example/depth/tasks/7-modules/build.sc similarity index 100% rename from example/tasks/7-modules/build.sc rename to example/depth/tasks/7-modules/build.sc diff --git a/example/tasks/7-modules/outer/inner/sources/inner-source.txt b/example/depth/tasks/7-modules/outer/inner/sources/inner-source.txt similarity index 100% rename from example/tasks/7-modules/outer/inner/sources/inner-source.txt rename to example/depth/tasks/7-modules/outer/inner/sources/inner-source.txt diff --git a/example/tasks/7-modules/outer/sources/outer-source.txt b/example/depth/tasks/7-modules/outer/sources/outer-source.txt similarity index 100% rename from example/tasks/7-modules/outer/sources/outer-source.txt rename to example/depth/tasks/7-modules/outer/sources/outer-source.txt diff --git a/example/tasks/7-modules/outer2/nested/inner/sources/inner-source.txt b/example/depth/tasks/7-modules/outer2/nested/inner/sources/inner-source.txt similarity index 100% rename from example/tasks/7-modules/outer2/nested/inner/sources/inner-source.txt rename to example/depth/tasks/7-modules/outer2/nested/inner/sources/inner-source.txt diff --git a/example/tasks/7-modules/outer2/nested/sources/outer-source.txt b/example/depth/tasks/7-modules/outer2/nested/sources/outer-source.txt similarity index 100% rename from example/tasks/7-modules/outer2/nested/sources/outer-source.txt rename to example/depth/tasks/7-modules/outer2/nested/sources/outer-source.txt diff --git a/example/tasks/8-diy-java-modules/build.sc b/example/depth/tasks/8-diy-java-modules/build.sc similarity index 100% rename from example/tasks/8-diy-java-modules/build.sc rename to example/depth/tasks/8-diy-java-modules/build.sc diff --git a/example/tasks/8-diy-java-modules/foo/bar/src/Bar.java b/example/depth/tasks/8-diy-java-modules/foo/bar/src/Bar.java similarity index 100% rename from example/tasks/8-diy-java-modules/foo/bar/src/Bar.java rename to example/depth/tasks/8-diy-java-modules/foo/bar/src/Bar.java diff --git a/example/tasks/8-diy-java-modules/foo/src/Foo.java b/example/depth/tasks/8-diy-java-modules/foo/src/Foo.java similarity index 100% rename from example/tasks/8-diy-java-modules/foo/src/Foo.java rename to example/depth/tasks/8-diy-java-modules/foo/src/Foo.java diff --git a/example/tasks/8-diy-java-modules/qux/src/Qux.java b/example/depth/tasks/8-diy-java-modules/qux/src/Qux.java similarity index 100% rename from example/tasks/8-diy-java-modules/qux/src/Qux.java rename to example/depth/tasks/8-diy-java-modules/qux/src/Qux.java diff --git a/example/tasks/9-backticked-names/build.sc b/example/depth/tasks/9-backticked-names/build.sc similarity index 100% rename from example/tasks/9-backticked-names/build.sc rename to example/depth/tasks/9-backticked-names/build.sc diff --git a/example/misc/3-import-file-ivy/build.sc b/example/extending/imports/3-import-file-ivy/build.sc similarity index 100% rename from example/misc/3-import-file-ivy/build.sc rename to example/extending/imports/3-import-file-ivy/build.sc diff --git a/example/misc/3-import-file-ivy/scalaversion.sc b/example/extending/imports/3-import-file-ivy/scalaversion.sc similarity index 100% rename from example/misc/3-import-file-ivy/scalaversion.sc rename to example/extending/imports/3-import-file-ivy/scalaversion.sc diff --git a/example/misc/3-import-file-ivy/src/Foo.scala b/example/extending/imports/3-import-file-ivy/src/Foo.scala similarity index 100% rename from example/misc/3-import-file-ivy/src/Foo.scala rename to example/extending/imports/3-import-file-ivy/src/Foo.scala diff --git a/example/misc/6-contrib-import/build.sc b/example/extending/imports/6-contrib-import/build.sc similarity index 100% rename from example/misc/6-contrib-import/build.sc rename to example/extending/imports/6-contrib-import/build.sc diff --git a/example/misc/6-contrib-import/foo/src/Foo.scala b/example/extending/imports/6-contrib-import/foo/src/Foo.scala similarity index 100% rename from example/misc/6-contrib-import/foo/src/Foo.scala rename to example/extending/imports/6-contrib-import/foo/src/Foo.scala diff --git a/example/misc/4-meta-build/build.sc b/example/extending/metabuild/4-meta-build/build.sc similarity index 100% rename from example/misc/4-meta-build/build.sc rename to example/extending/metabuild/4-meta-build/build.sc diff --git a/example/misc/4-meta-build/mill-build/build.sc b/example/extending/metabuild/4-meta-build/mill-build/build.sc similarity index 100% rename from example/misc/4-meta-build/mill-build/build.sc rename to example/extending/metabuild/4-meta-build/mill-build/build.sc diff --git a/example/misc/4-meta-build/src/Foo.scala b/example/extending/metabuild/4-meta-build/src/Foo.scala similarity index 100% rename from example/misc/4-meta-build/src/Foo.scala rename to example/extending/metabuild/4-meta-build/src/Foo.scala diff --git a/example/misc/5-meta-shared-sources/build.sc b/example/extending/metabuild/5-meta-shared-sources/build.sc similarity index 100% rename from example/misc/5-meta-shared-sources/build.sc rename to example/extending/metabuild/5-meta-shared-sources/build.sc diff --git a/example/misc/5-meta-shared-sources/mill-build/build.sc b/example/extending/metabuild/5-meta-shared-sources/mill-build/build.sc similarity index 100% rename from example/misc/5-meta-shared-sources/mill-build/build.sc rename to example/extending/metabuild/5-meta-shared-sources/mill-build/build.sc diff --git a/example/misc/5-meta-shared-sources/mill-build/src/ScalaVersion.scala b/example/extending/metabuild/5-meta-shared-sources/mill-build/src/ScalaVersion.scala similarity index 100% rename from example/misc/5-meta-shared-sources/mill-build/src/ScalaVersion.scala rename to example/extending/metabuild/5-meta-shared-sources/mill-build/src/ScalaVersion.scala diff --git a/example/misc/5-meta-shared-sources/src/Foo.scala b/example/extending/metabuild/5-meta-shared-sources/src/Foo.scala similarity index 100% rename from example/misc/5-meta-shared-sources/src/Foo.scala rename to example/extending/metabuild/5-meta-shared-sources/src/Foo.scala diff --git a/example/misc/7-writing-mill-plugins/build.sc b/example/extending/plugins/7-writing-mill-plugins/build.sc similarity index 99% rename from example/misc/7-writing-mill-plugins/build.sc rename to example/extending/plugins/7-writing-mill-plugins/build.sc index b0e65dc8bec..6fa43908270 100644 --- a/example/misc/7-writing-mill-plugins/build.sc +++ b/example/extending/plugins/7-writing-mill-plugins/build.sc @@ -80,9 +80,7 @@ compiling 1 Scala source... /** Usage > ./mill myplugin.test -+ myplugin.ExampleTests.example... + myplugin.IntegrationTests.integration... -+ myplugin.UnitTests.simple... ... */ diff --git a/example/misc/7-writing-mill-plugins/myplugin/src/LineCountJavaModule.scala b/example/extending/plugins/7-writing-mill-plugins/myplugin/src/LineCountJavaModule.scala similarity index 100% rename from example/misc/7-writing-mill-plugins/myplugin/src/LineCountJavaModule.scala rename to example/extending/plugins/7-writing-mill-plugins/myplugin/src/LineCountJavaModule.scala diff --git a/example/misc/7-writing-mill-plugins/myplugin/test/resources/example-test-project/build.sc b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/resources/example-test-project/build.sc similarity index 100% rename from example/misc/7-writing-mill-plugins/myplugin/test/resources/example-test-project/build.sc rename to example/extending/plugins/7-writing-mill-plugins/myplugin/test/resources/example-test-project/build.sc diff --git a/example/basicjava/2-custom-build-logic/src/foo/Foo.java b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/resources/example-test-project/src/foo/Foo.java similarity index 100% rename from example/basicjava/2-custom-build-logic/src/foo/Foo.java rename to example/extending/plugins/7-writing-mill-plugins/myplugin/test/resources/example-test-project/src/foo/Foo.java diff --git a/example/misc/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/build.sc b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/build.sc similarity index 100% rename from example/misc/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/build.sc rename to example/extending/plugins/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/build.sc diff --git a/example/misc/7-writing-mill-plugins/myplugin/test/resources/example-test-project/src/foo/Foo.java b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/src/foo/Foo.java similarity index 100% rename from example/misc/7-writing-mill-plugins/myplugin/test/resources/example-test-project/src/foo/Foo.java rename to example/extending/plugins/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/src/foo/Foo.java diff --git a/example/misc/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/src/foo/Foo.java b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/resources/unit-test-project/src/foo/Foo.java similarity index 100% rename from example/misc/7-writing-mill-plugins/myplugin/test/resources/integration-test-project/src/foo/Foo.java rename to example/extending/plugins/7-writing-mill-plugins/myplugin/test/resources/unit-test-project/src/foo/Foo.java diff --git a/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala new file mode 100644 index 00000000000..b08a6da489f --- /dev/null +++ b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala @@ -0,0 +1,17 @@ +//package myplugin +//import mill.testkit.ExampleTester +//import utest._ +// +//object ExampleTests extends TestSuite { +// +// def tests: Tests = Tests { +// test("example") { +// val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) +// ExampleTester.run( +// clientServerMode = true, +// workspaceSourcePath = resourceFolder / "example-test-project", +// millExecutable = os.Path(sys.env("MILL_EXECUTABLE_PATH")) +// ) +// } +// } +//} diff --git a/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala similarity index 96% rename from example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala rename to example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala index 652f5c8feae..06539d6051a 100644 --- a/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala +++ b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala @@ -7,6 +7,7 @@ object IntegrationTests extends TestSuite { def tests: Tests = Tests { test("integration") { + pprint.log(sys.env("MILL_EXECUTABLE_PATH")) val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) val tester = new IntegrationTester( clientServerMode = true, diff --git a/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala new file mode 100644 index 00000000000..660412b83f1 --- /dev/null +++ b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala @@ -0,0 +1,36 @@ +//package myplugin +// +//import mill.testkit.{TestBaseModule, UnitTester} +//import utest._ +// +//object UnitTests extends TestSuite { +// def tests: Tests = Tests { +// test("simple") { +// object build extends TestBaseModule with LineCountJavaModule{ +// def lineCountResourceFileName = "line-count.txt" +// } +// +// val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) +// val eval = UnitTester(build, resourceFolder/ "unit-test-project") +// +// // Evaluating tasks by direct reference +// val Right(result) = eval(build.resources) +// assert( +// result.value.exists(pathref => +// os.exists(pathref.path / "line-count.txt") && +// os.read(pathref.path / "line-count.txt") == "17" +// ) +// ) +// +// // Evaluating tasks by passing in their Mill selector +// val Right(result2) = eval("resources") +// val Seq(pathrefs: Seq[mill.api.PathRef]) = result2.value +// assert( +// pathrefs.exists(pathref => +// os.exists(pathref.path / "line-count.txt") && +// os.read(pathref.path / "line-count.txt") == "17" +// ) +// ) +// } +// } +//} diff --git a/example/basicjava/1-simple/build.sc b/example/javalib/basic/1-simple/build.sc similarity index 100% rename from example/basicjava/1-simple/build.sc rename to example/javalib/basic/1-simple/build.sc diff --git a/example/basicjava/1-simple/src/foo/Foo.java b/example/javalib/basic/1-simple/src/foo/Foo.java similarity index 100% rename from example/basicjava/1-simple/src/foo/Foo.java rename to example/javalib/basic/1-simple/src/foo/Foo.java diff --git a/example/basicjava/1-simple/test/src/foo/FooTest.java b/example/javalib/basic/1-simple/test/src/foo/FooTest.java similarity index 100% rename from example/basicjava/1-simple/test/src/foo/FooTest.java rename to example/javalib/basic/1-simple/test/src/foo/FooTest.java diff --git a/example/basicjava/2-custom-build-logic/build.sc b/example/javalib/basic/2-custom-build-logic/build.sc similarity index 100% rename from example/basicjava/2-custom-build-logic/build.sc rename to example/javalib/basic/2-custom-build-logic/build.sc diff --git a/example/misc/7-writing-mill-plugins/myplugin/test/resources/unit-test-project/src/foo/Foo.java b/example/javalib/basic/2-custom-build-logic/src/foo/Foo.java similarity index 100% rename from example/misc/7-writing-mill-plugins/myplugin/test/resources/unit-test-project/src/foo/Foo.java rename to example/javalib/basic/2-custom-build-logic/src/foo/Foo.java diff --git a/example/basicjava/2-custom-build-logic/test/src/foo/FooTests.java b/example/javalib/basic/2-custom-build-logic/test/src/foo/FooTests.java similarity index 100% rename from example/basicjava/2-custom-build-logic/test/src/foo/FooTests.java rename to example/javalib/basic/2-custom-build-logic/test/src/foo/FooTests.java diff --git a/example/basicjava/3-multi-module/bar/src/bar/Bar.java b/example/javalib/basic/3-multi-module/bar/src/bar/Bar.java similarity index 100% rename from example/basicjava/3-multi-module/bar/src/bar/Bar.java rename to example/javalib/basic/3-multi-module/bar/src/bar/Bar.java diff --git a/example/basicjava/3-multi-module/bar/test/src/bar/BarTests.java b/example/javalib/basic/3-multi-module/bar/test/src/bar/BarTests.java similarity index 100% rename from example/basicjava/3-multi-module/bar/test/src/bar/BarTests.java rename to example/javalib/basic/3-multi-module/bar/test/src/bar/BarTests.java diff --git a/example/basicjava/3-multi-module/build.sc b/example/javalib/basic/3-multi-module/build.sc similarity index 100% rename from example/basicjava/3-multi-module/build.sc rename to example/javalib/basic/3-multi-module/build.sc diff --git a/example/basicjava/3-multi-module/foo/src/foo/Foo.java b/example/javalib/basic/3-multi-module/foo/src/foo/Foo.java similarity index 100% rename from example/basicjava/3-multi-module/foo/src/foo/Foo.java rename to example/javalib/basic/3-multi-module/foo/src/foo/Foo.java diff --git a/example/basicjava/4-builtin-commands/bar/src/bar/Bar.java b/example/javalib/basic/4-builtin-commands/bar/src/bar/Bar.java similarity index 100% rename from example/basicjava/4-builtin-commands/bar/src/bar/Bar.java rename to example/javalib/basic/4-builtin-commands/bar/src/bar/Bar.java diff --git a/example/basicjava/4-builtin-commands/bar/test/src/bar/BarTest.java b/example/javalib/basic/4-builtin-commands/bar/test/src/bar/BarTest.java similarity index 100% rename from example/basicjava/4-builtin-commands/bar/test/src/bar/BarTest.java rename to example/javalib/basic/4-builtin-commands/bar/test/src/bar/BarTest.java diff --git a/example/basicjava/4-builtin-commands/build.sc b/example/javalib/basic/4-builtin-commands/build.sc similarity index 100% rename from example/basicjava/4-builtin-commands/build.sc rename to example/javalib/basic/4-builtin-commands/build.sc diff --git a/example/basicjava/4-builtin-commands/foo/src/foo/Foo.java b/example/javalib/basic/4-builtin-commands/foo/src/foo/Foo.java similarity index 100% rename from example/basicjava/4-builtin-commands/foo/src/foo/Foo.java rename to example/javalib/basic/4-builtin-commands/foo/src/foo/Foo.java diff --git a/example/javabuilds/1-common-config/build.sc b/example/javalib/builds/1-common-config/build.sc similarity index 100% rename from example/javabuilds/1-common-config/build.sc rename to example/javalib/builds/1-common-config/build.sc diff --git a/example/javabuilds/1-common-config/custom-resources/MyOtherResource.txt b/example/javalib/builds/1-common-config/custom-resources/MyOtherResource.txt similarity index 100% rename from example/javabuilds/1-common-config/custom-resources/MyOtherResource.txt rename to example/javalib/builds/1-common-config/custom-resources/MyOtherResource.txt diff --git a/example/javabuilds/1-common-config/custom-src/Foo2.java b/example/javalib/builds/1-common-config/custom-src/Foo2.java similarity index 100% rename from example/javabuilds/1-common-config/custom-src/Foo2.java rename to example/javalib/builds/1-common-config/custom-src/Foo2.java diff --git a/example/javabuilds/1-common-config/resources/MyResource.txt b/example/javalib/builds/1-common-config/resources/MyResource.txt similarity index 100% rename from example/javabuilds/1-common-config/resources/MyResource.txt rename to example/javalib/builds/1-common-config/resources/MyResource.txt diff --git a/example/javabuilds/1-common-config/src/foo/Foo.java b/example/javalib/builds/1-common-config/src/foo/Foo.java similarity index 100% rename from example/javabuilds/1-common-config/src/foo/Foo.java rename to example/javalib/builds/1-common-config/src/foo/Foo.java diff --git a/example/javabuilds/2-custom-tasks/build.sc b/example/javalib/builds/2-custom-tasks/build.sc similarity index 100% rename from example/javabuilds/2-custom-tasks/build.sc rename to example/javalib/builds/2-custom-tasks/build.sc diff --git a/example/javabuilds/2-custom-tasks/src/foo/Foo.java b/example/javalib/builds/2-custom-tasks/src/foo/Foo.java similarity index 100% rename from example/javabuilds/2-custom-tasks/src/foo/Foo.java rename to example/javalib/builds/2-custom-tasks/src/foo/Foo.java diff --git a/example/javabuilds/3-override-tasks/build.sc b/example/javalib/builds/3-override-tasks/build.sc similarity index 100% rename from example/javabuilds/3-override-tasks/build.sc rename to example/javalib/builds/3-override-tasks/build.sc diff --git a/example/javabuilds/4-nested-modules/baz/src/baz/Baz.java b/example/javalib/builds/4-nested-modules/baz/src/baz/Baz.java similarity index 100% rename from example/javabuilds/4-nested-modules/baz/src/baz/Baz.java rename to example/javalib/builds/4-nested-modules/baz/src/baz/Baz.java diff --git a/example/javabuilds/4-nested-modules/build.sc b/example/javalib/builds/4-nested-modules/build.sc similarity index 100% rename from example/javabuilds/4-nested-modules/build.sc rename to example/javalib/builds/4-nested-modules/build.sc diff --git a/example/javabuilds/4-nested-modules/foo/bar/src/bar/Bar.java b/example/javalib/builds/4-nested-modules/foo/bar/src/bar/Bar.java similarity index 100% rename from example/javabuilds/4-nested-modules/foo/bar/src/bar/Bar.java rename to example/javalib/builds/4-nested-modules/foo/bar/src/bar/Bar.java diff --git a/example/javabuilds/4-nested-modules/foo/qux/src/qux/Qux.java b/example/javalib/builds/4-nested-modules/foo/qux/src/qux/Qux.java similarity index 100% rename from example/javabuilds/4-nested-modules/foo/qux/src/qux/Qux.java rename to example/javalib/builds/4-nested-modules/foo/qux/src/qux/Qux.java diff --git a/example/javabuilds/4-nested-modules/foo/src/foo/Foo.java b/example/javalib/builds/4-nested-modules/foo/src/foo/Foo.java similarity index 100% rename from example/javabuilds/4-nested-modules/foo/src/foo/Foo.java rename to example/javalib/builds/4-nested-modules/foo/src/foo/Foo.java diff --git a/example/javabuilds/6-publish-module/build.sc b/example/javalib/builds/6-publish-module/build.sc similarity index 100% rename from example/javabuilds/6-publish-module/build.sc rename to example/javalib/builds/6-publish-module/build.sc diff --git a/example/javabuilds/6-publish-module/foo/src/foo/Foo.java b/example/javalib/builds/6-publish-module/foo/src/foo/Foo.java similarity index 100% rename from example/javabuilds/6-publish-module/foo/src/foo/Foo.java rename to example/javalib/builds/6-publish-module/foo/src/foo/Foo.java diff --git a/example/javabuilds/8-compat-modules/bar/src/main/java/bar/Bar.java b/example/javalib/builds/8-compat-modules/bar/src/main/java/bar/Bar.java similarity index 100% rename from example/javabuilds/8-compat-modules/bar/src/main/java/bar/Bar.java rename to example/javalib/builds/8-compat-modules/bar/src/main/java/bar/Bar.java diff --git a/example/javabuilds/8-compat-modules/build.sc b/example/javalib/builds/8-compat-modules/build.sc similarity index 100% rename from example/javabuilds/8-compat-modules/build.sc rename to example/javalib/builds/8-compat-modules/build.sc diff --git a/example/javabuilds/8-compat-modules/foo/src/main/java/foo/Foo.java b/example/javalib/builds/8-compat-modules/foo/src/main/java/foo/Foo.java similarity index 100% rename from example/javabuilds/8-compat-modules/foo/src/main/java/foo/Foo.java rename to example/javalib/builds/8-compat-modules/foo/src/main/java/foo/Foo.java diff --git a/example/javabuilds/8-compat-modules/foo/src/test/java/foo/FooTests.java b/example/javalib/builds/8-compat-modules/foo/src/test/java/foo/FooTests.java similarity index 100% rename from example/javabuilds/8-compat-modules/foo/src/test/java/foo/FooTests.java rename to example/javalib/builds/8-compat-modules/foo/src/test/java/foo/FooTests.java diff --git a/example/javabuilds/9-realistic/bar/src/bar/Bar.java b/example/javalib/builds/9-realistic/bar/src/bar/Bar.java similarity index 100% rename from example/javabuilds/9-realistic/bar/src/bar/Bar.java rename to example/javalib/builds/9-realistic/bar/src/bar/Bar.java diff --git a/example/javabuilds/9-realistic/bar/test/src/bar/BarTests.java b/example/javalib/builds/9-realistic/bar/test/src/bar/BarTests.java similarity index 100% rename from example/javabuilds/9-realistic/bar/test/src/bar/BarTests.java rename to example/javalib/builds/9-realistic/bar/test/src/bar/BarTests.java diff --git a/example/javabuilds/9-realistic/build.sc b/example/javalib/builds/9-realistic/build.sc similarity index 100% rename from example/javabuilds/9-realistic/build.sc rename to example/javalib/builds/9-realistic/build.sc diff --git a/example/javabuilds/9-realistic/foo/src/foo/Foo.java b/example/javalib/builds/9-realistic/foo/src/foo/Foo.java similarity index 100% rename from example/javabuilds/9-realistic/foo/src/foo/Foo.java rename to example/javalib/builds/9-realistic/foo/src/foo/Foo.java diff --git a/example/javabuilds/9-realistic/foo/test/src/foo/FooTests.java b/example/javalib/builds/9-realistic/foo/test/src/foo/FooTests.java similarity index 100% rename from example/javabuilds/9-realistic/foo/test/src/foo/FooTests.java rename to example/javalib/builds/9-realistic/foo/test/src/foo/FooTests.java diff --git a/example/javabuilds/9-realistic/qux/src/qux/Qux.java b/example/javalib/builds/9-realistic/qux/src/qux/Qux.java similarity index 100% rename from example/javabuilds/9-realistic/qux/src/qux/Qux.java rename to example/javalib/builds/9-realistic/qux/src/qux/Qux.java diff --git a/example/javamodule/1-compilation-execution-flags/build.sc b/example/javalib/module/1-compilation-execution-flags/build.sc similarity index 100% rename from example/javamodule/1-compilation-execution-flags/build.sc rename to example/javalib/module/1-compilation-execution-flags/build.sc diff --git a/example/javamodule/1-compilation-execution-flags/src/foo/Foo.java b/example/javalib/module/1-compilation-execution-flags/src/foo/Foo.java similarity index 100% rename from example/javamodule/1-compilation-execution-flags/src/foo/Foo.java rename to example/javalib/module/1-compilation-execution-flags/src/foo/Foo.java diff --git a/example/javamodule/10-downloading-non-maven-jars/build.sc b/example/javalib/module/10-downloading-non-maven-jars/build.sc similarity index 100% rename from example/javamodule/10-downloading-non-maven-jars/build.sc rename to example/javalib/module/10-downloading-non-maven-jars/build.sc diff --git a/example/javamodule/10-downloading-non-maven-jars/src/foo/Foo.java b/example/javalib/module/10-downloading-non-maven-jars/src/foo/Foo.java similarity index 100% rename from example/javamodule/10-downloading-non-maven-jars/src/foo/Foo.java rename to example/javalib/module/10-downloading-non-maven-jars/src/foo/Foo.java diff --git a/example/javamodule/10-downloading-non-maven-jars/textfile.txt b/example/javalib/module/10-downloading-non-maven-jars/textfile.txt similarity index 100% rename from example/javamodule/10-downloading-non-maven-jars/textfile.txt rename to example/javalib/module/10-downloading-non-maven-jars/textfile.txt diff --git a/example/javamodule/11-assembly-config/bar/resources/application.conf b/example/javalib/module/11-assembly-config/bar/resources/application.conf similarity index 100% rename from example/javamodule/11-assembly-config/bar/resources/application.conf rename to example/javalib/module/11-assembly-config/bar/resources/application.conf diff --git a/example/javamodule/11-assembly-config/build.sc b/example/javalib/module/11-assembly-config/build.sc similarity index 100% rename from example/javamodule/11-assembly-config/build.sc rename to example/javalib/module/11-assembly-config/build.sc diff --git a/example/javamodule/11-assembly-config/foo/resources/application.conf b/example/javalib/module/11-assembly-config/foo/resources/application.conf similarity index 100% rename from example/javamodule/11-assembly-config/foo/resources/application.conf rename to example/javalib/module/11-assembly-config/foo/resources/application.conf diff --git a/example/javamodule/11-assembly-config/foo/src/foo/Foo.java b/example/javalib/module/11-assembly-config/foo/src/foo/Foo.java similarity index 100% rename from example/javamodule/11-assembly-config/foo/src/foo/Foo.java rename to example/javalib/module/11-assembly-config/foo/src/foo/Foo.java diff --git a/example/javamodule/12-repository-config/build.sc b/example/javalib/module/12-repository-config/build.sc similarity index 100% rename from example/javamodule/12-repository-config/build.sc rename to example/javalib/module/12-repository-config/build.sc diff --git a/example/javamodule/12-repository-config/foo/src/foo/Foo.java b/example/javalib/module/12-repository-config/foo/src/foo/Foo.java similarity index 100% rename from example/javamodule/12-repository-config/foo/src/foo/Foo.java rename to example/javalib/module/12-repository-config/foo/src/foo/Foo.java diff --git a/example/javamodule/13-jni/build.sc b/example/javalib/module/13-jni/build.sc similarity index 100% rename from example/javamodule/13-jni/build.sc rename to example/javalib/module/13-jni/build.sc diff --git a/example/javamodule/13-jni/native-src/HelloWorld.c b/example/javalib/module/13-jni/native-src/HelloWorld.c similarity index 100% rename from example/javamodule/13-jni/native-src/HelloWorld.c rename to example/javalib/module/13-jni/native-src/HelloWorld.c diff --git a/example/javamodule/13-jni/src/foo/HelloWorld.java b/example/javalib/module/13-jni/src/foo/HelloWorld.java similarity index 100% rename from example/javamodule/13-jni/src/foo/HelloWorld.java rename to example/javalib/module/13-jni/src/foo/HelloWorld.java diff --git a/example/javamodule/13-jni/test/src/foo/HelloWorldTest.java b/example/javalib/module/13-jni/test/src/foo/HelloWorldTest.java similarity index 100% rename from example/javamodule/13-jni/test/src/foo/HelloWorldTest.java rename to example/javalib/module/13-jni/test/src/foo/HelloWorldTest.java diff --git a/example/javamodule/2-ivy-deps/build.sc b/example/javalib/module/2-ivy-deps/build.sc similarity index 100% rename from example/javamodule/2-ivy-deps/build.sc rename to example/javalib/module/2-ivy-deps/build.sc diff --git a/example/javamodule/2-ivy-deps/src/foo/Foo.java b/example/javalib/module/2-ivy-deps/src/foo/Foo.java similarity index 100% rename from example/javamodule/2-ivy-deps/src/foo/Foo.java rename to example/javalib/module/2-ivy-deps/src/foo/Foo.java diff --git a/example/javamodule/3-run-compile-deps/bar/src/bar/Bar.java b/example/javalib/module/3-run-compile-deps/bar/src/bar/Bar.java similarity index 100% rename from example/javamodule/3-run-compile-deps/bar/src/bar/Bar.java rename to example/javalib/module/3-run-compile-deps/bar/src/bar/Bar.java diff --git a/example/javamodule/3-run-compile-deps/build.sc b/example/javalib/module/3-run-compile-deps/build.sc similarity index 100% rename from example/javamodule/3-run-compile-deps/build.sc rename to example/javalib/module/3-run-compile-deps/build.sc diff --git a/example/javamodule/3-run-compile-deps/foo/src/foo/Foo.java b/example/javalib/module/3-run-compile-deps/foo/src/foo/Foo.java similarity index 100% rename from example/javamodule/3-run-compile-deps/foo/src/foo/Foo.java rename to example/javalib/module/3-run-compile-deps/foo/src/foo/Foo.java diff --git a/example/javamodule/5-resources/build.sc b/example/javalib/module/5-resources/build.sc similarity index 100% rename from example/javamodule/5-resources/build.sc rename to example/javalib/module/5-resources/build.sc diff --git a/example/javamodule/5-resources/foo/resources/file.txt b/example/javalib/module/5-resources/foo/resources/file.txt similarity index 100% rename from example/javamodule/5-resources/foo/resources/file.txt rename to example/javalib/module/5-resources/foo/resources/file.txt diff --git a/example/javamodule/5-resources/foo/src/Foo.java b/example/javalib/module/5-resources/foo/src/Foo.java similarity index 100% rename from example/javamodule/5-resources/foo/src/Foo.java rename to example/javalib/module/5-resources/foo/src/Foo.java diff --git a/example/javamodule/5-resources/foo/test/other-files/other-file.txt b/example/javalib/module/5-resources/foo/test/other-files/other-file.txt similarity index 100% rename from example/javamodule/5-resources/foo/test/other-files/other-file.txt rename to example/javalib/module/5-resources/foo/test/other-files/other-file.txt diff --git a/example/javamodule/5-resources/foo/test/resources/test-file-a.txt b/example/javalib/module/5-resources/foo/test/resources/test-file-a.txt similarity index 100% rename from example/javamodule/5-resources/foo/test/resources/test-file-a.txt rename to example/javalib/module/5-resources/foo/test/resources/test-file-a.txt diff --git a/example/javamodule/5-resources/foo/test/resources/test-file-b.txt b/example/javalib/module/5-resources/foo/test/resources/test-file-b.txt similarity index 100% rename from example/javamodule/5-resources/foo/test/resources/test-file-b.txt rename to example/javalib/module/5-resources/foo/test/resources/test-file-b.txt diff --git a/example/javamodule/5-resources/foo/test/src/FooTests.java b/example/javalib/module/5-resources/foo/test/src/FooTests.java similarity index 100% rename from example/javamodule/5-resources/foo/test/src/FooTests.java rename to example/javalib/module/5-resources/foo/test/src/FooTests.java diff --git a/example/javamodule/6-annotation-processors/bar/src/bar/GetterSetterExample.java b/example/javalib/module/6-annotation-processors/bar/src/bar/GetterSetterExample.java similarity index 100% rename from example/javamodule/6-annotation-processors/bar/src/bar/GetterSetterExample.java rename to example/javalib/module/6-annotation-processors/bar/src/bar/GetterSetterExample.java diff --git a/example/javamodule/6-annotation-processors/bar/test/src/bar/HelloWorldTest.java b/example/javalib/module/6-annotation-processors/bar/test/src/bar/HelloWorldTest.java similarity index 100% rename from example/javamodule/6-annotation-processors/bar/test/src/bar/HelloWorldTest.java rename to example/javalib/module/6-annotation-processors/bar/test/src/bar/HelloWorldTest.java diff --git a/example/javamodule/6-annotation-processors/build.sc b/example/javalib/module/6-annotation-processors/build.sc similarity index 100% rename from example/javamodule/6-annotation-processors/build.sc rename to example/javalib/module/6-annotation-processors/build.sc diff --git a/example/javamodule/6-annotation-processors/foo/src/foo/GetterSetterExample.java b/example/javalib/module/6-annotation-processors/foo/src/foo/GetterSetterExample.java similarity index 100% rename from example/javamodule/6-annotation-processors/foo/src/foo/GetterSetterExample.java rename to example/javalib/module/6-annotation-processors/foo/src/foo/GetterSetterExample.java diff --git a/example/javamodule/6-annotation-processors/foo/test/src/foo/HelloWorldTest.java b/example/javalib/module/6-annotation-processors/foo/test/src/foo/HelloWorldTest.java similarity index 100% rename from example/javamodule/6-annotation-processors/foo/test/src/foo/HelloWorldTest.java rename to example/javalib/module/6-annotation-processors/foo/test/src/foo/HelloWorldTest.java diff --git a/example/javamodule/7-docjar/build.sc b/example/javalib/module/7-docjar/build.sc similarity index 100% rename from example/javamodule/7-docjar/build.sc rename to example/javalib/module/7-docjar/build.sc diff --git a/example/javamodule/7-docjar/foo/src/foo/Foo.java b/example/javalib/module/7-docjar/foo/src/foo/Foo.java similarity index 100% rename from example/javamodule/7-docjar/foo/src/foo/Foo.java rename to example/javalib/module/7-docjar/foo/src/foo/Foo.java diff --git a/example/javamodule/8-unmanaged-jars/build.sc b/example/javalib/module/8-unmanaged-jars/build.sc similarity index 100% rename from example/javamodule/8-unmanaged-jars/build.sc rename to example/javalib/module/8-unmanaged-jars/build.sc diff --git a/example/javamodule/8-unmanaged-jars/lib/nanojson-1.8.jar b/example/javalib/module/8-unmanaged-jars/lib/nanojson-1.8.jar similarity index 100% rename from example/javamodule/8-unmanaged-jars/lib/nanojson-1.8.jar rename to example/javalib/module/8-unmanaged-jars/lib/nanojson-1.8.jar diff --git a/example/javamodule/8-unmanaged-jars/src/foo/Foo.java b/example/javalib/module/8-unmanaged-jars/src/foo/Foo.java similarity index 100% rename from example/javamodule/8-unmanaged-jars/src/foo/Foo.java rename to example/javalib/module/8-unmanaged-jars/src/foo/Foo.java diff --git a/example/javamodule/9-main-class/build.sc b/example/javalib/module/9-main-class/build.sc similarity index 100% rename from example/javamodule/9-main-class/build.sc rename to example/javalib/module/9-main-class/build.sc diff --git a/example/javamodule/9-main-class/src/foo/Bar.java b/example/javalib/module/9-main-class/src/foo/Bar.java similarity index 100% rename from example/javamodule/9-main-class/src/foo/Bar.java rename to example/javalib/module/9-main-class/src/foo/Bar.java diff --git a/example/javamodule/9-main-class/src/foo/Foo.java b/example/javalib/module/9-main-class/src/foo/Foo.java similarity index 100% rename from example/javamodule/9-main-class/src/foo/Foo.java rename to example/javalib/module/9-main-class/src/foo/Foo.java diff --git a/example/javamodule/9-main-class/src/foo/Qux.java b/example/javalib/module/9-main-class/src/foo/Qux.java similarity index 100% rename from example/javamodule/9-main-class/src/foo/Qux.java rename to example/javalib/module/9-main-class/src/foo/Qux.java diff --git a/example/javatesting/1-test-suite/bar/src/bar/Bar.java b/example/javalib/testing/1-test-suite/bar/src/bar/Bar.java similarity index 100% rename from example/javatesting/1-test-suite/bar/src/bar/Bar.java rename to example/javalib/testing/1-test-suite/bar/src/bar/Bar.java diff --git a/example/javatesting/1-test-suite/bar/test/src/bar/BarTests.java b/example/javalib/testing/1-test-suite/bar/test/src/bar/BarTests.java similarity index 100% rename from example/javatesting/1-test-suite/bar/test/src/bar/BarTests.java rename to example/javalib/testing/1-test-suite/bar/test/src/bar/BarTests.java diff --git a/example/javatesting/1-test-suite/build.sc b/example/javalib/testing/1-test-suite/build.sc similarity index 100% rename from example/javatesting/1-test-suite/build.sc rename to example/javalib/testing/1-test-suite/build.sc diff --git a/example/javatesting/1-test-suite/foo/src/foo/Foo.java b/example/javalib/testing/1-test-suite/foo/src/foo/Foo.java similarity index 100% rename from example/javatesting/1-test-suite/foo/src/foo/Foo.java rename to example/javalib/testing/1-test-suite/foo/src/foo/Foo.java diff --git a/example/javatesting/1-test-suite/foo/test/src/foo/FooTests.java b/example/javalib/testing/1-test-suite/foo/test/src/foo/FooTests.java similarity index 100% rename from example/javatesting/1-test-suite/foo/test/src/foo/FooTests.java rename to example/javalib/testing/1-test-suite/foo/test/src/foo/FooTests.java diff --git a/example/javatesting/2-test-deps/baz/src/baz/Baz.java b/example/javalib/testing/2-test-deps/baz/src/baz/Baz.java similarity index 100% rename from example/javatesting/2-test-deps/baz/src/baz/Baz.java rename to example/javalib/testing/2-test-deps/baz/src/baz/Baz.java diff --git a/example/javatesting/2-test-deps/baz/test/src/baz/BazTestUtils.java b/example/javalib/testing/2-test-deps/baz/test/src/baz/BazTestUtils.java similarity index 100% rename from example/javatesting/2-test-deps/baz/test/src/baz/BazTestUtils.java rename to example/javalib/testing/2-test-deps/baz/test/src/baz/BazTestUtils.java diff --git a/example/javatesting/2-test-deps/baz/test/src/baz/BazTests.java b/example/javalib/testing/2-test-deps/baz/test/src/baz/BazTests.java similarity index 100% rename from example/javatesting/2-test-deps/baz/test/src/baz/BazTests.java rename to example/javalib/testing/2-test-deps/baz/test/src/baz/BazTests.java diff --git a/example/javatesting/2-test-deps/build.sc b/example/javalib/testing/2-test-deps/build.sc similarity index 100% rename from example/javatesting/2-test-deps/build.sc rename to example/javalib/testing/2-test-deps/build.sc diff --git a/example/javatesting/2-test-deps/qux/src/qux/Qux.java b/example/javalib/testing/2-test-deps/qux/src/qux/Qux.java similarity index 100% rename from example/javatesting/2-test-deps/qux/src/qux/Qux.java rename to example/javalib/testing/2-test-deps/qux/src/qux/Qux.java diff --git a/example/javatesting/2-test-deps/qux/test/src/qux/QuxTests.java b/example/javalib/testing/2-test-deps/qux/test/src/qux/QuxTests.java similarity index 100% rename from example/javatesting/2-test-deps/qux/test/src/qux/QuxTests.java rename to example/javalib/testing/2-test-deps/qux/test/src/qux/QuxTests.java diff --git a/example/javatesting/3-integration-suite/build.sc b/example/javalib/testing/3-integration-suite/build.sc similarity index 100% rename from example/javatesting/3-integration-suite/build.sc rename to example/javalib/testing/3-integration-suite/build.sc diff --git a/example/javatesting/3-integration-suite/qux/integration/src/qux/QuxIntegrationTests.java b/example/javalib/testing/3-integration-suite/qux/integration/src/qux/QuxIntegrationTests.java similarity index 100% rename from example/javatesting/3-integration-suite/qux/integration/src/qux/QuxIntegrationTests.java rename to example/javalib/testing/3-integration-suite/qux/integration/src/qux/QuxIntegrationTests.java diff --git a/example/javatesting/3-integration-suite/qux/src/qux/Qux.java b/example/javalib/testing/3-integration-suite/qux/src/qux/Qux.java similarity index 100% rename from example/javatesting/3-integration-suite/qux/src/qux/Qux.java rename to example/javalib/testing/3-integration-suite/qux/src/qux/Qux.java diff --git a/example/javatesting/3-integration-suite/qux/test/src/qux/QuxTests.java b/example/javalib/testing/3-integration-suite/qux/test/src/qux/QuxTests.java similarity index 100% rename from example/javatesting/3-integration-suite/qux/test/src/qux/QuxTests.java rename to example/javalib/testing/3-integration-suite/qux/test/src/qux/QuxTests.java diff --git a/example/javaweb/1-hello-jetty/build.sc b/example/javalib/web/1-hello-jetty/build.sc similarity index 100% rename from example/javaweb/1-hello-jetty/build.sc rename to example/javalib/web/1-hello-jetty/build.sc diff --git a/example/javaweb/1-hello-jetty/resources/application.properties b/example/javalib/web/1-hello-jetty/resources/application.properties similarity index 100% rename from example/javaweb/1-hello-jetty/resources/application.properties rename to example/javalib/web/1-hello-jetty/resources/application.properties diff --git a/example/javaweb/1-hello-jetty/src/com/example/HelloJetty.java b/example/javalib/web/1-hello-jetty/src/com/example/HelloJetty.java similarity index 100% rename from example/javaweb/1-hello-jetty/src/com/example/HelloJetty.java rename to example/javalib/web/1-hello-jetty/src/com/example/HelloJetty.java diff --git a/example/javaweb/1-hello-jetty/test/src/com/example/HelloJettyTest.java b/example/javalib/web/1-hello-jetty/test/src/com/example/HelloJettyTest.java similarity index 100% rename from example/javaweb/1-hello-jetty/test/src/com/example/HelloJettyTest.java rename to example/javalib/web/1-hello-jetty/test/src/com/example/HelloJettyTest.java diff --git a/example/javaweb/2-hello-spring-boot/build.sc b/example/javalib/web/2-hello-spring-boot/build.sc similarity index 100% rename from example/javaweb/2-hello-spring-boot/build.sc rename to example/javalib/web/2-hello-spring-boot/build.sc diff --git a/example/javaweb/2-hello-spring-boot/resources/application.properties b/example/javalib/web/2-hello-spring-boot/resources/application.properties similarity index 100% rename from example/javaweb/2-hello-spring-boot/resources/application.properties rename to example/javalib/web/2-hello-spring-boot/resources/application.properties diff --git a/example/javaweb/2-hello-spring-boot/src/com/example/HelloSpringBoot.java b/example/javalib/web/2-hello-spring-boot/src/com/example/HelloSpringBoot.java similarity index 100% rename from example/javaweb/2-hello-spring-boot/src/com/example/HelloSpringBoot.java rename to example/javalib/web/2-hello-spring-boot/src/com/example/HelloSpringBoot.java diff --git a/example/javaweb/2-hello-spring-boot/test/src/com/example/HelloSpringBootTest.java b/example/javalib/web/2-hello-spring-boot/test/src/com/example/HelloSpringBootTest.java similarity index 100% rename from example/javaweb/2-hello-spring-boot/test/src/com/example/HelloSpringBootTest.java rename to example/javalib/web/2-hello-spring-boot/test/src/com/example/HelloSpringBootTest.java diff --git a/example/javaweb/3-todo-spring-boot/build.sc b/example/javalib/web/3-todo-spring-boot/build.sc similarity index 100% rename from example/javaweb/3-todo-spring-boot/build.sc rename to example/javalib/web/3-todo-spring-boot/build.sc diff --git a/example/javaweb/3-todo-spring-boot/integration/resources/application.properties b/example/javalib/web/3-todo-spring-boot/integration/resources/application.properties similarity index 100% rename from example/javaweb/3-todo-spring-boot/integration/resources/application.properties rename to example/javalib/web/3-todo-spring-boot/integration/resources/application.properties diff --git a/example/javaweb/3-todo-spring-boot/integration/src/com/example/TodomvcIntegrationTests.java b/example/javalib/web/3-todo-spring-boot/integration/src/com/example/TodomvcIntegrationTests.java similarity index 100% rename from example/javaweb/3-todo-spring-boot/integration/src/com/example/TodomvcIntegrationTests.java rename to example/javalib/web/3-todo-spring-boot/integration/src/com/example/TodomvcIntegrationTests.java diff --git a/example/javaweb/3-todo-spring-boot/resources/templates/fragments.html b/example/javalib/web/3-todo-spring-boot/resources/templates/fragments.html similarity index 100% rename from example/javaweb/3-todo-spring-boot/resources/templates/fragments.html rename to example/javalib/web/3-todo-spring-boot/resources/templates/fragments.html diff --git a/example/javaweb/3-todo-spring-boot/resources/templates/index.html b/example/javalib/web/3-todo-spring-boot/resources/templates/index.html similarity index 100% rename from example/javaweb/3-todo-spring-boot/resources/templates/index.html rename to example/javalib/web/3-todo-spring-boot/resources/templates/index.html diff --git a/example/javaweb/3-todo-spring-boot/src/com/example/TodomvcApplication.java b/example/javalib/web/3-todo-spring-boot/src/com/example/TodomvcApplication.java similarity index 100% rename from example/javaweb/3-todo-spring-boot/src/com/example/TodomvcApplication.java rename to example/javalib/web/3-todo-spring-boot/src/com/example/TodomvcApplication.java diff --git a/example/javaweb/3-todo-spring-boot/src/com/example/todoitem/TodoItem.java b/example/javalib/web/3-todo-spring-boot/src/com/example/todoitem/TodoItem.java similarity index 100% rename from example/javaweb/3-todo-spring-boot/src/com/example/todoitem/TodoItem.java rename to example/javalib/web/3-todo-spring-boot/src/com/example/todoitem/TodoItem.java diff --git a/example/javaweb/3-todo-spring-boot/src/com/example/todoitem/TodoItemNotFoundException.java b/example/javalib/web/3-todo-spring-boot/src/com/example/todoitem/TodoItemNotFoundException.java similarity index 100% rename from example/javaweb/3-todo-spring-boot/src/com/example/todoitem/TodoItemNotFoundException.java rename to example/javalib/web/3-todo-spring-boot/src/com/example/todoitem/TodoItemNotFoundException.java diff --git a/example/javaweb/3-todo-spring-boot/src/com/example/todoitem/TodoItemRepository.java b/example/javalib/web/3-todo-spring-boot/src/com/example/todoitem/TodoItemRepository.java similarity index 100% rename from example/javaweb/3-todo-spring-boot/src/com/example/todoitem/TodoItemRepository.java rename to example/javalib/web/3-todo-spring-boot/src/com/example/todoitem/TodoItemRepository.java diff --git a/example/javaweb/3-todo-spring-boot/src/com/example/todoitem/web/TodoItemController.java b/example/javalib/web/3-todo-spring-boot/src/com/example/todoitem/web/TodoItemController.java similarity index 100% rename from example/javaweb/3-todo-spring-boot/src/com/example/todoitem/web/TodoItemController.java rename to example/javalib/web/3-todo-spring-boot/src/com/example/todoitem/web/TodoItemController.java diff --git a/example/javaweb/3-todo-spring-boot/src/com/example/todoitem/web/TodoItemFormData.java b/example/javalib/web/3-todo-spring-boot/src/com/example/todoitem/web/TodoItemFormData.java similarity index 100% rename from example/javaweb/3-todo-spring-boot/src/com/example/todoitem/web/TodoItemFormData.java rename to example/javalib/web/3-todo-spring-boot/src/com/example/todoitem/web/TodoItemFormData.java diff --git a/example/javaweb/3-todo-spring-boot/test/resources/application.properties b/example/javalib/web/3-todo-spring-boot/test/resources/application.properties similarity index 100% rename from example/javaweb/3-todo-spring-boot/test/resources/application.properties rename to example/javalib/web/3-todo-spring-boot/test/resources/application.properties diff --git a/example/javaweb/3-todo-spring-boot/test/src/com/example/TodomvcTests.java b/example/javalib/web/3-todo-spring-boot/test/src/com/example/TodomvcTests.java similarity index 100% rename from example/javaweb/3-todo-spring-boot/test/src/com/example/TodomvcTests.java rename to example/javalib/web/3-todo-spring-boot/test/src/com/example/TodomvcTests.java diff --git a/example/javaweb/4-hello-micronaut/build.sc b/example/javalib/web/4-hello-micronaut/build.sc similarity index 100% rename from example/javaweb/4-hello-micronaut/build.sc rename to example/javalib/web/4-hello-micronaut/build.sc diff --git a/example/javaweb/4-hello-micronaut/src/main/java/example/micronaut/Application.java b/example/javalib/web/4-hello-micronaut/src/main/java/example/micronaut/Application.java similarity index 100% rename from example/javaweb/4-hello-micronaut/src/main/java/example/micronaut/Application.java rename to example/javalib/web/4-hello-micronaut/src/main/java/example/micronaut/Application.java diff --git a/example/javaweb/4-hello-micronaut/src/main/java/example/micronaut/HelloController.java b/example/javalib/web/4-hello-micronaut/src/main/java/example/micronaut/HelloController.java similarity index 100% rename from example/javaweb/4-hello-micronaut/src/main/java/example/micronaut/HelloController.java rename to example/javalib/web/4-hello-micronaut/src/main/java/example/micronaut/HelloController.java diff --git a/example/javaweb/4-hello-micronaut/src/main/resources/application.properties b/example/javalib/web/4-hello-micronaut/src/main/resources/application.properties similarity index 100% rename from example/javaweb/4-hello-micronaut/src/main/resources/application.properties rename to example/javalib/web/4-hello-micronaut/src/main/resources/application.properties diff --git a/example/javaweb/4-hello-micronaut/src/main/resources/logback.xml b/example/javalib/web/4-hello-micronaut/src/main/resources/logback.xml similarity index 100% rename from example/javaweb/4-hello-micronaut/src/main/resources/logback.xml rename to example/javalib/web/4-hello-micronaut/src/main/resources/logback.xml diff --git a/example/javaweb/4-hello-micronaut/src/test/java/example/micronaut/DefaultTest.java b/example/javalib/web/4-hello-micronaut/src/test/java/example/micronaut/DefaultTest.java similarity index 100% rename from example/javaweb/4-hello-micronaut/src/test/java/example/micronaut/DefaultTest.java rename to example/javalib/web/4-hello-micronaut/src/test/java/example/micronaut/DefaultTest.java diff --git a/example/javaweb/4-hello-micronaut/src/test/java/example/micronaut/HelloControllerTest.java b/example/javalib/web/4-hello-micronaut/src/test/java/example/micronaut/HelloControllerTest.java similarity index 100% rename from example/javaweb/4-hello-micronaut/src/test/java/example/micronaut/HelloControllerTest.java rename to example/javalib/web/4-hello-micronaut/src/test/java/example/micronaut/HelloControllerTest.java diff --git a/example/javaweb/5-todo-micronaut/build.sc b/example/javalib/web/5-todo-micronaut/build.sc similarity index 100% rename from example/javaweb/5-todo-micronaut/build.sc rename to example/javalib/web/5-todo-micronaut/build.sc diff --git a/example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/Application.java b/example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/Application.java similarity index 100% rename from example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/Application.java rename to example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/Application.java diff --git a/example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/LoggingHeadersFilter.java b/example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/LoggingHeadersFilter.java similarity index 100% rename from example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/LoggingHeadersFilter.java rename to example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/LoggingHeadersFilter.java diff --git a/example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/TodoItem.java b/example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/TodoItem.java similarity index 100% rename from example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/TodoItem.java rename to example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/TodoItem.java diff --git a/example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/TodoItemController.java b/example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/TodoItemController.java similarity index 100% rename from example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/TodoItemController.java rename to example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/TodoItemController.java diff --git a/example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/TodoItemFormData.java b/example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/TodoItemFormData.java similarity index 100% rename from example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/TodoItemFormData.java rename to example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/TodoItemFormData.java diff --git a/example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/TodoItemMapper.java b/example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/TodoItemMapper.java similarity index 100% rename from example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/TodoItemMapper.java rename to example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/TodoItemMapper.java diff --git a/example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/TodoItemNotFoundException.java b/example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/TodoItemNotFoundException.java similarity index 100% rename from example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/TodoItemNotFoundException.java rename to example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/TodoItemNotFoundException.java diff --git a/example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/TodoItemNotFoundExceptionHandler.java b/example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/TodoItemNotFoundExceptionHandler.java similarity index 100% rename from example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/TodoItemNotFoundExceptionHandler.java rename to example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/TodoItemNotFoundExceptionHandler.java diff --git a/example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/TodoItemRepository.java b/example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/TodoItemRepository.java similarity index 100% rename from example/javaweb/5-todo-micronaut/src/main/java/example/micronaut/TodoItemRepository.java rename to example/javalib/web/5-todo-micronaut/src/main/java/example/micronaut/TodoItemRepository.java diff --git a/example/javaweb/5-todo-micronaut/src/main/resources/application.properties b/example/javalib/web/5-todo-micronaut/src/main/resources/application.properties similarity index 100% rename from example/javaweb/5-todo-micronaut/src/main/resources/application.properties rename to example/javalib/web/5-todo-micronaut/src/main/resources/application.properties diff --git a/example/javaweb/5-todo-micronaut/src/main/resources/logback.xml b/example/javalib/web/5-todo-micronaut/src/main/resources/logback.xml similarity index 100% rename from example/javaweb/5-todo-micronaut/src/main/resources/logback.xml rename to example/javalib/web/5-todo-micronaut/src/main/resources/logback.xml diff --git a/example/javaweb/5-todo-micronaut/src/main/resources/public/learn.json b/example/javalib/web/5-todo-micronaut/src/main/resources/public/learn.json similarity index 100% rename from example/javaweb/5-todo-micronaut/src/main/resources/public/learn.json rename to example/javalib/web/5-todo-micronaut/src/main/resources/public/learn.json diff --git a/example/javaweb/5-todo-micronaut/src/main/resources/templates/fragments.html b/example/javalib/web/5-todo-micronaut/src/main/resources/templates/fragments.html similarity index 100% rename from example/javaweb/5-todo-micronaut/src/main/resources/templates/fragments.html rename to example/javalib/web/5-todo-micronaut/src/main/resources/templates/fragments.html diff --git a/example/javaweb/5-todo-micronaut/src/main/resources/templates/index.html b/example/javalib/web/5-todo-micronaut/src/main/resources/templates/index.html similarity index 100% rename from example/javaweb/5-todo-micronaut/src/main/resources/templates/index.html rename to example/javalib/web/5-todo-micronaut/src/main/resources/templates/index.html diff --git a/example/javaweb/5-todo-micronaut/src/test/java/example/micronaut/HtmxWebJarsTest.java b/example/javalib/web/5-todo-micronaut/src/test/java/example/micronaut/HtmxWebJarsTest.java similarity index 100% rename from example/javaweb/5-todo-micronaut/src/test/java/example/micronaut/HtmxWebJarsTest.java rename to example/javalib/web/5-todo-micronaut/src/test/java/example/micronaut/HtmxWebJarsTest.java diff --git a/example/javaweb/5-todo-micronaut/src/test/java/example/micronaut/LearnJsonTest.java b/example/javalib/web/5-todo-micronaut/src/test/java/example/micronaut/LearnJsonTest.java similarity index 100% rename from example/javaweb/5-todo-micronaut/src/test/java/example/micronaut/LearnJsonTest.java rename to example/javalib/web/5-todo-micronaut/src/test/java/example/micronaut/LearnJsonTest.java diff --git a/example/javaweb/5-todo-micronaut/src/test/java/example/micronaut/TodoItemControllerTest.java b/example/javalib/web/5-todo-micronaut/src/test/java/example/micronaut/TodoItemControllerTest.java similarity index 100% rename from example/javaweb/5-todo-micronaut/src/test/java/example/micronaut/TodoItemControllerTest.java rename to example/javalib/web/5-todo-micronaut/src/test/java/example/micronaut/TodoItemControllerTest.java diff --git a/example/javaweb/5-todo-micronaut/src/test/java/example/micronaut/TodoItemMapperTest.java b/example/javalib/web/5-todo-micronaut/src/test/java/example/micronaut/TodoItemMapperTest.java similarity index 100% rename from example/javaweb/5-todo-micronaut/src/test/java/example/micronaut/TodoItemMapperTest.java rename to example/javalib/web/5-todo-micronaut/src/test/java/example/micronaut/TodoItemMapperTest.java diff --git a/example/javaweb/5-todo-micronaut/src/test/java/example/micronaut/TodoTest.java b/example/javalib/web/5-todo-micronaut/src/test/java/example/micronaut/TodoTest.java similarity index 100% rename from example/javaweb/5-todo-micronaut/src/test/java/example/micronaut/TodoTest.java rename to example/javalib/web/5-todo-micronaut/src/test/java/example/micronaut/TodoTest.java diff --git a/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala b/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala deleted file mode 100644 index c5e7ed8dec9..00000000000 --- a/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala +++ /dev/null @@ -1,17 +0,0 @@ -package myplugin -import mill.testkit.ExampleTester -import utest._ - -object ExampleTests extends TestSuite { - - def tests: Tests = Tests { - test("example") { - val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) - ExampleTester.run( - clientServerMode = true, - workspaceSourcePath = resourceFolder / "example-test-project", - millExecutable = os.Path(sys.env("MILL_EXECUTABLE_PATH")) - ) - } - } -} diff --git a/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala b/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala deleted file mode 100644 index 7fc0e055d70..00000000000 --- a/example/misc/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala +++ /dev/null @@ -1,36 +0,0 @@ -package myplugin - -import mill.testkit.{TestBaseModule, UnitTester} -import utest._ - -object UnitTests extends TestSuite { - def tests: Tests = Tests { - test("simple") { - object build extends TestBaseModule with LineCountJavaModule{ - def lineCountResourceFileName = "line-count.txt" - } - - val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) - val eval = UnitTester(build, resourceFolder/ "unit-test-project") - - // Evaluating tasks by direct reference - val Right(result) = eval(build.resources) - assert( - result.value.exists(pathref => - os.exists(pathref.path / "line-count.txt") && - os.read(pathref.path / "line-count.txt") == "17" - ) - ) - - // Evaluating tasks by passing in their Mill selector - val Right(result2) = eval("resources") - val Seq(pathrefs: Seq[mill.api.PathRef]) = result2.value - assert( - pathrefs.exists(pathref => - os.exists(pathref.path / "line-count.txt") && - os.read(pathref.path / "line-count.txt") == "17" - ) - ) - } - } -} diff --git a/example/basic/1-simple/build.sc b/example/scalalib/basic/1-simple/build.sc similarity index 100% rename from example/basic/1-simple/build.sc rename to example/scalalib/basic/1-simple/build.sc diff --git a/example/basic/1-simple/src/Foo.scala b/example/scalalib/basic/1-simple/src/Foo.scala similarity index 100% rename from example/basic/1-simple/src/Foo.scala rename to example/scalalib/basic/1-simple/src/Foo.scala diff --git a/example/basic/1-simple/test/src/FooTests.scala b/example/scalalib/basic/1-simple/test/src/FooTests.scala similarity index 92% rename from example/basic/1-simple/test/src/FooTests.scala rename to example/scalalib/basic/1-simple/test/src/FooTests.scala index c893d7d3f66..33d48636ccc 100644 --- a/example/basic/1-simple/test/src/FooTests.scala +++ b/example/scalalib/basic/1-simple/test/src/FooTests.scala @@ -1,5 +1,4 @@ -package foo -import utest._ + object FooTests extends TestSuite { def tests = Tests { test("simple") { diff --git a/example/basic/2-custom-build-logic/build.sc b/example/scalalib/basic/2-custom-build-logic/build.sc similarity index 100% rename from example/basic/2-custom-build-logic/build.sc rename to example/scalalib/basic/2-custom-build-logic/build.sc diff --git a/example/basic/2-custom-build-logic/src/Foo.scala b/example/scalalib/basic/2-custom-build-logic/src/Foo.scala similarity index 100% rename from example/basic/2-custom-build-logic/src/Foo.scala rename to example/scalalib/basic/2-custom-build-logic/src/Foo.scala diff --git a/example/basic/2-custom-build-logic/test/src/FooTests.scala b/example/scalalib/basic/2-custom-build-logic/test/src/FooTests.scala similarity index 82% rename from example/basic/2-custom-build-logic/test/src/FooTests.scala rename to example/scalalib/basic/2-custom-build-logic/test/src/FooTests.scala index 62dd4d901fb..2af033b9094 100644 --- a/example/basic/2-custom-build-logic/test/src/FooTests.scala +++ b/example/scalalib/basic/2-custom-build-logic/test/src/FooTests.scala @@ -1,5 +1,4 @@ -package foo -import utest._ + object FooTests extends TestSuite { def tests = Tests { test("simple") { diff --git a/example/basic/3-multi-module/bar/src/Bar.scala b/example/scalalib/basic/3-multi-module/bar/src/Bar.scala similarity index 100% rename from example/basic/3-multi-module/bar/src/Bar.scala rename to example/scalalib/basic/3-multi-module/bar/src/Bar.scala diff --git a/example/basic/3-multi-module/bar/test/src/BarTests.scala b/example/scalalib/basic/3-multi-module/bar/test/src/BarTests.scala similarity index 100% rename from example/basic/3-multi-module/bar/test/src/BarTests.scala rename to example/scalalib/basic/3-multi-module/bar/test/src/BarTests.scala diff --git a/example/basic/3-multi-module/build.sc b/example/scalalib/basic/3-multi-module/build.sc similarity index 100% rename from example/basic/3-multi-module/build.sc rename to example/scalalib/basic/3-multi-module/build.sc diff --git a/example/basic/3-multi-module/foo/src/Foo.scala b/example/scalalib/basic/3-multi-module/foo/src/Foo.scala similarity index 100% rename from example/basic/3-multi-module/foo/src/Foo.scala rename to example/scalalib/basic/3-multi-module/foo/src/Foo.scala diff --git a/example/basic/4-builtin-commands/bar/src/Bar.scala b/example/scalalib/basic/4-builtin-commands/bar/src/Bar.scala similarity index 100% rename from example/basic/4-builtin-commands/bar/src/Bar.scala rename to example/scalalib/basic/4-builtin-commands/bar/src/Bar.scala diff --git a/example/basic/4-builtin-commands/build.sc b/example/scalalib/basic/4-builtin-commands/build.sc similarity index 100% rename from example/basic/4-builtin-commands/build.sc rename to example/scalalib/basic/4-builtin-commands/build.sc diff --git a/example/basic/4-builtin-commands/foo/src/Foo.scala b/example/scalalib/basic/4-builtin-commands/foo/src/Foo.scala similarity index 100% rename from example/basic/4-builtin-commands/foo/src/Foo.scala rename to example/scalalib/basic/4-builtin-commands/foo/src/Foo.scala diff --git a/example/basic/5-multiple-test-frameworks/build.sc b/example/scalalib/basic/5-multiple-test-frameworks/build.sc similarity index 100% rename from example/basic/5-multiple-test-frameworks/build.sc rename to example/scalalib/basic/5-multiple-test-frameworks/build.sc diff --git a/example/basic/5-multiple-test-frameworks/src/Foo.scala b/example/scalalib/basic/5-multiple-test-frameworks/src/Foo.scala similarity index 100% rename from example/basic/5-multiple-test-frameworks/src/Foo.scala rename to example/scalalib/basic/5-multiple-test-frameworks/src/Foo.scala diff --git a/example/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala similarity index 87% rename from example/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala rename to example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala index ddba7228dc1..92ee234c58d 100644 --- a/example/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala +++ b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala @@ -1,6 +1,4 @@ -package foo -import org.scalatest.freespec._ class FooScalaTests extends AnyFreeSpec { "Foo" - { diff --git a/example/scalamodule/13-contrib-scoverage/test/src/FooTests.scala b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooTests.scala similarity index 92% rename from example/scalamodule/13-contrib-scoverage/test/src/FooTests.scala rename to example/scalalib/basic/5-multiple-test-frameworks/test/src/FooTests.scala index c893d7d3f66..33d48636ccc 100644 --- a/example/scalamodule/13-contrib-scoverage/test/src/FooTests.scala +++ b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooTests.scala @@ -1,5 +1,4 @@ -package foo -import utest._ + object FooTests extends TestSuite { def tests = Tests { test("simple") { diff --git a/example/scalabuilds/1-common-config/build.sc b/example/scalalib/builds/1-common-config/build.sc similarity index 100% rename from example/scalabuilds/1-common-config/build.sc rename to example/scalalib/builds/1-common-config/build.sc diff --git a/example/scalabuilds/1-common-config/custom-resources/MyOtherResource.txt b/example/scalalib/builds/1-common-config/custom-resources/MyOtherResource.txt similarity index 100% rename from example/scalabuilds/1-common-config/custom-resources/MyOtherResource.txt rename to example/scalalib/builds/1-common-config/custom-resources/MyOtherResource.txt diff --git a/example/scalabuilds/1-common-config/custom-src/Foo2.scala b/example/scalalib/builds/1-common-config/custom-src/Foo2.scala similarity index 100% rename from example/scalabuilds/1-common-config/custom-src/Foo2.scala rename to example/scalalib/builds/1-common-config/custom-src/Foo2.scala diff --git a/example/scalabuilds/1-common-config/resources/MyResource.txt b/example/scalalib/builds/1-common-config/resources/MyResource.txt similarity index 100% rename from example/scalabuilds/1-common-config/resources/MyResource.txt rename to example/scalalib/builds/1-common-config/resources/MyResource.txt diff --git a/example/scalabuilds/1-common-config/src/Foo.scala b/example/scalalib/builds/1-common-config/src/Foo.scala similarity index 100% rename from example/scalabuilds/1-common-config/src/Foo.scala rename to example/scalalib/builds/1-common-config/src/Foo.scala diff --git a/example/scalabuilds/2-custom-tasks/build.sc b/example/scalalib/builds/2-custom-tasks/build.sc similarity index 100% rename from example/scalabuilds/2-custom-tasks/build.sc rename to example/scalalib/builds/2-custom-tasks/build.sc diff --git a/example/scalabuilds/2-custom-tasks/src/Foo.scala b/example/scalalib/builds/2-custom-tasks/src/Foo.scala similarity index 100% rename from example/scalabuilds/2-custom-tasks/src/Foo.scala rename to example/scalalib/builds/2-custom-tasks/src/Foo.scala diff --git a/example/scalabuilds/3-override-tasks/build.sc b/example/scalalib/builds/3-override-tasks/build.sc similarity index 100% rename from example/scalabuilds/3-override-tasks/build.sc rename to example/scalalib/builds/3-override-tasks/build.sc diff --git a/example/scalabuilds/4-nested-modules/baz/src/Baz.scala b/example/scalalib/builds/4-nested-modules/baz/src/Baz.scala similarity index 100% rename from example/scalabuilds/4-nested-modules/baz/src/Baz.scala rename to example/scalalib/builds/4-nested-modules/baz/src/Baz.scala diff --git a/example/scalabuilds/4-nested-modules/build.sc b/example/scalalib/builds/4-nested-modules/build.sc similarity index 100% rename from example/scalabuilds/4-nested-modules/build.sc rename to example/scalalib/builds/4-nested-modules/build.sc diff --git a/example/scalabuilds/4-nested-modules/foo/bar/src/Bar.scala b/example/scalalib/builds/4-nested-modules/foo/bar/src/Bar.scala similarity index 100% rename from example/scalabuilds/4-nested-modules/foo/bar/src/Bar.scala rename to example/scalalib/builds/4-nested-modules/foo/bar/src/Bar.scala diff --git a/example/scalabuilds/4-nested-modules/foo/qux/src/Qux.scala b/example/scalalib/builds/4-nested-modules/foo/qux/src/Qux.scala similarity index 100% rename from example/scalabuilds/4-nested-modules/foo/qux/src/Qux.scala rename to example/scalalib/builds/4-nested-modules/foo/qux/src/Qux.scala diff --git a/example/scalabuilds/4-nested-modules/foo/src/Foo.scala b/example/scalalib/builds/4-nested-modules/foo/src/Foo.scala similarity index 100% rename from example/scalabuilds/4-nested-modules/foo/src/Foo.scala rename to example/scalalib/builds/4-nested-modules/foo/src/Foo.scala diff --git a/example/scalabuilds/6-publish-module/build.sc b/example/scalalib/builds/6-publish-module/build.sc similarity index 100% rename from example/scalabuilds/6-publish-module/build.sc rename to example/scalalib/builds/6-publish-module/build.sc diff --git a/example/scalabuilds/6-publish-module/foo/src/Foo.scala b/example/scalalib/builds/6-publish-module/foo/src/Foo.scala similarity index 100% rename from example/scalabuilds/6-publish-module/foo/src/Foo.scala rename to example/scalalib/builds/6-publish-module/foo/src/Foo.scala diff --git a/example/scalabuilds/7-cross-scala-version/bar/src/Bar.scala b/example/scalalib/builds/7-cross-scala-version/bar/src/Bar.scala similarity index 100% rename from example/scalabuilds/7-cross-scala-version/bar/src/Bar.scala rename to example/scalalib/builds/7-cross-scala-version/bar/src/Bar.scala diff --git a/example/scalabuilds/7-cross-scala-version/build.sc b/example/scalalib/builds/7-cross-scala-version/build.sc similarity index 100% rename from example/scalabuilds/7-cross-scala-version/build.sc rename to example/scalalib/builds/7-cross-scala-version/build.sc diff --git a/example/scalabuilds/7-cross-scala-version/foo/src-2.12/MinorVersionSpecific.scala b/example/scalalib/builds/7-cross-scala-version/foo/src-2.12/MinorVersionSpecific.scala similarity index 100% rename from example/scalabuilds/7-cross-scala-version/foo/src-2.12/MinorVersionSpecific.scala rename to example/scalalib/builds/7-cross-scala-version/foo/src-2.12/MinorVersionSpecific.scala diff --git a/example/scalabuilds/7-cross-scala-version/foo/src-2.13/MinorVersionSpecific.scala b/example/scalalib/builds/7-cross-scala-version/foo/src-2.13/MinorVersionSpecific.scala similarity index 100% rename from example/scalabuilds/7-cross-scala-version/foo/src-2.13/MinorVersionSpecific.scala rename to example/scalalib/builds/7-cross-scala-version/foo/src-2.13/MinorVersionSpecific.scala diff --git a/example/scalabuilds/7-cross-scala-version/foo/src-2/MajorVersionSpecific.scala b/example/scalalib/builds/7-cross-scala-version/foo/src-2/MajorVersionSpecific.scala similarity index 100% rename from example/scalabuilds/7-cross-scala-version/foo/src-2/MajorVersionSpecific.scala rename to example/scalalib/builds/7-cross-scala-version/foo/src-2/MajorVersionSpecific.scala diff --git a/example/scalabuilds/7-cross-scala-version/foo/src-3.2/MinorVersionSpecific.scala b/example/scalalib/builds/7-cross-scala-version/foo/src-3.2/MinorVersionSpecific.scala similarity index 100% rename from example/scalabuilds/7-cross-scala-version/foo/src-3.2/MinorVersionSpecific.scala rename to example/scalalib/builds/7-cross-scala-version/foo/src-3.2/MinorVersionSpecific.scala diff --git a/example/scalabuilds/7-cross-scala-version/foo/src-3/MajorVersionSpecific.scala b/example/scalalib/builds/7-cross-scala-version/foo/src-3/MajorVersionSpecific.scala similarity index 100% rename from example/scalabuilds/7-cross-scala-version/foo/src-3/MajorVersionSpecific.scala rename to example/scalalib/builds/7-cross-scala-version/foo/src-3/MajorVersionSpecific.scala diff --git a/example/scalabuilds/7-cross-scala-version/foo/src/Foo.scala b/example/scalalib/builds/7-cross-scala-version/foo/src/Foo.scala similarity index 100% rename from example/scalabuilds/7-cross-scala-version/foo/src/Foo.scala rename to example/scalalib/builds/7-cross-scala-version/foo/src/Foo.scala diff --git a/example/scalabuilds/8-compat-modules/bar/src/main/scala-2.12/MinorVersionSpecific.scala b/example/scalalib/builds/8-compat-modules/bar/src/main/scala-2.12/MinorVersionSpecific.scala similarity index 100% rename from example/scalabuilds/8-compat-modules/bar/src/main/scala-2.12/MinorVersionSpecific.scala rename to example/scalalib/builds/8-compat-modules/bar/src/main/scala-2.12/MinorVersionSpecific.scala diff --git a/example/scalabuilds/8-compat-modules/bar/src/main/scala-2.13/MinorVersionSpecific.scala b/example/scalalib/builds/8-compat-modules/bar/src/main/scala-2.13/MinorVersionSpecific.scala similarity index 100% rename from example/scalabuilds/8-compat-modules/bar/src/main/scala-2.13/MinorVersionSpecific.scala rename to example/scalalib/builds/8-compat-modules/bar/src/main/scala-2.13/MinorVersionSpecific.scala diff --git a/example/scalabuilds/8-compat-modules/bar/src/main/scala/Bar.scala b/example/scalalib/builds/8-compat-modules/bar/src/main/scala/Bar.scala similarity index 100% rename from example/scalabuilds/8-compat-modules/bar/src/main/scala/Bar.scala rename to example/scalalib/builds/8-compat-modules/bar/src/main/scala/Bar.scala diff --git a/example/scalabuilds/8-compat-modules/build.sc b/example/scalalib/builds/8-compat-modules/build.sc similarity index 100% rename from example/scalabuilds/8-compat-modules/build.sc rename to example/scalalib/builds/8-compat-modules/build.sc diff --git a/example/scalabuilds/8-compat-modules/foo/src/main/scala/Foo.scala b/example/scalalib/builds/8-compat-modules/foo/src/main/scala/Foo.scala similarity index 100% rename from example/scalabuilds/8-compat-modules/foo/src/main/scala/Foo.scala rename to example/scalalib/builds/8-compat-modules/foo/src/main/scala/Foo.scala diff --git a/example/scalabuilds/8-compat-modules/foo/src/test/scala/FooTests.scala b/example/scalalib/builds/8-compat-modules/foo/src/test/scala/FooTests.scala similarity index 100% rename from example/scalabuilds/8-compat-modules/foo/src/test/scala/FooTests.scala rename to example/scalalib/builds/8-compat-modules/foo/src/test/scala/FooTests.scala diff --git a/example/scalabuilds/9-realistic/bar/src-2/BarVersionSpecific.scala b/example/scalalib/builds/9-realistic/bar/src-2/BarVersionSpecific.scala similarity index 100% rename from example/scalabuilds/9-realistic/bar/src-2/BarVersionSpecific.scala rename to example/scalalib/builds/9-realistic/bar/src-2/BarVersionSpecific.scala diff --git a/example/scalabuilds/9-realistic/bar/src-3/BarVersionSpecific.scala b/example/scalalib/builds/9-realistic/bar/src-3/BarVersionSpecific.scala similarity index 100% rename from example/scalabuilds/9-realistic/bar/src-3/BarVersionSpecific.scala rename to example/scalalib/builds/9-realistic/bar/src-3/BarVersionSpecific.scala diff --git a/example/scalabuilds/9-realistic/bar/src/Bar.scala b/example/scalalib/builds/9-realistic/bar/src/Bar.scala similarity index 100% rename from example/scalabuilds/9-realistic/bar/src/Bar.scala rename to example/scalalib/builds/9-realistic/bar/src/Bar.scala diff --git a/example/scalabuilds/9-realistic/bar/test/src-2/BarVersionSpecificTests.scala b/example/scalalib/builds/9-realistic/bar/test/src-2/BarVersionSpecificTests.scala similarity index 100% rename from example/scalabuilds/9-realistic/bar/test/src-2/BarVersionSpecificTests.scala rename to example/scalalib/builds/9-realistic/bar/test/src-2/BarVersionSpecificTests.scala diff --git a/example/scalabuilds/9-realistic/bar/test/src-3/BarVersionSpecificTests.scala b/example/scalalib/builds/9-realistic/bar/test/src-3/BarVersionSpecificTests.scala similarity index 100% rename from example/scalabuilds/9-realistic/bar/test/src-3/BarVersionSpecificTests.scala rename to example/scalalib/builds/9-realistic/bar/test/src-3/BarVersionSpecificTests.scala diff --git a/example/scalabuilds/9-realistic/bar/test/src/BarTests.scala b/example/scalalib/builds/9-realistic/bar/test/src/BarTests.scala similarity index 100% rename from example/scalabuilds/9-realistic/bar/test/src/BarTests.scala rename to example/scalalib/builds/9-realistic/bar/test/src/BarTests.scala diff --git a/example/scalabuilds/9-realistic/build.sc b/example/scalalib/builds/9-realistic/build.sc similarity index 100% rename from example/scalabuilds/9-realistic/build.sc rename to example/scalalib/builds/9-realistic/build.sc diff --git a/example/scalabuilds/9-realistic/foo/src/Foo.scala b/example/scalalib/builds/9-realistic/foo/src/Foo.scala similarity index 100% rename from example/scalabuilds/9-realistic/foo/src/Foo.scala rename to example/scalalib/builds/9-realistic/foo/src/Foo.scala diff --git a/example/scalabuilds/9-realistic/foo/test/src/FooTests.scala b/example/scalalib/builds/9-realistic/foo/test/src/FooTests.scala similarity index 100% rename from example/scalabuilds/9-realistic/foo/test/src/FooTests.scala rename to example/scalalib/builds/9-realistic/foo/test/src/FooTests.scala diff --git a/example/scalabuilds/9-realistic/qux/src/Qux.java b/example/scalalib/builds/9-realistic/qux/src/Qux.java similarity index 100% rename from example/scalabuilds/9-realistic/qux/src/Qux.java rename to example/scalalib/builds/9-realistic/qux/src/Qux.java diff --git a/example/scalamodule/1-compilation-execution-flags/build.sc b/example/scalalib/module/1-compilation-execution-flags/build.sc similarity index 100% rename from example/scalamodule/1-compilation-execution-flags/build.sc rename to example/scalalib/module/1-compilation-execution-flags/build.sc diff --git a/example/scalamodule/1-compilation-execution-flags/src/Foo.scala b/example/scalalib/module/1-compilation-execution-flags/src/Foo.scala similarity index 100% rename from example/scalamodule/1-compilation-execution-flags/src/Foo.scala rename to example/scalalib/module/1-compilation-execution-flags/src/Foo.scala diff --git a/example/scalamodule/10-downloading-non-maven-jars/build.sc b/example/scalalib/module/10-downloading-non-maven-jars/build.sc similarity index 100% rename from example/scalamodule/10-downloading-non-maven-jars/build.sc rename to example/scalalib/module/10-downloading-non-maven-jars/build.sc diff --git a/example/scalamodule/10-downloading-non-maven-jars/src/Foo.scala b/example/scalalib/module/10-downloading-non-maven-jars/src/Foo.scala similarity index 100% rename from example/scalamodule/10-downloading-non-maven-jars/src/Foo.scala rename to example/scalalib/module/10-downloading-non-maven-jars/src/Foo.scala diff --git a/example/scalamodule/10-downloading-non-maven-jars/textfile.txt b/example/scalalib/module/10-downloading-non-maven-jars/textfile.txt similarity index 100% rename from example/scalamodule/10-downloading-non-maven-jars/textfile.txt rename to example/scalalib/module/10-downloading-non-maven-jars/textfile.txt diff --git a/example/scalamodule/11-assembly-config/bar/resources/application.conf b/example/scalalib/module/11-assembly-config/bar/resources/application.conf similarity index 100% rename from example/scalamodule/11-assembly-config/bar/resources/application.conf rename to example/scalalib/module/11-assembly-config/bar/resources/application.conf diff --git a/example/scalamodule/11-assembly-config/build.sc b/example/scalalib/module/11-assembly-config/build.sc similarity index 100% rename from example/scalamodule/11-assembly-config/build.sc rename to example/scalalib/module/11-assembly-config/build.sc diff --git a/example/scalamodule/11-assembly-config/foo/resources/application.conf b/example/scalalib/module/11-assembly-config/foo/resources/application.conf similarity index 100% rename from example/scalamodule/11-assembly-config/foo/resources/application.conf rename to example/scalalib/module/11-assembly-config/foo/resources/application.conf diff --git a/example/scalamodule/11-assembly-config/foo/src/Foo.scala b/example/scalalib/module/11-assembly-config/foo/src/Foo.scala similarity index 100% rename from example/scalamodule/11-assembly-config/foo/src/Foo.scala rename to example/scalalib/module/11-assembly-config/foo/src/Foo.scala diff --git a/example/scalamodule/12-repository-config/build.sc b/example/scalalib/module/12-repository-config/build.sc similarity index 100% rename from example/scalamodule/12-repository-config/build.sc rename to example/scalalib/module/12-repository-config/build.sc diff --git a/example/scalamodule/12-repository-config/foo/src/Foo.scala b/example/scalalib/module/12-repository-config/foo/src/Foo.scala similarity index 100% rename from example/scalamodule/12-repository-config/foo/src/Foo.scala rename to example/scalalib/module/12-repository-config/foo/src/Foo.scala diff --git a/example/scalamodule/13-contrib-scoverage/build.sc b/example/scalalib/module/13-contrib-scoverage/build.sc similarity index 100% rename from example/scalamodule/13-contrib-scoverage/build.sc rename to example/scalalib/module/13-contrib-scoverage/build.sc diff --git a/example/scalamodule/13-contrib-scoverage/src/Foo.scala b/example/scalalib/module/13-contrib-scoverage/src/Foo.scala similarity index 100% rename from example/scalamodule/13-contrib-scoverage/src/Foo.scala rename to example/scalalib/module/13-contrib-scoverage/src/Foo.scala diff --git a/example/basic/5-multiple-test-frameworks/test/src/FooTests.scala b/example/scalalib/module/13-contrib-scoverage/test/src/FooTests.scala similarity index 92% rename from example/basic/5-multiple-test-frameworks/test/src/FooTests.scala rename to example/scalalib/module/13-contrib-scoverage/test/src/FooTests.scala index c893d7d3f66..33d48636ccc 100644 --- a/example/basic/5-multiple-test-frameworks/test/src/FooTests.scala +++ b/example/scalalib/module/13-contrib-scoverage/test/src/FooTests.scala @@ -1,5 +1,4 @@ -package foo -import utest._ + object FooTests extends TestSuite { def tests = Tests { test("simple") { diff --git a/example/scalamodule/14-unidoc/build.sc b/example/scalalib/module/14-unidoc/build.sc similarity index 100% rename from example/scalamodule/14-unidoc/build.sc rename to example/scalalib/module/14-unidoc/build.sc diff --git a/example/scalamodule/14-unidoc/foo/bar/src/Bar.scala b/example/scalalib/module/14-unidoc/foo/bar/src/Bar.scala similarity index 100% rename from example/scalamodule/14-unidoc/foo/bar/src/Bar.scala rename to example/scalalib/module/14-unidoc/foo/bar/src/Bar.scala diff --git a/example/scalamodule/14-unidoc/foo/qux/src/Qux.scala b/example/scalalib/module/14-unidoc/foo/qux/src/Qux.scala similarity index 100% rename from example/scalamodule/14-unidoc/foo/qux/src/Qux.scala rename to example/scalalib/module/14-unidoc/foo/qux/src/Qux.scala diff --git a/example/scalamodule/14-unidoc/foo/src/Foo.scala b/example/scalalib/module/14-unidoc/foo/src/Foo.scala similarity index 100% rename from example/scalamodule/14-unidoc/foo/src/Foo.scala rename to example/scalalib/module/14-unidoc/foo/src/Foo.scala diff --git a/example/scalamodule/2-ivy-deps/build.sc b/example/scalalib/module/2-ivy-deps/build.sc similarity index 100% rename from example/scalamodule/2-ivy-deps/build.sc rename to example/scalalib/module/2-ivy-deps/build.sc diff --git a/example/scalamodule/2-ivy-deps/src/Foo.scala b/example/scalalib/module/2-ivy-deps/src/Foo.scala similarity index 100% rename from example/scalamodule/2-ivy-deps/src/Foo.scala rename to example/scalalib/module/2-ivy-deps/src/Foo.scala diff --git a/example/scalamodule/3-run-compile-deps/bar/src/Bar.scala b/example/scalalib/module/3-run-compile-deps/bar/src/Bar.scala similarity index 100% rename from example/scalamodule/3-run-compile-deps/bar/src/Bar.scala rename to example/scalalib/module/3-run-compile-deps/bar/src/Bar.scala diff --git a/example/scalamodule/3-run-compile-deps/build.sc b/example/scalalib/module/3-run-compile-deps/build.sc similarity index 100% rename from example/scalamodule/3-run-compile-deps/build.sc rename to example/scalalib/module/3-run-compile-deps/build.sc diff --git a/example/scalamodule/3-run-compile-deps/foo/src/Foo.scala b/example/scalalib/module/3-run-compile-deps/foo/src/Foo.scala similarity index 100% rename from example/scalamodule/3-run-compile-deps/foo/src/Foo.scala rename to example/scalalib/module/3-run-compile-deps/foo/src/Foo.scala diff --git a/example/scalamodule/5-resources/build.sc b/example/scalalib/module/5-resources/build.sc similarity index 100% rename from example/scalamodule/5-resources/build.sc rename to example/scalalib/module/5-resources/build.sc diff --git a/example/scalamodule/5-resources/foo/resources/file.txt b/example/scalalib/module/5-resources/foo/resources/file.txt similarity index 100% rename from example/scalamodule/5-resources/foo/resources/file.txt rename to example/scalalib/module/5-resources/foo/resources/file.txt diff --git a/example/scalamodule/5-resources/foo/src/Foo.scala b/example/scalalib/module/5-resources/foo/src/Foo.scala similarity index 100% rename from example/scalamodule/5-resources/foo/src/Foo.scala rename to example/scalalib/module/5-resources/foo/src/Foo.scala diff --git a/example/scalamodule/5-resources/foo/test/other-files/other-file.txt b/example/scalalib/module/5-resources/foo/test/other-files/other-file.txt similarity index 100% rename from example/scalamodule/5-resources/foo/test/other-files/other-file.txt rename to example/scalalib/module/5-resources/foo/test/other-files/other-file.txt diff --git a/example/scalamodule/5-resources/foo/test/resources/test-file-a.txt b/example/scalalib/module/5-resources/foo/test/resources/test-file-a.txt similarity index 100% rename from example/scalamodule/5-resources/foo/test/resources/test-file-a.txt rename to example/scalalib/module/5-resources/foo/test/resources/test-file-a.txt diff --git a/example/scalamodule/5-resources/foo/test/resources/test-file-b.txt b/example/scalalib/module/5-resources/foo/test/resources/test-file-b.txt similarity index 100% rename from example/scalamodule/5-resources/foo/test/resources/test-file-b.txt rename to example/scalalib/module/5-resources/foo/test/resources/test-file-b.txt diff --git a/example/scalamodule/5-resources/foo/test/src/FooTests.scala b/example/scalalib/module/5-resources/foo/test/src/FooTests.scala similarity index 100% rename from example/scalamodule/5-resources/foo/test/src/FooTests.scala rename to example/scalalib/module/5-resources/foo/test/src/FooTests.scala diff --git a/example/scalamodule/6-scala-compiler-plugins/build.sc b/example/scalalib/module/6-scala-compiler-plugins/build.sc similarity index 100% rename from example/scalamodule/6-scala-compiler-plugins/build.sc rename to example/scalalib/module/6-scala-compiler-plugins/build.sc diff --git a/example/scalamodule/6-scala-compiler-plugins/src/Bar.scala b/example/scalalib/module/6-scala-compiler-plugins/src/Bar.scala similarity index 100% rename from example/scalamodule/6-scala-compiler-plugins/src/Bar.scala rename to example/scalalib/module/6-scala-compiler-plugins/src/Bar.scala diff --git a/example/scalamodule/6-scala-compiler-plugins/src/Foo.scala b/example/scalalib/module/6-scala-compiler-plugins/src/Foo.scala similarity index 100% rename from example/scalamodule/6-scala-compiler-plugins/src/Foo.scala rename to example/scalalib/module/6-scala-compiler-plugins/src/Foo.scala diff --git a/example/scalamodule/7-docjar/bar/src/Bar.scala b/example/scalalib/module/7-docjar/bar/src/Bar.scala similarity index 100% rename from example/scalamodule/7-docjar/bar/src/Bar.scala rename to example/scalalib/module/7-docjar/bar/src/Bar.scala diff --git a/example/scalamodule/7-docjar/build.sc b/example/scalalib/module/7-docjar/build.sc similarity index 100% rename from example/scalamodule/7-docjar/build.sc rename to example/scalalib/module/7-docjar/build.sc diff --git a/example/scalamodule/7-docjar/foo/src/Foo.scala b/example/scalalib/module/7-docjar/foo/src/Foo.scala similarity index 100% rename from example/scalamodule/7-docjar/foo/src/Foo.scala rename to example/scalalib/module/7-docjar/foo/src/Foo.scala diff --git a/example/scalamodule/8-unmanaged-jars/build.sc b/example/scalalib/module/8-unmanaged-jars/build.sc similarity index 100% rename from example/scalamodule/8-unmanaged-jars/build.sc rename to example/scalalib/module/8-unmanaged-jars/build.sc diff --git a/example/scalamodule/8-unmanaged-jars/lib/nanojson-1.8.jar b/example/scalalib/module/8-unmanaged-jars/lib/nanojson-1.8.jar similarity index 100% rename from example/scalamodule/8-unmanaged-jars/lib/nanojson-1.8.jar rename to example/scalalib/module/8-unmanaged-jars/lib/nanojson-1.8.jar diff --git a/example/scalamodule/8-unmanaged-jars/src/Foo.scala b/example/scalalib/module/8-unmanaged-jars/src/Foo.scala similarity index 100% rename from example/scalamodule/8-unmanaged-jars/src/Foo.scala rename to example/scalalib/module/8-unmanaged-jars/src/Foo.scala diff --git a/example/scalamodule/9-main-class/build.sc b/example/scalalib/module/9-main-class/build.sc similarity index 100% rename from example/scalamodule/9-main-class/build.sc rename to example/scalalib/module/9-main-class/build.sc diff --git a/example/scalamodule/9-main-class/src/Bar.scala b/example/scalalib/module/9-main-class/src/Bar.scala similarity index 100% rename from example/scalamodule/9-main-class/src/Bar.scala rename to example/scalalib/module/9-main-class/src/Bar.scala diff --git a/example/scalamodule/9-main-class/src/Foo.scala b/example/scalalib/module/9-main-class/src/Foo.scala similarity index 100% rename from example/scalamodule/9-main-class/src/Foo.scala rename to example/scalalib/module/9-main-class/src/Foo.scala diff --git a/example/scalamodule/9-main-class/src/Qux.scala b/example/scalalib/module/9-main-class/src/Qux.scala similarity index 100% rename from example/scalamodule/9-main-class/src/Qux.scala rename to example/scalalib/module/9-main-class/src/Qux.scala diff --git a/example/scalatesting/1-test-suite/bar/src/Bar.scala b/example/scalalib/testing/1-test-suite/bar/src/Bar.scala similarity index 100% rename from example/scalatesting/1-test-suite/bar/src/Bar.scala rename to example/scalalib/testing/1-test-suite/bar/src/Bar.scala diff --git a/example/scalatesting/1-test-suite/bar/test/src/BarTests.scala b/example/scalalib/testing/1-test-suite/bar/test/src/BarTests.scala similarity index 100% rename from example/scalatesting/1-test-suite/bar/test/src/BarTests.scala rename to example/scalalib/testing/1-test-suite/bar/test/src/BarTests.scala diff --git a/example/scalatesting/1-test-suite/build.sc b/example/scalalib/testing/1-test-suite/build.sc similarity index 100% rename from example/scalatesting/1-test-suite/build.sc rename to example/scalalib/testing/1-test-suite/build.sc diff --git a/example/scalatesting/1-test-suite/foo/src/Foo.scala b/example/scalalib/testing/1-test-suite/foo/src/Foo.scala similarity index 100% rename from example/scalatesting/1-test-suite/foo/src/Foo.scala rename to example/scalalib/testing/1-test-suite/foo/src/Foo.scala diff --git a/example/scalatesting/1-test-suite/foo/test/src/FooTests.scala b/example/scalalib/testing/1-test-suite/foo/test/src/FooTests.scala similarity index 100% rename from example/scalatesting/1-test-suite/foo/test/src/FooTests.scala rename to example/scalalib/testing/1-test-suite/foo/test/src/FooTests.scala diff --git a/example/scalatesting/2-test-deps/baz/src/Baz.scala b/example/scalalib/testing/2-test-deps/baz/src/Baz.scala similarity index 100% rename from example/scalatesting/2-test-deps/baz/src/Baz.scala rename to example/scalalib/testing/2-test-deps/baz/src/Baz.scala diff --git a/example/scalatesting/2-test-deps/baz/test/src/BazTestUtils.scala b/example/scalalib/testing/2-test-deps/baz/test/src/BazTestUtils.scala similarity index 100% rename from example/scalatesting/2-test-deps/baz/test/src/BazTestUtils.scala rename to example/scalalib/testing/2-test-deps/baz/test/src/BazTestUtils.scala diff --git a/example/scalatesting/2-test-deps/baz/test/src/BazTests.scala b/example/scalalib/testing/2-test-deps/baz/test/src/BazTests.scala similarity index 100% rename from example/scalatesting/2-test-deps/baz/test/src/BazTests.scala rename to example/scalalib/testing/2-test-deps/baz/test/src/BazTests.scala diff --git a/example/scalatesting/2-test-deps/build.sc b/example/scalalib/testing/2-test-deps/build.sc similarity index 100% rename from example/scalatesting/2-test-deps/build.sc rename to example/scalalib/testing/2-test-deps/build.sc diff --git a/example/scalatesting/2-test-deps/qux/src/Qux.scala b/example/scalalib/testing/2-test-deps/qux/src/Qux.scala similarity index 100% rename from example/scalatesting/2-test-deps/qux/src/Qux.scala rename to example/scalalib/testing/2-test-deps/qux/src/Qux.scala diff --git a/example/scalatesting/2-test-deps/qux/test/src/QuxTests.scala b/example/scalalib/testing/2-test-deps/qux/test/src/QuxTests.scala similarity index 100% rename from example/scalatesting/2-test-deps/qux/test/src/QuxTests.scala rename to example/scalalib/testing/2-test-deps/qux/test/src/QuxTests.scala diff --git a/example/scalatesting/3-integration-suite/build.sc b/example/scalalib/testing/3-integration-suite/build.sc similarity index 100% rename from example/scalatesting/3-integration-suite/build.sc rename to example/scalalib/testing/3-integration-suite/build.sc diff --git a/example/scalatesting/3-integration-suite/qux/integration/src/QuxTests.scala b/example/scalalib/testing/3-integration-suite/qux/integration/src/QuxTests.scala similarity index 100% rename from example/scalatesting/3-integration-suite/qux/integration/src/QuxTests.scala rename to example/scalalib/testing/3-integration-suite/qux/integration/src/QuxTests.scala diff --git a/example/scalatesting/3-integration-suite/qux/src/Qux.scala b/example/scalalib/testing/3-integration-suite/qux/src/Qux.scala similarity index 100% rename from example/scalatesting/3-integration-suite/qux/src/Qux.scala rename to example/scalalib/testing/3-integration-suite/qux/src/Qux.scala diff --git a/example/scalatesting/3-integration-suite/qux/test/src/QuxTests.scala b/example/scalalib/testing/3-integration-suite/qux/test/src/QuxTests.scala similarity index 100% rename from example/scalatesting/3-integration-suite/qux/test/src/QuxTests.scala rename to example/scalalib/testing/3-integration-suite/qux/test/src/QuxTests.scala diff --git a/example/web/1-todo-webapp/build.sc b/example/scalalib/web/1-todo-webapp/build.sc similarity index 100% rename from example/web/1-todo-webapp/build.sc rename to example/scalalib/web/1-todo-webapp/build.sc diff --git a/example/web/1-todo-webapp/resources/webapp/index.css b/example/scalalib/web/1-todo-webapp/resources/webapp/index.css similarity index 100% rename from example/web/1-todo-webapp/resources/webapp/index.css rename to example/scalalib/web/1-todo-webapp/resources/webapp/index.css diff --git a/example/web/1-todo-webapp/resources/webapp/main.js b/example/scalalib/web/1-todo-webapp/resources/webapp/main.js similarity index 100% rename from example/web/1-todo-webapp/resources/webapp/main.js rename to example/scalalib/web/1-todo-webapp/resources/webapp/main.js diff --git a/example/web/1-todo-webapp/src/WebApp.scala b/example/scalalib/web/1-todo-webapp/src/WebApp.scala similarity index 100% rename from example/web/1-todo-webapp/src/WebApp.scala rename to example/scalalib/web/1-todo-webapp/src/WebApp.scala diff --git a/example/web/1-todo-webapp/test/src/WebAppTests.scala b/example/scalalib/web/1-todo-webapp/test/src/WebAppTests.scala similarity index 94% rename from example/web/1-todo-webapp/test/src/WebAppTests.scala rename to example/scalalib/web/1-todo-webapp/test/src/WebAppTests.scala index 2aa948961ab..7e8f7b79d69 100644 --- a/example/web/1-todo-webapp/test/src/WebAppTests.scala +++ b/example/scalalib/web/1-todo-webapp/test/src/WebAppTests.scala @@ -1,6 +1,4 @@ -package webapp -import utest._ object WebAppTests extends TestSuite { def withServer[T](example: cask.main.Main)(f: String => T): T = { diff --git a/example/web/2-webapp-cache-busting/build.sc b/example/scalalib/web/2-webapp-cache-busting/build.sc similarity index 100% rename from example/web/2-webapp-cache-busting/build.sc rename to example/scalalib/web/2-webapp-cache-busting/build.sc diff --git a/example/web/2-webapp-cache-busting/resources/webapp/index.css b/example/scalalib/web/2-webapp-cache-busting/resources/webapp/index.css similarity index 100% rename from example/web/2-webapp-cache-busting/resources/webapp/index.css rename to example/scalalib/web/2-webapp-cache-busting/resources/webapp/index.css diff --git a/example/web/2-webapp-cache-busting/resources/webapp/main.js b/example/scalalib/web/2-webapp-cache-busting/resources/webapp/main.js similarity index 100% rename from example/web/2-webapp-cache-busting/resources/webapp/main.js rename to example/scalalib/web/2-webapp-cache-busting/resources/webapp/main.js diff --git a/example/web/2-webapp-cache-busting/src/WebApp.scala b/example/scalalib/web/2-webapp-cache-busting/src/WebApp.scala similarity index 100% rename from example/web/2-webapp-cache-busting/src/WebApp.scala rename to example/scalalib/web/2-webapp-cache-busting/src/WebApp.scala diff --git a/example/web/5-webapp-scalajs-shared/test/src/WebAppTests.scala b/example/scalalib/web/2-webapp-cache-busting/test/src/WebAppTests.scala similarity index 94% rename from example/web/5-webapp-scalajs-shared/test/src/WebAppTests.scala rename to example/scalalib/web/2-webapp-cache-busting/test/src/WebAppTests.scala index 2aa948961ab..7e8f7b79d69 100644 --- a/example/web/5-webapp-scalajs-shared/test/src/WebAppTests.scala +++ b/example/scalalib/web/2-webapp-cache-busting/test/src/WebAppTests.scala @@ -1,6 +1,4 @@ -package webapp -import utest._ object WebAppTests extends TestSuite { def withServer[T](example: cask.main.Main)(f: String => T): T = { diff --git a/example/web/3-scalajs-module/build.sc b/example/scalalib/web/3-scalajs-module/build.sc similarity index 100% rename from example/web/3-scalajs-module/build.sc rename to example/scalalib/web/3-scalajs-module/build.sc diff --git a/example/web/3-scalajs-module/foo/src/Foo.scala b/example/scalalib/web/3-scalajs-module/foo/src/Foo.scala similarity index 100% rename from example/web/3-scalajs-module/foo/src/Foo.scala rename to example/scalalib/web/3-scalajs-module/foo/src/Foo.scala diff --git a/example/web/3-scalajs-module/foo/test/src/FooTests.scala b/example/scalalib/web/3-scalajs-module/foo/test/src/FooTests.scala similarity index 100% rename from example/web/3-scalajs-module/foo/test/src/FooTests.scala rename to example/scalalib/web/3-scalajs-module/foo/test/src/FooTests.scala diff --git a/example/web/4-webapp-scalajs/build.sc b/example/scalalib/web/4-webapp-scalajs/build.sc similarity index 100% rename from example/web/4-webapp-scalajs/build.sc rename to example/scalalib/web/4-webapp-scalajs/build.sc diff --git a/example/web/4-webapp-scalajs/client/src/ClientApp.scala b/example/scalalib/web/4-webapp-scalajs/client/src/ClientApp.scala similarity index 100% rename from example/web/4-webapp-scalajs/client/src/ClientApp.scala rename to example/scalalib/web/4-webapp-scalajs/client/src/ClientApp.scala diff --git a/example/web/4-webapp-scalajs/resources/webapp/index.css b/example/scalalib/web/4-webapp-scalajs/resources/webapp/index.css similarity index 100% rename from example/web/4-webapp-scalajs/resources/webapp/index.css rename to example/scalalib/web/4-webapp-scalajs/resources/webapp/index.css diff --git a/example/web/4-webapp-scalajs/src/WebApp.scala b/example/scalalib/web/4-webapp-scalajs/src/WebApp.scala similarity index 100% rename from example/web/4-webapp-scalajs/src/WebApp.scala rename to example/scalalib/web/4-webapp-scalajs/src/WebApp.scala diff --git a/example/web/2-webapp-cache-busting/test/src/WebAppTests.scala b/example/scalalib/web/4-webapp-scalajs/test/src/WebAppTests.scala similarity index 94% rename from example/web/2-webapp-cache-busting/test/src/WebAppTests.scala rename to example/scalalib/web/4-webapp-scalajs/test/src/WebAppTests.scala index 2aa948961ab..7e8f7b79d69 100644 --- a/example/web/2-webapp-cache-busting/test/src/WebAppTests.scala +++ b/example/scalalib/web/4-webapp-scalajs/test/src/WebAppTests.scala @@ -1,6 +1,4 @@ -package webapp -import utest._ object WebAppTests extends TestSuite { def withServer[T](example: cask.main.Main)(f: String => T): T = { diff --git a/example/web/5-webapp-scalajs-shared/build.sc b/example/scalalib/web/5-webapp-scalajs-shared/build.sc similarity index 100% rename from example/web/5-webapp-scalajs-shared/build.sc rename to example/scalalib/web/5-webapp-scalajs-shared/build.sc diff --git a/example/web/5-webapp-scalajs-shared/client/src/ClientApp.scala b/example/scalalib/web/5-webapp-scalajs-shared/client/src/ClientApp.scala similarity index 100% rename from example/web/5-webapp-scalajs-shared/client/src/ClientApp.scala rename to example/scalalib/web/5-webapp-scalajs-shared/client/src/ClientApp.scala diff --git a/example/web/5-webapp-scalajs-shared/resources/webapp/index.css b/example/scalalib/web/5-webapp-scalajs-shared/resources/webapp/index.css similarity index 100% rename from example/web/5-webapp-scalajs-shared/resources/webapp/index.css rename to example/scalalib/web/5-webapp-scalajs-shared/resources/webapp/index.css diff --git a/example/web/5-webapp-scalajs-shared/shared/src/Shared.scala b/example/scalalib/web/5-webapp-scalajs-shared/shared/src/Shared.scala similarity index 100% rename from example/web/5-webapp-scalajs-shared/shared/src/Shared.scala rename to example/scalalib/web/5-webapp-scalajs-shared/shared/src/Shared.scala diff --git a/example/web/5-webapp-scalajs-shared/src/WebApp.scala b/example/scalalib/web/5-webapp-scalajs-shared/src/WebApp.scala similarity index 100% rename from example/web/5-webapp-scalajs-shared/src/WebApp.scala rename to example/scalalib/web/5-webapp-scalajs-shared/src/WebApp.scala diff --git a/example/web/4-webapp-scalajs/test/src/WebAppTests.scala b/example/scalalib/web/5-webapp-scalajs-shared/test/src/WebAppTests.scala similarity index 94% rename from example/web/4-webapp-scalajs/test/src/WebAppTests.scala rename to example/scalalib/web/5-webapp-scalajs-shared/test/src/WebAppTests.scala index 2aa948961ab..7e8f7b79d69 100644 --- a/example/web/4-webapp-scalajs/test/src/WebAppTests.scala +++ b/example/scalalib/web/5-webapp-scalajs-shared/test/src/WebAppTests.scala @@ -1,6 +1,4 @@ -package webapp -import utest._ object WebAppTests extends TestSuite { def withServer[T](example: cask.main.Main)(f: String => T): T = { diff --git a/example/web/6-cross-version-platform-publishing/build.sc b/example/scalalib/web/6-cross-version-platform-publishing/build.sc similarity index 100% rename from example/web/6-cross-version-platform-publishing/build.sc rename to example/scalalib/web/6-cross-version-platform-publishing/build.sc diff --git a/example/web/6-cross-version-platform-publishing/foo/bar/src-2/BarVersionSpecific.scala b/example/scalalib/web/6-cross-version-platform-publishing/foo/bar/src-2/BarVersionSpecific.scala similarity index 100% rename from example/web/6-cross-version-platform-publishing/foo/bar/src-2/BarVersionSpecific.scala rename to example/scalalib/web/6-cross-version-platform-publishing/foo/bar/src-2/BarVersionSpecific.scala diff --git a/example/web/6-cross-version-platform-publishing/foo/bar/src-3/BarVersionSpecific.scala b/example/scalalib/web/6-cross-version-platform-publishing/foo/bar/src-3/BarVersionSpecific.scala similarity index 100% rename from example/web/6-cross-version-platform-publishing/foo/bar/src-3/BarVersionSpecific.scala rename to example/scalalib/web/6-cross-version-platform-publishing/foo/bar/src-3/BarVersionSpecific.scala diff --git a/example/web/6-cross-version-platform-publishing/foo/bar/src/Bar.scala b/example/scalalib/web/6-cross-version-platform-publishing/foo/bar/src/Bar.scala similarity index 100% rename from example/web/6-cross-version-platform-publishing/foo/bar/src/Bar.scala rename to example/scalalib/web/6-cross-version-platform-publishing/foo/bar/src/Bar.scala diff --git a/example/web/6-cross-version-platform-publishing/foo/bar/test/src/BarTests.scala b/example/scalalib/web/6-cross-version-platform-publishing/foo/bar/test/src/BarTests.scala similarity index 100% rename from example/web/6-cross-version-platform-publishing/foo/bar/test/src/BarTests.scala rename to example/scalalib/web/6-cross-version-platform-publishing/foo/bar/test/src/BarTests.scala diff --git a/example/web/6-cross-version-platform-publishing/foo/qux/src-js/QuxPlatformSpecific.scala b/example/scalalib/web/6-cross-version-platform-publishing/foo/qux/src-js/QuxPlatformSpecific.scala similarity index 100% rename from example/web/6-cross-version-platform-publishing/foo/qux/src-js/QuxPlatformSpecific.scala rename to example/scalalib/web/6-cross-version-platform-publishing/foo/qux/src-js/QuxPlatformSpecific.scala diff --git a/example/web/6-cross-version-platform-publishing/foo/qux/src-jvm/QuxPlatformSpecific.scala b/example/scalalib/web/6-cross-version-platform-publishing/foo/qux/src-jvm/QuxPlatformSpecific.scala similarity index 100% rename from example/web/6-cross-version-platform-publishing/foo/qux/src-jvm/QuxPlatformSpecific.scala rename to example/scalalib/web/6-cross-version-platform-publishing/foo/qux/src-jvm/QuxPlatformSpecific.scala diff --git a/example/web/6-cross-version-platform-publishing/foo/qux/src/Qux.scala b/example/scalalib/web/6-cross-version-platform-publishing/foo/qux/src/Qux.scala similarity index 100% rename from example/web/6-cross-version-platform-publishing/foo/qux/src/Qux.scala rename to example/scalalib/web/6-cross-version-platform-publishing/foo/qux/src/Qux.scala diff --git a/example/web/6-cross-version-platform-publishing/foo/qux/test/src/QuxTests.scala b/example/scalalib/web/6-cross-version-platform-publishing/foo/qux/test/src/QuxTests.scala similarity index 100% rename from example/web/6-cross-version-platform-publishing/foo/qux/test/src/QuxTests.scala rename to example/scalalib/web/6-cross-version-platform-publishing/foo/qux/test/src/QuxTests.scala diff --git a/example/web/7-cross-platform-version-publishing/bar/src-2/BarVersionSpecific.scala b/example/scalalib/web/7-cross-platform-version-publishing/bar/src-2/BarVersionSpecific.scala similarity index 100% rename from example/web/7-cross-platform-version-publishing/bar/src-2/BarVersionSpecific.scala rename to example/scalalib/web/7-cross-platform-version-publishing/bar/src-2/BarVersionSpecific.scala diff --git a/example/web/7-cross-platform-version-publishing/bar/src-3/BarVersionSpecific.scala b/example/scalalib/web/7-cross-platform-version-publishing/bar/src-3/BarVersionSpecific.scala similarity index 100% rename from example/web/7-cross-platform-version-publishing/bar/src-3/BarVersionSpecific.scala rename to example/scalalib/web/7-cross-platform-version-publishing/bar/src-3/BarVersionSpecific.scala diff --git a/example/web/7-cross-platform-version-publishing/bar/src/Bar.scala b/example/scalalib/web/7-cross-platform-version-publishing/bar/src/Bar.scala similarity index 100% rename from example/web/7-cross-platform-version-publishing/bar/src/Bar.scala rename to example/scalalib/web/7-cross-platform-version-publishing/bar/src/Bar.scala diff --git a/example/web/7-cross-platform-version-publishing/bar/test/src/BarTests.scala b/example/scalalib/web/7-cross-platform-version-publishing/bar/test/src/BarTests.scala similarity index 100% rename from example/web/7-cross-platform-version-publishing/bar/test/src/BarTests.scala rename to example/scalalib/web/7-cross-platform-version-publishing/bar/test/src/BarTests.scala diff --git a/example/web/7-cross-platform-version-publishing/build.sc b/example/scalalib/web/7-cross-platform-version-publishing/build.sc similarity index 100% rename from example/web/7-cross-platform-version-publishing/build.sc rename to example/scalalib/web/7-cross-platform-version-publishing/build.sc diff --git a/example/web/7-cross-platform-version-publishing/qux/src-js/QuxPlatformSpecific.scala b/example/scalalib/web/7-cross-platform-version-publishing/qux/src-js/QuxPlatformSpecific.scala similarity index 100% rename from example/web/7-cross-platform-version-publishing/qux/src-js/QuxPlatformSpecific.scala rename to example/scalalib/web/7-cross-platform-version-publishing/qux/src-js/QuxPlatformSpecific.scala diff --git a/example/web/7-cross-platform-version-publishing/qux/src-jvm/QuxPlatformSpecific.scala b/example/scalalib/web/7-cross-platform-version-publishing/qux/src-jvm/QuxPlatformSpecific.scala similarity index 100% rename from example/web/7-cross-platform-version-publishing/qux/src-jvm/QuxPlatformSpecific.scala rename to example/scalalib/web/7-cross-platform-version-publishing/qux/src-jvm/QuxPlatformSpecific.scala diff --git a/example/web/7-cross-platform-version-publishing/qux/src/Qux.scala b/example/scalalib/web/7-cross-platform-version-publishing/qux/src/Qux.scala similarity index 100% rename from example/web/7-cross-platform-version-publishing/qux/src/Qux.scala rename to example/scalalib/web/7-cross-platform-version-publishing/qux/src/Qux.scala diff --git a/example/web/7-cross-platform-version-publishing/qux/test/src/QuxTests.scala b/example/scalalib/web/7-cross-platform-version-publishing/qux/test/src/QuxTests.scala similarity index 100% rename from example/web/7-cross-platform-version-publishing/qux/test/src/QuxTests.scala rename to example/scalalib/web/7-cross-platform-version-publishing/qux/test/src/QuxTests.scala diff --git a/example/thirdparty/acyclic/build.sc b/example/thirdparty/acyclic/build.sc deleted file mode 100644 index c8216888f87..00000000000 --- a/example/thirdparty/acyclic/build.sc +++ /dev/null @@ -1,84 +0,0 @@ -import mill._, scalalib._, publish._ - -// acyclic test suite assumes files are on disk at specific paths relative to `os.pwd`. -// To avoid changing the test code, we instead copy the necessary files into the `os.pwd` -// when preparing the resources for test suite execution -os.copy.over( - interp.watch(mill.api.WorkspaceRoot.workspaceRoot / "acyclic"), - os.pwd / "acyclic", - createFolders = true -) - -object Deps { - def acyclic = ivy"com.lihaoyi:::acyclic:0.3.6" - def scalaCompiler(scalaVersion: String) = ivy"org.scala-lang:scala-compiler:$scalaVersion" - val utest = ivy"com.lihaoyi::utest:0.8.4" -} - -val crosses = - Seq("2.11.12") ++ - Range.inclusive(8, 17).map("2.12." + _) ++ - Range.inclusive(0, 10).map("2.13." + _) - -object acyclic extends Cross[AcyclicModule](crosses) -trait AcyclicModule extends CrossScalaModule with PublishModule { - def crossFullScalaVersion = true - def artifactName = "acyclic" - def publishVersion = "1.3.3.7" - - def pomSettings = PomSettings( - description = artifactName(), - organization = "com.lihaoyi", - url = "https://github.com/com-lihaoyi/acyclic", - licenses = Seq(License.MIT), - versionControl = VersionControl.github(owner = "com-lihaoyi", repo = "acyclic"), - developers = Seq(Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")) - ) - - def compileIvyDeps = Agg(Deps.scalaCompiler(crossScalaVersion)) - - object test extends ScalaTests with TestModule.Utest { - def sources = T.sources(millSourcePath / "src", millSourcePath / "resources") - def ivyDeps = Agg(Deps.utest, Deps.scalaCompiler(crossScalaVersion)) - } -} - -// Acyclic is an example of a very small project that is a Scala compiler -// plugin. It is cross-built against all point versions of Scala from 2.11.12 -// to 2.13.10, and has a dependency on the `org.scala-lang:scala-compiler` -// -// Project home: https://github.com/com-lihaoyi/acyclic - -/** Usage - -> ./mill resolve acyclic[_].compile -acyclic[2.11.12].compile -acyclic[2.12.10].compile -acyclic[2.12.11].compile -acyclic[2.12.12].compile -acyclic[2.12.13].compile -acyclic[2.12.14].compile -acyclic[2.12.15].compile -acyclic[2.12.16].compile -acyclic[2.12.8].compile -acyclic[2.12.9].compile -acyclic[2.13.0].compile -acyclic[2.13.1].compile -acyclic[2.13.2].compile -acyclic[2.13.3].compile -acyclic[2.13.4].compile -acyclic[2.13.5].compile -acyclic[2.13.6].compile -acyclic[2.13.7].compile -acyclic[2.13.8].compile -acyclic[2.13.9].compile - -> ./mill acyclic[2.12.17].compile -compiling 6 Scala sources... -... - -> ./mill acyclic[2.13.10].test.testLocal # acyclic tests need testLocal due to classloader assumptions --------------------------------- Running Tests -------------------------------- -... - -*/ \ No newline at end of file diff --git a/example/thirdparty/commons-io/build.sc b/example/thirdparty/commons-io/build.sc deleted file mode 100644 index 5f65af34b97..00000000000 --- a/example/thirdparty/commons-io/build.sc +++ /dev/null @@ -1,71 +0,0 @@ -import mill._, javalib._, publish._ -import $ivy.`com.lihaoyi::mill-contrib-jmh:$MILL_VERSION` -import contrib.jmh.JmhModule - -object commonsio extends RootModule with PublishModule with MavenModule { - def publishVersion = "2.17.0-SNAPSHOT" - - def pomSettings = PomSettings( - description = artifactName(), - organization = "org.apache.commons", - url = "https://github.com/apache/commons-io", - licenses = Seq(License.`Apache-2.0`), - versionControl = VersionControl.github(owner = "apache", repo = "commons-io"), - developers = Nil - ) - - object test extends MavenTests with TestModule.Junit5 with JmhModule{ - def testSandboxWorkingDir = false - def jmhCoreVersion = "1.37" - def ivyDeps = super.ivyDeps() ++ Agg( - ivy"org.junit.jupiter:junit-jupiter:5.10.3", - ivy"org.junit-pioneer:junit-pioneer:1.9.1", - ivy"net.bytebuddy:byte-buddy:1.14.18", - ivy"net.bytebuddy:byte-buddy-agent:1.14.18", - ivy"org.mockito:mockito-inline:4.11.0", - ivy"com.google.jimfs:jimfs:1.3.0", - ivy"org.apache.commons:commons-lang3:3.14.0", - ivy"commons-codec:commons-codec:1.17.1", - ivy"org.openjdk.jmh:jmh-core:1.37", - ivy"org.openjdk.jmh:jmh-generator-annprocess:1.37", - ) - } -} - -// The Apache Commons IO library contains utility classes, stream implementations, file filters, -// file comparators, endian transformation classes, and much more. -// -// The core library `commonsio` is dependency-free, but the test suite `commonsio.test` -// as a number of libraries included. It also ships with JMH benchmarks, which Mill -// supports via the built in JMH plugin -// -// Project home: https://github.com/apache/commons-io - -/** Usage - -> ./mill compile -compiling 254 Java sources... -... - -> ./mill test.compile -compiling 261 Java sources... -... - -> ./mill test.testOnly org.apache.commons.io.FileUtilsTest -Test org.apache.commons.io.FileUtilsTest#testCopyFile1() started -Test org.apache.commons.io.FileUtilsTest#testCopyFile1() finished, took ... -... - -> ./mill test.testOnly org.apache.commons.io.FileSystemTest -Test org.apache.commons.io.FileSystemTest#testIsLegalName() started -Test org.apache.commons.io.FileSystemTest#testIsLegalName() finished, took ... -... - -> ./mill test.runJmh '.*PathUtilsContentEqualsBenchmark' -bm SingleShotTime -Benchmark Mode Cnt ... -PathUtilsContentEqualsBenchmark.testCurrent_fileContentEquals ss 5 ... -PathUtilsContentEqualsBenchmark.testCurrent_fileContentEquals_Blackhole ss 5 ... -PathUtilsContentEqualsBenchmark.testProposal_contentEquals ss 5 ... -PathUtilsContentEqualsBenchmark.testProposal_contentEquals_Blackhole ss 5 ... - -*/ \ No newline at end of file diff --git a/example/thirdparty/fansi/build.sc b/example/thirdparty/fansi/build.sc deleted file mode 100644 index ef1de921bac..00000000000 --- a/example/thirdparty/fansi/build.sc +++ /dev/null @@ -1,94 +0,0 @@ -import mill._, scalalib._, scalajslib._, scalanativelib._, publish._ - -val dottyCommunityBuildVersion = sys.props.get("dottyVersion").toList - -val scalaVersions = Seq("2.12.17", "2.13.8", "2.11.12", "3.1.3") ++ dottyCommunityBuildVersion - -trait FansiModule extends PublishModule with CrossScalaModule with PlatformScalaModule { - def publishVersion = "1.3.3.7" - - def pomSettings = PomSettings( - description = artifactName(), - organization = "com.lihaoyi", - url = "https://github.com/com-lihaoyi/Fansi", - licenses = Seq(License.MIT), - versionControl = VersionControl.github(owner = "com-lihaoyi", repo = "fansi"), - developers = Seq(Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")) - ) - - def ivyDeps = Agg(ivy"com.lihaoyi::sourcecode::0.3.0") - - trait FansiTests extends ScalaTests with TestModule.Utest { - def ivyDeps = Agg(ivy"com.lihaoyi::utest::0.8.4") - } -} - -object fansi extends Module { - object jvm extends Cross[JvmFansiModule](scalaVersions) - trait JvmFansiModule extends FansiModule with ScalaModule { - object test extends FansiTests with ScalaTests - } - - object js extends Cross[JsFansiModule](scalaVersions) - trait JsFansiModule extends FansiModule with ScalaJSModule { - def scalaJSVersion = "1.16.0" - object test extends FansiTests with ScalaJSTests - } - - object native extends Cross[NativeFansiModule](scalaVersions) - trait NativeFansiModule extends FansiModule with ScalaNativeModule { - def scalaNativeVersion = "0.4.5" - object test extends FansiTests with ScalaNativeTests - } -} - -// Fansi is an example of a small library that is cross built against every -// minor version of Scala (including Scala 3.x) and every platform: JVM, JS, -// and Native. -// Both the library and the test suite are duplicated across all -// entries in the {version}x{platform} matrix, and you can select which one you -// want to compile, test, or publish -// -// Project home: https://github.com/com-lihaoyi/fansi - -/** Usage - -> ./mill resolve __.compile -fansi.js[2.11.12].test.compile -fansi.js[2.12.17].compile -fansi.js[2.12.17].test.compile -fansi.js[2.13.8].compile -fansi.js[2.13.8].test.compile -fansi.js[3.1.3].compile -fansi.js[3.1.3].test.compile -fansi.jvm[2.11.12].compile -fansi.jvm[2.11.12].test.compile -fansi.jvm[2.12.17].compile -fansi.jvm[2.12.17].test.compile -fansi.jvm[2.13.8].compile -fansi.jvm[2.13.8].test.compile -fansi.jvm[3.1.3].compile -fansi.jvm[3.1.3].test.compile -fansi.native[2.11.12].compile -fansi.native[2.11.12].test.compile -fansi.native[2.12.17].compile -fansi.native[2.12.17].test.compile -fansi.native[2.13.8].compile -fansi.native[2.13.8].test.compile -fansi.native[3.1.3].compile -fansi.native[3.1.3].test.compile - -> ./mill fansi.jvm[2.12.17].compile -compiling 1 Scala source... -... - -> ./mill fansi.js[2.13.8].test -Starting process: node --------------------------------- Running Tests -------------------------------- -... - -> ./mill fansi.native[3.1.3].publishLocal -Publishing Artifact(com.lihaoyi,fansi_native0.4_3,1.3.3.7) to ivy repo... -... - -*/ \ No newline at end of file diff --git a/example/thirdparty/jimfs/build.sc b/example/thirdparty/jimfs/build.sc deleted file mode 100644 index d8b5543532d..00000000000 --- a/example/thirdparty/jimfs/build.sc +++ /dev/null @@ -1,63 +0,0 @@ -import mill._, javalib._, publish._ - -def sharedCompileIvyDeps = T{ - Agg( - ivy"com.google.auto.service:auto-service:1.0.1", - ivy"com.google.code.findbugs:jsr305:3.0.2", - ivy"org.checkerframework:checker-compat-qual:2.5.5", - ivy"com.ibm.icu:icu4j:73.1", - ) -} - - -object jimfs extends PublishModule with MavenModule { - def publishVersion = "1.3.3.7" - - def pomSettings = PomSettings( - description = artifactName(), - organization = "com.google", - url = "https://github.com/google/jimfs", - licenses = Seq(License.MIT), - versionControl = VersionControl.github(owner = "google", repo = "jimfs"), - developers = Nil - ) - - def ivyDeps = sharedCompileIvyDeps() ++ Agg( - ivy"com.google.guava:guava:31.1-android", - ) - - def javacOptions = Seq("-processor", "com.google.auto.service.processor.AutoServiceProcessor") - - object test extends MavenTests { - def ivyDeps = sharedCompileIvyDeps() ++ Agg( - ivy"junit:junit:4.13.2", - ivy"com.google.guava:guava-testlib:31.1-android", - ivy"com.google.truth:truth:1.1.3", - ivy"com.github.sbt:junit-interface:0.13.2", - ivy"com.ibm.icu:icu4j:73.1", - ) - - def testFramework = "com.novocode.junit.JUnitFramework" - } -} - -// JimFS is a small Java library implementing an in-memory filesystem. It is commonly -// used in test suites to validate filesystem operations without needing to write -// to disk. -// -// It has a relatively simple codebase structure, a single module and test suite. -// It has a number of compile-time-only dependencies shared between the library and -// test suite. One wrinkle is that it uses annotation processors as part of its build, -// which Mill supports by providing the relevant `ivyDeps` of the annotation processor -// and providing `javacOptions` to invoke it. -// -// Project home: https://github.com/google/jimfs - -/** Usage - -> ./mill jimfs.test -Test run com.google.common.jimfs.FileTest started -Test run com.google.common.jimfs.FileTest finished: 0 failed, 0 ignored, 7 total... -... - -*/ \ No newline at end of file diff --git a/example/thirdparty/mockito/build.sc b/example/thirdparty/mockito/build.sc deleted file mode 100644 index 890bde760ba..00000000000 --- a/example/thirdparty/mockito/build.sc +++ /dev/null @@ -1,275 +0,0 @@ -import mill._, javalib._ - -object libraries{ - - object versions { - val bytebuddy = "1.14.18" - val junitJupiter = "5.10.3" - val errorprone = "2.23.0" - } - val junit4 = ivy"junit:junit:4.13.2" - val junitJupiterApi = ivy"org.junit.jupiter:junit-jupiter-api:${versions.junitJupiter}" - val junitJupiterParams = ivy"org.junit.jupiter:junit-jupiter-params:${versions.junitJupiter}" - val junitPlatformLauncher = ivy"org.junit.platform:junit-platform-launcher:1.10.3" - val junitJupiterEngine = ivy"org.junit.jupiter:junit-jupiter-engine:${versions.junitJupiter}" - val junitVintageEngine = ivy"org.junit.vintage:junit-vintage-engine:${versions.junitJupiter}" - val assertj = ivy"org.assertj:assertj-core:3.26.3" - val hamcrest = ivy"org.hamcrest:hamcrest-core:2.2" - val opentest4j = ivy"org.opentest4j:opentest4j:1.3.0" - - val bytebuddy = ivy"net.bytebuddy:byte-buddy:${versions.bytebuddy}" - val bytebuddyagent = ivy"net.bytebuddy:byte-buddy-agent:${versions.bytebuddy}" - val bytebuddyandroid = ivy"net.bytebuddy:byte-buddy-android:${versions.bytebuddy}" - - val errorprone = ivy"com.google.errorprone:error_prone_core:${versions.errorprone}" - val errorproneTestApi = ivy"com.google.errorprone:error_prone_test_helpers:${versions.errorprone}" - - val autoservice = ivy"com.google.auto.service:auto-service:1.1.1" - - val objenesis = ivy"org.objenesis:objenesis:3.3" - - val osgi = ivy"org.osgi:osgi.core:8.0.0" - val equinox = ivy"org.eclipse.platform:org.eclipse.osgi:3.20.0" - val bndGradle = "biz.aQute.bnd:biz.aQute.bnd.gradle:6.4.0" - - val groovy = ivy"org.codehaus.groovy:groovy:3.0.22" -} - -trait MockitoModule extends MavenModule{ - def testModuleDeps: Seq[JavaModule] = Nil - def testIvyDeps: T[Agg[Dep]] = Agg.empty[Dep] - def testRuntimeIvyDeps: T[Agg[Dep]] = Agg.empty[Dep] - def testFramework = "com.novocode.junit.JUnitFramework" - def testForkArgs: T[Seq[String]] = Seq.empty[String] - object test extends MavenTests{ - def moduleDeps = super.moduleDeps ++ MockitoModule.this.testModuleDeps - def testFramework = MockitoModule.this.testFramework - def runIvyDeps = testRuntimeIvyDeps() - def forkArgs = testForkArgs() - def ivyDeps = - testIvyDeps() ++ - Agg( - libraries.hamcrest, - libraries.junit4, - libraries.bytebuddyagent, - ivy"com.github.sbt:junit-interface:0.13.2" - ) - } -} - -object mockito extends RootModule with MockitoModule{ - def compileIvyDeps = Agg( - libraries.hamcrest, libraries.junit4, libraries.bytebuddyagent, - libraries.bytebuddy, - libraries.opentest4j - ) - - def ivyDeps = Agg( - libraries.objenesis - ) - - def testIvyDeps = Agg( - libraries.assertj, - libraries.junitJupiterApi, - libraries.junitJupiterParams - ) - - def resources = T{ - val subpath = os.SubPath("org/mockito/internal/creation/bytebuddy/inject/") - os.copy( - compile().classes.path / subpath / "MockMethodDispatcher.class", - T.dest / subpath / "MockMethodDispatcher.raw", - createFolders = true - ) - super.resources() ++ Seq(PathRef(T.dest)) - } - - object subprojects extends Module { - object android extends MockitoModule { - def moduleDeps = Seq(mockito) - def ivyDeps = Agg(libraries.bytebuddyandroid) - } - object errorprone extends MockitoModule { - def compileIvyDeps = Agg(libraries.autoservice) - def moduleDeps = Seq(mockito) - def ivyDeps = Agg(libraries.errorprone) - def testIvyDeps = Agg(libraries.errorproneTestApi) - - def forkArgs = Seq( - // "-processorpath", libraries.autoservice, - "-Xbootclasspath/a:${configurations.errorproneJavac.asPath}", - "--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", - "--add-exports=jdk.compiler/com.sun.tools.javac.type=ALL-UNNAMED", - "--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", - "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", - "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", - "--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", - "--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED", - "--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", - "--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", - ) - - def javacOptions = Seq( - "--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", - "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", - "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" - ) - } - object extTest extends MockitoModule{ - def moduleDeps = Seq(mockito, `junit-jupiter`) - def testModuleDeps = Seq(mockito.test) - def testIvyDeps = Agg( - libraries.junit4, - libraries.assertj, - libraries.junitJupiterApi, - ) - - def testRuntimeIvyDeps = Agg( - libraries.junitJupiterEngine, - libraries.junitVintageEngine, - libraries.junitPlatformLauncher - ) - } - - object inlineTest extends MockitoModule{ - def testModuleDeps = Seq(mockito) - def testIvyDeps = Agg(libraries.junit4, libraries.assertj) - } - -// object `java21-test` extends MockitoModule{ -// def testModuleDeps = Seq(mockito) -// def testIvyDeps = Agg(libraries.junit4, libraries.assertj) -// } - - - object `junit-jupiter` extends MockitoModule{ - def moduleDeps = Seq(mockito) - - def ivyDeps = Agg(libraries.junitJupiterApi) - def testFramework = "com.github.sbt.junit.jupiter.api.JupiterFramework" - def testIvyDeps = Agg( - libraries.assertj, - libraries.junitPlatformLauncher, - ivy"com.github.sbt.junit:jupiter-interface:0.11.4" - ) - - def testRuntimeIvyDeps = Agg( - libraries.junitJupiterEngine, - ) - } - - object junitJupiterExtensionTest extends MockitoModule{ - def testFramework = "com.github.sbt.junit.jupiter.api.JupiterFramework" - def testModuleDeps = Seq(`junit-jupiter`) - def testIvyDeps = Agg(libraries.assertj, libraries.junitJupiterApi) - def testRuntimeIvyDeps = Agg( - libraries.junitJupiterEngine, libraries.junitPlatformLauncher, - ivy"com.github.sbt.junit:jupiter-interface:0.11.4" - ) - } - object junitJupiterInlineMockMakerExtensionTest extends MockitoModule{ - def testFramework = "com.github.sbt.junit.jupiter.api.JupiterFramework" - def testModuleDeps = Seq(`junit-jupiter`) - def testIvyDeps = Agg(libraries.assertj, libraries.junitJupiterApi) - def testRuntimeIvyDeps = Agg( - libraries.junitJupiterEngine, libraries.junitPlatformLauncher, - ivy"com.github.sbt.junit:jupiter-interface:0.11.4" - ) - } - object junitJupiterParallelTest extends MockitoModule{ - def testFramework = "com.github.sbt.junit.jupiter.api.JupiterFramework" - def testModuleDeps = Seq(`junit-jupiter`) - def testIvyDeps = Agg(libraries.junitJupiterApi) - def testRuntimeIvyDeps = Agg( - libraries.junitJupiterEngine, libraries.junitPlatformLauncher, - ivy"com.github.sbt.junit:jupiter-interface:0.11.4", - libraries.bytebuddy - ) - } - object `memory-test` extends MockitoModule{ - def testModuleDeps = Seq(mockito) - def testIvyDeps = Agg(libraries.assertj) - def testForkArgs = Seq("-Xmx128m") - } - -// object `osgi-test` extends MockitoModule { -// def testModuleDeps = Seq(mockito) -// def testIvyDeps = Agg(libraries.junit4, libraries.osgi) -// def testRuntimeIvyDeps = Agg(libraries.equinox) -// trait BundleModule extends MockitoModule{ -// def bundleName: String = millModuleSegments.parts.last -// override def millSourcePath = `osgi-test`.millSourcePath -// def sources = T.sources(millSourcePath / "src" / bundleName / "java") -// -// def manifest = super.manifest().add( -// "Bundle-Name" -> bundleName, -// "Bundle-SymbolicName" -> bundleName, -// "Bundle-Name" -> "Mockito Mock Library for Java. Core bundle requires Byte Buddy and Objenesis.", -// "Bundle-SymbolicName" -> "org.mockito.mockito-core", -//// "Bundle-Version" -> s"$${version_cleanup;0.0.0}", -// "-versionpolicy" -> "[${version;==;${@}},${version;+;${@}})", -// "Export-Package" -> "org.mockito.internal.*;status=INTERNAL;mandatory:=status;version=0.0.0,org.mockito.*;version=0.0.0", -// "Import-Package" -> Seq( -// "net.bytebuddy.*;version=\"[1.6.0,2.0)\"", -// "junit.*;resolution:=optional", -// "org.junit.*;resolution:=optional", -// "org.hamcrest;resolution:=optional", -// "org.objenesis;version=\"[3.1,4.0)\"", -// "org.opentest4j.*;resolution:=optional", -// "org.mockito.*" -// ).mkString(","), -// "-removeheaders" -> "Private-Package", -// "Automatic-Module-Name" -> "org.mockito", -// "-noextraheaders" -> "true" -// ) -// } -// -// object testBundle extends BundleModule{ -// def moduleDeps = Seq(`osgi-test`.test, otherBundle) -// def ivyDeps = Agg(libraries.osgi) -// } -// -// object otherBundle extends BundleModule{ -// def moduleDeps = Seq(`osgi-test`.test) -// def ivyDeps = Agg(libraries.osgi) -// } -// -// object testRuntimeBundles extends JavaModule{ -// def unmanagedClasspath = Agg(testBundle.jar(), otherBundle.jar(), mockito.jar()) -// def ivyDeps = Agg(libraries.bytebuddy, libraries.bytebuddyagent, libraries.objenesis) -// } -// -// def testForkArgs = Seq( -// s"-DtestRuntimeBundles=${testRuntimeBundles.runClasspath().map(_.path).distinct.filter(os.exists(_)).mkString(java.io.File.pathSeparator)}" -// ) -// } - object `programmatic-test` extends MockitoModule{ - def testModuleDeps = Seq(mockito) - def testIvyDeps = Agg(libraries.junit4, libraries.assertj) - } - object proxy extends MockitoModule{ - def testModuleDeps = Seq(mockito) - def testIvyDeps = Agg(libraries.junit4, libraries.assertj) - } - object subclass extends MockitoModule{ - def testModuleDeps = Seq(mockito) - def testIvyDeps = Agg(libraries.junit4, libraries.assertj) - } - } -} - - -// Run a few smoketests on the mockito repo, compiling everything (including tests) -// but only running the subset of tests that run quickly -/** Usage - -> ./mill -j5 __.compile - -> ./mill __.test -Test org.mockitoinline.StaticMockTest.testStaticMockSimple... -Test org.mockito.internal.creation.MockSettingsImplTest.validates_invocation_listeners finished... -Test org.mockitousage.junitrunner.StubbingWarningsJUnitRunnerTest.shows_arg_mismatch_warnings_when_test_fails finished... -Test org.mockitousage.session.MockitoSessionTest.allows_updating_strictness finished... -... - -*/ diff --git a/example/thirdparty/netty/build.sc b/example/thirdparty/netty/build.sc deleted file mode 100644 index 4a7a3181c92..00000000000 --- a/example/thirdparty/netty/build.sc +++ /dev/null @@ -1,626 +0,0 @@ -import mill._, javalib._ -import $ivy.`org.codehaus.groovy:groovy:3.0.9` -import $ivy.`org.codehaus.groovy:groovy-ant:3.0.9` -import $ivy.`ant:ant-optional:1.5.3-1` -// TODO: -// testsuite-shading -// testsuite-native-image* -// testsuite-autobahn - -def isOSX = System.getProperty("os.name").toLowerCase.contains("mac") - -trait NettyBaseModule extends MavenModule{ - def javacOptions = Seq("-source", "1.8", "-target", "1.8") -} -trait NettyBaseTestSuiteModule extends NettyBaseModule with TestModule.Junit5{ - def testSandboxWorkingDir = false - def testFramework = "com.github.sbt.junit.jupiter.api.JupiterFramework" - def ivyDeps = Agg( - ivy"com.github.sbt.junit:jupiter-interface:0.11.2", - ivy"org.hamcrest:hamcrest-library:1.3", - ivy"org.assertj:assertj-core:3.18.0", - ivy"org.junit.jupiter:junit-jupiter-api:5.9.0", - ivy"org.junit.jupiter:junit-jupiter-params:5.9.0", - ivy"org.mockito:mockito-core:2.18.3", - ivy"org.reflections:reflections:0.10.2", - ivy"com.google.code.gson:gson:2.8.9", - ivy"com.google.guava:guava:28.2-jre", - ivy"org.jctools:jctools-core:4.0.5", - ivy"io.netty:netty-tcnative-classes:2.0.65.Final", - ivy"io.netty:netty-tcnative-boringssl-static:2.0.65.Final", - ivy"com.barchart.udt:barchart-udt-bundle:2.3.0", - ivy"com.aayushatharva.brotli4j:native-linux-x86_64:1.16.0", - ivy"com.aayushatharva.brotli4j:native-linux-aarch64:1.16.0", - ivy"com.aayushatharva.brotli4j:native-linux-riscv64:1.16.0", - ivy"com.aayushatharva.brotli4j:native-osx-x86_64:1.16.0", - ivy"com.aayushatharva.brotli4j:native-osx-aarch64:1.16.0", - ivy"com.aayushatharva.brotli4j:native-windows-x86_64:1.16.0", - ivy"org.jboss.marshalling:jboss-marshalling:2.0.5.Final", - ivy"com.aayushatharva.brotli4j:brotli4j:1.16.0", - ivy"org.apache.commons:commons-compress:1.26.0", - ivy"com.jcraft:jzlib:1.1.3", - ivy"net.jpountz.lz4:lz4:1.3.0", - ivy"com.ning:compress-lzf:1.0.3", - ivy"com.github.jponge:lzma-java:1.3", - ivy"com.github.luben:zstd-jni:1.5.5-11", - ivy"ch.qos.logback:logback-classic:1.1.7", - ivy"org.eclipse.jetty.npn:npn-api:1.1.1.v20141010", - ivy"org.bouncycastle:bcpkix-jdk15on:1.69", - ivy"org.bouncycastle:bctls-jdk15on:1.69", - ) - - def forkArgs = Seq( - "-DnativeImage.handlerMetadataGroupId=io.netty", - "-Dio.netty.bootstrap.extensions=serviceload", - "-XX:+AllowRedefinitionToAddDeleteMethods", - "--add-exports", "java.base/sun.security.x509=ALL-UNNAMED", - "-enableassertions" - ) - - def compile = T{ - // Hack to satisfy fragile tests that look for /test-classes/ in the file paths - val sup = super.compile() - val testClasses = T.dest / "test-classes" - if (os.exists(sup.classes.path)) os.copy(sup.classes.path, testClasses, createFolders = true) - sup.copy(classes = PathRef(testClasses)) - } -} -trait NettyTestSuiteModule extends NettyBaseTestSuiteModule{ - -} -trait NettyModule extends NettyBaseModule{ - def testModuleDeps: Seq[MavenModule] = Nil - def testIvyDeps: T[Agg[mill.scalalib.Dep]] = T{ Agg() } - - object test extends NettyBaseTestSuiteModule with MavenTests{ - def moduleDeps = super.moduleDeps ++ testModuleDeps - def ivyDeps = super.ivyDeps() ++ testIvyDeps() - def forkWorkingDir = NettyModule.this.millSourcePath - def forkArgs = super.forkArgs() ++ Seq( - "-Dnativeimage.handlerMetadataArtifactId=netty-" + NettyModule.this.millModuleSegments.parts.last, - ) - - } -} - -trait NettyJniModule extends NettyModule { - def jniLibraryName: T[String] - def cSources = T.source(millSourcePath / "src" / "main" / "c") - def resources = T{ - os.copy(clang().path, T.dest / "META-INF" / "native" / jniLibraryName(), createFolders = true) - Seq(PathRef(T.dest)) - } - def clang = T{ - val Seq(sourceJar) = defaultResolver() - .resolveDeps( - Agg(ivy"io.netty:netty-jni-util:0.0.9.Final").map(bindDependency()), - sources = true - ) - .toSeq - - os.makeDir.all(T.dest / "src" / "main" / "c") - os.proc("jar", "xf", sourceJar.path).call(cwd = T.dest / "src" / "main" / "c") - - os.proc( - "clang", - // CFLAGS - "-O3", "-Werror", "-fno-omit-frame-pointer", - "-Wunused-variable", "-fvisibility=hidden", - "-I" + (T.dest / "src" / "main" / "c"), - "-I" + `transport-native-unix-common`.cHeaders().path, - "-I" + sys.props("java.home") + "/include/", - "-I" + sys.props("java.home") + "/include/darwin", - "-I" + sys.props("java.home") + "/include/linux", - // LD_FLAGS - "-Wl,-weak_library," + (`transport-native-unix-common`.make()._1.path / "libnetty-unix-common.a"), - "-Wl,-platform_version,macos,10.9,10.9", - "-Wl,-single_module", - "-Wl,-undefined", - "-Wl,dynamic_lookup", - "-fno-common", - "-DPIC", - // sources - os.list(cSources().path) - ).call(cwd = T.dest, env = Map("MACOSX_DEPLOYMENT_TARGET" -> "10.9")) - - PathRef(T.dest / "a.out") - } -} - - -object all extends NettyModule{ - -} - -object bom extends NettyModule{ - -} - -object buffer extends NettyModule{ - def moduleDeps = Seq(common) - def testIvyDeps = Agg(ivy"org.jctools:jctools-core:4.0.5") -} - -object codec extends NettyModule { - def moduleDeps = Seq(common, buffer, transport) - def testModuleDeps = Seq(transport.test) - def ivyDeps = Agg( - ivy"com.google.protobuf:protobuf-java:2.6.1", - ) - def compileIvyDeps = Agg( - ivy"org.jboss.marshalling:jboss-marshalling:2.0.5.Final", - ivy"com.aayushatharva.brotli4j:brotli4j:1.16.0", - ivy"com.jcraft:jzlib:1.1.3", - ivy"net.jpountz.lz4:lz4:1.3.0", - ivy"com.ning:compress-lzf:1.0.3", - ivy"com.github.jponge:lzma-java:1.3", - ivy"com.github.luben:zstd-jni:1.5.5-11", - ivy"com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-5", - ) -} - -object `codec-dns` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport, codec) - def testModuleDeps = Seq(transport.test) -} - -object `codec-haproxy` extends NettyModule{ - def moduleDeps = Seq(buffer, transport, codec) - def testModuleDeps = Seq(transport.test) -} - -object `codec-http` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport, codec, handler) - def testModuleDeps = Seq(transport.test) - def compileIvyDeps = Agg( - ivy"com.jcraft:jzlib:1.1.3", - ivy"com.aayushatharva.brotli4j:brotli4j:1.16.0", - ) - def testIvyDeps = Agg( - ivy"com.aayushatharva.brotli4j:brotli4j:1.16.0", - ) -} - -object `codec-http2` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport, codec, handler, `codec-http`) - def testModuleDeps = Seq(transport.test) - def compileIvyDeps = Agg( - ivy"com.aayushatharva.brotli4j:brotli4j:1.16.0", - ) -} - -object `codec-memcache` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport, codec) - def testModuleDeps = Seq(transport.test) -} - -object `codec-mqtt` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport, codec) - def testModuleDeps = Seq(transport.test) -} - -object `codec-redis` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport, codec) - def testModuleDeps = Seq(transport.test) -} - -object `codec-smtp` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport, codec) - def testModuleDeps = Seq(transport.test) -} - -object `codec-socks` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport, codec) - def testModuleDeps = Seq(transport.test) -} - -object `codec-stomp` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport, codec) - def testModuleDeps = Seq(transport.test) -} - -object `codec-xml` extends NettyModule{ - def moduleDeps = Seq(buffer, transport, codec) - def testModuleDeps = Seq(transport.test) - def ivyDeps = Agg( - ivy"com.fasterxml:aalto-xml:1.0.0" - ) -} - -object common extends NettyModule{ - def compileIvyDeps = Agg( - ivy"org.jctools:jctools-core:4.0.5", - ivy"org.graalvm.nativeimage:svm:19.3.6", - ivy"org.jetbrains:annotations-java5:23.0.0", - ivy"io.projectreactor.tools:blockhound:1.0.6.RELEASE", - ivy"commons-logging:commons-logging:1.2", - ivy"org.apache.logging.log4j:log4j-api:2.17.2", - ivy"org.apache.logging.log4j:log4j-1.2-api:2.17.2", - ivy"org.slf4j:slf4j-api:1.7.30", - ) - def testIvyDeps = Agg( - ivy"org.jetbrains:annotations-java5:23.0.0", - ivy"commons-logging:commons-logging:1.2", - ivy"org.apache.logging.log4j:log4j-api:2.17.2", - ivy"org.apache.logging.log4j:log4j-core:2.17.2", - ivy"org.apache.logging.log4j:log4j-1.2-api:2.17.2", - ivy"org.jctools:jctools-core:4.0.5", - ) - - def script = T.source(millSourcePath / "src" / "main" / "script") - def generatedSources0 = T{ - val shell = new groovy.lang.GroovyShell() - - val context = new java.util.HashMap[String, Object] - context.put("collection.template.dir", T.workspace + "/common/src/main/templates") - context.put("collection.template.test.dir", T.workspace + "/common/src/test/templates") - context.put("collection.src.dir", (T.dest / "src").toString) - context.put("collection.testsrc.dir", (T.dest / "testsrc").toString) - shell.setProperty("properties", context) - shell.setProperty("ant", new groovy.ant.AntBuilder()) - shell.evaluate((script().path / "codegen.groovy").toIO) - (PathRef(T.dest / "src"), PathRef(T.dest / "testsrc")) - } - - def generatedSources = T{ Seq(generatedSources0()._1)} -} - -object `dev-tools` extends NettyModule{ - -} - -object example extends NettyModule{ - def ivyDeps = Agg( - ivy"org.bouncycastle:bcpkix-jdk15on:1.69", - ivy"org.bouncycastle:bctls-jdk15on:1.69", - ivy"com.sun.activation:javax.activation:1.2.0" - - ) - def moduleDeps = Seq( - common, - buffer, - transport, - codec, - handler, - `transport-sctp`, `transport-rxtx`, `transport-udt`, - `handler-proxy`, `codec-http`, `codec-memcache`, - `codec-http2`, `codec-redis`, `codec-socks`, `codec-stomp`, `codec-mqtt`, `codec-haproxy`, `codec-dns` - ) -} - -object handler extends NettyModule{ - def moduleDeps = Seq(common, resolver, buffer, transport, `transport-native-unix-common`, codec) - def testModuleDeps = Seq(transport.test) - def compileIvyDeps = Agg( - ivy"org.bouncycastle:bcpkix-jdk15on:1.69", - ivy"org.bouncycastle:bctls-jdk15on:1.69", - ivy"org.conscrypt:conscrypt-openjdk-uber:2.5.2", - ivy"io.netty:netty-tcnative-classes:2.0.65.Final", - ivy"org.eclipse.jetty.alpn:alpn-api:1.1.2.v20150522", - ivy"org.eclipse.jetty.npn:npn-api:1.1.1.v20141010", - ) - - def testIvyDeps = Agg( - ivy"org.bouncycastle:bcpkix-jdk15on:1.69", - ivy"org.bouncycastle:bctls-jdk15on:1.69", - ivy"software.amazon.cryptools:AmazonCorrettoCryptoProvider:1.1.0;classifier=linux-x86_64", - ivy"org.conscrypt:conscrypt-openjdk-uber:2.5.2", - - ) -} - -object `handler-proxy` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport, codec, `codec-socks`, `codec-http`, handler) - def testModuleDeps = Seq(transport.test) -} - -object `handler-ssl-ocsp` extends NettyModule{ - def moduleDeps = Seq(`codec-http`, transport, `resolver-dns`) - def ivyDeps = Agg( - ivy"org.bouncycastle:bcpkix-jdk15on:1.69", - ivy"org.bouncycastle:bctls-jdk15on:1.69", - ) -} - -object microbench extends NettyModule{ - - def moduleDeps = Seq( - handler, `codec-http`, `codec-http2`, `codec-redis`, `codec-mqtt`, `codec-stomp`, - `transport-native-epoll`, `transport-native-kqueue` - ) - - def ivyDeps = Agg( - ivy"org.junit.jupiter:junit-jupiter-api:5.9.0", - ivy"org.jctools:jctools-core:4.0.5", - ivy"org.openjdk.jmh:jmh-core:1.36", - ivy"org.openjdk.jmh:jmh-generator-annprocess:1.36", - ivy"org.agrona:Agrona:0.5.1" - ) -} - -object resolver extends NettyModule{ - def moduleDeps = Seq(common) -} - -object `resolver-dns` extends NettyModule{ - def moduleDeps = Seq(common, buffer, resolver, transport, codec, `codec-dns`, handler) - def testModuleDeps = Seq(transport.test) - def testIvyDeps = Agg( - ivy"org.apache.directory.server:apacheds-protocol-dns:1.5.7" - ) -} - -object `resolver-dns-classes-macos` extends NettyModule{ - def moduleDeps = Seq(common, resolver, `transport-native-unix-common`, `resolver-dns`) -} - - -object `resolver-dns-native-macos` extends NettyJniModule { - def jniLibraryName = "libnetty_resolver_dns_native_macos_aarch_64.jnilib" - def moduleDeps = Seq(resolver) - def testModuleDeps = Seq(`resolver-dns`, `resolver-dns-classes-macos`) - def testIvyDeps = Agg( - ivy"org.apache.directory.server:apacheds-protocol-dns:1.5.7" - ) - - -} - -object testsuite extends NettyTestSuiteModule{ - def moduleDeps = Seq(common, resolver, transport, `transport-sctp`, handler, `codec-http`, `transport-udt`) - def ivyDeps = super.ivyDeps() ++ Agg( - ivy"org.slf4j:slf4j-api:1.7.30", - ivy"org.tukaani:xz:1.5", - ) -} - - -object `testsuite-autobahn` extends NettyTestSuiteModule{ - def moduleDeps = Seq(common, buffer, transport, `codec-http`) -// override def test(args: String*) = { -// val server = os.proc(assembly().path).spawn() -// os.proc( -// "docker", "run", "-it", "--rm", -//// "-v", s"${PWD}/config:/config", -//// "-v", s"${PWD}/reports:/reports", -// "-p", "9000:9000", -// "--name", "fuzzingserver", -// "crossbario/autobahn-testsuite" -// ).call() -// server.destroy() -// } -} - - -object `testsuite-http2` extends NettyTestSuiteModule{ - def moduleDeps = Seq(common, buffer, transport, handler, `codec-http`, `codec-http2`) - def h2Spec = T{ - - val isOSX = sys.props("os.name").toLowerCase.contains("mac") - val binaryName = if (isOSX) "h2spec_darwin_amd64.tar.gz" else "h2spec_linux_amd64.tar.gz" - val url = s"https://github.com/summerwind/h2spec/releases/download/v2.6.0/$binaryName" - os.write(T.dest / "h2spec.tar.gz", requests.get(url)) - - os.proc("tar", "xzf", T.dest / "h2spec.tar.gz").call(cwd = T.dest) - PathRef(T.dest / "h2spec") - } - override def test(args: String*) = T.command{ - val server = os.proc(assembly().path).spawn(stdout = os.Inherit) - try { - Thread.sleep(1000) // let the server start up - - os.proc(h2Spec().path, "-p9000", "--junit-report", T.dest / "report.xml") - .call(stdout = os.Inherit, check = false) - - // Use the Scala XML library to parse and fish out the data we want from the report - val xmlFile = scala.xml.XML.loadFile((T.dest / "report.xml").toIO) - val testCasesWithErrors = (xmlFile \\ "testcase").filter { testcase => - (testcase \\ "error").nonEmpty - } - - // Extract the package and classname - val errorDetails = testCasesWithErrors.map { testcase => - val pkg = (testcase \ "@package").text - val classname = (testcase \ "@classname").text - (pkg, classname) - } - - // Check results - val expectedFailures = Set( - ("http2/3.5", "Sends invalid connection preface"), - ("http2/5.1", "half closed (remote): Sends a HEADERS frame"), - ("http2/5.1", "closed: Sends a HEADERS frame"), - ("http2/5.1.1", "Sends stream identifier that is numerically smaller than previous"), - ("http2/8.1.2.3", "Sends a HEADERS frame that omits \":method\" pseudo-header field"), - ("http2/8.1.2.3", "Sends a HEADERS frame that omits \":scheme\" pseudo-header field"), - ("http2/8.1.2.3", "Sends a HEADERS frame that omits \":path\" pseudo-header field"), - ) - assert(errorDetails.toSet.subsetOf(expectedFailures)) - } finally server.destroyForcibly() - ("", Seq.empty[testrunner.TestResult]) - } -} - -object `testsuite-native` extends NettyTestSuiteModule{ - def moduleDeps = Seq(`transport-native-kqueue`, `resolver-dns-native-macos`, `resolver-dns-classes-macos`, `transport-native-epoll`) - def testModuleDeps = Seq(`resolver-dns-classes-macos`) - override def sources = T.sources( millSourcePath / "src" / "test" / "java" ) -} - -object `testsuite-native-image` extends NettyTestSuiteModule{ - def moduleDeps = Seq(common, buffer, transport, handler, `codec-http`) -} - -object `testsuite-native-image-client` extends NettyTestSuiteModule{ - def moduleDeps = Seq(transport, `resolver-dns`) -} - -object `testsuite-native-image-client-runtime-init` extends NettyTestSuiteModule{ - def moduleDeps = Seq(common) -} - - -object `testsuite-osgi` extends NettyTestSuiteModule{ - def moduleDeps = Seq( - buffer, - codec, `codec-dns`, `codec-haproxy`, `codec-http`, `codec-http2`, `codec-memcache`, `codec-mqtt`, `codec-socks`, `codec-stomp`, - common, - handler, `handler-proxy`, - resolver, `resolver-dns`, - transport, `transport-sctp`, `transport-udt` - ) - - override def sources = T.sources( millSourcePath / "src" / "test" / "java" ) - - def ivyDeps = super.ivyDeps() ++ Agg( - ivy"org.apache.felix:org.apache.felix.configadmin:1.9.14", - ivy"org.ops4j.pax.exam:pax-exam-junit4:4.13.0", - ivy"org.ops4j.pax.exam:pax-exam-container-native:4.13.0", - ivy"org.ops4j.pax.exam:pax-exam-link-assembly:4.13.0", - ivy"org.apache.felix:org.apache.felix.framework:6.0.2", - ) -} - -object `testsuite-shading` extends NettyTestSuiteModule{ - def moduleDeps = Seq(common) - override def sources = T.sources( millSourcePath / "src" / "test" / "java" ) -} - -object transport extends NettyModule{ - def moduleDeps = Seq(common, buffer, resolver) -} - -object `transport-blockhound-tests` extends NettyTestSuiteModule{ - def moduleDeps = Seq(transport, handler, `resolver-dns`) - def ivyDeps = super.ivyDeps() ++ Agg( - ivy"io.projectreactor.tools:blockhound:1.0.6.RELEASE" - ) -} - -object `transport-classes-epoll` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport, `transport-native-unix-common`) -} - -object `transport-classes-kqueue` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport, `transport-native-unix-common`) -} - -object `transport-native-epoll` extends NettyJniModule{ - def jniLibraryName = "libnetty_transport_native_epoll_aarch_64.jnilib" - def moduleDeps = Seq(common, buffer, transport, `transport-native-unix-common`, `transport-classes-epoll`) - def testModuleDeps = Seq(testsuite, `transport-native-unix-common-tests`) - - def testIvyDeps = Agg( - ivy"io.github.artsok:rerunner-jupiter:2.1.6" - ) - - // Stub this out on OS-X - def clang = if (!isOSX) T{ super.clang() } else T{ PathRef(os.temp())} -} - -object `transport-native-kqueue` extends NettyJniModule{ - def jniLibraryName = "libnetty_transport_native_kqueue_aarch_64.jnilib" - def moduleDeps = Seq(common, buffer, transport, `transport-native-unix-common`, `transport-classes-kqueue`) - def testModuleDeps = Seq(testsuite, `transport-native-unix-common-tests`) - - // Stub this out on linux - def clang = if (isOSX) T{ super.clang() } else T{ PathRef(os.temp())} -} - -object `transport-native-unix-common` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport) - def ivyDeps = Agg(ivy"org.junit.jupiter:junit-jupiter-api:5.9.0") - - def makefile = T.source(millSourcePath / "Makefile") - def cSources = T.source(millSourcePath / "src" / "main" / "c") - def cHeaders = T{ - for(p <- os.walk(cSources().path) if p.ext == "h"){ - os.copy(p, T.dest / p.relativeTo(cSources().path), createFolders = true) - } - PathRef(T.dest) - } - - def make = T{ - val Seq(sourceJar) = resolveDeps( - deps = T.task(Agg(ivy"io.netty:netty-jni-util:0.0.9.Final").map(bindDependency())), - sources = true - )().toSeq - - os.copy(makefile().path, T.dest / "Makefile") - os.copy(cSources().path, T.dest / "src" / "main" / "c", createFolders = true) - os.proc("jar", "xf", sourceJar.path).call(cwd = T.dest / "src" / "main" / "c") - - os.proc("make").call( - cwd = T.dest, - env = Map( - "CC" -> "clang", - "AR" -> "ar", - "JNI_PLATFORM" -> "darwin", - "LIB_DIR" -> "lib-out", - "OBJ_DIR" -> "obj-out", - "MACOSX_DEPLOYMENT_TARGET" -> "10.9", - "CFLAGS" -> Seq( - "-O3", - "-Werror", - "-Wno-attributes", - "-fPIC", - "-fno-omit-frame-pointer", - "-Wunused-variable", - "-fvisibility=hidden", - "-I" + sys.props("java.home") + "/include/", - "-I" + sys.props("java.home") + "/include/darwin", - "-I" + sys.props("java.home") + "/include/linux", - ).mkString(" "), - "LD_FLAGS" -> "-Wl,--no-as-needed -lrt -Wl,-platform_version,macos,10.9,10.9", - "LIB_NAME" -> "libnetty-unix-common" - ) - ) - - - (PathRef(T.dest / "lib-out"), PathRef(T.dest / "obj-out")) - } -} -object `transport-native-unix-common-tests` extends NettyTestSuiteModule{ - def moduleDeps = Seq(transport, `transport-native-unix-common`) -} - -object `transport-rxtx` extends NettyModule{ - def moduleDeps = Seq(buffer, transport) - def ivyDeps = Agg( - ivy"org.rxtx:rxtx:2.1.7" - ) -} - -object `transport-sctp` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport, codec) - def testModuleDeps = Seq(transport.test) -} - -object `transport-udt` extends NettyModule{ - def moduleDeps = Seq(common, buffer, transport) - def ivyDeps = Agg( - ivy"com.barchart.udt:barchart-udt-bundle:2.3.0", - ivy"com.google.caliper:caliper:0.5-rc1", - ivy"com.yammer.metrics:metrics-core:2.2.0" - ) -} - - -// Run a few smoketests on the netty repo, compiling everything (including tests) -// but only running the subset of tests that run quickly (otherwise this would -// take over an hour) -/** Usage - -> ./mill -j5 __.compile - -> ./mill 'codec-{dns,haproxy,http,http2,memcache,mqtt,redis,smtp,socks,stomp,xml}.test' -...Test io.netty.handler.codec.stomp.StompSubframeEncoderTest#testEscapeStompHeaders() started -...Test io.netty.handler.codec.stomp.StompSubframeEncoderTest#testEscapeStompHeaders() finished... -... - -> ./mill 'transport-{blockhound-tests,native-unix-common,sctp}.test' -...Test io.netty.channel.unix.UnixChannelUtilTest#testUnPooledAllocatorIsBufferCopyNeededForWrite() started -...Test io.netty.channel.unix.UnixChannelUtilTest#testUnPooledAllocatorIsBufferCopyNeededForWrite() finished... -... - -*/ From a18cc3b6da0a3c65d9b7e2fd86fceecbcd3d5283 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 21:24:42 +0800 Subject: [PATCH 06/24] . --- build.sc | 2 +- docs/modules/ROOT/pages/Modules.adoc | 8 ++++---- .../depth/{tasks => modules}/10-module-sc/bar/module.sc | 0 .../{tasks => modules}/10-module-sc/bar/qux/module.sc | 0 .../10-module-sc/bar/qux/module/src/BarQux.scala | 0 example/depth/{tasks => modules}/10-module-sc/build.sc | 0 .../depth/{tasks => modules}/10-module-sc/foo/module.sc | 0 .../{tasks => modules}/10-module-sc/foo/src/Foo.scala | 0 .../11-module-run-task/bar/src/Bar.scala | 0 .../depth/{tasks => modules}/11-module-run-task/build.sc | 0 .../11-module-run-task/foo/src/Foo.scala | 0 example/depth/{tasks => modules}/7-modules/build.sc | 0 .../7-modules/outer/inner/sources/inner-source.txt | 0 .../7-modules/outer/sources/outer-source.txt | 0 .../outer2/nested/inner/sources/inner-source.txt | 0 .../7-modules/outer2/nested/sources/outer-source.txt | 0 .../depth/{tasks => modules}/8-diy-java-modules/build.sc | 0 .../8-diy-java-modules/foo/bar/src/Bar.java | 0 .../8-diy-java-modules/foo/src/Foo.java | 0 .../8-diy-java-modules/qux/src/Qux.java | 0 .../depth/{tasks => modules}/9-backticked-names/build.sc | 0 21 files changed, 5 insertions(+), 5 deletions(-) rename example/depth/{tasks => modules}/10-module-sc/bar/module.sc (100%) rename example/depth/{tasks => modules}/10-module-sc/bar/qux/module.sc (100%) rename example/depth/{tasks => modules}/10-module-sc/bar/qux/module/src/BarQux.scala (100%) rename example/depth/{tasks => modules}/10-module-sc/build.sc (100%) rename example/depth/{tasks => modules}/10-module-sc/foo/module.sc (100%) rename example/depth/{tasks => modules}/10-module-sc/foo/src/Foo.scala (100%) rename example/depth/{tasks => modules}/11-module-run-task/bar/src/Bar.scala (100%) rename example/depth/{tasks => modules}/11-module-run-task/build.sc (100%) rename example/depth/{tasks => modules}/11-module-run-task/foo/src/Foo.scala (100%) rename example/depth/{tasks => modules}/7-modules/build.sc (100%) rename example/depth/{tasks => modules}/7-modules/outer/inner/sources/inner-source.txt (100%) rename example/depth/{tasks => modules}/7-modules/outer/sources/outer-source.txt (100%) rename example/depth/{tasks => modules}/7-modules/outer2/nested/inner/sources/inner-source.txt (100%) rename example/depth/{tasks => modules}/7-modules/outer2/nested/sources/outer-source.txt (100%) rename example/depth/{tasks => modules}/8-diy-java-modules/build.sc (100%) rename example/depth/{tasks => modules}/8-diy-java-modules/foo/bar/src/Bar.java (100%) rename example/depth/{tasks => modules}/8-diy-java-modules/foo/src/Foo.java (100%) rename example/depth/{tasks => modules}/8-diy-java-modules/qux/src/Qux.java (100%) rename example/depth/{tasks => modules}/9-backticked-names/build.sc (100%) diff --git a/build.sc b/build.sc index 1e2eab81027..14c3cf5e774 100644 --- a/build.sc +++ b/build.sc @@ -1224,6 +1224,7 @@ object example extends Module { object depth extends Module{ object tasks extends Cross[ExampleCrossModule](listIn(millSourcePath / "tasks")) + object modules extends Cross[ExampleCrossModule](listIn(millSourcePath / "modules")) object cross extends Cross[ExampleCrossModule](listIn(millSourcePath / "cross")) } @@ -1755,7 +1756,6 @@ object docs extends Module { } )() - pprint.log(renderedExamples.map(_._1),height=9999) for ((name, pref) <- renderedExamples) os.copy( pref.path, pagesWd / "example" / os.SubPath(s"$name.adoc"), diff --git a/docs/modules/ROOT/pages/Modules.adoc b/docs/modules/ROOT/pages/Modules.adoc index ba2636ed247..ba6952fa1f2 100644 --- a/docs/modules/ROOT/pages/Modules.adoc +++ b/docs/modules/ROOT/pages/Modules.adoc @@ -12,15 +12,15 @@ Mill's comes with built in modules such as `mill.scalalib.ScalaModule` and `mill.scalalib.CrossSbtModule`, but you can also define your own modules to do things that are not built-in to Mill. -include::example/depth/tasks/7-modules.adoc[] +include::example/depth/modules/7-modules.adoc[] == Use Case: DIY Java Modules -include::example/depth/tasks/8-diy-java-modules.adoc[] +include::example/depth/modules/8-diy-java-modules.adoc[] == Backticked Names -include::example/depth/tasks/9-backticked-names.adoc[] +include::example/depth/modules/9-backticked-names.adoc[] == External Modules @@ -61,6 +61,6 @@ needing to define your own `T.command` in your `build.sc` file == Nested `module.sc` files -include::example/depth/tasks/10-module-sc.adoc[] +include::example/depth/modules/10-module-sc.adoc[] diff --git a/example/depth/tasks/10-module-sc/bar/module.sc b/example/depth/modules/10-module-sc/bar/module.sc similarity index 100% rename from example/depth/tasks/10-module-sc/bar/module.sc rename to example/depth/modules/10-module-sc/bar/module.sc diff --git a/example/depth/tasks/10-module-sc/bar/qux/module.sc b/example/depth/modules/10-module-sc/bar/qux/module.sc similarity index 100% rename from example/depth/tasks/10-module-sc/bar/qux/module.sc rename to example/depth/modules/10-module-sc/bar/qux/module.sc diff --git a/example/depth/tasks/10-module-sc/bar/qux/module/src/BarQux.scala b/example/depth/modules/10-module-sc/bar/qux/module/src/BarQux.scala similarity index 100% rename from example/depth/tasks/10-module-sc/bar/qux/module/src/BarQux.scala rename to example/depth/modules/10-module-sc/bar/qux/module/src/BarQux.scala diff --git a/example/depth/tasks/10-module-sc/build.sc b/example/depth/modules/10-module-sc/build.sc similarity index 100% rename from example/depth/tasks/10-module-sc/build.sc rename to example/depth/modules/10-module-sc/build.sc diff --git a/example/depth/tasks/10-module-sc/foo/module.sc b/example/depth/modules/10-module-sc/foo/module.sc similarity index 100% rename from example/depth/tasks/10-module-sc/foo/module.sc rename to example/depth/modules/10-module-sc/foo/module.sc diff --git a/example/depth/tasks/10-module-sc/foo/src/Foo.scala b/example/depth/modules/10-module-sc/foo/src/Foo.scala similarity index 100% rename from example/depth/tasks/10-module-sc/foo/src/Foo.scala rename to example/depth/modules/10-module-sc/foo/src/Foo.scala diff --git a/example/depth/tasks/11-module-run-task/bar/src/Bar.scala b/example/depth/modules/11-module-run-task/bar/src/Bar.scala similarity index 100% rename from example/depth/tasks/11-module-run-task/bar/src/Bar.scala rename to example/depth/modules/11-module-run-task/bar/src/Bar.scala diff --git a/example/depth/tasks/11-module-run-task/build.sc b/example/depth/modules/11-module-run-task/build.sc similarity index 100% rename from example/depth/tasks/11-module-run-task/build.sc rename to example/depth/modules/11-module-run-task/build.sc diff --git a/example/depth/tasks/11-module-run-task/foo/src/Foo.scala b/example/depth/modules/11-module-run-task/foo/src/Foo.scala similarity index 100% rename from example/depth/tasks/11-module-run-task/foo/src/Foo.scala rename to example/depth/modules/11-module-run-task/foo/src/Foo.scala diff --git a/example/depth/tasks/7-modules/build.sc b/example/depth/modules/7-modules/build.sc similarity index 100% rename from example/depth/tasks/7-modules/build.sc rename to example/depth/modules/7-modules/build.sc diff --git a/example/depth/tasks/7-modules/outer/inner/sources/inner-source.txt b/example/depth/modules/7-modules/outer/inner/sources/inner-source.txt similarity index 100% rename from example/depth/tasks/7-modules/outer/inner/sources/inner-source.txt rename to example/depth/modules/7-modules/outer/inner/sources/inner-source.txt diff --git a/example/depth/tasks/7-modules/outer/sources/outer-source.txt b/example/depth/modules/7-modules/outer/sources/outer-source.txt similarity index 100% rename from example/depth/tasks/7-modules/outer/sources/outer-source.txt rename to example/depth/modules/7-modules/outer/sources/outer-source.txt diff --git a/example/depth/tasks/7-modules/outer2/nested/inner/sources/inner-source.txt b/example/depth/modules/7-modules/outer2/nested/inner/sources/inner-source.txt similarity index 100% rename from example/depth/tasks/7-modules/outer2/nested/inner/sources/inner-source.txt rename to example/depth/modules/7-modules/outer2/nested/inner/sources/inner-source.txt diff --git a/example/depth/tasks/7-modules/outer2/nested/sources/outer-source.txt b/example/depth/modules/7-modules/outer2/nested/sources/outer-source.txt similarity index 100% rename from example/depth/tasks/7-modules/outer2/nested/sources/outer-source.txt rename to example/depth/modules/7-modules/outer2/nested/sources/outer-source.txt diff --git a/example/depth/tasks/8-diy-java-modules/build.sc b/example/depth/modules/8-diy-java-modules/build.sc similarity index 100% rename from example/depth/tasks/8-diy-java-modules/build.sc rename to example/depth/modules/8-diy-java-modules/build.sc diff --git a/example/depth/tasks/8-diy-java-modules/foo/bar/src/Bar.java b/example/depth/modules/8-diy-java-modules/foo/bar/src/Bar.java similarity index 100% rename from example/depth/tasks/8-diy-java-modules/foo/bar/src/Bar.java rename to example/depth/modules/8-diy-java-modules/foo/bar/src/Bar.java diff --git a/example/depth/tasks/8-diy-java-modules/foo/src/Foo.java b/example/depth/modules/8-diy-java-modules/foo/src/Foo.java similarity index 100% rename from example/depth/tasks/8-diy-java-modules/foo/src/Foo.java rename to example/depth/modules/8-diy-java-modules/foo/src/Foo.java diff --git a/example/depth/tasks/8-diy-java-modules/qux/src/Qux.java b/example/depth/modules/8-diy-java-modules/qux/src/Qux.java similarity index 100% rename from example/depth/tasks/8-diy-java-modules/qux/src/Qux.java rename to example/depth/modules/8-diy-java-modules/qux/src/Qux.java diff --git a/example/depth/tasks/9-backticked-names/build.sc b/example/depth/modules/9-backticked-names/build.sc similarity index 100% rename from example/depth/tasks/9-backticked-names/build.sc rename to example/depth/modules/9-backticked-names/build.sc From 2ca5bb48fcfa8fd94111418898cc1cdc1340aba5 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 22:21:12 +0800 Subject: [PATCH 07/24] . --- build.sc | 27 ++++--- .../11-module-run-task/bar/src/Bar.scala | 0 .../11-module-run-task/build.sc | 0 .../11-module-run-task/foo/src/Foo.scala | 0 .../plugins/7-writing-mill-plugins/build.sc | 10 +-- .../test/src/mill/testkit/ExampleTests.scala | 34 ++++----- .../src/mill/testkit/IntegrationTests.scala | 2 + .../test/src/mill/testkit/UnitTests.scala | 72 +++++++++---------- 8 files changed, 79 insertions(+), 66 deletions(-) rename example/depth/{modules => tasks}/11-module-run-task/bar/src/Bar.scala (100%) rename example/depth/{modules => tasks}/11-module-run-task/build.sc (100%) rename example/depth/{modules => tasks}/11-module-run-task/foo/src/Foo.scala (100%) diff --git a/build.sc b/build.sc index 14c3cf5e774..4d26ce4a054 100644 --- a/build.sc +++ b/build.sc @@ -381,7 +381,8 @@ trait MillScalaModule extends ScalaModule with MillJavaModule with ScalafixModul Seq(PathRef(T.dest)) } - def runClasspath = super.runClasspath() ++ writeLocalTestOverrides() + def runClasspathWithoutOverrides = T{ super.runClasspath() } + def runClasspath = runClasspathWithoutOverrides() ++ writeLocalTestOverrides() def scalacPluginIvyDeps = super.scalacPluginIvyDeps() ++ @@ -1542,13 +1543,16 @@ object dist extends MillPublishJavaModule { def jar = dev.rawAssembly() } -object dev extends MillPublishScalaModule { - // disable scalafix here because it crashes when a module has no sources - def fix(args: String*): Command[Unit] = T.command {} - def moduleDeps = Seq(runner, idea) - - def testTransitiveDeps = super.testTransitiveDeps() ++ Seq( - (s"com.lihaoyi-${dist.artifactId()}", rawAssembly().path.toString), +object dist0 extends MillPublishJavaModule { + def writeLocalTestOverrides = T.task { + for ((k, v) <- testTransitiveDeps()) { + os.write(T.dest / "mill" / "local-test-overrides" / k, v, createFolders = true) + } + Seq(PathRef(T.dest)) + } + def upstreamAssemblyClasspath = Agg.from(dev.runClasspathWithoutOverrides()) + def localClasspath = super.localClasspath() ++ writeLocalTestOverrides() + def testTransitiveDeps = runner.testTransitiveDeps() ++ Seq( runner.linenumbers.testDep(), scalalib.backgroundwrapper.testDep(), contrib.bloop.testDep(), @@ -1561,6 +1565,13 @@ object dev extends MillPublishScalaModule { bsp.worker.testDep(), testkit.testDep(), ) +} +object dev extends MillPublishScalaModule { + // disable scalafix here because it crashes when a module has no sources + def fix(args: String*): Command[Unit] = T.command {} + def moduleDeps = Seq(runner, idea) + + def testTransitiveDeps = dist0.testTransitiveDeps() def genTask(m: ScalaModule) = T.task { Seq(m.jar(), m.sourceJar()) ++ m.runClasspath() } diff --git a/example/depth/modules/11-module-run-task/bar/src/Bar.scala b/example/depth/tasks/11-module-run-task/bar/src/Bar.scala similarity index 100% rename from example/depth/modules/11-module-run-task/bar/src/Bar.scala rename to example/depth/tasks/11-module-run-task/bar/src/Bar.scala diff --git a/example/depth/modules/11-module-run-task/build.sc b/example/depth/tasks/11-module-run-task/build.sc similarity index 100% rename from example/depth/modules/11-module-run-task/build.sc rename to example/depth/tasks/11-module-run-task/build.sc diff --git a/example/depth/modules/11-module-run-task/foo/src/Foo.scala b/example/depth/tasks/11-module-run-task/foo/src/Foo.scala similarity index 100% rename from example/depth/modules/11-module-run-task/foo/src/Foo.scala rename to example/depth/tasks/11-module-run-task/foo/src/Foo.scala diff --git a/example/extending/plugins/7-writing-mill-plugins/build.sc b/example/extending/plugins/7-writing-mill-plugins/build.sc index 6fa43908270..48cdc10d274 100644 --- a/example/extending/plugins/7-writing-mill-plugins/build.sc +++ b/example/extending/plugins/7-writing-mill-plugins/build.sc @@ -18,11 +18,11 @@ object myplugin extends ScalaModule with PublishModule { object testMill extends JavaModule{ def ivyDeps = Agg(ivy"com.lihaoyi:mill-dist:$millVersion") def mainClass = Some("mill.runner.client.MillClientMain") - def resources = T{ - val p = T.dest / "mill" / "local-test-overrides" / s"com.lihaoyi-${myplugin.artifactId()}" - os.write(p, myplugin.runClasspath().map(_.path).mkString("\n"), createFolders = true) - Seq(PathRef(T.dest)) - } +// def resources = T{ +// val p = T.dest / "mill" / "local-test-overrides" / s"com.lihaoyi-${myplugin.artifactId()}" +// os.write(p, myplugin.runClasspath().map(_.path).mkString("\n"), createFolders = true) +// Seq(PathRef(T.dest)) +// } } } diff --git a/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala index b08a6da489f..c5e7ed8dec9 100644 --- a/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala +++ b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/ExampleTests.scala @@ -1,17 +1,17 @@ -//package myplugin -//import mill.testkit.ExampleTester -//import utest._ -// -//object ExampleTests extends TestSuite { -// -// def tests: Tests = Tests { -// test("example") { -// val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) -// ExampleTester.run( -// clientServerMode = true, -// workspaceSourcePath = resourceFolder / "example-test-project", -// millExecutable = os.Path(sys.env("MILL_EXECUTABLE_PATH")) -// ) -// } -// } -//} +package myplugin +import mill.testkit.ExampleTester +import utest._ + +object ExampleTests extends TestSuite { + + def tests: Tests = Tests { + test("example") { + val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) + ExampleTester.run( + clientServerMode = true, + workspaceSourcePath = resourceFolder / "example-test-project", + millExecutable = os.Path(sys.env("MILL_EXECUTABLE_PATH")) + ) + } + } +} diff --git a/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala index 06539d6051a..475ff861059 100644 --- a/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala +++ b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/IntegrationTests.scala @@ -4,7 +4,9 @@ import utest._ object IntegrationTests extends TestSuite { + println("initializing myplugin.IntegrationTest") def tests: Tests = Tests { + println("initializing myplugin.IntegrationTest.tests") test("integration") { pprint.log(sys.env("MILL_EXECUTABLE_PATH")) diff --git a/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala index 660412b83f1..7fc0e055d70 100644 --- a/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala +++ b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala @@ -1,36 +1,36 @@ -//package myplugin -// -//import mill.testkit.{TestBaseModule, UnitTester} -//import utest._ -// -//object UnitTests extends TestSuite { -// def tests: Tests = Tests { -// test("simple") { -// object build extends TestBaseModule with LineCountJavaModule{ -// def lineCountResourceFileName = "line-count.txt" -// } -// -// val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) -// val eval = UnitTester(build, resourceFolder/ "unit-test-project") -// -// // Evaluating tasks by direct reference -// val Right(result) = eval(build.resources) -// assert( -// result.value.exists(pathref => -// os.exists(pathref.path / "line-count.txt") && -// os.read(pathref.path / "line-count.txt") == "17" -// ) -// ) -// -// // Evaluating tasks by passing in their Mill selector -// val Right(result2) = eval("resources") -// val Seq(pathrefs: Seq[mill.api.PathRef]) = result2.value -// assert( -// pathrefs.exists(pathref => -// os.exists(pathref.path / "line-count.txt") && -// os.read(pathref.path / "line-count.txt") == "17" -// ) -// ) -// } -// } -//} +package myplugin + +import mill.testkit.{TestBaseModule, UnitTester} +import utest._ + +object UnitTests extends TestSuite { + def tests: Tests = Tests { + test("simple") { + object build extends TestBaseModule with LineCountJavaModule{ + def lineCountResourceFileName = "line-count.txt" + } + + val resourceFolder = os.Path(sys.env("MILL_TEST_RESOURCE_FOLDER")) + val eval = UnitTester(build, resourceFolder/ "unit-test-project") + + // Evaluating tasks by direct reference + val Right(result) = eval(build.resources) + assert( + result.value.exists(pathref => + os.exists(pathref.path / "line-count.txt") && + os.read(pathref.path / "line-count.txt") == "17" + ) + ) + + // Evaluating tasks by passing in their Mill selector + val Right(result2) = eval("resources") + val Seq(pathrefs: Seq[mill.api.PathRef]) = result2.value + assert( + pathrefs.exists(pathref => + os.exists(pathref.path / "line-count.txt") && + os.read(pathref.path / "line-count.txt") == "17" + ) + ) + } + } +} From 050d7a7a28fa44793ab68ccc0f3d308be5fda593 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 22:27:18 +0800 Subject: [PATCH 08/24] . --- ci/test-mill-bootstrap.sh | 2 +- ci/test-mill-dev.sh | 2 +- ci/test-mill-release.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/test-mill-bootstrap.sh b/ci/test-mill-bootstrap.sh index 1cd7c0a2439..50047066a95 100755 --- a/ci/test-mill-bootstrap.sh +++ b/ci/test-mill-bootstrap.sh @@ -20,4 +20,4 @@ ci/prepare-mill-bootstrap.sh # Run tests target/mill-release -i "__.compile" -target/mill-release -i "example.basic[1-simple].server.test" +target/mill-release -i "example.scalalib.basic[1-simple].server.test" diff --git a/ci/test-mill-dev.sh b/ci/test-mill-dev.sh index 0c36fc46080..d81d297cfe0 100755 --- a/ci/test-mill-dev.sh +++ b/ci/test-mill-dev.sh @@ -2,7 +2,7 @@ set -eux -EXAMPLE=example/scalabuilds/9-realistic +EXAMPLE=example/scalalib/builds/9-realistic rm -rf $EXAMPLE/out diff --git a/ci/test-mill-release.sh b/ci/test-mill-release.sh index b9170e9f8ec..3cdb3ba973b 100755 --- a/ci/test-mill-release.sh +++ b/ci/test-mill-release.sh @@ -5,7 +5,7 @@ set -eux # Build Mill ./mill -i dev.assembly -EXAMPLE=example/scalabuilds/9-realistic +EXAMPLE=example/scalalib/builds/9-realistic rm -rf $EXAMPLE/out From 88372bd63d5bf5e8087ae878aa7feae8371f50fa Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 22:32:22 +0800 Subject: [PATCH 09/24] . --- .../basic/1-simple/test/src/FooTests.scala | 1 - .../test/src/FooTests.scala | 1 - .../test/src/FooScalaTests.scala | 2 - .../test/src/FooTests.scala | 1 - .../test/src/FooTests.scala | 1 - .../1-todo-webapp/test/src/WebAppTests.scala | 2 - .../test/src/WebAppTests.scala | 2 - .../test/src/WebAppTests.scala | 2 - .../test/src/WebAppTests.scala | 2 - example/thirdparty/acyclic/build.sc | 84 +++ example/thirdparty/commons-io/build.sc | 71 ++ example/thirdparty/fansi/build.sc | 94 +++ example/thirdparty/jimfs/build.sc | 63 ++ example/thirdparty/mockito/build.sc | 275 ++++++++ example/thirdparty/netty/build.sc | 626 ++++++++++++++++++ .../test/src/MultiLevelBuildTests.scala | 2 +- 16 files changed, 1214 insertions(+), 15 deletions(-) create mode 100644 example/thirdparty/acyclic/build.sc create mode 100644 example/thirdparty/commons-io/build.sc create mode 100644 example/thirdparty/fansi/build.sc create mode 100644 example/thirdparty/jimfs/build.sc create mode 100644 example/thirdparty/mockito/build.sc create mode 100644 example/thirdparty/netty/build.sc diff --git a/example/scalalib/basic/1-simple/test/src/FooTests.scala b/example/scalalib/basic/1-simple/test/src/FooTests.scala index 33d48636ccc..45576fcf513 100644 --- a/example/scalalib/basic/1-simple/test/src/FooTests.scala +++ b/example/scalalib/basic/1-simple/test/src/FooTests.scala @@ -1,4 +1,3 @@ - object FooTests extends TestSuite { def tests = Tests { test("simple") { diff --git a/example/scalalib/basic/2-custom-build-logic/test/src/FooTests.scala b/example/scalalib/basic/2-custom-build-logic/test/src/FooTests.scala index 2af033b9094..cec04cb1e13 100644 --- a/example/scalalib/basic/2-custom-build-logic/test/src/FooTests.scala +++ b/example/scalalib/basic/2-custom-build-logic/test/src/FooTests.scala @@ -1,4 +1,3 @@ - object FooTests extends TestSuite { def tests = Tests { test("simple") { diff --git a/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala index 92ee234c58d..cb1b8d10ade 100644 --- a/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala +++ b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala @@ -1,5 +1,3 @@ - - class FooScalaTests extends AnyFreeSpec { "Foo" - { "simple" in { diff --git a/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooTests.scala b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooTests.scala index 33d48636ccc..45576fcf513 100644 --- a/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooTests.scala +++ b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooTests.scala @@ -1,4 +1,3 @@ - object FooTests extends TestSuite { def tests = Tests { test("simple") { diff --git a/example/scalalib/module/13-contrib-scoverage/test/src/FooTests.scala b/example/scalalib/module/13-contrib-scoverage/test/src/FooTests.scala index 33d48636ccc..45576fcf513 100644 --- a/example/scalalib/module/13-contrib-scoverage/test/src/FooTests.scala +++ b/example/scalalib/module/13-contrib-scoverage/test/src/FooTests.scala @@ -1,4 +1,3 @@ - object FooTests extends TestSuite { def tests = Tests { test("simple") { diff --git a/example/scalalib/web/1-todo-webapp/test/src/WebAppTests.scala b/example/scalalib/web/1-todo-webapp/test/src/WebAppTests.scala index 7e8f7b79d69..7298f2396da 100644 --- a/example/scalalib/web/1-todo-webapp/test/src/WebAppTests.scala +++ b/example/scalalib/web/1-todo-webapp/test/src/WebAppTests.scala @@ -1,5 +1,3 @@ - - object WebAppTests extends TestSuite { def withServer[T](example: cask.main.Main)(f: String => T): T = { val server = io.undertow.Undertow.builder diff --git a/example/scalalib/web/2-webapp-cache-busting/test/src/WebAppTests.scala b/example/scalalib/web/2-webapp-cache-busting/test/src/WebAppTests.scala index 7e8f7b79d69..7298f2396da 100644 --- a/example/scalalib/web/2-webapp-cache-busting/test/src/WebAppTests.scala +++ b/example/scalalib/web/2-webapp-cache-busting/test/src/WebAppTests.scala @@ -1,5 +1,3 @@ - - object WebAppTests extends TestSuite { def withServer[T](example: cask.main.Main)(f: String => T): T = { val server = io.undertow.Undertow.builder diff --git a/example/scalalib/web/4-webapp-scalajs/test/src/WebAppTests.scala b/example/scalalib/web/4-webapp-scalajs/test/src/WebAppTests.scala index 7e8f7b79d69..7298f2396da 100644 --- a/example/scalalib/web/4-webapp-scalajs/test/src/WebAppTests.scala +++ b/example/scalalib/web/4-webapp-scalajs/test/src/WebAppTests.scala @@ -1,5 +1,3 @@ - - object WebAppTests extends TestSuite { def withServer[T](example: cask.main.Main)(f: String => T): T = { val server = io.undertow.Undertow.builder diff --git a/example/scalalib/web/5-webapp-scalajs-shared/test/src/WebAppTests.scala b/example/scalalib/web/5-webapp-scalajs-shared/test/src/WebAppTests.scala index 7e8f7b79d69..7298f2396da 100644 --- a/example/scalalib/web/5-webapp-scalajs-shared/test/src/WebAppTests.scala +++ b/example/scalalib/web/5-webapp-scalajs-shared/test/src/WebAppTests.scala @@ -1,5 +1,3 @@ - - object WebAppTests extends TestSuite { def withServer[T](example: cask.main.Main)(f: String => T): T = { val server = io.undertow.Undertow.builder diff --git a/example/thirdparty/acyclic/build.sc b/example/thirdparty/acyclic/build.sc new file mode 100644 index 00000000000..c8216888f87 --- /dev/null +++ b/example/thirdparty/acyclic/build.sc @@ -0,0 +1,84 @@ +import mill._, scalalib._, publish._ + +// acyclic test suite assumes files are on disk at specific paths relative to `os.pwd`. +// To avoid changing the test code, we instead copy the necessary files into the `os.pwd` +// when preparing the resources for test suite execution +os.copy.over( + interp.watch(mill.api.WorkspaceRoot.workspaceRoot / "acyclic"), + os.pwd / "acyclic", + createFolders = true +) + +object Deps { + def acyclic = ivy"com.lihaoyi:::acyclic:0.3.6" + def scalaCompiler(scalaVersion: String) = ivy"org.scala-lang:scala-compiler:$scalaVersion" + val utest = ivy"com.lihaoyi::utest:0.8.4" +} + +val crosses = + Seq("2.11.12") ++ + Range.inclusive(8, 17).map("2.12." + _) ++ + Range.inclusive(0, 10).map("2.13." + _) + +object acyclic extends Cross[AcyclicModule](crosses) +trait AcyclicModule extends CrossScalaModule with PublishModule { + def crossFullScalaVersion = true + def artifactName = "acyclic" + def publishVersion = "1.3.3.7" + + def pomSettings = PomSettings( + description = artifactName(), + organization = "com.lihaoyi", + url = "https://github.com/com-lihaoyi/acyclic", + licenses = Seq(License.MIT), + versionControl = VersionControl.github(owner = "com-lihaoyi", repo = "acyclic"), + developers = Seq(Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")) + ) + + def compileIvyDeps = Agg(Deps.scalaCompiler(crossScalaVersion)) + + object test extends ScalaTests with TestModule.Utest { + def sources = T.sources(millSourcePath / "src", millSourcePath / "resources") + def ivyDeps = Agg(Deps.utest, Deps.scalaCompiler(crossScalaVersion)) + } +} + +// Acyclic is an example of a very small project that is a Scala compiler +// plugin. It is cross-built against all point versions of Scala from 2.11.12 +// to 2.13.10, and has a dependency on the `org.scala-lang:scala-compiler` +// +// Project home: https://github.com/com-lihaoyi/acyclic + +/** Usage + +> ./mill resolve acyclic[_].compile +acyclic[2.11.12].compile +acyclic[2.12.10].compile +acyclic[2.12.11].compile +acyclic[2.12.12].compile +acyclic[2.12.13].compile +acyclic[2.12.14].compile +acyclic[2.12.15].compile +acyclic[2.12.16].compile +acyclic[2.12.8].compile +acyclic[2.12.9].compile +acyclic[2.13.0].compile +acyclic[2.13.1].compile +acyclic[2.13.2].compile +acyclic[2.13.3].compile +acyclic[2.13.4].compile +acyclic[2.13.5].compile +acyclic[2.13.6].compile +acyclic[2.13.7].compile +acyclic[2.13.8].compile +acyclic[2.13.9].compile + +> ./mill acyclic[2.12.17].compile +compiling 6 Scala sources... +... + +> ./mill acyclic[2.13.10].test.testLocal # acyclic tests need testLocal due to classloader assumptions +-------------------------------- Running Tests -------------------------------- +... + +*/ \ No newline at end of file diff --git a/example/thirdparty/commons-io/build.sc b/example/thirdparty/commons-io/build.sc new file mode 100644 index 00000000000..5f65af34b97 --- /dev/null +++ b/example/thirdparty/commons-io/build.sc @@ -0,0 +1,71 @@ +import mill._, javalib._, publish._ +import $ivy.`com.lihaoyi::mill-contrib-jmh:$MILL_VERSION` +import contrib.jmh.JmhModule + +object commonsio extends RootModule with PublishModule with MavenModule { + def publishVersion = "2.17.0-SNAPSHOT" + + def pomSettings = PomSettings( + description = artifactName(), + organization = "org.apache.commons", + url = "https://github.com/apache/commons-io", + licenses = Seq(License.`Apache-2.0`), + versionControl = VersionControl.github(owner = "apache", repo = "commons-io"), + developers = Nil + ) + + object test extends MavenTests with TestModule.Junit5 with JmhModule{ + def testSandboxWorkingDir = false + def jmhCoreVersion = "1.37" + def ivyDeps = super.ivyDeps() ++ Agg( + ivy"org.junit.jupiter:junit-jupiter:5.10.3", + ivy"org.junit-pioneer:junit-pioneer:1.9.1", + ivy"net.bytebuddy:byte-buddy:1.14.18", + ivy"net.bytebuddy:byte-buddy-agent:1.14.18", + ivy"org.mockito:mockito-inline:4.11.0", + ivy"com.google.jimfs:jimfs:1.3.0", + ivy"org.apache.commons:commons-lang3:3.14.0", + ivy"commons-codec:commons-codec:1.17.1", + ivy"org.openjdk.jmh:jmh-core:1.37", + ivy"org.openjdk.jmh:jmh-generator-annprocess:1.37", + ) + } +} + +// The Apache Commons IO library contains utility classes, stream implementations, file filters, +// file comparators, endian transformation classes, and much more. +// +// The core library `commonsio` is dependency-free, but the test suite `commonsio.test` +// as a number of libraries included. It also ships with JMH benchmarks, which Mill +// supports via the built in JMH plugin +// +// Project home: https://github.com/apache/commons-io + +/** Usage + +> ./mill compile +compiling 254 Java sources... +... + +> ./mill test.compile +compiling 261 Java sources... +... + +> ./mill test.testOnly org.apache.commons.io.FileUtilsTest +Test org.apache.commons.io.FileUtilsTest#testCopyFile1() started +Test org.apache.commons.io.FileUtilsTest#testCopyFile1() finished, took ... +... + +> ./mill test.testOnly org.apache.commons.io.FileSystemTest +Test org.apache.commons.io.FileSystemTest#testIsLegalName() started +Test org.apache.commons.io.FileSystemTest#testIsLegalName() finished, took ... +... + +> ./mill test.runJmh '.*PathUtilsContentEqualsBenchmark' -bm SingleShotTime +Benchmark Mode Cnt ... +PathUtilsContentEqualsBenchmark.testCurrent_fileContentEquals ss 5 ... +PathUtilsContentEqualsBenchmark.testCurrent_fileContentEquals_Blackhole ss 5 ... +PathUtilsContentEqualsBenchmark.testProposal_contentEquals ss 5 ... +PathUtilsContentEqualsBenchmark.testProposal_contentEquals_Blackhole ss 5 ... + +*/ \ No newline at end of file diff --git a/example/thirdparty/fansi/build.sc b/example/thirdparty/fansi/build.sc new file mode 100644 index 00000000000..ef1de921bac --- /dev/null +++ b/example/thirdparty/fansi/build.sc @@ -0,0 +1,94 @@ +import mill._, scalalib._, scalajslib._, scalanativelib._, publish._ + +val dottyCommunityBuildVersion = sys.props.get("dottyVersion").toList + +val scalaVersions = Seq("2.12.17", "2.13.8", "2.11.12", "3.1.3") ++ dottyCommunityBuildVersion + +trait FansiModule extends PublishModule with CrossScalaModule with PlatformScalaModule { + def publishVersion = "1.3.3.7" + + def pomSettings = PomSettings( + description = artifactName(), + organization = "com.lihaoyi", + url = "https://github.com/com-lihaoyi/Fansi", + licenses = Seq(License.MIT), + versionControl = VersionControl.github(owner = "com-lihaoyi", repo = "fansi"), + developers = Seq(Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")) + ) + + def ivyDeps = Agg(ivy"com.lihaoyi::sourcecode::0.3.0") + + trait FansiTests extends ScalaTests with TestModule.Utest { + def ivyDeps = Agg(ivy"com.lihaoyi::utest::0.8.4") + } +} + +object fansi extends Module { + object jvm extends Cross[JvmFansiModule](scalaVersions) + trait JvmFansiModule extends FansiModule with ScalaModule { + object test extends FansiTests with ScalaTests + } + + object js extends Cross[JsFansiModule](scalaVersions) + trait JsFansiModule extends FansiModule with ScalaJSModule { + def scalaJSVersion = "1.16.0" + object test extends FansiTests with ScalaJSTests + } + + object native extends Cross[NativeFansiModule](scalaVersions) + trait NativeFansiModule extends FansiModule with ScalaNativeModule { + def scalaNativeVersion = "0.4.5" + object test extends FansiTests with ScalaNativeTests + } +} + +// Fansi is an example of a small library that is cross built against every +// minor version of Scala (including Scala 3.x) and every platform: JVM, JS, +// and Native. +// Both the library and the test suite are duplicated across all +// entries in the {version}x{platform} matrix, and you can select which one you +// want to compile, test, or publish +// +// Project home: https://github.com/com-lihaoyi/fansi + +/** Usage + +> ./mill resolve __.compile +fansi.js[2.11.12].test.compile +fansi.js[2.12.17].compile +fansi.js[2.12.17].test.compile +fansi.js[2.13.8].compile +fansi.js[2.13.8].test.compile +fansi.js[3.1.3].compile +fansi.js[3.1.3].test.compile +fansi.jvm[2.11.12].compile +fansi.jvm[2.11.12].test.compile +fansi.jvm[2.12.17].compile +fansi.jvm[2.12.17].test.compile +fansi.jvm[2.13.8].compile +fansi.jvm[2.13.8].test.compile +fansi.jvm[3.1.3].compile +fansi.jvm[3.1.3].test.compile +fansi.native[2.11.12].compile +fansi.native[2.11.12].test.compile +fansi.native[2.12.17].compile +fansi.native[2.12.17].test.compile +fansi.native[2.13.8].compile +fansi.native[2.13.8].test.compile +fansi.native[3.1.3].compile +fansi.native[3.1.3].test.compile + +> ./mill fansi.jvm[2.12.17].compile +compiling 1 Scala source... +... + +> ./mill fansi.js[2.13.8].test +Starting process: node +-------------------------------- Running Tests -------------------------------- +... + +> ./mill fansi.native[3.1.3].publishLocal +Publishing Artifact(com.lihaoyi,fansi_native0.4_3,1.3.3.7) to ivy repo... +... + +*/ \ No newline at end of file diff --git a/example/thirdparty/jimfs/build.sc b/example/thirdparty/jimfs/build.sc new file mode 100644 index 00000000000..d8b5543532d --- /dev/null +++ b/example/thirdparty/jimfs/build.sc @@ -0,0 +1,63 @@ +import mill._, javalib._, publish._ + +def sharedCompileIvyDeps = T{ + Agg( + ivy"com.google.auto.service:auto-service:1.0.1", + ivy"com.google.code.findbugs:jsr305:3.0.2", + ivy"org.checkerframework:checker-compat-qual:2.5.5", + ivy"com.ibm.icu:icu4j:73.1", + ) +} + + +object jimfs extends PublishModule with MavenModule { + def publishVersion = "1.3.3.7" + + def pomSettings = PomSettings( + description = artifactName(), + organization = "com.google", + url = "https://github.com/google/jimfs", + licenses = Seq(License.MIT), + versionControl = VersionControl.github(owner = "google", repo = "jimfs"), + developers = Nil + ) + + def ivyDeps = sharedCompileIvyDeps() ++ Agg( + ivy"com.google.guava:guava:31.1-android", + ) + + def javacOptions = Seq("-processor", "com.google.auto.service.processor.AutoServiceProcessor") + + object test extends MavenTests { + def ivyDeps = sharedCompileIvyDeps() ++ Agg( + ivy"junit:junit:4.13.2", + ivy"com.google.guava:guava-testlib:31.1-android", + ivy"com.google.truth:truth:1.1.3", + ivy"com.github.sbt:junit-interface:0.13.2", + ivy"com.ibm.icu:icu4j:73.1", + ) + + def testFramework = "com.novocode.junit.JUnitFramework" + } +} + +// JimFS is a small Java library implementing an in-memory filesystem. It is commonly +// used in test suites to validate filesystem operations without needing to write +// to disk. +// +// It has a relatively simple codebase structure, a single module and test suite. +// It has a number of compile-time-only dependencies shared between the library and +// test suite. One wrinkle is that it uses annotation processors as part of its build, +// which Mill supports by providing the relevant `ivyDeps` of the annotation processor +// and providing `javacOptions` to invoke it. +// +// Project home: https://github.com/google/jimfs + +/** Usage + +> ./mill jimfs.test +Test run com.google.common.jimfs.FileTest started +Test run com.google.common.jimfs.FileTest finished: 0 failed, 0 ignored, 7 total... +... + +*/ \ No newline at end of file diff --git a/example/thirdparty/mockito/build.sc b/example/thirdparty/mockito/build.sc new file mode 100644 index 00000000000..890bde760ba --- /dev/null +++ b/example/thirdparty/mockito/build.sc @@ -0,0 +1,275 @@ +import mill._, javalib._ + +object libraries{ + + object versions { + val bytebuddy = "1.14.18" + val junitJupiter = "5.10.3" + val errorprone = "2.23.0" + } + val junit4 = ivy"junit:junit:4.13.2" + val junitJupiterApi = ivy"org.junit.jupiter:junit-jupiter-api:${versions.junitJupiter}" + val junitJupiterParams = ivy"org.junit.jupiter:junit-jupiter-params:${versions.junitJupiter}" + val junitPlatformLauncher = ivy"org.junit.platform:junit-platform-launcher:1.10.3" + val junitJupiterEngine = ivy"org.junit.jupiter:junit-jupiter-engine:${versions.junitJupiter}" + val junitVintageEngine = ivy"org.junit.vintage:junit-vintage-engine:${versions.junitJupiter}" + val assertj = ivy"org.assertj:assertj-core:3.26.3" + val hamcrest = ivy"org.hamcrest:hamcrest-core:2.2" + val opentest4j = ivy"org.opentest4j:opentest4j:1.3.0" + + val bytebuddy = ivy"net.bytebuddy:byte-buddy:${versions.bytebuddy}" + val bytebuddyagent = ivy"net.bytebuddy:byte-buddy-agent:${versions.bytebuddy}" + val bytebuddyandroid = ivy"net.bytebuddy:byte-buddy-android:${versions.bytebuddy}" + + val errorprone = ivy"com.google.errorprone:error_prone_core:${versions.errorprone}" + val errorproneTestApi = ivy"com.google.errorprone:error_prone_test_helpers:${versions.errorprone}" + + val autoservice = ivy"com.google.auto.service:auto-service:1.1.1" + + val objenesis = ivy"org.objenesis:objenesis:3.3" + + val osgi = ivy"org.osgi:osgi.core:8.0.0" + val equinox = ivy"org.eclipse.platform:org.eclipse.osgi:3.20.0" + val bndGradle = "biz.aQute.bnd:biz.aQute.bnd.gradle:6.4.0" + + val groovy = ivy"org.codehaus.groovy:groovy:3.0.22" +} + +trait MockitoModule extends MavenModule{ + def testModuleDeps: Seq[JavaModule] = Nil + def testIvyDeps: T[Agg[Dep]] = Agg.empty[Dep] + def testRuntimeIvyDeps: T[Agg[Dep]] = Agg.empty[Dep] + def testFramework = "com.novocode.junit.JUnitFramework" + def testForkArgs: T[Seq[String]] = Seq.empty[String] + object test extends MavenTests{ + def moduleDeps = super.moduleDeps ++ MockitoModule.this.testModuleDeps + def testFramework = MockitoModule.this.testFramework + def runIvyDeps = testRuntimeIvyDeps() + def forkArgs = testForkArgs() + def ivyDeps = + testIvyDeps() ++ + Agg( + libraries.hamcrest, + libraries.junit4, + libraries.bytebuddyagent, + ivy"com.github.sbt:junit-interface:0.13.2" + ) + } +} + +object mockito extends RootModule with MockitoModule{ + def compileIvyDeps = Agg( + libraries.hamcrest, libraries.junit4, libraries.bytebuddyagent, + libraries.bytebuddy, + libraries.opentest4j + ) + + def ivyDeps = Agg( + libraries.objenesis + ) + + def testIvyDeps = Agg( + libraries.assertj, + libraries.junitJupiterApi, + libraries.junitJupiterParams + ) + + def resources = T{ + val subpath = os.SubPath("org/mockito/internal/creation/bytebuddy/inject/") + os.copy( + compile().classes.path / subpath / "MockMethodDispatcher.class", + T.dest / subpath / "MockMethodDispatcher.raw", + createFolders = true + ) + super.resources() ++ Seq(PathRef(T.dest)) + } + + object subprojects extends Module { + object android extends MockitoModule { + def moduleDeps = Seq(mockito) + def ivyDeps = Agg(libraries.bytebuddyandroid) + } + object errorprone extends MockitoModule { + def compileIvyDeps = Agg(libraries.autoservice) + def moduleDeps = Seq(mockito) + def ivyDeps = Agg(libraries.errorprone) + def testIvyDeps = Agg(libraries.errorproneTestApi) + + def forkArgs = Seq( + // "-processorpath", libraries.autoservice, + "-Xbootclasspath/a:${configurations.errorproneJavac.asPath}", + "--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", + "--add-exports=jdk.compiler/com.sun.tools.javac.type=ALL-UNNAMED", + "--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", + "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", + "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", + "--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", + "--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED", + "--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", + "--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", + ) + + def javacOptions = Seq( + "--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", + "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", + "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" + ) + } + object extTest extends MockitoModule{ + def moduleDeps = Seq(mockito, `junit-jupiter`) + def testModuleDeps = Seq(mockito.test) + def testIvyDeps = Agg( + libraries.junit4, + libraries.assertj, + libraries.junitJupiterApi, + ) + + def testRuntimeIvyDeps = Agg( + libraries.junitJupiterEngine, + libraries.junitVintageEngine, + libraries.junitPlatformLauncher + ) + } + + object inlineTest extends MockitoModule{ + def testModuleDeps = Seq(mockito) + def testIvyDeps = Agg(libraries.junit4, libraries.assertj) + } + +// object `java21-test` extends MockitoModule{ +// def testModuleDeps = Seq(mockito) +// def testIvyDeps = Agg(libraries.junit4, libraries.assertj) +// } + + + object `junit-jupiter` extends MockitoModule{ + def moduleDeps = Seq(mockito) + + def ivyDeps = Agg(libraries.junitJupiterApi) + def testFramework = "com.github.sbt.junit.jupiter.api.JupiterFramework" + def testIvyDeps = Agg( + libraries.assertj, + libraries.junitPlatformLauncher, + ivy"com.github.sbt.junit:jupiter-interface:0.11.4" + ) + + def testRuntimeIvyDeps = Agg( + libraries.junitJupiterEngine, + ) + } + + object junitJupiterExtensionTest extends MockitoModule{ + def testFramework = "com.github.sbt.junit.jupiter.api.JupiterFramework" + def testModuleDeps = Seq(`junit-jupiter`) + def testIvyDeps = Agg(libraries.assertj, libraries.junitJupiterApi) + def testRuntimeIvyDeps = Agg( + libraries.junitJupiterEngine, libraries.junitPlatformLauncher, + ivy"com.github.sbt.junit:jupiter-interface:0.11.4" + ) + } + object junitJupiterInlineMockMakerExtensionTest extends MockitoModule{ + def testFramework = "com.github.sbt.junit.jupiter.api.JupiterFramework" + def testModuleDeps = Seq(`junit-jupiter`) + def testIvyDeps = Agg(libraries.assertj, libraries.junitJupiterApi) + def testRuntimeIvyDeps = Agg( + libraries.junitJupiterEngine, libraries.junitPlatformLauncher, + ivy"com.github.sbt.junit:jupiter-interface:0.11.4" + ) + } + object junitJupiterParallelTest extends MockitoModule{ + def testFramework = "com.github.sbt.junit.jupiter.api.JupiterFramework" + def testModuleDeps = Seq(`junit-jupiter`) + def testIvyDeps = Agg(libraries.junitJupiterApi) + def testRuntimeIvyDeps = Agg( + libraries.junitJupiterEngine, libraries.junitPlatformLauncher, + ivy"com.github.sbt.junit:jupiter-interface:0.11.4", + libraries.bytebuddy + ) + } + object `memory-test` extends MockitoModule{ + def testModuleDeps = Seq(mockito) + def testIvyDeps = Agg(libraries.assertj) + def testForkArgs = Seq("-Xmx128m") + } + +// object `osgi-test` extends MockitoModule { +// def testModuleDeps = Seq(mockito) +// def testIvyDeps = Agg(libraries.junit4, libraries.osgi) +// def testRuntimeIvyDeps = Agg(libraries.equinox) +// trait BundleModule extends MockitoModule{ +// def bundleName: String = millModuleSegments.parts.last +// override def millSourcePath = `osgi-test`.millSourcePath +// def sources = T.sources(millSourcePath / "src" / bundleName / "java") +// +// def manifest = super.manifest().add( +// "Bundle-Name" -> bundleName, +// "Bundle-SymbolicName" -> bundleName, +// "Bundle-Name" -> "Mockito Mock Library for Java. Core bundle requires Byte Buddy and Objenesis.", +// "Bundle-SymbolicName" -> "org.mockito.mockito-core", +//// "Bundle-Version" -> s"$${version_cleanup;0.0.0}", +// "-versionpolicy" -> "[${version;==;${@}},${version;+;${@}})", +// "Export-Package" -> "org.mockito.internal.*;status=INTERNAL;mandatory:=status;version=0.0.0,org.mockito.*;version=0.0.0", +// "Import-Package" -> Seq( +// "net.bytebuddy.*;version=\"[1.6.0,2.0)\"", +// "junit.*;resolution:=optional", +// "org.junit.*;resolution:=optional", +// "org.hamcrest;resolution:=optional", +// "org.objenesis;version=\"[3.1,4.0)\"", +// "org.opentest4j.*;resolution:=optional", +// "org.mockito.*" +// ).mkString(","), +// "-removeheaders" -> "Private-Package", +// "Automatic-Module-Name" -> "org.mockito", +// "-noextraheaders" -> "true" +// ) +// } +// +// object testBundle extends BundleModule{ +// def moduleDeps = Seq(`osgi-test`.test, otherBundle) +// def ivyDeps = Agg(libraries.osgi) +// } +// +// object otherBundle extends BundleModule{ +// def moduleDeps = Seq(`osgi-test`.test) +// def ivyDeps = Agg(libraries.osgi) +// } +// +// object testRuntimeBundles extends JavaModule{ +// def unmanagedClasspath = Agg(testBundle.jar(), otherBundle.jar(), mockito.jar()) +// def ivyDeps = Agg(libraries.bytebuddy, libraries.bytebuddyagent, libraries.objenesis) +// } +// +// def testForkArgs = Seq( +// s"-DtestRuntimeBundles=${testRuntimeBundles.runClasspath().map(_.path).distinct.filter(os.exists(_)).mkString(java.io.File.pathSeparator)}" +// ) +// } + object `programmatic-test` extends MockitoModule{ + def testModuleDeps = Seq(mockito) + def testIvyDeps = Agg(libraries.junit4, libraries.assertj) + } + object proxy extends MockitoModule{ + def testModuleDeps = Seq(mockito) + def testIvyDeps = Agg(libraries.junit4, libraries.assertj) + } + object subclass extends MockitoModule{ + def testModuleDeps = Seq(mockito) + def testIvyDeps = Agg(libraries.junit4, libraries.assertj) + } + } +} + + +// Run a few smoketests on the mockito repo, compiling everything (including tests) +// but only running the subset of tests that run quickly +/** Usage + +> ./mill -j5 __.compile + +> ./mill __.test +Test org.mockitoinline.StaticMockTest.testStaticMockSimple... +Test org.mockito.internal.creation.MockSettingsImplTest.validates_invocation_listeners finished... +Test org.mockitousage.junitrunner.StubbingWarningsJUnitRunnerTest.shows_arg_mismatch_warnings_when_test_fails finished... +Test org.mockitousage.session.MockitoSessionTest.allows_updating_strictness finished... +... + +*/ diff --git a/example/thirdparty/netty/build.sc b/example/thirdparty/netty/build.sc new file mode 100644 index 00000000000..4a7a3181c92 --- /dev/null +++ b/example/thirdparty/netty/build.sc @@ -0,0 +1,626 @@ +import mill._, javalib._ +import $ivy.`org.codehaus.groovy:groovy:3.0.9` +import $ivy.`org.codehaus.groovy:groovy-ant:3.0.9` +import $ivy.`ant:ant-optional:1.5.3-1` +// TODO: +// testsuite-shading +// testsuite-native-image* +// testsuite-autobahn + +def isOSX = System.getProperty("os.name").toLowerCase.contains("mac") + +trait NettyBaseModule extends MavenModule{ + def javacOptions = Seq("-source", "1.8", "-target", "1.8") +} +trait NettyBaseTestSuiteModule extends NettyBaseModule with TestModule.Junit5{ + def testSandboxWorkingDir = false + def testFramework = "com.github.sbt.junit.jupiter.api.JupiterFramework" + def ivyDeps = Agg( + ivy"com.github.sbt.junit:jupiter-interface:0.11.2", + ivy"org.hamcrest:hamcrest-library:1.3", + ivy"org.assertj:assertj-core:3.18.0", + ivy"org.junit.jupiter:junit-jupiter-api:5.9.0", + ivy"org.junit.jupiter:junit-jupiter-params:5.9.0", + ivy"org.mockito:mockito-core:2.18.3", + ivy"org.reflections:reflections:0.10.2", + ivy"com.google.code.gson:gson:2.8.9", + ivy"com.google.guava:guava:28.2-jre", + ivy"org.jctools:jctools-core:4.0.5", + ivy"io.netty:netty-tcnative-classes:2.0.65.Final", + ivy"io.netty:netty-tcnative-boringssl-static:2.0.65.Final", + ivy"com.barchart.udt:barchart-udt-bundle:2.3.0", + ivy"com.aayushatharva.brotli4j:native-linux-x86_64:1.16.0", + ivy"com.aayushatharva.brotli4j:native-linux-aarch64:1.16.0", + ivy"com.aayushatharva.brotli4j:native-linux-riscv64:1.16.0", + ivy"com.aayushatharva.brotli4j:native-osx-x86_64:1.16.0", + ivy"com.aayushatharva.brotli4j:native-osx-aarch64:1.16.0", + ivy"com.aayushatharva.brotli4j:native-windows-x86_64:1.16.0", + ivy"org.jboss.marshalling:jboss-marshalling:2.0.5.Final", + ivy"com.aayushatharva.brotli4j:brotli4j:1.16.0", + ivy"org.apache.commons:commons-compress:1.26.0", + ivy"com.jcraft:jzlib:1.1.3", + ivy"net.jpountz.lz4:lz4:1.3.0", + ivy"com.ning:compress-lzf:1.0.3", + ivy"com.github.jponge:lzma-java:1.3", + ivy"com.github.luben:zstd-jni:1.5.5-11", + ivy"ch.qos.logback:logback-classic:1.1.7", + ivy"org.eclipse.jetty.npn:npn-api:1.1.1.v20141010", + ivy"org.bouncycastle:bcpkix-jdk15on:1.69", + ivy"org.bouncycastle:bctls-jdk15on:1.69", + ) + + def forkArgs = Seq( + "-DnativeImage.handlerMetadataGroupId=io.netty", + "-Dio.netty.bootstrap.extensions=serviceload", + "-XX:+AllowRedefinitionToAddDeleteMethods", + "--add-exports", "java.base/sun.security.x509=ALL-UNNAMED", + "-enableassertions" + ) + + def compile = T{ + // Hack to satisfy fragile tests that look for /test-classes/ in the file paths + val sup = super.compile() + val testClasses = T.dest / "test-classes" + if (os.exists(sup.classes.path)) os.copy(sup.classes.path, testClasses, createFolders = true) + sup.copy(classes = PathRef(testClasses)) + } +} +trait NettyTestSuiteModule extends NettyBaseTestSuiteModule{ + +} +trait NettyModule extends NettyBaseModule{ + def testModuleDeps: Seq[MavenModule] = Nil + def testIvyDeps: T[Agg[mill.scalalib.Dep]] = T{ Agg() } + + object test extends NettyBaseTestSuiteModule with MavenTests{ + def moduleDeps = super.moduleDeps ++ testModuleDeps + def ivyDeps = super.ivyDeps() ++ testIvyDeps() + def forkWorkingDir = NettyModule.this.millSourcePath + def forkArgs = super.forkArgs() ++ Seq( + "-Dnativeimage.handlerMetadataArtifactId=netty-" + NettyModule.this.millModuleSegments.parts.last, + ) + + } +} + +trait NettyJniModule extends NettyModule { + def jniLibraryName: T[String] + def cSources = T.source(millSourcePath / "src" / "main" / "c") + def resources = T{ + os.copy(clang().path, T.dest / "META-INF" / "native" / jniLibraryName(), createFolders = true) + Seq(PathRef(T.dest)) + } + def clang = T{ + val Seq(sourceJar) = defaultResolver() + .resolveDeps( + Agg(ivy"io.netty:netty-jni-util:0.0.9.Final").map(bindDependency()), + sources = true + ) + .toSeq + + os.makeDir.all(T.dest / "src" / "main" / "c") + os.proc("jar", "xf", sourceJar.path).call(cwd = T.dest / "src" / "main" / "c") + + os.proc( + "clang", + // CFLAGS + "-O3", "-Werror", "-fno-omit-frame-pointer", + "-Wunused-variable", "-fvisibility=hidden", + "-I" + (T.dest / "src" / "main" / "c"), + "-I" + `transport-native-unix-common`.cHeaders().path, + "-I" + sys.props("java.home") + "/include/", + "-I" + sys.props("java.home") + "/include/darwin", + "-I" + sys.props("java.home") + "/include/linux", + // LD_FLAGS + "-Wl,-weak_library," + (`transport-native-unix-common`.make()._1.path / "libnetty-unix-common.a"), + "-Wl,-platform_version,macos,10.9,10.9", + "-Wl,-single_module", + "-Wl,-undefined", + "-Wl,dynamic_lookup", + "-fno-common", + "-DPIC", + // sources + os.list(cSources().path) + ).call(cwd = T.dest, env = Map("MACOSX_DEPLOYMENT_TARGET" -> "10.9")) + + PathRef(T.dest / "a.out") + } +} + + +object all extends NettyModule{ + +} + +object bom extends NettyModule{ + +} + +object buffer extends NettyModule{ + def moduleDeps = Seq(common) + def testIvyDeps = Agg(ivy"org.jctools:jctools-core:4.0.5") +} + +object codec extends NettyModule { + def moduleDeps = Seq(common, buffer, transport) + def testModuleDeps = Seq(transport.test) + def ivyDeps = Agg( + ivy"com.google.protobuf:protobuf-java:2.6.1", + ) + def compileIvyDeps = Agg( + ivy"org.jboss.marshalling:jboss-marshalling:2.0.5.Final", + ivy"com.aayushatharva.brotli4j:brotli4j:1.16.0", + ivy"com.jcraft:jzlib:1.1.3", + ivy"net.jpountz.lz4:lz4:1.3.0", + ivy"com.ning:compress-lzf:1.0.3", + ivy"com.github.jponge:lzma-java:1.3", + ivy"com.github.luben:zstd-jni:1.5.5-11", + ivy"com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-5", + ) +} + +object `codec-dns` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport, codec) + def testModuleDeps = Seq(transport.test) +} + +object `codec-haproxy` extends NettyModule{ + def moduleDeps = Seq(buffer, transport, codec) + def testModuleDeps = Seq(transport.test) +} + +object `codec-http` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport, codec, handler) + def testModuleDeps = Seq(transport.test) + def compileIvyDeps = Agg( + ivy"com.jcraft:jzlib:1.1.3", + ivy"com.aayushatharva.brotli4j:brotli4j:1.16.0", + ) + def testIvyDeps = Agg( + ivy"com.aayushatharva.brotli4j:brotli4j:1.16.0", + ) +} + +object `codec-http2` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport, codec, handler, `codec-http`) + def testModuleDeps = Seq(transport.test) + def compileIvyDeps = Agg( + ivy"com.aayushatharva.brotli4j:brotli4j:1.16.0", + ) +} + +object `codec-memcache` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport, codec) + def testModuleDeps = Seq(transport.test) +} + +object `codec-mqtt` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport, codec) + def testModuleDeps = Seq(transport.test) +} + +object `codec-redis` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport, codec) + def testModuleDeps = Seq(transport.test) +} + +object `codec-smtp` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport, codec) + def testModuleDeps = Seq(transport.test) +} + +object `codec-socks` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport, codec) + def testModuleDeps = Seq(transport.test) +} + +object `codec-stomp` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport, codec) + def testModuleDeps = Seq(transport.test) +} + +object `codec-xml` extends NettyModule{ + def moduleDeps = Seq(buffer, transport, codec) + def testModuleDeps = Seq(transport.test) + def ivyDeps = Agg( + ivy"com.fasterxml:aalto-xml:1.0.0" + ) +} + +object common extends NettyModule{ + def compileIvyDeps = Agg( + ivy"org.jctools:jctools-core:4.0.5", + ivy"org.graalvm.nativeimage:svm:19.3.6", + ivy"org.jetbrains:annotations-java5:23.0.0", + ivy"io.projectreactor.tools:blockhound:1.0.6.RELEASE", + ivy"commons-logging:commons-logging:1.2", + ivy"org.apache.logging.log4j:log4j-api:2.17.2", + ivy"org.apache.logging.log4j:log4j-1.2-api:2.17.2", + ivy"org.slf4j:slf4j-api:1.7.30", + ) + def testIvyDeps = Agg( + ivy"org.jetbrains:annotations-java5:23.0.0", + ivy"commons-logging:commons-logging:1.2", + ivy"org.apache.logging.log4j:log4j-api:2.17.2", + ivy"org.apache.logging.log4j:log4j-core:2.17.2", + ivy"org.apache.logging.log4j:log4j-1.2-api:2.17.2", + ivy"org.jctools:jctools-core:4.0.5", + ) + + def script = T.source(millSourcePath / "src" / "main" / "script") + def generatedSources0 = T{ + val shell = new groovy.lang.GroovyShell() + + val context = new java.util.HashMap[String, Object] + context.put("collection.template.dir", T.workspace + "/common/src/main/templates") + context.put("collection.template.test.dir", T.workspace + "/common/src/test/templates") + context.put("collection.src.dir", (T.dest / "src").toString) + context.put("collection.testsrc.dir", (T.dest / "testsrc").toString) + shell.setProperty("properties", context) + shell.setProperty("ant", new groovy.ant.AntBuilder()) + shell.evaluate((script().path / "codegen.groovy").toIO) + (PathRef(T.dest / "src"), PathRef(T.dest / "testsrc")) + } + + def generatedSources = T{ Seq(generatedSources0()._1)} +} + +object `dev-tools` extends NettyModule{ + +} + +object example extends NettyModule{ + def ivyDeps = Agg( + ivy"org.bouncycastle:bcpkix-jdk15on:1.69", + ivy"org.bouncycastle:bctls-jdk15on:1.69", + ivy"com.sun.activation:javax.activation:1.2.0" + + ) + def moduleDeps = Seq( + common, + buffer, + transport, + codec, + handler, + `transport-sctp`, `transport-rxtx`, `transport-udt`, + `handler-proxy`, `codec-http`, `codec-memcache`, + `codec-http2`, `codec-redis`, `codec-socks`, `codec-stomp`, `codec-mqtt`, `codec-haproxy`, `codec-dns` + ) +} + +object handler extends NettyModule{ + def moduleDeps = Seq(common, resolver, buffer, transport, `transport-native-unix-common`, codec) + def testModuleDeps = Seq(transport.test) + def compileIvyDeps = Agg( + ivy"org.bouncycastle:bcpkix-jdk15on:1.69", + ivy"org.bouncycastle:bctls-jdk15on:1.69", + ivy"org.conscrypt:conscrypt-openjdk-uber:2.5.2", + ivy"io.netty:netty-tcnative-classes:2.0.65.Final", + ivy"org.eclipse.jetty.alpn:alpn-api:1.1.2.v20150522", + ivy"org.eclipse.jetty.npn:npn-api:1.1.1.v20141010", + ) + + def testIvyDeps = Agg( + ivy"org.bouncycastle:bcpkix-jdk15on:1.69", + ivy"org.bouncycastle:bctls-jdk15on:1.69", + ivy"software.amazon.cryptools:AmazonCorrettoCryptoProvider:1.1.0;classifier=linux-x86_64", + ivy"org.conscrypt:conscrypt-openjdk-uber:2.5.2", + + ) +} + +object `handler-proxy` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport, codec, `codec-socks`, `codec-http`, handler) + def testModuleDeps = Seq(transport.test) +} + +object `handler-ssl-ocsp` extends NettyModule{ + def moduleDeps = Seq(`codec-http`, transport, `resolver-dns`) + def ivyDeps = Agg( + ivy"org.bouncycastle:bcpkix-jdk15on:1.69", + ivy"org.bouncycastle:bctls-jdk15on:1.69", + ) +} + +object microbench extends NettyModule{ + + def moduleDeps = Seq( + handler, `codec-http`, `codec-http2`, `codec-redis`, `codec-mqtt`, `codec-stomp`, + `transport-native-epoll`, `transport-native-kqueue` + ) + + def ivyDeps = Agg( + ivy"org.junit.jupiter:junit-jupiter-api:5.9.0", + ivy"org.jctools:jctools-core:4.0.5", + ivy"org.openjdk.jmh:jmh-core:1.36", + ivy"org.openjdk.jmh:jmh-generator-annprocess:1.36", + ivy"org.agrona:Agrona:0.5.1" + ) +} + +object resolver extends NettyModule{ + def moduleDeps = Seq(common) +} + +object `resolver-dns` extends NettyModule{ + def moduleDeps = Seq(common, buffer, resolver, transport, codec, `codec-dns`, handler) + def testModuleDeps = Seq(transport.test) + def testIvyDeps = Agg( + ivy"org.apache.directory.server:apacheds-protocol-dns:1.5.7" + ) +} + +object `resolver-dns-classes-macos` extends NettyModule{ + def moduleDeps = Seq(common, resolver, `transport-native-unix-common`, `resolver-dns`) +} + + +object `resolver-dns-native-macos` extends NettyJniModule { + def jniLibraryName = "libnetty_resolver_dns_native_macos_aarch_64.jnilib" + def moduleDeps = Seq(resolver) + def testModuleDeps = Seq(`resolver-dns`, `resolver-dns-classes-macos`) + def testIvyDeps = Agg( + ivy"org.apache.directory.server:apacheds-protocol-dns:1.5.7" + ) + + +} + +object testsuite extends NettyTestSuiteModule{ + def moduleDeps = Seq(common, resolver, transport, `transport-sctp`, handler, `codec-http`, `transport-udt`) + def ivyDeps = super.ivyDeps() ++ Agg( + ivy"org.slf4j:slf4j-api:1.7.30", + ivy"org.tukaani:xz:1.5", + ) +} + + +object `testsuite-autobahn` extends NettyTestSuiteModule{ + def moduleDeps = Seq(common, buffer, transport, `codec-http`) +// override def test(args: String*) = { +// val server = os.proc(assembly().path).spawn() +// os.proc( +// "docker", "run", "-it", "--rm", +//// "-v", s"${PWD}/config:/config", +//// "-v", s"${PWD}/reports:/reports", +// "-p", "9000:9000", +// "--name", "fuzzingserver", +// "crossbario/autobahn-testsuite" +// ).call() +// server.destroy() +// } +} + + +object `testsuite-http2` extends NettyTestSuiteModule{ + def moduleDeps = Seq(common, buffer, transport, handler, `codec-http`, `codec-http2`) + def h2Spec = T{ + + val isOSX = sys.props("os.name").toLowerCase.contains("mac") + val binaryName = if (isOSX) "h2spec_darwin_amd64.tar.gz" else "h2spec_linux_amd64.tar.gz" + val url = s"https://github.com/summerwind/h2spec/releases/download/v2.6.0/$binaryName" + os.write(T.dest / "h2spec.tar.gz", requests.get(url)) + + os.proc("tar", "xzf", T.dest / "h2spec.tar.gz").call(cwd = T.dest) + PathRef(T.dest / "h2spec") + } + override def test(args: String*) = T.command{ + val server = os.proc(assembly().path).spawn(stdout = os.Inherit) + try { + Thread.sleep(1000) // let the server start up + + os.proc(h2Spec().path, "-p9000", "--junit-report", T.dest / "report.xml") + .call(stdout = os.Inherit, check = false) + + // Use the Scala XML library to parse and fish out the data we want from the report + val xmlFile = scala.xml.XML.loadFile((T.dest / "report.xml").toIO) + val testCasesWithErrors = (xmlFile \\ "testcase").filter { testcase => + (testcase \\ "error").nonEmpty + } + + // Extract the package and classname + val errorDetails = testCasesWithErrors.map { testcase => + val pkg = (testcase \ "@package").text + val classname = (testcase \ "@classname").text + (pkg, classname) + } + + // Check results + val expectedFailures = Set( + ("http2/3.5", "Sends invalid connection preface"), + ("http2/5.1", "half closed (remote): Sends a HEADERS frame"), + ("http2/5.1", "closed: Sends a HEADERS frame"), + ("http2/5.1.1", "Sends stream identifier that is numerically smaller than previous"), + ("http2/8.1.2.3", "Sends a HEADERS frame that omits \":method\" pseudo-header field"), + ("http2/8.1.2.3", "Sends a HEADERS frame that omits \":scheme\" pseudo-header field"), + ("http2/8.1.2.3", "Sends a HEADERS frame that omits \":path\" pseudo-header field"), + ) + assert(errorDetails.toSet.subsetOf(expectedFailures)) + } finally server.destroyForcibly() + ("", Seq.empty[testrunner.TestResult]) + } +} + +object `testsuite-native` extends NettyTestSuiteModule{ + def moduleDeps = Seq(`transport-native-kqueue`, `resolver-dns-native-macos`, `resolver-dns-classes-macos`, `transport-native-epoll`) + def testModuleDeps = Seq(`resolver-dns-classes-macos`) + override def sources = T.sources( millSourcePath / "src" / "test" / "java" ) +} + +object `testsuite-native-image` extends NettyTestSuiteModule{ + def moduleDeps = Seq(common, buffer, transport, handler, `codec-http`) +} + +object `testsuite-native-image-client` extends NettyTestSuiteModule{ + def moduleDeps = Seq(transport, `resolver-dns`) +} + +object `testsuite-native-image-client-runtime-init` extends NettyTestSuiteModule{ + def moduleDeps = Seq(common) +} + + +object `testsuite-osgi` extends NettyTestSuiteModule{ + def moduleDeps = Seq( + buffer, + codec, `codec-dns`, `codec-haproxy`, `codec-http`, `codec-http2`, `codec-memcache`, `codec-mqtt`, `codec-socks`, `codec-stomp`, + common, + handler, `handler-proxy`, + resolver, `resolver-dns`, + transport, `transport-sctp`, `transport-udt` + ) + + override def sources = T.sources( millSourcePath / "src" / "test" / "java" ) + + def ivyDeps = super.ivyDeps() ++ Agg( + ivy"org.apache.felix:org.apache.felix.configadmin:1.9.14", + ivy"org.ops4j.pax.exam:pax-exam-junit4:4.13.0", + ivy"org.ops4j.pax.exam:pax-exam-container-native:4.13.0", + ivy"org.ops4j.pax.exam:pax-exam-link-assembly:4.13.0", + ivy"org.apache.felix:org.apache.felix.framework:6.0.2", + ) +} + +object `testsuite-shading` extends NettyTestSuiteModule{ + def moduleDeps = Seq(common) + override def sources = T.sources( millSourcePath / "src" / "test" / "java" ) +} + +object transport extends NettyModule{ + def moduleDeps = Seq(common, buffer, resolver) +} + +object `transport-blockhound-tests` extends NettyTestSuiteModule{ + def moduleDeps = Seq(transport, handler, `resolver-dns`) + def ivyDeps = super.ivyDeps() ++ Agg( + ivy"io.projectreactor.tools:blockhound:1.0.6.RELEASE" + ) +} + +object `transport-classes-epoll` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport, `transport-native-unix-common`) +} + +object `transport-classes-kqueue` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport, `transport-native-unix-common`) +} + +object `transport-native-epoll` extends NettyJniModule{ + def jniLibraryName = "libnetty_transport_native_epoll_aarch_64.jnilib" + def moduleDeps = Seq(common, buffer, transport, `transport-native-unix-common`, `transport-classes-epoll`) + def testModuleDeps = Seq(testsuite, `transport-native-unix-common-tests`) + + def testIvyDeps = Agg( + ivy"io.github.artsok:rerunner-jupiter:2.1.6" + ) + + // Stub this out on OS-X + def clang = if (!isOSX) T{ super.clang() } else T{ PathRef(os.temp())} +} + +object `transport-native-kqueue` extends NettyJniModule{ + def jniLibraryName = "libnetty_transport_native_kqueue_aarch_64.jnilib" + def moduleDeps = Seq(common, buffer, transport, `transport-native-unix-common`, `transport-classes-kqueue`) + def testModuleDeps = Seq(testsuite, `transport-native-unix-common-tests`) + + // Stub this out on linux + def clang = if (isOSX) T{ super.clang() } else T{ PathRef(os.temp())} +} + +object `transport-native-unix-common` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport) + def ivyDeps = Agg(ivy"org.junit.jupiter:junit-jupiter-api:5.9.0") + + def makefile = T.source(millSourcePath / "Makefile") + def cSources = T.source(millSourcePath / "src" / "main" / "c") + def cHeaders = T{ + for(p <- os.walk(cSources().path) if p.ext == "h"){ + os.copy(p, T.dest / p.relativeTo(cSources().path), createFolders = true) + } + PathRef(T.dest) + } + + def make = T{ + val Seq(sourceJar) = resolveDeps( + deps = T.task(Agg(ivy"io.netty:netty-jni-util:0.0.9.Final").map(bindDependency())), + sources = true + )().toSeq + + os.copy(makefile().path, T.dest / "Makefile") + os.copy(cSources().path, T.dest / "src" / "main" / "c", createFolders = true) + os.proc("jar", "xf", sourceJar.path).call(cwd = T.dest / "src" / "main" / "c") + + os.proc("make").call( + cwd = T.dest, + env = Map( + "CC" -> "clang", + "AR" -> "ar", + "JNI_PLATFORM" -> "darwin", + "LIB_DIR" -> "lib-out", + "OBJ_DIR" -> "obj-out", + "MACOSX_DEPLOYMENT_TARGET" -> "10.9", + "CFLAGS" -> Seq( + "-O3", + "-Werror", + "-Wno-attributes", + "-fPIC", + "-fno-omit-frame-pointer", + "-Wunused-variable", + "-fvisibility=hidden", + "-I" + sys.props("java.home") + "/include/", + "-I" + sys.props("java.home") + "/include/darwin", + "-I" + sys.props("java.home") + "/include/linux", + ).mkString(" "), + "LD_FLAGS" -> "-Wl,--no-as-needed -lrt -Wl,-platform_version,macos,10.9,10.9", + "LIB_NAME" -> "libnetty-unix-common" + ) + ) + + + (PathRef(T.dest / "lib-out"), PathRef(T.dest / "obj-out")) + } +} +object `transport-native-unix-common-tests` extends NettyTestSuiteModule{ + def moduleDeps = Seq(transport, `transport-native-unix-common`) +} + +object `transport-rxtx` extends NettyModule{ + def moduleDeps = Seq(buffer, transport) + def ivyDeps = Agg( + ivy"org.rxtx:rxtx:2.1.7" + ) +} + +object `transport-sctp` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport, codec) + def testModuleDeps = Seq(transport.test) +} + +object `transport-udt` extends NettyModule{ + def moduleDeps = Seq(common, buffer, transport) + def ivyDeps = Agg( + ivy"com.barchart.udt:barchart-udt-bundle:2.3.0", + ivy"com.google.caliper:caliper:0.5-rc1", + ivy"com.yammer.metrics:metrics-core:2.2.0" + ) +} + + +// Run a few smoketests on the netty repo, compiling everything (including tests) +// but only running the subset of tests that run quickly (otherwise this would +// take over an hour) +/** Usage + +> ./mill -j5 __.compile + +> ./mill 'codec-{dns,haproxy,http,http2,memcache,mqtt,redis,smtp,socks,stomp,xml}.test' +...Test io.netty.handler.codec.stomp.StompSubframeEncoderTest#testEscapeStompHeaders() started +...Test io.netty.handler.codec.stomp.StompSubframeEncoderTest#testEscapeStompHeaders() finished... +... + +> ./mill 'transport-{blockhound-tests,native-unix-common,sctp}.test' +...Test io.netty.channel.unix.UnixChannelUtilTest#testUnPooledAllocatorIsBufferCopyNeededForWrite() started +...Test io.netty.channel.unix.UnixChannelUtilTest#testUnPooledAllocatorIsBufferCopyNeededForWrite() finished... +... + +*/ diff --git a/integration/invalidation/multi-level-editing/test/src/MultiLevelBuildTests.scala b/integration/invalidation/multi-level-editing/test/src/MultiLevelBuildTests.scala index 98c5bb1746a..5c48c5d95e1 100644 --- a/integration/invalidation/multi-level-editing/test/src/MultiLevelBuildTests.scala +++ b/integration/invalidation/multi-level-editing/test/src/MultiLevelBuildTests.scala @@ -51,7 +51,7 @@ object MultiLevelBuildTests extends IntegrationTestSuite { for (depth <- Range(0, n)) yield { val path = - workspacePath / out / Seq.fill(depth)(millBuild) / millRunnerState + workspacePath / "out" / Seq.fill(depth)(millBuild) / millRunnerState if (os.exists(path)) upickle.default.read[RunnerState.Frame.Logged](os.read(path)) -> path else RunnerState.Frame.Logged(Map(), Seq(), Seq(), Map(), None, Seq(), 0) -> path } From 0e77a149bb9bfd095cc8ae4b0bbe7415a17d1efe Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 22:37:39 +0800 Subject: [PATCH 10/24] . --- ci/test-mill-release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/test-mill-release.sh b/ci/test-mill-release.sh index 3cdb3ba973b..ebc549544ec 100755 --- a/ci/test-mill-release.sh +++ b/ci/test-mill-release.sh @@ -12,10 +12,10 @@ rm -rf $EXAMPLE/out test ! -d $EXAMPLE/out/foo/3.3.3/compile.dest test ! -f $EXAMPLE/out/bar/2.13.8/assembly.dest/out.jar -(cd $EXAMPLE && ../../../out/dev/assembly.dest/mill -i "foo[3.3.3].run") +(cd $EXAMPLE && ../../../../out/dev/assembly.dest/mill -i "foo[3.3.3].run") test -d $EXAMPLE/out/foo/3.3.3/compile.dest -(cd $EXAMPLE && ../../../out/dev/assembly.dest/mill show "bar[2.13.8].assembly") +(cd $EXAMPLE && ../../../../out/dev/assembly.dest/mill show "bar[2.13.8].assembly") test -f $EXAMPLE/out/bar/2.13.8/assembly.dest/out.jar From 799ed617344c1181fc1b556066f299b04d0e3adc Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 22:41:11 +0800 Subject: [PATCH 11/24] fix --- build.sc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sc b/build.sc index 4d26ce4a054..3368c13adc8 100644 --- a/build.sc +++ b/build.sc @@ -1571,7 +1571,9 @@ object dev extends MillPublishScalaModule { def fix(args: String*): Command[Unit] = T.command {} def moduleDeps = Seq(runner, idea) - def testTransitiveDeps = dist0.testTransitiveDeps() + def testTransitiveDeps = dist0.testTransitiveDeps() ++ Seq( + (s"com.lihaoyi-${dist.artifactId()}", dist0.assembly().path.toString), + ) def genTask(m: ScalaModule) = T.task { Seq(m.jar(), m.sourceJar()) ++ m.runClasspath() } From 30c1d346f6b50d9d1107c53b3bf77da7dff928c4 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 22:51:38 +0800 Subject: [PATCH 12/24] . --- .../plugins/7-writing-mill-plugins/build.sc | 16 ++++++++++------ .../test/src/mill/testkit/UnitTests.scala | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/example/extending/plugins/7-writing-mill-plugins/build.sc b/example/extending/plugins/7-writing-mill-plugins/build.sc index 48cdc10d274..cfac7617024 100644 --- a/example/extending/plugins/7-writing-mill-plugins/build.sc +++ b/example/extending/plugins/7-writing-mill-plugins/build.sc @@ -18,11 +18,11 @@ object myplugin extends ScalaModule with PublishModule { object testMill extends JavaModule{ def ivyDeps = Agg(ivy"com.lihaoyi:mill-dist:$millVersion") def mainClass = Some("mill.runner.client.MillClientMain") -// def resources = T{ -// val p = T.dest / "mill" / "local-test-overrides" / s"com.lihaoyi-${myplugin.artifactId()}" -// os.write(p, myplugin.runClasspath().map(_.path).mkString("\n"), createFolders = true) -// Seq(PathRef(T.dest)) -// } + def resources = T{ + val p = T.dest / "mill" / "local-test-overrides" / s"com.lihaoyi-${myplugin.artifactId()}" + os.write(p, myplugin.runClasspath().map(_.path).mkString("\n"), createFolders = true) + Seq(PathRef(T.dest)) + } } } @@ -80,7 +80,9 @@ compiling 1 Scala source... /** Usage > ./mill myplugin.test ++ myplugin.UnitTests.unit... + myplugin.IntegrationTests.integration... ++ myplugin.ExampleTests.example... ... */ @@ -169,8 +171,10 @@ compiling 1 Scala source... /** Usage +> sed -i 's/0.0.1/0.0.2/g' build.sc + > ./mill myplugin.publishLocal -Publishing Artifact(com.lihaoyi,myplugin_2.13,0.0.1) to ivy repo... +Publishing Artifact(com.lihaoyi,myplugin_2.13,0.0.2) to ivy repo... */ // Mill plugins are JVM libraries like any other library written in Java or Scala. Thus they diff --git a/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala index 7fc0e055d70..0f941094f11 100644 --- a/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala +++ b/example/extending/plugins/7-writing-mill-plugins/myplugin/test/src/mill/testkit/UnitTests.scala @@ -5,7 +5,7 @@ import utest._ object UnitTests extends TestSuite { def tests: Tests = Tests { - test("simple") { + test("unit") { object build extends TestBaseModule with LineCountJavaModule{ def lineCountResourceFileName = "line-count.txt" } From 11e5ef1ccf0c5830fafaf727ff776c8813b59c32 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 23:12:14 +0800 Subject: [PATCH 13/24] . --- build.sc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sc b/build.sc index 3368c13adc8..dccc5e7ffca 100644 --- a/build.sc +++ b/build.sc @@ -1641,7 +1641,9 @@ object dev extends MillPublishScalaModule { } def assembly = T { T.traverse(allPublishModules)(m => m.publishLocalCached)() - rawAssembly() + val raw = rawAssembly().path + os.copy(raw, T.dest / raw.last) + PathRef(raw.last) } def prependShellScript = T { From 3b61089c53b9b485db36a8aae0cbdd36e1e73177 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 23:12:25 +0800 Subject: [PATCH 14/24] . --- build.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sc b/build.sc index dccc5e7ffca..e8adfd526c4 100644 --- a/build.sc +++ b/build.sc @@ -1643,7 +1643,7 @@ object dev extends MillPublishScalaModule { T.traverse(allPublishModules)(m => m.publishLocalCached)() val raw = rawAssembly().path os.copy(raw, T.dest / raw.last) - PathRef(raw.last) + PathRef(T.dest / raw.last) } def prependShellScript = T { From fed4aaf3ece8074d044f1b2b6f77408599e18198 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 23:33:06 +0800 Subject: [PATCH 15/24] . --- example/scalalib/basic/1-simple/test/src/FooTests.scala | 4 ++++ .../5-multiple-test-frameworks/test/src/FooScalaTests.scala | 5 +++++ .../basic/5-multiple-test-frameworks/test/src/FooTests.scala | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/example/scalalib/basic/1-simple/test/src/FooTests.scala b/example/scalalib/basic/1-simple/test/src/FooTests.scala index 45576fcf513..9dcd8bf4e04 100644 --- a/example/scalalib/basic/1-simple/test/src/FooTests.scala +++ b/example/scalalib/basic/1-simple/test/src/FooTests.scala @@ -1,3 +1,7 @@ +package foo + +import utest._ + object FooTests extends TestSuite { def tests = Tests { test("simple") { diff --git a/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala index cb1b8d10ade..d481dbad452 100644 --- a/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala +++ b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala @@ -1,3 +1,7 @@ +package foo + +import org.scalatest.freespec._ + class FooScalaTests extends AnyFreeSpec { "Foo" - { "simple" in { @@ -12,3 +16,4 @@ class FooScalaTests extends AnyFreeSpec { } } } +t \ No newline at end of file diff --git a/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooTests.scala b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooTests.scala index 45576fcf513..9dcd8bf4e04 100644 --- a/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooTests.scala +++ b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooTests.scala @@ -1,3 +1,7 @@ +package foo + +import utest._ + object FooTests extends TestSuite { def tests = Tests { test("simple") { From b75f13b4f7bbaef4b1f3ccc8be4e1f2f23928a4d Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 23:36:55 +0800 Subject: [PATCH 16/24] . --- .../5-multiple-test-frameworks/test/src/FooScalaTests.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala index d481dbad452..8ff976d187d 100644 --- a/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala +++ b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala @@ -16,4 +16,4 @@ class FooScalaTests extends AnyFreeSpec { } } } -t \ No newline at end of file +t From 3812ad401cfce1b0e58230de529239f0dc7d0c98 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 24 Aug 2024 23:51:54 +0800 Subject: [PATCH 17/24] . --- example/depth/tasks/2-primary-tasks/build.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/depth/tasks/2-primary-tasks/build.sc b/example/depth/tasks/2-primary-tasks/build.sc index 923f06c68ae..d7ddb698f14 100644 --- a/example/depth/tasks/2-primary-tasks/build.sc +++ b/example/depth/tasks/2-primary-tasks/build.sc @@ -32,7 +32,7 @@ def allSources = T { } def lineCount: T[Int] = T { - println("Computing line count!!!") + println("Computing line count") allSources() .map(p => os.read.lines(p.path).size) .sum From 42e33727914964c89fa94ac3a7d05ddde4c4578e Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 25 Aug 2024 00:08:13 +0800 Subject: [PATCH 18/24] . --- .../5-multiple-test-frameworks/test/src/FooScalaTests.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala index 8ff976d187d..ddba7228dc1 100644 --- a/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala +++ b/example/scalalib/basic/5-multiple-test-frameworks/test/src/FooScalaTests.scala @@ -16,4 +16,3 @@ class FooScalaTests extends AnyFreeSpec { } } } -t From b2b41d7b6c6c4a9d4c294ecc34ddd232e02d7de4 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 25 Aug 2024 07:15:31 +0800 Subject: [PATCH 19/24] . --- .../module/13-contrib-scoverage/test/src/FooTests.scala | 3 +++ example/scalalib/web/1-todo-webapp/test/src/WebAppTests.scala | 4 ++++ .../web/2-webapp-cache-busting/test/src/WebAppTests.scala | 4 ++++ .../scalalib/web/4-webapp-scalajs/test/src/WebAppTests.scala | 4 ++++ .../web/5-webapp-scalajs-shared/test/src/WebAppTests.scala | 4 ++++ 5 files changed, 19 insertions(+) diff --git a/example/scalalib/module/13-contrib-scoverage/test/src/FooTests.scala b/example/scalalib/module/13-contrib-scoverage/test/src/FooTests.scala index 45576fcf513..10a0eb56739 100644 --- a/example/scalalib/module/13-contrib-scoverage/test/src/FooTests.scala +++ b/example/scalalib/module/13-contrib-scoverage/test/src/FooTests.scala @@ -1,3 +1,6 @@ +package foo +import utest._ + object FooTests extends TestSuite { def tests = Tests { test("simple") { diff --git a/example/scalalib/web/1-todo-webapp/test/src/WebAppTests.scala b/example/scalalib/web/1-todo-webapp/test/src/WebAppTests.scala index 7298f2396da..2aa948961ab 100644 --- a/example/scalalib/web/1-todo-webapp/test/src/WebAppTests.scala +++ b/example/scalalib/web/1-todo-webapp/test/src/WebAppTests.scala @@ -1,3 +1,7 @@ +package webapp + +import utest._ + object WebAppTests extends TestSuite { def withServer[T](example: cask.main.Main)(f: String => T): T = { val server = io.undertow.Undertow.builder diff --git a/example/scalalib/web/2-webapp-cache-busting/test/src/WebAppTests.scala b/example/scalalib/web/2-webapp-cache-busting/test/src/WebAppTests.scala index 7298f2396da..2aa948961ab 100644 --- a/example/scalalib/web/2-webapp-cache-busting/test/src/WebAppTests.scala +++ b/example/scalalib/web/2-webapp-cache-busting/test/src/WebAppTests.scala @@ -1,3 +1,7 @@ +package webapp + +import utest._ + object WebAppTests extends TestSuite { def withServer[T](example: cask.main.Main)(f: String => T): T = { val server = io.undertow.Undertow.builder diff --git a/example/scalalib/web/4-webapp-scalajs/test/src/WebAppTests.scala b/example/scalalib/web/4-webapp-scalajs/test/src/WebAppTests.scala index 7298f2396da..2aa948961ab 100644 --- a/example/scalalib/web/4-webapp-scalajs/test/src/WebAppTests.scala +++ b/example/scalalib/web/4-webapp-scalajs/test/src/WebAppTests.scala @@ -1,3 +1,7 @@ +package webapp + +import utest._ + object WebAppTests extends TestSuite { def withServer[T](example: cask.main.Main)(f: String => T): T = { val server = io.undertow.Undertow.builder diff --git a/example/scalalib/web/5-webapp-scalajs-shared/test/src/WebAppTests.scala b/example/scalalib/web/5-webapp-scalajs-shared/test/src/WebAppTests.scala index 7298f2396da..2aa948961ab 100644 --- a/example/scalalib/web/5-webapp-scalajs-shared/test/src/WebAppTests.scala +++ b/example/scalalib/web/5-webapp-scalajs-shared/test/src/WebAppTests.scala @@ -1,3 +1,7 @@ +package webapp + +import utest._ + object WebAppTests extends TestSuite { def withServer[T](example: cask.main.Main)(f: String => T): T = { val server = io.undertow.Undertow.builder From b31ee21a1088c06a5c3eb66dcf2430bbe1422e9d Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 25 Aug 2024 08:04:15 +0800 Subject: [PATCH 20/24] . --- build.sc | 85 +++++++++---------- .../plugins/7-writing-mill-plugins/build.sc | 8 +- readme.adoc | 16 ++-- 3 files changed, 51 insertions(+), 58 deletions(-) diff --git a/build.sc b/build.sc index e8adfd526c4..35466ce39dd 100644 --- a/build.sc +++ b/build.sc @@ -306,6 +306,21 @@ trait MillJavaModule extends JavaModule { upstream.toMap ++ current } + + def testIvyDeps: T[Agg[Dep]] = Agg(Deps.TestDeps.utest) + def testModuleDeps: Seq[JavaModule] = + if (this == main) Seq(main) + else Seq(this, main.test) + + def writeLocalTestOverrides = T.task { + for ((k, v) <- testTransitiveDeps()) { + os.write(T.dest / "mill" / "local-test-overrides" / k, v, createFolders = true) + } + Seq(PathRef(T.dest)) + } + + def runClasspath = super.runClasspath() ++ writeLocalTestOverrides() + def repositoriesTask = T.task { super.repositoriesTask() ++ Seq(MavenRepository("https://oss.sonatype.org/content/repositories/releases")) @@ -369,21 +384,6 @@ trait MillScalaModule extends ScalaModule with MillJavaModule with ScalafixModul "-Xlint:adapted-args" ) - def testIvyDeps: T[Agg[Dep]] = Agg(Deps.TestDeps.utest) - def testModuleDeps: Seq[JavaModule] = - if (this == main) Seq(main) - else Seq(this, main.test) - - def writeLocalTestOverrides = T.task { - for ((k, v) <- testTransitiveDeps()) { - os.write(T.dest / "mill" / "local-test-overrides" / k, v, createFolders = true) - } - Seq(PathRef(T.dest)) - } - - def runClasspathWithoutOverrides = T{ super.runClasspath() } - def runClasspath = runClasspathWithoutOverrides() ++ writeLocalTestOverrides() - def scalacPluginIvyDeps = super.scalacPluginIvyDeps() ++ Agg(Deps.acyclic) ++ @@ -396,7 +396,6 @@ trait MillScalaModule extends ScalaModule with MillJavaModule with ScalafixModul /** Default tests module. */ lazy val test: MillScalaTests = new MillScalaTests {} trait MillScalaTests extends ScalaTests with MillBaseTestsModule { - def runClasspath = super.runClasspath() ++ writeLocalTestOverrides() def forkArgs = super.forkArgs() ++ outer.testArgs() def moduleDeps = outer.testModuleDeps def ivyDeps = super.ivyDeps() ++ outer.testIvyDeps() @@ -600,18 +599,18 @@ object main extends MillStableScalaModule with BuildInfo { "millEmbeddedDeps", ( T.traverse( - dev.recursiveModuleDeps.collect { case m: PublishModule => m } + dist.recursiveModuleDeps.collect { case m: PublishModule => m } )( _.publishSelfDependency )() .map(artifact => s"${artifact.group}:${artifact.id}:${artifact.version}") ++ Lib.resolveDependenciesMetadata( - repositories = dev.repositoriesTask(), - dev.transitiveIvyDeps(), - Some(dev.mapDependencies()), - dev.resolutionCustomizer(), + repositories = dist.repositoriesTask(), + dist.transitiveIvyDeps(), + Some(dist.mapDependencies()), + dist.resolutionCustomizer(), Some(T.ctx()), - dev.coursierCacheCustomizer() + dist.coursierCacheCustomizer() )._2.minDependencies.toSeq .map(d => s"${d.module.organization.value}:${d.module.name.value}:${d.version}") ) @@ -764,7 +763,7 @@ object testkit extends MillPublishScalaModule { super.sources() ++ Seq(PathRef(build.millSourcePath / "mill-build" / "src")) - def forkEnv = super.forkEnv() ++ Map("MILL_EXECUTABLE_PATH" -> dev.launcher().path.toString()) + def forkEnv = super.forkEnv() ++ Map("MILL_EXECUTABLE_PATH" -> dist.launcher().path.toString()) } object testrunner extends MillPublishScalaModule { @@ -1180,10 +1179,10 @@ trait IntegrationTestModule extends MillScalaModule { ) ++ testReleaseEnv() - def forkArgs = T { super.forkArgs() ++ dev.forkArgs() } + def forkArgs = T { super.forkArgs() ++ dist.forkArgs() } def testReleaseEnv = - if (mode == "local") T { Map("MILL_INTEGRATION_LAUNCHER" -> dev.launcher().path.toString()) } + if (mode == "local") T { Map("MILL_INTEGRATION_LAUNCHER" -> dist.launcher().path.toString()) } else T { Map("MILL_INTEGRATION_LAUNCHER" -> integration.testMill().path.toString()) } def compile = IntegrationTestModule.this.compile() @@ -1288,8 +1287,6 @@ object example extends Module { } trait ExampleCrossModule extends IntegrationTestCrossModule { - // disable scalafix because these example modules don't have sources causing it to misbehave - def fix(args: String*): Command[Unit] = T.command {} def testRepoRoot: T[PathRef] = T.source(millSourcePath) def compile = testkit.compile() @@ -1539,19 +1536,14 @@ object idea extends MillPublishScalaModule { def moduleDeps = Seq(scalalib, runner) } -object dist extends MillPublishJavaModule { - def jar = dev.rawAssembly() -} - +/** + * Version of [[dist]] meant for local integration testing within the Mill + * repo. Looks mostly the same as [[dist]], except it does not have a reference + * to itself in its [[testTransitiveDeps]], to avoid a circular dependency. + */ object dist0 extends MillPublishJavaModule { - def writeLocalTestOverrides = T.task { - for ((k, v) <- testTransitiveDeps()) { - os.write(T.dest / "mill" / "local-test-overrides" / k, v, createFolders = true) - } - Seq(PathRef(T.dest)) - } - def upstreamAssemblyClasspath = Agg.from(dev.runClasspathWithoutOverrides()) - def localClasspath = super.localClasspath() ++ writeLocalTestOverrides() + def moduleDeps = Seq(runner, idea) + def testTransitiveDeps = runner.testTransitiveDeps() ++ Seq( runner.linenumbers.testDep(), scalalib.backgroundwrapper.testDep(), @@ -1566,13 +1558,14 @@ object dist0 extends MillPublishJavaModule { testkit.testDep(), ) } -object dev extends MillPublishScalaModule { - // disable scalafix here because it crashes when a module has no sources - def fix(args: String*): Command[Unit] = T.command {} + + +object dist extends MillPublishJavaModule { + def jar = rawAssembly() def moduleDeps = Seq(runner, idea) def testTransitiveDeps = dist0.testTransitiveDeps() ++ Seq( - (s"com.lihaoyi-${dist.artifactId()}", dist0.assembly().path.toString), + (s"com.lihaoyi-${dist.artifactId()}", dist0.runClasspath().map(_.path).mkString("\n")), ) def genTask(m: ScalaModule) = T.task { Seq(m.jar(), m.sourceJar()) ++ m.runClasspath() } @@ -2011,12 +2004,12 @@ def installLocalCache() = T.command { } def installLocalTask(binFile: Task[String], ivyRepo: String = null): Task[os.Path] = T.task { - val millBin = dev.assembly() + val millBin = dist.assembly() val targetFile = os.Path(binFile(), T.workspace) if (os.exists(targetFile)) T.log.info(s"Overwriting existing local Mill binary at ${targetFile}") os.copy.over(millBin.path, targetFile, createFolders = true) - T.log.info(s"Published ${dev.allPublishModules.size} modules and installed ${targetFile}") + T.log.info(s"Published ${dist.allPublishModules.size} modules and installed ${targetFile}") targetFile } @@ -2083,7 +2076,7 @@ def uploadToGithub(authKey: String) = T.command { val examples = exampleZips().map(z => (z.path, z.path.last)) val zips = examples ++ Seq( - (dev.assembly().path, label + "-assembly"), + (dist.assembly().path, label + "-assembly"), (bootstrapLauncher().path, label) ) diff --git a/example/extending/plugins/7-writing-mill-plugins/build.sc b/example/extending/plugins/7-writing-mill-plugins/build.sc index cfac7617024..b208eb7522b 100644 --- a/example/extending/plugins/7-writing-mill-plugins/build.sc +++ b/example/extending/plugins/7-writing-mill-plugins/build.sc @@ -8,19 +8,19 @@ import mill.main.BuildInfo.millVersion object myplugin extends ScalaModule with PublishModule { def scalaVersion = "2.13.8" - def ivyDeps = Agg(ivy"com.lihaoyi::mill-scalalib:$millVersion") + def ivyDeps = Agg(ivy"com.lihaoyi:mill-dist:$millVersion") // Testing Config object test extends ScalaTests with TestModule.Utest{ def ivyDeps = Agg(ivy"com.lihaoyi::mill-testkit:$millVersion") - def forkEnv = Map("MILL_EXECUTABLE_PATH" -> testMill.assembly().path.toString) + def forkEnv = Map("MILL_EXECUTABLE_PATH" -> millExecutable.assembly().path.toString) - object testMill extends JavaModule{ + object millExecutable extends JavaModule{ def ivyDeps = Agg(ivy"com.lihaoyi:mill-dist:$millVersion") def mainClass = Some("mill.runner.client.MillClientMain") def resources = T{ val p = T.dest / "mill" / "local-test-overrides" / s"com.lihaoyi-${myplugin.artifactId()}" - os.write(p, myplugin.runClasspath().map(_.path).mkString("\n"), createFolders = true) + os.write(p, myplugin.localClasspath().map(_.path).mkString("\n"), createFolders = true) Seq(PathRef(T.dest)) } } diff --git a/readme.adoc b/readme.adoc index 9055be3b816..9b61bff9ab6 100644 --- a/readme.adoc +++ b/readme.adoc @@ -85,8 +85,8 @@ The following table contains the main ways you can test the code in |=== | Config | Automated Testing | Manual Testing | Manual Testing CI | In-Process Tests | `main.__.test`, `scalalib.test`, `contrib.buildinfo.test`, etc. | | -| Sub-Process w/o packaging/publishing| `example.\\__.local`, `integration.__.local` | `dev.run` | `test-mill-dev.sh` -| Sub-Process w/ packaging/publishing | `example.\\__.server`, `integration.__.server` | `dev.assembly` | `test-mill-release.sh` +| Sub-Process w/o packaging/publishing| `example.\\__.local`, `integration.__.local` | `dist.run` | `test-mill-dev.sh` +| Sub-Process w/ packaging/publishing | `example.\\__.server`, `integration.__.server` | `dist.assembly` | `test-mill-release.sh` | Bootstrapping: Building Mill with your current checkout of Mill | | `installLocal` | `test-mill-bootstrap.sh` |=== @@ -109,7 +109,7 @@ Note that the in-memory tests compile the `BaseModule` together with the test su `example.\\__.local` and `integration.__.local` tests run Mill end-to-end in a subprocess, but *without* the expensive/slow steps of packaging the core packages into an assembly jar and publishing the remaining packages to `~/.ivy2/local`. You can reproduce these tests manually using -`./mill dev.run `. +`./mill dist.run `. `example` tests are written in a single `build.sc` file, with the test commands written in a comment with a bash-like syntax together with the build code and comments that explain the example. These serve three purposes: @@ -128,7 +128,7 @@ The `integration` tests are similar to `example` tests and share most of their t 2. `integration` tests are written using a Scala test suite extending `IntegrationTestSuite`, giving more flexibility at the expense of readability -You can reproduce any of the tests manually using `dev.run`, e.g. +You can reproduce any of the tests manually using `dist.run`, e.g. **Automated Test** @@ -141,14 +141,14 @@ You can reproduce any of the tests manually using `dev.run`, e.g. [source,bash] ---- -./mill dev.run example/basic/1-simple run --text hello +./mill dist.run example/basic/1-simple run --text hello ---- **Manual Test using Launcher Script** [source,bash] ---- -./mill dev.launcher && (cd example/basic/1-simple && ../../../out/dev/launcher.dest/run run --text hello) +./mill dist.launcher && (cd example/basic/1-simple && ../../../out/dist/launcher.dest/run run --text hello) ---- === Sub-Process Tests *with* Packaging/Publishing @@ -157,11 +157,11 @@ You can reproduce any of the tests manually using `dev.run`, e.g. `integration.__.fork` cover the same test cases as the `.local` tests described above, but they perform packaging of the Mill core modules into an assembly jar, and publish the remaining modules to `~/.ivy2/local`. This results in a more realistic test environment, but at the cost of taking tens-of-seconds more to run a test after making a code change. -You can reproduce these tests manually using `dev.assembly`: +You can reproduce these tests manually using `dist.assembly`: [source,bash] ---- -./mill dev.assembly && (cd example/basic/1-simple && ../../../out/dev/assembly.dest/mill run --text hello) +./mill dist.assembly && (cd example/basic/1-simple && ../../../out/dist/assembly.dest/mill run --text hello) ---- There are two flavors of these tests: From 7490c3087b830a48ef6c23ff8c72a66c30d7c212 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 25 Aug 2024 08:17:09 +0800 Subject: [PATCH 21/24] . --- .../src/mill/testkit/ExampleTestSuite.scala | 2 +- testkit/src/mill/testkit/ExampleTester.scala | 34 +++++++++---------- .../mill/testkit/IntegrationTestSuite.scala | 2 +- .../src/mill/testkit/IntegrationTester.scala | 10 +++--- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/testkit/src/mill/testkit/ExampleTestSuite.scala b/testkit/src/mill/testkit/ExampleTestSuite.scala index ccb760d9eb3..94fe69d6953 100644 --- a/testkit/src/mill/testkit/ExampleTestSuite.scala +++ b/testkit/src/mill/testkit/ExampleTestSuite.scala @@ -5,7 +5,7 @@ object ExampleTestSuite extends IntegrationTestSuite { val tests: Tests = Tests { test("exampleTest") { - ExampleTester.run(clientServerMode, workspaceSourcePath, millExecutable) + new ExampleTester(this).run() } } } diff --git a/testkit/src/mill/testkit/ExampleTester.scala b/testkit/src/mill/testkit/ExampleTester.scala index e2027b6f5f8..34c203dd7b8 100644 --- a/testkit/src/mill/testkit/ExampleTester.scala +++ b/testkit/src/mill/testkit/ExampleTester.scala @@ -52,18 +52,16 @@ import scala.concurrent.duration.FiniteDuration object ExampleTester { def run(clientServerMode: Boolean, workspaceSourcePath: os.Path, millExecutable: os.Path): Unit = new ExampleTester( - clientServerMode, - workspaceSourcePath, - millExecutable + new IntegrationTester( + clientServerMode, + workspaceSourcePath, + millExecutable + ) ).run() } -class ExampleTester( - clientServerMode: Boolean, - workspaceSourcePath: os.Path, - millExecutable: os.Path -) extends IntegrationTester(clientServerMode, workspaceSourcePath, millExecutable) { - initWorkspace() +class ExampleTester(tester: IntegrationTester.Impl) { + tester.initWorkspace() val testTimeout: FiniteDuration = 5.minutes @@ -99,8 +97,8 @@ class ExampleTester( val incorrectPlatform = (comment.exists(_.startsWith("windows")) && !Util.windowsPlatform) || (comment.exists(_.startsWith("mac/linux")) && Util.windowsPlatform) || - (comment.exists(_.startsWith("--no-server")) && clientServerMode) || - (comment.exists(_.startsWith("not --no-server")) && !clientServerMode) + (comment.exists(_.startsWith("--no-server")) && tester.clientServerMode) || + (comment.exists(_.startsWith("not --no-server")) && !tester.clientServerMode) if (!incorrectPlatform) { processCommand(workspaceRoot, expectedSnippets, commandHead.trim) @@ -124,7 +122,7 @@ class ExampleTester( os.copy(os.Path(from, workspaceRoot), os.Path(to, workspaceRoot)) case Seq("sed", "-i", s"s/$oldStr/$newStr/g", file) => - modifyFile(os.Path(file, workspaceRoot), _.replace(oldStr, newStr)) + tester.modifyFile(os.Path(file, workspaceRoot), _.replace(oldStr, newStr)) case Seq("curl", url) => Thread.sleep(1500) // Need to give backgroundWrapper time to spin up @@ -182,11 +180,11 @@ class ExampleTester( } case Seq("printf", literal, ">>", path) => - modifyFile(os.Path(path, workspacePath), _ + ujson.read(s""""${literal}"""").str) + tester.modifyFile(os.Path(path, tester.workspacePath), _ + ujson.read(s""""${literal}"""").str) case Seq(command, rest @ _*) => val evalResult = command match { - case "./mill" | "mill" => eval(rest) + case "./mill" | "mill" => tester.eval(rest) case s"./$cmd" => val tokens = cmd +: rest val executable = workspaceRoot / os.SubPath(tokens.head) @@ -270,16 +268,16 @@ class ExampleTester( } def run(): Any = { - val parsed = ExampleParser(workspaceSourcePath) + val parsed = ExampleParser(tester.workspaceSourcePath) val usageComment = parsed.collect { case ("example", txt) => txt }.mkString("\n\n") val commandBlocks = ("\n" + usageComment.trim).split("\n> ").filter(_.nonEmpty) retryOnTimeout(3) { - try os.remove.all(workspacePath / "out") + try os.remove.all(tester.workspacePath / "out") catch { case e: Throwable => /*do nothing*/ } - for (commandBlock <- commandBlocks) processCommandBlock(workspacePath, commandBlock) - if (clientServerMode) eval("shutdown") + for (commandBlock <- commandBlocks) processCommandBlock(tester.workspacePath, commandBlock) + if (tester.clientServerMode) tester.eval("shutdown") } } } diff --git a/testkit/src/mill/testkit/IntegrationTestSuite.scala b/testkit/src/mill/testkit/IntegrationTestSuite.scala index 2c97a8bf2f3..426b16dd318 100644 --- a/testkit/src/mill/testkit/IntegrationTestSuite.scala +++ b/testkit/src/mill/testkit/IntegrationTestSuite.scala @@ -4,7 +4,7 @@ import os.Path import utest._ abstract class IntegrationTestSuite extends TestSuite with IntegrationTester.Impl { - protected def workspaceSourcePath: os.Path = os.Path(sys.env("MILL_INTEGRATION_REPO_ROOT")) + def workspaceSourcePath: os.Path = os.Path(sys.env("MILL_INTEGRATION_REPO_ROOT")) val clientServerMode: Boolean = sys.env("MILL_INTEGRATION_SERVER_MODE").toBoolean def millExecutable: Path = os.Path(System.getenv("MILL_INTEGRATION_LAUNCHER"), os.pwd) diff --git a/testkit/src/mill/testkit/IntegrationTester.scala b/testkit/src/mill/testkit/IntegrationTester.scala index bfb4a89768c..b3f1b3addba 100644 --- a/testkit/src/mill/testkit/IntegrationTester.scala +++ b/testkit/src/mill/testkit/IntegrationTester.scala @@ -39,7 +39,7 @@ object IntegrationTester { trait Impl extends AutoCloseable { def millExecutable: os.Path - protected def workspaceSourcePath: os.Path + def workspaceSourcePath: os.Path val clientServerMode: Boolean @@ -54,13 +54,12 @@ object IntegrationTester { * Make sure it lives inside `os.pwd` because somehow the tests fail on windows * if it lives in the global temp folder. */ - val workspacePath: os.Path = - os.temp.dir(workspacePathBase, deleteOnExit = false) + val workspacePath: os.Path = os.temp.dir(workspacePathBase, deleteOnExit = false) def debugLog = false /** - * Evaluates a Mill [[cmd]]. Essentially the same as `os.call`, except it + * Evaluates a Mill command. Essentially the same as `os.call`, except it * provides the Mill executable and some test flags and environment variables * for you, and wraps the output in a [[IntegrationTester.EvalResult]] for * convenience. @@ -104,8 +103,7 @@ object IntegrationTester { ) } - private val millTestSuiteEnv: Map[String, String] = - Map("MILL_TEST_SUITE" -> this.getClass().toString()) + private val millTestSuiteEnv = Map("MILL_TEST_SUITE" -> this.getClass().toString()) /** * Helpers to read the `.json` metadata files belonging to a particular task From 65dde6e27f678ac05fd9e62578e236a562da8b9c Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 25 Aug 2024 08:45:03 +0800 Subject: [PATCH 22/24] Update test-mill-dev.sh --- ci/test-mill-dev.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/test-mill-dev.sh b/ci/test-mill-dev.sh index d81d297cfe0..44828909db0 100755 --- a/ci/test-mill-dev.sh +++ b/ci/test-mill-dev.sh @@ -9,10 +9,10 @@ rm -rf $EXAMPLE/out test ! -d $EXAMPLE/out/foo/3.3.3/compile.dest test ! -f $EXAMPLE/out/bar/2.13.8/assembly.dest/out.jar -./mill -i dev.run $EXAMPLE -i "foo[3.3.3].run" +./mill -i dist.run $EXAMPLE -i "foo[3.3.3].run" test -d $EXAMPLE/out/foo/3.3.3/compile.dest -./mill -i dev.run $EXAMPLE show "bar[2.13.8].assembly" +./mill -i dist.run $EXAMPLE show "bar[2.13.8].assembly" test -f $EXAMPLE/out/bar/2.13.8/assembly.dest/out.jar From e4eb7cb0dbede02d83aafaecaa5d6c3e8e25c56c Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 25 Aug 2024 08:45:43 +0800 Subject: [PATCH 23/24] Update test-mill-release.sh --- ci/test-mill-release.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/test-mill-release.sh b/ci/test-mill-release.sh index ebc549544ec..562771dff96 100755 --- a/ci/test-mill-release.sh +++ b/ci/test-mill-release.sh @@ -3,7 +3,7 @@ set -eux # Build Mill -./mill -i dev.assembly +./mill -i dist.assembly EXAMPLE=example/scalalib/builds/9-realistic @@ -12,10 +12,10 @@ rm -rf $EXAMPLE/out test ! -d $EXAMPLE/out/foo/3.3.3/compile.dest test ! -f $EXAMPLE/out/bar/2.13.8/assembly.dest/out.jar -(cd $EXAMPLE && ../../../../out/dev/assembly.dest/mill -i "foo[3.3.3].run") +(cd $EXAMPLE && ../../../../out/dist/assembly.dest/mill -i "foo[3.3.3].run") test -d $EXAMPLE/out/foo/3.3.3/compile.dest -(cd $EXAMPLE && ../../../../out/dev/assembly.dest/mill show "bar[2.13.8].assembly") +(cd $EXAMPLE && ../../../../out/dist/assembly.dest/mill show "bar[2.13.8].assembly") test -f $EXAMPLE/out/bar/2.13.8/assembly.dest/out.jar From f0ed4c0916baf14389a71b3b939f06a798b9b7b7 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 25 Aug 2024 09:35:23 +0800 Subject: [PATCH 24/24] . --- build.sc | 4 ++++ testkit/src/mill/testkit/ExampleTester.scala | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/build.sc b/build.sc index 35466ce39dd..d525fb33874 100644 --- a/build.sc +++ b/build.sc @@ -1287,6 +1287,8 @@ object example extends Module { } trait ExampleCrossModule extends IntegrationTestCrossModule { + // disable scalafix because these example modules don't have sources causing it to misbehave + def fix(args: String*): Command[Unit] = T.command {} def testRepoRoot: T[PathRef] = T.source(millSourcePath) def compile = testkit.compile() @@ -1542,6 +1544,8 @@ object idea extends MillPublishScalaModule { * to itself in its [[testTransitiveDeps]], to avoid a circular dependency. */ object dist0 extends MillPublishJavaModule { + // disable scalafix here because it crashes when a module has no sources + def fix(args: String*): Command[Unit] = T.command {} def moduleDeps = Seq(runner, idea) def testTransitiveDeps = runner.testTransitiveDeps() ++ Seq( diff --git a/testkit/src/mill/testkit/ExampleTester.scala b/testkit/src/mill/testkit/ExampleTester.scala index 34c203dd7b8..335e0acee3e 100644 --- a/testkit/src/mill/testkit/ExampleTester.scala +++ b/testkit/src/mill/testkit/ExampleTester.scala @@ -180,7 +180,10 @@ class ExampleTester(tester: IntegrationTester.Impl) { } case Seq("printf", literal, ">>", path) => - tester.modifyFile(os.Path(path, tester.workspacePath), _ + ujson.read(s""""${literal}"""").str) + tester.modifyFile( + os.Path(path, tester.workspacePath), + _ + ujson.read(s""""${literal}"""").str + ) case Seq(command, rest @ _*) => val evalResult = command match {