From 2f3ce63dae49e2192a21bd9ec543711d716d601a Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Fri, 4 Oct 2024 19:06:49 +0800 Subject: [PATCH] . --- build.mill | 2 - contrib/checkstyle/readme.adoc | 128 ----------------- contrib/errorprone/readme.adoc | 31 ---- contrib/package.mill | 14 -- .../javalib/linting/1-error-prone/build.mill | 36 ++++- .../javalib/linting/2-checkstyle/build.mill | 132 +++++++++++++++++- scalalib/package.mill | 3 +- .../javalib}/checkstyle/CheckstyleArgs.scala | 2 +- .../checkstyle/CheckstyleModule.scala | 4 +- .../checkstyle/CheckstyleXsltModule.scala | 4 +- .../checkstyle/CheckstyleXsltReport.scala | 2 +- .../errorprone/ErrorProneModule.scala | 6 +- .../compatible-java/checkstyle-config.xml | 0 .../src/com/etsy/sbt/TestClass.java | 0 .../compatible-scala/checkstyle-config.xml | 0 .../checkstyle-xslt/html/noframes.xml | 0 .../src/com/etsy/sbt/TestClass.java | 0 .../src/com/etsy/sbt/TestClass.scala | 0 .../non-compatible/checkstyle-config.xml | 0 .../checkstyle-xslt/htm/noframes-copy.xml | 0 .../checkstyle-xslt/htm/noframes.xml | 0 .../checkstyle-xslt/htm/readme.txt | 0 .../checkstyle-xslt/html/noframes-copy.xml | 0 .../checkstyle-xslt/html/noframes.xml | 0 .../src/blocks/ArrayTrailingComma.java | 0 .../src/coding/EmptyStatement.java | 0 .../resources/errorprone}/src/ShortSet.java | 0 .../checkstyle/CheckstyleModuleTest.scala | 6 +- .../checkstyle/CheckstyleXsltModuleTest.scala | 6 +- .../javalib}/errorprone/ErrorProneTests.scala | 6 +- 30 files changed, 179 insertions(+), 203 deletions(-) delete mode 100644 contrib/checkstyle/readme.adoc delete mode 100644 contrib/errorprone/readme.adoc rename {contrib/checkstyle/src/mill/contrib => scalalib/src/mill/javalib}/checkstyle/CheckstyleArgs.scala (94%) rename {contrib/checkstyle/src/mill/contrib => scalalib/src/mill/javalib}/checkstyle/CheckstyleModule.scala (98%) rename {contrib/checkstyle/src/mill/contrib => scalalib/src/mill/javalib}/checkstyle/CheckstyleXsltModule.scala (98%) rename {contrib/checkstyle/src/mill/contrib => scalalib/src/mill/javalib}/checkstyle/CheckstyleXsltReport.scala (93%) rename {contrib/errorprone/src/mill/contrib => scalalib/src/mill/javalib}/errorprone/ErrorProneModule.scala (96%) rename {contrib/checkstyle/test/resources => scalalib/test/resources/checkstyle}/compatible-java/checkstyle-config.xml (100%) rename {contrib/checkstyle/test/resources => scalalib/test/resources/checkstyle}/compatible-java/src/com/etsy/sbt/TestClass.java (100%) rename {contrib/checkstyle/test/resources => scalalib/test/resources/checkstyle}/compatible-scala/checkstyle-config.xml (100%) rename {contrib/checkstyle/test/resources => scalalib/test/resources/checkstyle}/compatible-scala/checkstyle-xslt/html/noframes.xml (100%) rename {contrib/checkstyle/test/resources => scalalib/test/resources/checkstyle}/compatible-scala/src/com/etsy/sbt/TestClass.java (100%) rename {contrib/checkstyle/test/resources => scalalib/test/resources/checkstyle}/compatible-scala/src/com/etsy/sbt/TestClass.scala (100%) rename {contrib/checkstyle/test/resources => scalalib/test/resources/checkstyle}/non-compatible/checkstyle-config.xml (100%) rename {contrib/checkstyle/test/resources => scalalib/test/resources/checkstyle}/non-compatible/checkstyle-xslt/htm/noframes-copy.xml (100%) rename {contrib/checkstyle/test/resources => scalalib/test/resources/checkstyle}/non-compatible/checkstyle-xslt/htm/noframes.xml (100%) rename {contrib/checkstyle/test/resources => scalalib/test/resources/checkstyle}/non-compatible/checkstyle-xslt/htm/readme.txt (100%) rename {contrib/checkstyle/test/resources => scalalib/test/resources/checkstyle}/non-compatible/checkstyle-xslt/html/noframes-copy.xml (100%) rename {contrib/checkstyle/test/resources => scalalib/test/resources/checkstyle}/non-compatible/checkstyle-xslt/html/noframes.xml (100%) rename {contrib/checkstyle/test/resources => scalalib/test/resources/checkstyle}/non-compatible/src/blocks/ArrayTrailingComma.java (100%) rename {contrib/checkstyle/test/resources => scalalib/test/resources/checkstyle}/non-compatible/src/coding/EmptyStatement.java (100%) rename {contrib/errorprone/test/resources/simple => scalalib/test/resources/errorprone}/src/ShortSet.java (100%) rename {contrib/checkstyle/test/src/mill/contrib => scalalib/test/src/mill/javalib}/checkstyle/CheckstyleModuleTest.scala (98%) rename {contrib/checkstyle/test/src/mill/contrib => scalalib/test/src/mill/javalib}/checkstyle/CheckstyleXsltModuleTest.scala (95%) rename {contrib/errorprone/test/src/mill/contrib => scalalib/test/src/mill/javalib}/errorprone/ErrorProneTests.scala (94%) diff --git a/build.mill b/build.mill index 76447bb9f0c..412f6180546 100644 --- a/build.mill +++ b/build.mill @@ -758,8 +758,6 @@ object dist0 extends MillPublishJavaModule { build.contrib.jmh.testDep(), build.contrib.playlib.testDep(), build.contrib.playlib.worker("2.8").testDep(), - build.contrib.errorprone.testDep(), - build.contrib.checkstyle.testDep(), build.bsp.worker.testDep(), build.testkit.testDep() ) diff --git a/contrib/checkstyle/readme.adoc b/contrib/checkstyle/readme.adoc deleted file mode 100644 index 984107bae74..00000000000 --- a/contrib/checkstyle/readme.adoc +++ /dev/null @@ -1,128 +0,0 @@ -= Checkstyle -:page-aliases: Plugin_Checkstyle.adoc - -Performs quality checks on Java source files using https://checkstyle.org[Checkstyle] and generates reports from these checks. - -== CheckstyleModule - -To use this plugin in a Java/Scala module, - -1. Extend `mill.contrib.checkstyle.CheckstyleModule`. -2. Define a https://checkstyle.org/config.html[configuration] file `checkstyle-config.xml`. -3. Run the `checkstyle` command. - -=== checkstyle - -- flags -[source,sh] ----- - -// if an exception should be raised when violations are found -checkstyle --check - -// if Checkstyle output report should be written to System.out -checkstyle --stdout ----- - -- sources (optional) -[source,sh] ----- -// incorrect paths will cause a command failure -// checkstyle a/b - -// you can specify paths relative to millSourcePath -checkstyle src/a/b - -// process a single file -checkstyle src/a/B.java - -// process multiple sources -checkstyle src/a/b src/c/d src/e/F.java - -// process with flags -checkstyle --check --stdout src/a/b src/c/d - -// process all module sources -checkstyle ----- - -=== Shared configuration - -To share `checkstyle-config.xml` across modules, adapt the following example. -[source,scala] ----- -import mill._ -import mill.contrib.checkstyle.CheckstyleModule -import mill.scalalib._ - -object foo extends Module { - - object bar extends MyModule - object baz extends Module { - object fizz extends MyModule - object buzz extends MyModule - } - - trait MyModule extends JavaModule with CheckstyleModule { - - override def checkstyleConfig = Task { - api.PathRef(T.workspace / "checkstyle-config.xml") - } - } -} ----- - - -=== Limitations - -- Version `6.3` or above is required for `plain` and `xml` formats. -- Setting `checkstyleOptions` might cause failures with legacy versions. - -== CheckstyleXsltModule - -This plugin extends the `mill.contrib.checkstyle.CheckstyleModule` with the ability to generate reports by applying https://www.w3.org/TR/xslt/[XSL Transformations] on a Checkstyle output report. - -=== Auto detect XSL Transformations - -XSLT files are detected automatically provided a prescribed directory structure is followed. -[source,scala] ----- -/** - * checkstyle-xslt - * ├─ html - * │ ├─ xslt0.xml - * │ └─ xslt1.xml - * └─ pdf - * ├─ xslt1.xml - * └─ xslt2.xml - * - * html/xslt0.xml -> xslt0.html - * html/xslt1.xml -> xslt1.html - * pdf/xslt1.xml -> xslt1.pdf - * pdf/xslt2.xml -> xslt2.pdf - */ ----- - -=== Specify XSL Transformations manually - -For a custom setup, adapt the following example. -[source,scala] ----- -import mill._ -import mill.api.PathRef -import mill.contrib.checkstyle.CheckstyleXsltModule -import mill.contrib.checkstyle.CheckstyleXsltReport -import mill.scalalib._ - -object foo extends JavaModule with CheckstyleXsltModule { - - override def checkstyleXsltReports = Task { - Set( - CheckstyleXsltReport( - PathRef(millSourcePath / "checkstyle-no-frames.xml"), - PathRef(T.dest / "checkstyle-no-frames.html"), - ) - ) - } -} ----- diff --git a/contrib/errorprone/readme.adoc b/contrib/errorprone/readme.adoc deleted file mode 100644 index 159b045051a..00000000000 --- a/contrib/errorprone/readme.adoc +++ /dev/null @@ -1,31 +0,0 @@ -= Mill ErrorProne Plugin -:page-aliases: Plugin_ErrorProne.adoc - -https://errorprone.info/index[Error Prone] augments the Java compiler's type checker and detect common mistakes at compile time. - -You just need to mix the `ErrorProneModule` into your `JavaModule` and it will automatically run with every compilation. - -.`build.mill.scala`: Enable `ErrorProne` in a module -[source,scala] ----- -package build -import mill._, scalalib._ - -import $ivy.`com.lihaoyi::mill-contrib-errorprone:` -import mill.contrib.errorprone.ErrorProneModule - -object foo extends JavaModule with ErrorProneModule { -} ----- - -== Configuration - -The following configuration options exist: - -`def errorProneVersion: T[String]`:: -The `error-prone` version to use. Defaults to [[BuildInfo.errorProneVersion]], the version used to build and test the module. -Find the latest at https://mvnrepository.com/artifact/com.google.errorprone/error_prone_core[mvnrepository.com] - -`def errorProneOptions: T[Seq[String]]`:: - Options directly given to the `error-prone` processor. -Those are documented as "flags" at https://errorprone.info/docs/flags diff --git a/contrib/package.mill b/contrib/package.mill index 50ac2d28719..d11cc3a0132 100644 --- a/contrib/package.mill +++ b/contrib/package.mill @@ -211,18 +211,4 @@ object `package` extends RootModule { def compileModuleDeps = Seq(build.scalalib) def testModuleDeps = super.testModuleDeps ++ Seq(build.scalalib) } - - object errorprone extends ContribModule with BuildInfo { - def compileModuleDeps = Seq(build.scalalib) - def testModuleDeps = super.testModuleDeps ++ Seq(build.scalalib) - def buildInfoPackageName = "mill.contrib.errorprone" - def buildInfoObjectName = "BuildInfo" - def buildInfoMembers = - Seq(BuildInfo.Value("errorProneVersion", Deps.RuntimeDeps.errorProneCore.version)) - } - - object checkstyle extends ContribModule { - def compileModuleDeps = Seq(build.scalalib) - def testModuleDeps = super.testModuleDeps ++ Seq(build.scalalib) - } } diff --git a/example/javalib/linting/1-error-prone/build.mill b/example/javalib/linting/1-error-prone/build.mill index 53eeea130e7..5a9f7bd0603 100644 --- a/example/javalib/linting/1-error-prone/build.mill +++ b/example/javalib/linting/1-error-prone/build.mill @@ -3,10 +3,8 @@ package build -import mill._, javalib._ -import mill.contrib.errorprone._ +import mill._, javalib._, errorprone._ -import $ivy.`com.lihaoyi::mill-contrib-errorprone:` object `package` extends RootModule with JavaModule with ErrorProneModule { def errorProneOptions = Seq("-XepAllErrorsAsWarnings") @@ -29,4 +27,34 @@ object `package` extends RootModule with JavaModule with ErrorProneModule { [warn] ^ */ -// Find more details on the xref:contrib/errorprone.adoc[ErrorProne plugin page]. \ No newline at end of file +// :page-aliases: Plugin_ErrorProne.adoc +// +// https://errorprone.info/index[Error Prone] augments the Java compiler's type checker and detect common mistakes at compile time. +// +// You just need to mix the `ErrorProneModule` into your `JavaModule` and it will automatically run with every compilation. +// +// .`build.mill.scala`: Enable `ErrorProne` in a module +// [source,scala] +// ---- +// package build +// import mill._, scalalib._ +// +// import $ivy.`com.lihaoyi::mill-contrib-errorprone:` +// import mill.contrib.errorprone.ErrorProneModule +// +// object foo extends JavaModule with ErrorProneModule { +// } +// ---- +// +// == Configuration +// +// The following configuration options exist: +// +// `def errorProneVersion: T[String]`:: +// The `error-prone` version to use. Defaults to [[BuildInfo.errorProneVersion]], the version used to build and test the module. +// Find the latest at https://mvnrepository.com/artifact/com.google.errorprone/error_prone_core[mvnrepository.com] +// +// `def errorProneOptions: T[Seq[String]]`:: +// Options directly given to the `error-prone` processor. +// Those are documented as "flags" at https://errorprone.info/docs/flags +// \ No newline at end of file diff --git a/example/javalib/linting/2-checkstyle/build.mill b/example/javalib/linting/2-checkstyle/build.mill index a62c3d4915d..417356cb30b 100644 --- a/example/javalib/linting/2-checkstyle/build.mill +++ b/example/javalib/linting/2-checkstyle/build.mill @@ -1,8 +1,5 @@ package build -import mill._, javalib._ -import $ivy.`com.lihaoyi::mill-contrib-checkstyle:` - -import mill.contrib.checkstyle._ +import mill._, javalib._, checkstyle._ object `package` extends RootModule with CheckstyleModule { def checkstyleVersion = "9.3" @@ -34,4 +31,129 @@ Audit done. > ./mill checkstyle # after fixing the violations, checkstyle no longer errors Audit done. -*/ \ No newline at end of file +*/ + +// Performs quality checks on Java source files using https://checkstyle.org[Checkstyle] and generates reports from these checks. +// +// To use this plugin in a Java/Scala module, +// +// 1. Extend `mill.contrib.checkstyle.CheckstyleModule`. +// 2. Define a https://checkstyle.org/config.html[configuration] file `checkstyle-config.xml`. +// 3. Run the `checkstyle` command. +// +// === checkstyle +// +// - flags +// [source,sh] +// ---- +// +// // if an exception should be raised when violations are found +// checkstyle --check +// +// // if Checkstyle output report should be written to System.out +// checkstyle --stdout +// ---- +// +// - sources (optional) +// [source,sh] +// ---- +// // incorrect paths will cause a command failure +// // checkstyle a/b +// +// // you can specify paths relative to millSourcePath +// checkstyle src/a/b +// +// // process a single file +// checkstyle src/a/B.java +// +// // process multiple sources +// checkstyle src/a/b src/c/d src/e/F.java +// +// // process with flags +// checkstyle --check --stdout src/a/b src/c/d +// +// // process all module sources +// checkstyle +// ---- +// +// === Shared configuration +// +// To share `checkstyle-config.xml` across modules, adapt the following example. +// [source,scala] +// ---- +// import mill._ +// import mill.contrib.checkstyle.CheckstyleModule +// import mill.scalalib._ +// +// object foo extends Module { +// +// object bar extends MyModule +// object baz extends Module { +// object fizz extends MyModule +// object buzz extends MyModule +// } +// +// trait MyModule extends JavaModule with CheckstyleModule { +// +// override def checkstyleConfig = Task { +// api.PathRef(T.workspace / "checkstyle-config.xml") +// } +// } +// } +// ---- +// +// +// === Limitations +// +// - Version `6.3` or above is required for `plain` and `xml` formats. +// - Setting `checkstyleOptions` might cause failures with legacy versions. +// +// == CheckstyleXsltModule +// +// This plugin extends the `mill.contrib.checkstyle.CheckstyleModule` with the ability to generate reports by applying https://www.w3.org/TR/xslt/[XSL Transformations] on a Checkstyle output report. +// +// === Auto detect XSL Transformations +// +// XSLT files are detected automatically provided a prescribed directory structure is followed. +// [source,scala] +// ---- +// /** +// * checkstyle-xslt +// * ├─ html +// * │ ├─ xslt0.xml +// * │ └─ xslt1.xml +// * └─ pdf +// * ├─ xslt1.xml +// * └─ xslt2.xml +// * +// * html/xslt0.xml -> xslt0.html +// * html/xslt1.xml -> xslt1.html +// * pdf/xslt1.xml -> xslt1.pdf +// * pdf/xslt2.xml -> xslt2.pdf +// */ +// ---- +// +// === Specify XSL Transformations manually +// +// For a custom setup, adapt the following example. +// [source,scala] +// ---- +// import mill._ +// import mill.api.PathRef +// import mill.contrib.checkstyle.CheckstyleXsltModule +// import mill.contrib.checkstyle.CheckstyleXsltReport +// import mill.scalalib._ +// +// object foo extends JavaModule with CheckstyleXsltModule { +// +// override def checkstyleXsltReports = Task { +// Set( +// CheckstyleXsltReport( +// PathRef(millSourcePath / "checkstyle-no-frames.xml"), +// PathRef(T.dest / "checkstyle-no-frames.html"), +// ) +// ) +// } +// } +// ---- +// \ No newline at end of file diff --git a/scalalib/package.mill b/scalalib/package.mill index c0d829ff4dc..b061af417dc 100644 --- a/scalalib/package.mill +++ b/scalalib/package.mill @@ -70,7 +70,8 @@ object `package` extends RootModule with build.MillStableScalaModule { s"${d.dep.module.organization.value}:${d.dep.module.name.value}:${d.version}" }, "Dependency to jupiter-interface" - ) + ), + BuildInfo.Value("errorProneVersion", build.Deps.RuntimeDeps.errorProneCore.version) ) } diff --git a/contrib/checkstyle/src/mill/contrib/checkstyle/CheckstyleArgs.scala b/scalalib/src/mill/javalib/checkstyle/CheckstyleArgs.scala similarity index 94% rename from contrib/checkstyle/src/mill/contrib/checkstyle/CheckstyleArgs.scala rename to scalalib/src/mill/javalib/checkstyle/CheckstyleArgs.scala index a875c2b4384..87b66400703 100644 --- a/contrib/checkstyle/src/mill/contrib/checkstyle/CheckstyleArgs.scala +++ b/scalalib/src/mill/javalib/checkstyle/CheckstyleArgs.scala @@ -1,4 +1,4 @@ -package mill.contrib.checkstyle +package mill.javalib.checkstyle import mainargs.{Leftover, ParserForClass, main} diff --git a/contrib/checkstyle/src/mill/contrib/checkstyle/CheckstyleModule.scala b/scalalib/src/mill/javalib/checkstyle/CheckstyleModule.scala similarity index 98% rename from contrib/checkstyle/src/mill/contrib/checkstyle/CheckstyleModule.scala rename to scalalib/src/mill/javalib/checkstyle/CheckstyleModule.scala index f27a09c2e6f..f71e5078e25 100644 --- a/contrib/checkstyle/src/mill/contrib/checkstyle/CheckstyleModule.scala +++ b/scalalib/src/mill/javalib/checkstyle/CheckstyleModule.scala @@ -1,6 +1,6 @@ -package mill -package contrib.checkstyle +package mill.javalib.checkstyle +import mill._ import mill.api.{Loose, PathRef} import mill.scalalib.{DepSyntax, JavaModule} import mill.util.Jvm diff --git a/contrib/checkstyle/src/mill/contrib/checkstyle/CheckstyleXsltModule.scala b/scalalib/src/mill/javalib/checkstyle/CheckstyleXsltModule.scala similarity index 98% rename from contrib/checkstyle/src/mill/contrib/checkstyle/CheckstyleXsltModule.scala rename to scalalib/src/mill/javalib/checkstyle/CheckstyleXsltModule.scala index c7e0ea68c68..8dafd90f879 100644 --- a/contrib/checkstyle/src/mill/contrib/checkstyle/CheckstyleXsltModule.scala +++ b/scalalib/src/mill/javalib/checkstyle/CheckstyleXsltModule.scala @@ -1,6 +1,6 @@ -package mill -package contrib.checkstyle +package mill.javalib.checkstyle +import mill._ import javax.xml.transform.TransformerFactory import javax.xml.transform.stream.{StreamResult, StreamSource} diff --git a/contrib/checkstyle/src/mill/contrib/checkstyle/CheckstyleXsltReport.scala b/scalalib/src/mill/javalib/checkstyle/CheckstyleXsltReport.scala similarity index 93% rename from contrib/checkstyle/src/mill/contrib/checkstyle/CheckstyleXsltReport.scala rename to scalalib/src/mill/javalib/checkstyle/CheckstyleXsltReport.scala index 2235bf30b77..00edd00face 100644 --- a/contrib/checkstyle/src/mill/contrib/checkstyle/CheckstyleXsltReport.scala +++ b/scalalib/src/mill/javalib/checkstyle/CheckstyleXsltReport.scala @@ -1,4 +1,4 @@ -package mill.contrib.checkstyle +package mill.javalib.checkstyle import mill.api.PathRef diff --git a/contrib/errorprone/src/mill/contrib/errorprone/ErrorProneModule.scala b/scalalib/src/mill/javalib/errorprone/ErrorProneModule.scala similarity index 96% rename from contrib/errorprone/src/mill/contrib/errorprone/ErrorProneModule.scala rename to scalalib/src/mill/javalib/errorprone/ErrorProneModule.scala index 8241822fd6e..e9d8dddb839 100644 --- a/contrib/errorprone/src/mill/contrib/errorprone/ErrorProneModule.scala +++ b/scalalib/src/mill/javalib/errorprone/ErrorProneModule.scala @@ -1,8 +1,8 @@ -package mill.contrib.errorprone +package mill.javalib.errorprone import mill.api.PathRef -import mill.{Agg, T, Task} import mill.scalalib.{Dep, DepSyntax, JavaModule} +import mill.{Agg, T, Task} import java.io.File @@ -15,7 +15,7 @@ trait ErrorProneModule extends JavaModule { /** The `error-prone` version to use. Defaults to [[BuildInfo.errorProneVersion]]. */ def errorProneVersion: T[String] = Task.Input { - BuildInfo.errorProneVersion + mill.scalalib.api.Versions.errorProneVersion } /** diff --git a/contrib/checkstyle/test/resources/compatible-java/checkstyle-config.xml b/scalalib/test/resources/checkstyle/compatible-java/checkstyle-config.xml similarity index 100% rename from contrib/checkstyle/test/resources/compatible-java/checkstyle-config.xml rename to scalalib/test/resources/checkstyle/compatible-java/checkstyle-config.xml diff --git a/contrib/checkstyle/test/resources/compatible-java/src/com/etsy/sbt/TestClass.java b/scalalib/test/resources/checkstyle/compatible-java/src/com/etsy/sbt/TestClass.java similarity index 100% rename from contrib/checkstyle/test/resources/compatible-java/src/com/etsy/sbt/TestClass.java rename to scalalib/test/resources/checkstyle/compatible-java/src/com/etsy/sbt/TestClass.java diff --git a/contrib/checkstyle/test/resources/compatible-scala/checkstyle-config.xml b/scalalib/test/resources/checkstyle/compatible-scala/checkstyle-config.xml similarity index 100% rename from contrib/checkstyle/test/resources/compatible-scala/checkstyle-config.xml rename to scalalib/test/resources/checkstyle/compatible-scala/checkstyle-config.xml diff --git a/contrib/checkstyle/test/resources/compatible-scala/checkstyle-xslt/html/noframes.xml b/scalalib/test/resources/checkstyle/compatible-scala/checkstyle-xslt/html/noframes.xml similarity index 100% rename from contrib/checkstyle/test/resources/compatible-scala/checkstyle-xslt/html/noframes.xml rename to scalalib/test/resources/checkstyle/compatible-scala/checkstyle-xslt/html/noframes.xml diff --git a/contrib/checkstyle/test/resources/compatible-scala/src/com/etsy/sbt/TestClass.java b/scalalib/test/resources/checkstyle/compatible-scala/src/com/etsy/sbt/TestClass.java similarity index 100% rename from contrib/checkstyle/test/resources/compatible-scala/src/com/etsy/sbt/TestClass.java rename to scalalib/test/resources/checkstyle/compatible-scala/src/com/etsy/sbt/TestClass.java diff --git a/contrib/checkstyle/test/resources/compatible-scala/src/com/etsy/sbt/TestClass.scala b/scalalib/test/resources/checkstyle/compatible-scala/src/com/etsy/sbt/TestClass.scala similarity index 100% rename from contrib/checkstyle/test/resources/compatible-scala/src/com/etsy/sbt/TestClass.scala rename to scalalib/test/resources/checkstyle/compatible-scala/src/com/etsy/sbt/TestClass.scala diff --git a/contrib/checkstyle/test/resources/non-compatible/checkstyle-config.xml b/scalalib/test/resources/checkstyle/non-compatible/checkstyle-config.xml similarity index 100% rename from contrib/checkstyle/test/resources/non-compatible/checkstyle-config.xml rename to scalalib/test/resources/checkstyle/non-compatible/checkstyle-config.xml diff --git a/contrib/checkstyle/test/resources/non-compatible/checkstyle-xslt/htm/noframes-copy.xml b/scalalib/test/resources/checkstyle/non-compatible/checkstyle-xslt/htm/noframes-copy.xml similarity index 100% rename from contrib/checkstyle/test/resources/non-compatible/checkstyle-xslt/htm/noframes-copy.xml rename to scalalib/test/resources/checkstyle/non-compatible/checkstyle-xslt/htm/noframes-copy.xml diff --git a/contrib/checkstyle/test/resources/non-compatible/checkstyle-xslt/htm/noframes.xml b/scalalib/test/resources/checkstyle/non-compatible/checkstyle-xslt/htm/noframes.xml similarity index 100% rename from contrib/checkstyle/test/resources/non-compatible/checkstyle-xslt/htm/noframes.xml rename to scalalib/test/resources/checkstyle/non-compatible/checkstyle-xslt/htm/noframes.xml diff --git a/contrib/checkstyle/test/resources/non-compatible/checkstyle-xslt/htm/readme.txt b/scalalib/test/resources/checkstyle/non-compatible/checkstyle-xslt/htm/readme.txt similarity index 100% rename from contrib/checkstyle/test/resources/non-compatible/checkstyle-xslt/htm/readme.txt rename to scalalib/test/resources/checkstyle/non-compatible/checkstyle-xslt/htm/readme.txt diff --git a/contrib/checkstyle/test/resources/non-compatible/checkstyle-xslt/html/noframes-copy.xml b/scalalib/test/resources/checkstyle/non-compatible/checkstyle-xslt/html/noframes-copy.xml similarity index 100% rename from contrib/checkstyle/test/resources/non-compatible/checkstyle-xslt/html/noframes-copy.xml rename to scalalib/test/resources/checkstyle/non-compatible/checkstyle-xslt/html/noframes-copy.xml diff --git a/contrib/checkstyle/test/resources/non-compatible/checkstyle-xslt/html/noframes.xml b/scalalib/test/resources/checkstyle/non-compatible/checkstyle-xslt/html/noframes.xml similarity index 100% rename from contrib/checkstyle/test/resources/non-compatible/checkstyle-xslt/html/noframes.xml rename to scalalib/test/resources/checkstyle/non-compatible/checkstyle-xslt/html/noframes.xml diff --git a/contrib/checkstyle/test/resources/non-compatible/src/blocks/ArrayTrailingComma.java b/scalalib/test/resources/checkstyle/non-compatible/src/blocks/ArrayTrailingComma.java similarity index 100% rename from contrib/checkstyle/test/resources/non-compatible/src/blocks/ArrayTrailingComma.java rename to scalalib/test/resources/checkstyle/non-compatible/src/blocks/ArrayTrailingComma.java diff --git a/contrib/checkstyle/test/resources/non-compatible/src/coding/EmptyStatement.java b/scalalib/test/resources/checkstyle/non-compatible/src/coding/EmptyStatement.java similarity index 100% rename from contrib/checkstyle/test/resources/non-compatible/src/coding/EmptyStatement.java rename to scalalib/test/resources/checkstyle/non-compatible/src/coding/EmptyStatement.java diff --git a/contrib/errorprone/test/resources/simple/src/ShortSet.java b/scalalib/test/resources/errorprone/src/ShortSet.java similarity index 100% rename from contrib/errorprone/test/resources/simple/src/ShortSet.java rename to scalalib/test/resources/errorprone/src/ShortSet.java diff --git a/contrib/checkstyle/test/src/mill/contrib/checkstyle/CheckstyleModuleTest.scala b/scalalib/test/src/mill/javalib/checkstyle/CheckstyleModuleTest.scala similarity index 98% rename from contrib/checkstyle/test/src/mill/contrib/checkstyle/CheckstyleModuleTest.scala rename to scalalib/test/src/mill/javalib/checkstyle/CheckstyleModuleTest.scala index dd6d6978fe7..c7c9ae9e66c 100644 --- a/contrib/checkstyle/test/src/mill/contrib/checkstyle/CheckstyleModuleTest.scala +++ b/scalalib/test/src/mill/javalib/checkstyle/CheckstyleModuleTest.scala @@ -1,6 +1,6 @@ -package mill -package contrib.checkstyle +package mill.javalib.checkstyle +import mill._ import mainargs.Leftover import mill.scalalib.{JavaModule, ScalaModule} import mill.testkit.{TestBaseModule, UnitTester} @@ -10,7 +10,7 @@ object CheckstyleModuleTest extends TestSuite { def tests: Tests = Tests { - val resources: os.Path = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) + val resources: os.Path = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "checkstyle" // violations (for version 10.18.1) in "non-compatible" module val violations: Seq[String] = diff --git a/contrib/checkstyle/test/src/mill/contrib/checkstyle/CheckstyleXsltModuleTest.scala b/scalalib/test/src/mill/javalib/checkstyle/CheckstyleXsltModuleTest.scala similarity index 95% rename from contrib/checkstyle/test/src/mill/contrib/checkstyle/CheckstyleXsltModuleTest.scala rename to scalalib/test/src/mill/javalib/checkstyle/CheckstyleXsltModuleTest.scala index 9be0a628ef9..795b778073f 100644 --- a/contrib/checkstyle/test/src/mill/contrib/checkstyle/CheckstyleXsltModuleTest.scala +++ b/scalalib/test/src/mill/javalib/checkstyle/CheckstyleXsltModuleTest.scala @@ -1,6 +1,6 @@ -package mill -package contrib.checkstyle +package mill.javalib.checkstyle +import mill._ import mainargs.Leftover import mill.scalalib.{JavaModule, ScalaModule} import mill.testkit.{TestBaseModule, UnitTester} @@ -10,7 +10,7 @@ object CheckstyleXsltModuleTest extends TestSuite { def tests: Tests = Tests { - val resources: os.Path = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) + val resources: os.Path = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "checkstyle" test("checkstyle generates XSLT output reports") { diff --git a/contrib/errorprone/test/src/mill/contrib/errorprone/ErrorProneTests.scala b/scalalib/test/src/mill/javalib/errorprone/ErrorProneTests.scala similarity index 94% rename from contrib/errorprone/test/src/mill/contrib/errorprone/ErrorProneTests.scala rename to scalalib/test/src/mill/javalib/errorprone/ErrorProneTests.scala index c0b6bcd4bcd..b2582d24339 100644 --- a/contrib/errorprone/test/src/mill/contrib/errorprone/ErrorProneTests.scala +++ b/scalalib/test/src/mill/javalib/errorprone/ErrorProneTests.scala @@ -1,6 +1,6 @@ -package mill.contrib.errorprone +package mill.javalib.errorprone -import mill.{T, Task} +import mill.T import mill.scalalib.JavaModule import mill.testkit.{TestBaseModule, UnitTester} import os.Path @@ -16,7 +16,7 @@ object ErrorProneTests extends TestSuite { )) } - val testModuleSourcesPath: Path = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "simple" + val testModuleSourcesPath: Path = os.Path(sys.env("MILL_TEST_RESOURCE_DIR")) / "errorprone" def tests = Tests { test("reference") {