From fc4de97586a1e3db9750e8badd10bc4fc2f2aeb3 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 2 Jan 2025 15:05:58 +0000 Subject: [PATCH 1/3] Update scalafmt-core to 3.8.4-RC4 --- .scalafmt.conf | 2 +- example/extending/metabuild/3-autoformatting/.scalafmt.conf | 2 +- main/maven/test/resources/.scalafmt.conf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index ca282ea5224..10101574639 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = "3.8.4-RC1" +version = "3.8.4-RC4" align.openParenCallSite = false align.preset = none diff --git a/example/extending/metabuild/3-autoformatting/.scalafmt.conf b/example/extending/metabuild/3-autoformatting/.scalafmt.conf index 5cfdd6768ce..785cb01d15f 100644 --- a/example/extending/metabuild/3-autoformatting/.scalafmt.conf +++ b/example/extending/metabuild/3-autoformatting/.scalafmt.conf @@ -1,4 +1,4 @@ -version = "3.8.4-RC1" +version = "3.8.4-RC4" runner.dialect = scala213 diff --git a/main/maven/test/resources/.scalafmt.conf b/main/maven/test/resources/.scalafmt.conf index b3e25a743fe..79cee59457b 100644 --- a/main/maven/test/resources/.scalafmt.conf +++ b/main/maven/test/resources/.scalafmt.conf @@ -1,4 +1,4 @@ -version = "3.8.4-RC1" +version = "3.8.4-RC4" runner.dialect = scala213 newlines.source=fold newlines.topLevelStatementBlankLines = [ From 8fdf54e06c520e74d6a913d8486512b47807a1cf Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 2 Jan 2025 15:06:54 +0000 Subject: [PATCH 2/3] Reformat with scalafmt 3.8.4-RC4 Executed command: scalafmt --non-interactive --- build.mill | 29 ++-- ci/shared.mill | 2 - contrib/package.mill | 2 +- dist/package.mill | 30 ++-- docs/package.mill | 138 ++++++++++-------- example/package.mill | 118 ++++++++------- example/thirdparty/netty/build.mill | 6 +- .../resources/build.mill | 4 +- .../docannotations/resources/build.mill | 1 + .../resources/core3/package.mill | 2 +- .../keyword-module/resources/for/package.mill | 1 - .../keyword-module/resources/if/package.mill | 1 - .../resources/import/package.mill | 1 - .../resources/null/package.mill | 1 - .../resources/this/package.mill | 1 - .../launcher-old-versions/resources/build.sc | 1 + .../meta-skip-compile/resources/build.mill | 2 +- .../run-background/resources/build.mill | 23 +-- .../codesig-nested/resources/build.mill | 1 - .../codesig-subfolder/resources/build.mill | 1 - .../resources/subfolder/package.mill | 2 +- .../resources/subfolder2/package.mill | 3 +- .../resources/subfolder3/package.mill | 2 +- .../resources/subfolder4/package.mill | 2 +- .../resources/subfolder5/package.mill | 2 +- .../resources/subfolder6/package.mill | 2 +- .../resources/subfolder7/package.mill | 2 +- .../resources/subfolder8/package.mill | 2 +- .../resources/subfolder9/package.mill | 2 +- .../selective-execution/resources/build.mill | 2 +- .../resources/build.mill | 3 +- .../resources/subfolder/package.mill | 2 +- integration/package.mill | 3 +- javascriptlib/package.mill | 2 +- kotlinlib/package.mill | 18 ++- main/init/package.mill | 21 ++- main/package.mill | 7 +- pythonlib/package.mill | 3 +- .../resources/scalafmt/core/src/Main.scala | 5 +- .../resources/scalafmt/core/src/Person.scala | 5 +- scalalib/test/resources/scalafmt/core/util.sc | 4 +- .../scalatest/src/ScalaTestSpec.scala | 2 +- .../scalatest/src/ScalaTestSpec2.scala | 2 +- .../scalatest/src/ScalaTestSpec3.scala | 2 +- .../example-test-example-project/build.mill | 32 ++-- 45 files changed, 271 insertions(+), 226 deletions(-) diff --git a/build.mill b/build.mill index 9e86c91791e..22f62b13fe7 100644 --- a/build.mill +++ b/build.mill @@ -34,7 +34,7 @@ object Settings { // the last point version in each minor release series val legacyDocTags: Seq[String] = Seq( "0.9.12", - "0.10.15", + "0.10.15" ) val docTags: Seq[String] = Seq( "0.11.13", @@ -42,7 +42,7 @@ object Settings { ) val mimaBaseVersions: Seq[String] = 0.to(13).map("0.11." + _) ++ - Seq("0.12.0", "0.12.1", "0.12.2", "0.12.3", "0.12.4", "0.12.5") + Seq("0.12.0", "0.12.1", "0.12.2", "0.12.3", "0.12.4", "0.12.5") } object Deps { @@ -166,7 +166,8 @@ object Deps { val scalacScoverage2Plugin = ivy"org.scoverage:::scalac-scoverage-plugin:${scoverage2Version}" val scalacScoverage2Reporter = ivy"org.scoverage::scalac-scoverage-reporter:${scoverage2Version}" val scalacScoverage2Domain = ivy"org.scoverage::scalac-scoverage-domain:${scoverage2Version}" - val scalacScoverage2Serializer = ivy"org.scoverage::scalac-scoverage-serializer:${scoverage2Version}" + val scalacScoverage2Serializer = + ivy"org.scoverage::scalac-scoverage-serializer:${scoverage2Version}" val scalaparse = ivy"com.lihaoyi::scalaparse:${fastparse.version}" val scalatags = ivy"com.lihaoyi::scalatags:0.12.0" def scalaXml = ivy"org.scala-lang.modules::scala-xml:2.3.0" @@ -189,11 +190,16 @@ object Deps { val mavenVersion = "3.9.9" val mavenEmbedder = ivy"org.apache.maven:maven-embedder:$mavenVersion" val mavenResolverVersion = "1.9.22" - val mavenResolverConnectorBasic = ivy"org.apache.maven.resolver:maven-resolver-connector-basic:$mavenResolverVersion" - val mavenResolverSupplier = ivy"org.apache.maven.resolver:maven-resolver-supplier:$mavenResolverVersion" - val mavenResolverTransportFile = ivy"org.apache.maven.resolver:maven-resolver-transport-file:$mavenResolverVersion" - val mavenResolverTransportHttp = ivy"org.apache.maven.resolver:maven-resolver-transport-http:$mavenResolverVersion" - val mavenResolverTransportWagon = ivy"org.apache.maven.resolver:maven-resolver-transport-wagon:$mavenResolverVersion" + val mavenResolverConnectorBasic = + ivy"org.apache.maven.resolver:maven-resolver-connector-basic:$mavenResolverVersion" + val mavenResolverSupplier = + ivy"org.apache.maven.resolver:maven-resolver-supplier:$mavenResolverVersion" + val mavenResolverTransportFile = + ivy"org.apache.maven.resolver:maven-resolver-transport-file:$mavenResolverVersion" + val mavenResolverTransportHttp = + ivy"org.apache.maven.resolver:maven-resolver-transport-http:$mavenResolverVersion" + val mavenResolverTransportWagon = + ivy"org.apache.maven.resolver:maven-resolver-transport-wagon:$mavenResolverVersion" val coursierJvmIndexVersion = "0.0.4-70-51469f" object RuntimeDeps { @@ -201,7 +207,8 @@ object Deps { val koverVersion = "0.8.3" val detektCli = ivy"io.gitlab.arturbosch.detekt:detekt-cli:1.23.7" - val dokkaAnalysisDescriptors = ivy"org.jetbrains.dokka:analysis-kotlin-descriptors:$dokkaVersion" + val dokkaAnalysisDescriptors = + ivy"org.jetbrains.dokka:analysis-kotlin-descriptors:$dokkaVersion" val dokkaBase = ivy"org.jetbrains.dokka:dokka-base:$dokkaVersion" val dokkaCli = ivy"org.jetbrains.dokka:dokka-cli:$dokkaVersion" val errorProneCore = ivy"com.google.errorprone:error_prone_core:2.31.0" @@ -227,7 +234,7 @@ object Deps { koverJvmAgent, ktfmt, ktlint, - sbtTestInterface, + sbtTestInterface ) } @@ -651,14 +658,12 @@ def formatDep(dep: Dep) = { s"${d.module.organization.value}:${d.module.name.value}:${d.version}" } - def listIn(path: os.Path) = interp.watchValue(os.list(path).map(_.last)) object idea extends MillPublishScalaModule { def moduleDeps = Seq(build.scalalib, build.runner) } - private def resolveTasks[T](taskNames: String*): Seq[NamedTask[T]] = { mill.resolve.Resolve.Tasks.resolve( build, diff --git a/ci/shared.mill b/ci/shared.mill index d28af501855..e928eb4f592 100644 --- a/ci/shared.mill +++ b/ci/shared.mill @@ -1,7 +1,5 @@ package build.ci - - def downloadTestRepo(label: String, commit: String, dest: os.Path) = { os.unzip.stream(requests.get.stream(s"https://github.com/$label/archive/$commit.zip"), dest) dest diff --git a/contrib/package.mill b/contrib/package.mill index d11cc3a0132..bc2faf8f12d 100644 --- a/contrib/package.mill +++ b/contrib/package.mill @@ -115,7 +115,7 @@ object `package` extends RootModule { def testArgs = Task { super.testArgs() ++ Seq( - s"-DMILL_SCOVERAGE2_VERSION=${build.Deps.scalacScoverage2Plugin.dep.version}", + s"-DMILL_SCOVERAGE2_VERSION=${build.Deps.scalacScoverage2Plugin.dep.version}" ) } diff --git a/dist/package.mill b/dist/package.mill index 01a8f075e56..5ebfd2ccb2e 100644 --- a/dist/package.mill +++ b/dist/package.mill @@ -175,11 +175,11 @@ object `package` extends RootModule with build.MillPublishJavaModule { } } def launcherScript( - shellJvmArgs: Seq[String], - cmdJvmArgs: Seq[String], - shellClassPath: Agg[String], - cmdClassPath: Agg[String] - ) = { + shellJvmArgs: Seq[String], + cmdJvmArgs: Seq[String], + shellClassPath: Agg[String], + cmdClassPath: Agg[String] + ) = { val millMainClass = "mill.runner.client.MillClientMain" @@ -241,7 +241,9 @@ object `package` extends RootModule with build.MillPublishJavaModule { def installLocalCache() = Task.Command { val path = installLocalTask( - Task.Anon((os.home / ".cache" / "mill" / "download" / (build.millVersion() + batExt)).toString()) + Task.Anon( + (os.home / ".cache" / "mill" / "download" / (build.millVersion() + batExt)).toString() + ) )() Task.log.outputStream.println(path.toString()) PathRef(path) @@ -253,14 +255,21 @@ object `package` extends RootModule with build.MillPublishJavaModule { if (os.exists(targetFile)) Task.log.info(s"Overwriting existing local Mill binary at ${targetFile}") os.copy.over(millBin.path, targetFile, createFolders = true) - Task.log.info(s"Published ${build.dist.allPublishModules.size} modules and installed ${targetFile}") + Task.log.info( + s"Published ${build.dist.allPublishModules.size} modules and installed ${targetFile}" + ) targetFile } def millBootstrap = Task.Source(Task.workspace / "mill") def millBootstrapBat = Task.Source(Task.workspace / "mill.bat") - def prepareBootstrapLauncher(bootstrap: os.Path, dest: os.Path, buildVersion: String, fileName: String) = { + def prepareBootstrapLauncher( + bootstrap: os.Path, + dest: os.Path, + buildVersion: String, + fileName: String + ) = { val outputPath = dest / fileName val millBootstrapGrepPrefix = "(\n *DEFAULT_MILL_VERSION=)" @@ -284,7 +293,7 @@ object `package` extends RootModule with build.MillPublishJavaModule { prepareBootstrapLauncher(millBootstrapBat().path, Task.dest, build.millVersion(), "mill.bat") } - def examplePathsWithArtifactName:Task[Seq[(os.Path,String)]] = Task.Anon{ + def examplePathsWithArtifactName: Task[Seq[(os.Path, String)]] = Task.Anon { for { exampleMod <- build.example.exampleModules path = exampleMod.millSourcePath @@ -295,9 +304,8 @@ object `package` extends RootModule with build.MillPublishJavaModule { } } - def exampleZips: T[Seq[PathRef]] = Task { - examplePathsWithArtifactName().map{ case (examplePath, exampleStr) => + examplePathsWithArtifactName().map { case (examplePath, exampleStr) => os.copy(examplePath, Task.dest / exampleStr, createFolders = true) os.write(Task.dest / exampleStr / ".mill-version", build.millLastTag()) os.copy(bootstrapLauncher().path, Task.dest / exampleStr / "mill") diff --git a/docs/package.mill b/docs/package.mill index 13e706d0ef6..224b4f989e9 100644 --- a/docs/package.mill +++ b/docs/package.mill @@ -41,7 +41,7 @@ object `package` extends RootModule { "@antora/cli@3.1.9", "@antora/site-generator-default@3.1.9", "gitlab:antora/xref-validator", - "@antora/lunr-extension@v1.0.0-alpha.6", + "@antora/lunr-extension@v1.0.0-alpha.6" ), envArgs = Map(), workingDir = npmDir @@ -104,22 +104,22 @@ object `package` extends RootModule { PathRef(T.dest) } - def expandDiagramsInDirectoryAdocFile(dest: os.Path, - visualizeClassPath: Agg[os.Path]) - (implicit ctx: mill.api.Ctx) = { + def expandDiagramsInDirectoryAdocFile(dest: os.Path, visualizeClassPath: Agg[os.Path])(implicit + ctx: mill.api.Ctx + ) = { // Walk all files to render graphviz templates ourselves because the only Antora graphviz // plugin (Kroki) relies on an online web service that is super slow and flaky def walkAllFiles(inputs: Map[(os.Path, Int), String]): Map[(os.Path, Int), String] = { val output = collection.mutable.Map.empty[(os.Path, Int), String] - for (p <- os.walk(dest) if p.ext == "adoc"){ + for (p <- os.walk(dest) if p.ext == "adoc") { val outputLines = collection.mutable.ArrayDeque.empty[String] val graphvizLines = collection.mutable.ArrayDeque.empty[String] var isGraphViz = false var isGraphViz0 = false - for((line, i) <- os.read.lines(p).zipWithIndex){ - line match{ + for ((line, i) <- os.read.lines(p).zipWithIndex) { + line match { case "[graphviz]" => isGraphViz0 = true case "...." if isGraphViz0 => isGraphViz0 = false; isGraphViz = true case "```graphviz" => isGraphViz = true @@ -148,15 +148,19 @@ object `package` extends RootModule { val diagrams = walkAllFiles(Map()) // Batch the rendering so later it can be done in one call to a single subprocess, // minimizing per-subprocess overhead needed to spawn them over and over - val orderedDiagrams = diagrams.toSeq.map{case ((p, i), s) => (p, i, os.temp(s), os.temp.dir())} + val orderedDiagrams = diagrams.toSeq.map { case ((p, i), s) => + (p, i, os.temp(s), os.temp.dir()) + } mill.util.Jvm.runSubprocess( "mill.main.graphviz.GraphvizTools", visualizeClassPath, - mainArgs = orderedDiagrams.map{case (p, i, src, dest) => s"$src;$dest;svg"} + mainArgs = orderedDiagrams.map { case (p, i, src, dest) => s"$src;$dest;svg" } ) - walkAllFiles(orderedDiagrams.map{case (p, i, src, dest) => ((p, i), os.read(dest / "out.svg"))}.toMap) + walkAllFiles(orderedDiagrams.map { case (p, i, src, dest) => + ((p, i), os.read(dest / "out.svg")) + }.toMap) } @@ -201,7 +205,7 @@ object `package` extends RootModule { } def blogFolder0 = Task.Source(build.millSourcePath / "blog") - def blogFolder = Task{ + def blogFolder = Task { os.copy(blogFolder0().path, Task.dest, mergeFolders = true) expandDiagramsInDirectoryAdocFile(Task.dest, mill.main.VisualizeModule.classpath().map(_.path)) PathRef(Task.dest) @@ -224,7 +228,9 @@ object `package` extends RootModule { | sources: | - url: ${if (authorMode) build.baseDir else build.Settings.projectUrl} | branches: [] - | tags: ${build.Settings.legacyDocTags.filter(_ => !authorMode).map("'" + _ + "'").mkString("[", ",", "]")} + | tags: ${build.Settings.legacyDocTags.filter(_ => !authorMode).map( + "'" + _ + "'" + ).mkString("[", ",", "]")} | edit_url: false | start_path: docs/antora | @@ -262,12 +268,12 @@ object `package` extends RootModule { def oldDocSources: T[Seq[PathRef]] = Task { val versionLabels = - build.Settings.docTags.map{v => + build.Settings.docTags.map { v => val xVersion = v.split('.').dropRight(1).mkString(".") + ".x" (v, xVersion, xVersion) } ++ - // Set the latest stable branch as the "master" docs that people default to - Seq((build.Settings.docTags.last, "master", s"latest-${build.Settings.docTags.last}")) + // Set the latest stable branch as the "master" docs that people default to + Seq((build.Settings.docTags.last, "master", s"latest-${build.Settings.docTags.last}")) for ((millLastTag, version, displayVersion) <- versionLabels) yield { val checkout = T.dest / displayVersion @@ -275,7 +281,10 @@ object `package` extends RootModule { os.proc("git", "checkout", millLastTag).call(cwd = checkout, stdout = os.Inherit) val outputFolder = checkout / "out" / "docs" / "source.dest" os.proc("./mill", "-i", "docs.source").call(cwd = checkout, stdout = os.Inherit) - expandDiagramsInDirectoryAdocFile(outputFolder, mill.main.VisualizeModule.classpath().map(_.path)) + expandDiagramsInDirectoryAdocFile( + outputFolder, + mill.main.VisualizeModule.classpath().map(_.path) + ) sanitizeAntoraYml(outputFolder, version, displayVersion, millLastTag) PathRef(outputFolder) @@ -381,53 +390,54 @@ object `package` extends RootModule { } } - def allLinksAndAnchors: T[IndexedSeq[(os.Path, Seq[(String, String)], Seq[(String, String)], Set[String])]] = Task { + def allLinksAndAnchors + : T[IndexedSeq[(os.Path, Seq[(String, String)], Seq[(String, String)], Set[String])]] = Task { val base = fastPages().path val validExtensions = Set("html", "scala") for (path <- os.walk(base) if validExtensions(path.ext)) - yield { - val parsed = Jsoup.parse(os.read(path)) - val (remoteLinks, localLinks) = parsed - .select("a") - .asScala - .map(e => (e.toString, e.attr("href"))) - .toSeq - .filter(!_._2.startsWith("mailto:")) - .partition{case (e, l) => l.startsWith("http://") || l.startsWith("https://")} - ( - path, - remoteLinks, - localLinks.map{case (e, l) => (e, l.stripPrefix("file:"))}, - parsed.select("*").asScala.map(_.attr("id")).filter(_.nonEmpty).toSet, - ) - } + yield { + val parsed = Jsoup.parse(os.read(path)) + val (remoteLinks, localLinks) = parsed + .select("a") + .asScala + .map(e => (e.toString, e.attr("href"))) + .toSeq + .filter(!_._2.startsWith("mailto:")) + .partition { case (e, l) => l.startsWith("http://") || l.startsWith("https://") } + ( + path, + remoteLinks, + localLinks.map { case (e, l) => (e, l.stripPrefix("file:")) }, + parsed.select("*").asScala.map(_.attr("id")).filter(_.nonEmpty).toSet + ) + } } - def brokenRemoteLinks: T[Map[os.Path, Seq[(String, String, Int)]]] = Task{ + def brokenRemoteLinks: T[Map[os.Path, Seq[(String, String, Int)]]] = Task { val allLinks = allLinksAndAnchors() .flatMap { case (path, remoteLinks, localLinks, ids) => remoteLinks } .map(_._2) - .filter{l => + .filter { l => // ignore example links since those are expected to be unresolved until // a stable version is published and artifacts are uploaded to github !l.contains("/example/") && - !l.contains("/releases/download/") && - // Ignore internal repo links in the changelog because there are a lot - // of them, and they're not very interesting to check and verify. - !l.contains("https://github.com/com-lihaoyi/mill/pull/") && - !l.contains("https://github.com/com-lihaoyi/mill/milestone/") && - !l.contains("https://github.com/com-lihaoyi/mill/compare/") && - // Link meant for API configuration, not for clicking - !l.contains("https://s01.oss.sonatype.org/service/local") && - // Somehow this server doesn't respond properly to HEAD requests even though GET works - !l.contains("https://marketplace.visualstudio.com/items") + !l.contains("/releases/download/") && + // Ignore internal repo links in the changelog because there are a lot + // of them, and they're not very interesting to check and verify. + !l.contains("https://github.com/com-lihaoyi/mill/pull/") && + !l.contains("https://github.com/com-lihaoyi/mill/milestone/") && + !l.contains("https://github.com/com-lihaoyi/mill/compare/") && + // Link meant for API configuration, not for clicking + !l.contains("https://s01.oss.sonatype.org/service/local") && + // Somehow this server doesn't respond properly to HEAD requests even though GET works + !l.contains("https://marketplace.visualstudio.com/items") } .toSet // Try to fetch all the links serially. It isn't worth trying to parallelize it // because if we go too fast the remote websites tend to rate limit us anyway val linksToStatusCodes = allLinks.toSeq.zipWithIndex - .map{ case (link, i) => + .map { case (link, i) => val key = s"$i/${allLinks.size}" println(s"Checking link $link $key") val start = System.currentTimeMillis() @@ -440,14 +450,14 @@ object `package` extends RootModule { .toMap allLinksAndAnchors() - .map{case (path, remoteLinks, localLinks, ids) => + .map { case (path, remoteLinks, localLinks, ids) => ( path, - remoteLinks.collect{ + remoteLinks.collect { case (e, l) - if allLinks.contains(l) - && !linksToStatusCodes(l).toString.startsWith("2") => - (e, l, linksToStatusCodes(l)) + if allLinks.contains(l) + && !linksToStatusCodes(l).toString.startsWith("2") => + (e, l, linksToStatusCodes(l)) } ) } @@ -455,10 +465,12 @@ object `package` extends RootModule { .toMap } - - def checkBrokenLinks() = Task.Command{ - if (brokenLocalLinks().nonEmpty){ - throw new Exception("Broken Local Links: " + upickle.default.write(brokenLocalLinks(), indent = 2)) + def checkBrokenLinks() = Task.Command { + if (brokenLocalLinks().nonEmpty) { + throw new Exception("Broken Local Links: " + upickle.default.write( + brokenLocalLinks(), + indent = 2 + )) } // This is flaky due to rate limits so ignore it for now @@ -467,10 +479,10 @@ object `package` extends RootModule { // } } - def brokenLocalLinks: T[Map[os.Path, Seq[(String, String)]]] = Task{ + def brokenLocalLinks: T[Map[os.Path, Seq[(String, String)]]] = Task { val allLinksAndAnchors0 = allLinksAndAnchors() val pathsToIds = allLinksAndAnchors0 - .map{case (path, remoteLinks, localLinks, ids) => (path, ids)} + .map { case (path, remoteLinks, localLinks, ids) => (path, ids) } .toMap val brokenLinksPerPath: Seq[(os.Path, Seq[(String, String)])] = @@ -479,10 +491,10 @@ object `package` extends RootModule { // Skip scaladoc files when scanning for broken links because some // of those are scaladoc bugs outside of our control. if !path.segments.contains("api") - } yield{ + } yield { ( path, - localLinks.flatMap{case (elementString, url) => + localLinks.flatMap { case (elementString, url) => val (baseUrl, anchorOpt) = url match { case s"#$anchor" => (path.toString, Some(anchor)) case s"$prefix#$anchor" => (prefix, Some(anchor)) @@ -492,17 +504,19 @@ object `package` extends RootModule { val dest0 = os.Path(baseUrl, path / "..") val possibleDests = Seq(dest0, dest0 / "index.html") - possibleDests.find(os.exists(_)) match{ + possibleDests.find(os.exists(_)) match { case None => Some((elementString, url)) case Some(dest) => - anchorOpt.collect{case a if !pathsToIds.getOrElse(dest, Set()).contains(a) => (elementString, url)} + anchorOpt.collect { + case a if !pathsToIds.getOrElse(dest, Set()).contains(a) => (elementString, url) + } } } ) } val nonEmptyBrokenLinksPerPath = brokenLinksPerPath - .filter{ case (path, items) => path.last != "404.html" && items.nonEmpty } + .filter { case (path, items) => path.last != "404.html" && items.nonEmpty } nonEmptyBrokenLinksPerPath.toMap } diff --git a/example/package.mill b/example/package.mill index 374a484adce..311e3f4dfa4 100644 --- a/example/package.mill +++ b/example/package.mill @@ -29,32 +29,39 @@ object `package` extends RootModule with Module { object android extends Module { object javalib extends Cross[ExampleCrossModuleJava](build.listIn(millSourcePath / "javalib")) - object kotlinlib extends Cross[ExampleCrossModuleJava](build.listIn(millSourcePath / "kotlinlib")) + object kotlinlib + extends Cross[ExampleCrossModuleJava](build.listIn(millSourcePath / "kotlinlib")) } object javalib extends Module { object basic extends Cross[ExampleCrossModuleJava](build.listIn(millSourcePath / "basic")) object module extends Cross[ExampleCrossModuleJava](build.listIn(millSourcePath / "module")) - object dependencies extends Cross[ExampleCrossModuleJava](build.listIn(millSourcePath / "dependencies")) + object dependencies + extends Cross[ExampleCrossModuleJava](build.listIn(millSourcePath / "dependencies")) object testing extends Cross[ExampleCrossModuleJava](build.listIn(millSourcePath / "testing")) object linting extends Cross[ExampleCrossModuleJava](build.listIn(millSourcePath / "linting")) - object migrating extends Cross[ExampleCrossModuleJava](build.listIn(millSourcePath / "migrating")) - object publishing extends Cross[ExampleCrossModuleJava](build.listIn(millSourcePath / "publishing")) + object migrating + extends Cross[ExampleCrossModuleJava](build.listIn(millSourcePath / "migrating")) + object publishing + extends Cross[ExampleCrossModuleJava](build.listIn(millSourcePath / "publishing")) object web extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "web")) } object kotlinlib extends Module { object basic extends Cross[ExampleCrossModuleKotlin](build.listIn(millSourcePath / "basic")) object module extends Cross[ExampleCrossModuleKotlin](build.listIn(millSourcePath / "module")) - object dependencies extends Cross[ExampleCrossModuleKotlin](build.listIn(millSourcePath / "dependencies")) + object dependencies + extends Cross[ExampleCrossModuleKotlin](build.listIn(millSourcePath / "dependencies")) object testing extends Cross[ExampleCrossModuleKotlin](build.listIn(millSourcePath / "testing")) object linting extends Cross[ExampleCrossModuleKotlin](build.listIn(millSourcePath / "linting")) - object publishing extends Cross[ExampleCrossModuleKotlin](build.listIn(millSourcePath / "publishing")) + object publishing + extends Cross[ExampleCrossModuleKotlin](build.listIn(millSourcePath / "publishing")) object web extends Cross[ExampleCrossModuleKotlin](build.listIn(millSourcePath / "web")) } object scalalib extends Module { object basic extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "basic")) object module extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "module")) - object dependencies extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "dependencies")) + object dependencies + extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "dependencies")) object testing extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "testing")) object linting extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "linting")) object publishing extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "publishing")) @@ -65,29 +72,33 @@ object `package` extends RootModule with Module { object basic extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "basic")) object testing extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "testing")) object module extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "module")) - object dependencies extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "dependencies")) + object dependencies + extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "dependencies")) } object pythonlib extends Module { object basic extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "basic")) - object dependencies extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "dependencies")) + object dependencies + extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "dependencies")) object publishing extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "publishing")) object module extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "module")) object web extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "web")) } - object cli extends Module{ + object cli extends Module { object builtins extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "builtins")) } object fundamentals extends Module { - object dependencies extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "dependencies")) + object dependencies + extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "dependencies")) object tasks extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "tasks")) object modules extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "modules")) object cross extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "cross")) object `out-dir` extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "out-dir")) object libraries extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "libraries")) - object `library-deps` extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "library-deps")) + object `library-deps` + extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "library-deps")) } object depth extends Module { @@ -114,8 +125,11 @@ object `package` extends RootModule with Module { override def lineTransform(line: String) = this.millModuleSegments.parts.last match { case "1-test-suite" => line - .replace("mill bar.test bar.BarTests.hello", "kotest_filter_tests='hello' kotest_filter_specs='bar.BarTests' ./mill bar.test") - .replace("compiling 1 ... source...", "Compiling 1 ... source...") + .replace( + "mill bar.test bar.BarTests.hello", + "kotest_filter_tests='hello' kotest_filter_specs='bar.BarTests' ./mill bar.test" + ) + .replace("compiling 1 ... source...", "Compiling 1 ... source...") case _ => line } } @@ -136,7 +150,7 @@ object `package` extends RootModule with Module { def testRepoRoot = Task { os.copy(super.testRepoRoot().path, T.dest, mergeFolders = true) - for(suffix <- Seq("build.sc", "build.mill", "build.mill.scala")){ + for (suffix <- Seq("build.sc", "build.mill", "build.mill.scala")) { for (lines <- buildScLines() if os.exists(T.dest / suffix)) { os.write.over(T.dest / suffix, lines.mkString("\n")) } @@ -145,51 +159,51 @@ object `package` extends RootModule with Module { } def resources = upstreamOpt match { - case None => T{ Seq(super.testRepoRoot()) } - case Some(upstream) => T{ - os.copy.over(super.testRepoRoot().path, T.dest) - val upstreamRoot = upstream.testRepoRoot().path - val suffix = Seq("build.sc", "build.mill").find(s => os.exists(upstreamRoot / s)).head - for(lines <- buildScLines()) { - os.write.over(T.dest / suffix, lines.mkString("\n")) + case None => T { Seq(super.testRepoRoot()) } + case Some(upstream) => T { + os.copy.over(super.testRepoRoot().path, T.dest) + val upstreamRoot = upstream.testRepoRoot().path + val suffix = Seq("build.sc", "build.mill").find(s => os.exists(upstreamRoot / s)).head + for (lines <- buildScLines()) { + os.write.over(T.dest / suffix, lines.mkString("\n")) + } + Seq(PathRef(T.dest)) } - Seq(PathRef(T.dest)) - } } def buildScLines = upstreamOpt match { case None => T { None } case Some(upstream) => T { - Some { - val upstreamRoot = upstream.testRepoRoot().path - val suffix = Seq("build.sc", "build.mill").find(s => os.exists(upstreamRoot / s)).head - val upstreamLines = os.read.lines(upstream.testRepoRoot().path / suffix) - val lines = os.read.lines(super.testRepoRoot().path / suffix) - - import collection.mutable - val groupedLines = mutable.Map.empty[String, mutable.Buffer[String]] - var current = Option.empty[String] - lines.foreach { - case s"//// SNIPPET:$name" => - current = Some(name) - groupedLines(name) = mutable.Buffer() - case s => current.foreach(groupedLines(_).append(lineTransform(s))) - } + Some { + val upstreamRoot = upstream.testRepoRoot().path + val suffix = Seq("build.sc", "build.mill").find(s => os.exists(upstreamRoot / s)).head + val upstreamLines = os.read.lines(upstream.testRepoRoot().path / suffix) + val lines = os.read.lines(super.testRepoRoot().path / suffix) - current = None - upstreamLines.flatMap { - case s"//// SNIPPET:$name" => - if (name != "END") { + import collection.mutable + val groupedLines = mutable.Map.empty[String, mutable.Buffer[String]] + var current = Option.empty[String] + lines.foreach { + case s"//// SNIPPET:$name" => current = Some(name) - groupedLines(name) - } else { - current = None - Nil - } + groupedLines(name) = mutable.Buffer() + case s => current.foreach(groupedLines(_).append(lineTransform(s))) + } - case s => if (current.nonEmpty) None else Some(lineTransform(s)) + current = None + upstreamLines.flatMap { + case s"//// SNIPPET:$name" => + if (name != "END") { + current = Some(name) + groupedLines(name) + } else { + current = None + Nil + } + + case s => if (current.nonEmpty) None else Some(lineTransform(s)) + } } } - } } def lineTransform(line: String) = line @@ -201,7 +215,7 @@ object `package` extends RootModule with Module { def testRepoRoot: T[PathRef] = Task.Source(millSourcePath) def sources0 = Task.Sources(millSourcePath) - def sources = Task{ + def sources = Task { sources0() .flatMap(pathRef => os.walk(pathRef.path)) .filter(os.isFile) @@ -290,7 +304,7 @@ object `package` extends RootModule with Module { val (repoPath, repoHash) = repoInfo(crossValue) def repoSlug = repoPath.split("/").last - def downloadedRepo = Task{ + def downloadedRepo = Task { shared.downloadTestRepo(repoPath, repoHash, T.dest) val wrapperFolder = T.dest / s"$repoSlug-$repoHash" PathRef(wrapperFolder) diff --git a/example/thirdparty/netty/build.mill b/example/thirdparty/netty/build.mill index ce206b2b300..a2d3f1ed5a8 100644 --- a/example/thirdparty/netty/build.mill +++ b/example/thirdparty/netty/build.mill @@ -539,8 +539,7 @@ object `transport-native-epoll` extends NettyJniModule { ) // Stub this out on OS-X - def clang = if (!isOSX) T { super.clang() } - else T { PathRef(os.temp()) } + def clang = if (!isOSX) T { super.clang() } else T { PathRef(os.temp()) } } object `transport-native-kqueue` extends NettyJniModule { @@ -550,8 +549,7 @@ object `transport-native-kqueue` extends NettyJniModule { 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()) } + def clang = if (isOSX) T { super.clang() } else T { PathRef(os.temp()) } } object `transport-native-unix-common` extends NettyModule { diff --git a/integration/failure/non-exclusive-depends-on-exclusive/resources/build.mill b/integration/failure/non-exclusive-depends-on-exclusive/resources/build.mill index a1407147214..550de60d2c6 100644 --- a/integration/failure/non-exclusive-depends-on-exclusive/resources/build.mill +++ b/integration/failure/non-exclusive-depends-on-exclusive/resources/build.mill @@ -1,7 +1,7 @@ package build import mill._, mill.eval.Evaluator -def foo = Task{1} +def foo = Task { 1 } def cleanClientWrong(ev: Evaluator) = Task.Command { clean(ev, "foo")() println("cleanClientWrong done") @@ -10,4 +10,4 @@ def cleanClientWrong(ev: Evaluator) = Task.Command { def cleanClientRight(ev: Evaluator) = Task.Command(exclusive = true) { clean(ev, "foo")() println("cleanClientRight done") -} \ No newline at end of file +} diff --git a/integration/feature/docannotations/resources/build.mill b/integration/feature/docannotations/resources/build.mill index 97866f85e03..5bd2dad5b37 100644 --- a/integration/feature/docannotations/resources/build.mill +++ b/integration/feature/docannotations/resources/build.mill @@ -30,6 +30,7 @@ object basic extends Module with foo */ object core extends JavaModule { object test extends JavaTests with JUnitTests { + /** * -> The worker <- */ diff --git a/integration/feature/docannotations/resources/core3/package.mill b/integration/feature/docannotations/resources/core3/package.mill index 2f394df617a..f1c17b7411d 100644 --- a/integration/feature/docannotations/resources/core3/package.mill +++ b/integration/feature/docannotations/resources/core3/package.mill @@ -2,4 +2,4 @@ package build.core3 import mill.javalib.JavaModule -object `package` extends RootModule with JavaModule \ No newline at end of file +object `package` extends RootModule with JavaModule diff --git a/integration/feature/keyword-module/resources/for/package.mill b/integration/feature/keyword-module/resources/for/package.mill index 51faec20096..588c4a1f5a5 100644 --- a/integration/feature/keyword-module/resources/for/package.mill +++ b/integration/feature/keyword-module/resources/for/package.mill @@ -4,4 +4,3 @@ import mill._, scalalib._ object `package` extends RootModule { def task = Task { true } } - diff --git a/integration/feature/keyword-module/resources/if/package.mill b/integration/feature/keyword-module/resources/if/package.mill index 31f06345050..9afa9282e0f 100644 --- a/integration/feature/keyword-module/resources/if/package.mill +++ b/integration/feature/keyword-module/resources/if/package.mill @@ -4,4 +4,3 @@ import mill._, scalalib._ object `package` extends RootModule { def task = Task { true } } - diff --git a/integration/feature/keyword-module/resources/import/package.mill b/integration/feature/keyword-module/resources/import/package.mill index 69a5731a2d4..8907871e493 100644 --- a/integration/feature/keyword-module/resources/import/package.mill +++ b/integration/feature/keyword-module/resources/import/package.mill @@ -4,4 +4,3 @@ import mill._, scalalib._ object `package` extends RootModule { def task = Task { true } } - diff --git a/integration/feature/keyword-module/resources/null/package.mill b/integration/feature/keyword-module/resources/null/package.mill index 63a7e681c41..c07cbc78af9 100644 --- a/integration/feature/keyword-module/resources/null/package.mill +++ b/integration/feature/keyword-module/resources/null/package.mill @@ -4,4 +4,3 @@ import mill._, scalalib._ object `package` extends RootModule { def task = Task { true } } - diff --git a/integration/feature/keyword-module/resources/this/package.mill b/integration/feature/keyword-module/resources/this/package.mill index 9c4aa8cdc17..d2d0d04c142 100644 --- a/integration/feature/keyword-module/resources/this/package.mill +++ b/integration/feature/keyword-module/resources/this/package.mill @@ -4,4 +4,3 @@ import mill._, scalalib._ object `package` extends RootModule { def task = Task { true } } - diff --git a/integration/feature/launcher-old-versions/resources/build.sc b/integration/feature/launcher-old-versions/resources/build.sc index e69de29bb2d..8b137891791 100644 --- a/integration/feature/launcher-old-versions/resources/build.sc +++ b/integration/feature/launcher-old-versions/resources/build.sc @@ -0,0 +1 @@ + diff --git a/integration/feature/meta-skip-compile/resources/build.mill b/integration/feature/meta-skip-compile/resources/build.mill index 2cd1f46b14f..cedecf1e2f4 100644 --- a/integration/feature/meta-skip-compile/resources/build.mill +++ b/integration/feature/meta-skip-compile/resources/build.mill @@ -1 +1 @@ -CoMpIlAtIoNeRrOr \ No newline at end of file +CoMpIlAtIoNeRrOr diff --git a/integration/feature/run-background/resources/build.mill b/integration/feature/run-background/resources/build.mill index abbcc384415..9b0c4687e10 100644 --- a/integration/feature/run-background/resources/build.mill +++ b/integration/feature/run-background/resources/build.mill @@ -1,13 +1,14 @@ import mill._, javalib._ import mainargs.arg -object `package` extends RootModule with JavaModule{ - def runMainBackground(@arg(positional = true) mainClass: String, args: String*): Command[Unit] = Task.Command { - val res = super.runMainBackground(mainClass, args:_*)() - // Manually force an exit after runBackground has had a chance to run for a bit - new Thread(() => { - Thread.sleep(2000) - System.exit(0) - }).start() - res - } -} \ No newline at end of file +object `package` extends RootModule with JavaModule { + def runMainBackground(@arg(positional = true) mainClass: String, args: String*): Command[Unit] = + Task.Command { + val res = super.runMainBackground(mainClass, args: _*)() + // Manually force an exit after runBackground has had a chance to run for a bit + new Thread(() => { + Thread.sleep(2000) + System.exit(0) + }).start() + res + } +} diff --git a/integration/invalidation/codesig-nested/resources/build.mill b/integration/invalidation/codesig-nested/resources/build.mill index 7823d6fa9b4..d7c48c63f29 100644 --- a/integration/invalidation/codesig-nested/resources/build.mill +++ b/integration/invalidation/codesig-nested/resources/build.mill @@ -40,4 +40,3 @@ object crossOuter extends Cross[CrossOuter](1337, 31337, 31415926) trait CrossOuter extends TraitOuter with Cross.Module[Int] { override val valueTraitOuter = crossValue } - diff --git a/integration/invalidation/codesig-subfolder/resources/build.mill b/integration/invalidation/codesig-subfolder/resources/build.mill index 2ab019b2e1d..f673f2020b6 100644 --- a/integration/invalidation/codesig-subfolder/resources/build.mill +++ b/integration/invalidation/codesig-subfolder/resources/build.mill @@ -2,5 +2,4 @@ package build import $packages._ import mill._ - def foo = Task { println("running foo"); build.subfolder.helperFoo } diff --git a/integration/invalidation/codesig-subfolder/resources/subfolder/package.mill b/integration/invalidation/codesig-subfolder/resources/subfolder/package.mill index 55a380bd330..905eb5f86b0 100644 --- a/integration/invalidation/codesig-subfolder/resources/subfolder/package.mill +++ b/integration/invalidation/codesig-subfolder/resources/subfolder/package.mill @@ -4,4 +4,4 @@ import mill._ val valueFoo = 0 val valueFooUsedInBar = 0 def helperFoo = { println("running helperFoo"); 1 + valueFoo } -def subFolderTask = Task { println("running subFolderTask") } \ No newline at end of file +def subFolderTask = Task { println("running subFolderTask") } diff --git a/integration/invalidation/codesig-subfolder/resources/subfolder2/package.mill b/integration/invalidation/codesig-subfolder/resources/subfolder2/package.mill index 8521f1871c7..1ddddb6be78 100644 --- a/integration/invalidation/codesig-subfolder/resources/subfolder2/package.mill +++ b/integration/invalidation/codesig-subfolder/resources/subfolder2/package.mill @@ -1,5 +1,4 @@ package build.subfolder2 import mill._ - -def subFolder2Task = Task { println("running subFolder2Task") } \ No newline at end of file +def subFolder2Task = Task { println("running subFolder2Task") } diff --git a/integration/invalidation/codesig-subfolder/resources/subfolder3/package.mill b/integration/invalidation/codesig-subfolder/resources/subfolder3/package.mill index c5e31f704f1..e891518772f 100644 --- a/integration/invalidation/codesig-subfolder/resources/subfolder3/package.mill +++ b/integration/invalidation/codesig-subfolder/resources/subfolder3/package.mill @@ -1,4 +1,4 @@ package build.subfolder3 import mill._ -def subFolder2Task = Task { println("running subFolder3Task") } \ No newline at end of file +def subFolder2Task = Task { println("running subFolder3Task") } diff --git a/integration/invalidation/codesig-subfolder/resources/subfolder4/package.mill b/integration/invalidation/codesig-subfolder/resources/subfolder4/package.mill index 124bcd63265..b1ed0aa5d3e 100644 --- a/integration/invalidation/codesig-subfolder/resources/subfolder4/package.mill +++ b/integration/invalidation/codesig-subfolder/resources/subfolder4/package.mill @@ -1,4 +1,4 @@ package build.subfolder4 import mill._ -def subFolder2Task = Task { println("running subFolder4Task") } \ No newline at end of file +def subFolder2Task = Task { println("running subFolder4Task") } diff --git a/integration/invalidation/codesig-subfolder/resources/subfolder5/package.mill b/integration/invalidation/codesig-subfolder/resources/subfolder5/package.mill index dcb1d856286..326969bcdcf 100644 --- a/integration/invalidation/codesig-subfolder/resources/subfolder5/package.mill +++ b/integration/invalidation/codesig-subfolder/resources/subfolder5/package.mill @@ -1,4 +1,4 @@ package build.subfolder5 import mill._ -def subFolder2Task = Task { println("running subFolder3Task") } \ No newline at end of file +def subFolder2Task = Task { println("running subFolder3Task") } diff --git a/integration/invalidation/codesig-subfolder/resources/subfolder6/package.mill b/integration/invalidation/codesig-subfolder/resources/subfolder6/package.mill index 0386a7a0c75..c7d9db43bb3 100644 --- a/integration/invalidation/codesig-subfolder/resources/subfolder6/package.mill +++ b/integration/invalidation/codesig-subfolder/resources/subfolder6/package.mill @@ -1,4 +1,4 @@ package build.subfolder6 import mill._ -def subFolder2Task = Task { println("running subFolder3Task") } \ No newline at end of file +def subFolder2Task = Task { println("running subFolder3Task") } diff --git a/integration/invalidation/codesig-subfolder/resources/subfolder7/package.mill b/integration/invalidation/codesig-subfolder/resources/subfolder7/package.mill index 4fb82ea0b50..b404f0b489f 100644 --- a/integration/invalidation/codesig-subfolder/resources/subfolder7/package.mill +++ b/integration/invalidation/codesig-subfolder/resources/subfolder7/package.mill @@ -1,4 +1,4 @@ package build.subfolder7 import mill._ -def subFolder2Task = Task { println("running subFolder3Task") } \ No newline at end of file +def subFolder2Task = Task { println("running subFolder3Task") } diff --git a/integration/invalidation/codesig-subfolder/resources/subfolder8/package.mill b/integration/invalidation/codesig-subfolder/resources/subfolder8/package.mill index 5d4c1195a86..1cfefc2e02f 100644 --- a/integration/invalidation/codesig-subfolder/resources/subfolder8/package.mill +++ b/integration/invalidation/codesig-subfolder/resources/subfolder8/package.mill @@ -1,4 +1,4 @@ package build.subfolder8 import mill._ -def subFolder2Task = Task { println("running subFolder3Task") } \ No newline at end of file +def subFolder2Task = Task { println("running subFolder3Task") } diff --git a/integration/invalidation/codesig-subfolder/resources/subfolder9/package.mill b/integration/invalidation/codesig-subfolder/resources/subfolder9/package.mill index 6310173673b..0d2e4fffa0b 100644 --- a/integration/invalidation/codesig-subfolder/resources/subfolder9/package.mill +++ b/integration/invalidation/codesig-subfolder/resources/subfolder9/package.mill @@ -1,4 +1,4 @@ package build.subfolder9 import mill._ -def subFolder2Task = Task { println("running subFolder3Task") } \ No newline at end of file +def subFolder2Task = Task { println("running subFolder3Task") } diff --git a/integration/invalidation/selective-execution/resources/build.mill b/integration/invalidation/selective-execution/resources/build.mill index 4b0bf9d6068..38b6a9da807 100644 --- a/integration/invalidation/selective-execution/resources/build.mill +++ b/integration/invalidation/selective-execution/resources/build.mill @@ -27,4 +27,4 @@ object bar extends mill.define.TaskModule { } def defaultCommandName(): String = "barCommand" -} \ No newline at end of file +} diff --git a/integration/invalidation/zinc-build-compilation/resources/build.mill b/integration/invalidation/zinc-build-compilation/resources/build.mill index 558e897dce2..14bc4fc9366 100644 --- a/integration/invalidation/zinc-build-compilation/resources/build.mill +++ b/integration/invalidation/zinc-build-compilation/resources/build.mill @@ -2,7 +2,6 @@ package build import $packages._ import mill._ - def foo = { println("running foo"); build_.subfolder.package_.helperFoo } -def dummy = Task{ 1 } \ No newline at end of file +def dummy = Task { 1 } diff --git a/integration/invalidation/zinc-build-compilation/resources/subfolder/package.mill b/integration/invalidation/zinc-build-compilation/resources/subfolder/package.mill index 9ebda207da7..6cded6b3d63 100644 --- a/integration/invalidation/zinc-build-compilation/resources/subfolder/package.mill +++ b/integration/invalidation/zinc-build-compilation/resources/subfolder/package.mill @@ -3,4 +3,4 @@ import mill._ val valueFoo = 0 val valueFooUsedInBar = 0 -def helperFoo = { println("running helperFoo"); 1 + valueFoo } \ No newline at end of file +def helperFoo = { println("running helperFoo"); 1 + valueFoo } diff --git a/integration/package.mill b/integration/package.mill index 4268947e764..5a5318e163f 100644 --- a/integration/package.mill +++ b/integration/package.mill @@ -47,11 +47,10 @@ object `package` extends RootModule { Map( "MILL_INTEGRATION_SERVER_MODE" -> (mode == "local" || mode == "server").toString, "MILL_LAUNCHER" -> build.dist.bootstrapLauncher().path.toString, - "MILL_LAUNCHER_BAT" -> build.dist.bootstrapLauncherBat().path.toString, + "MILL_LAUNCHER_BAT" -> build.dist.bootstrapLauncherBat().path.toString ) ++ testReleaseEnv() - def forkArgs = Task { super.forkArgs() ++ build.dist.forkArgs() } def testReleaseEnv = diff --git a/javascriptlib/package.mill b/javascriptlib/package.mill index 41d40772b00..57d9413238b 100644 --- a/javascriptlib/package.mill +++ b/javascriptlib/package.mill @@ -7,4 +7,4 @@ import mill._ // because currently there is no previous artifact version object `package` extends RootModule with build.MillPublishScalaModule { def moduleDeps = Seq(build.main) -} \ No newline at end of file +} diff --git a/kotlinlib/package.mill b/kotlinlib/package.mill index 2913cb65eb2..a8e92814999 100644 --- a/kotlinlib/package.mill +++ b/kotlinlib/package.mill @@ -22,10 +22,22 @@ object `package` extends RootModule with build.MillPublishScalaModule with Build BuildInfo.Value("koverVersion", build.Deps.RuntimeDeps.koverVersion, "Version of Kover."), BuildInfo.Value("ktfmtVersion", build.Deps.RuntimeDeps.ktfmt.version, "Version of Ktfmt."), BuildInfo.Value("ktlintVersion", build.Deps.RuntimeDeps.ktlint.version, "Version of ktlint."), - BuildInfo.Value("detektVersion", build.Deps.RuntimeDeps.detektCli.version, "Version of Detekt."), + BuildInfo.Value( + "detektVersion", + build.Deps.RuntimeDeps.detektCli.version, + "Version of Detekt." + ), BuildInfo.Value("dokkaVersion", build.Deps.RuntimeDeps.dokkaVersion, "Version of Dokka."), - BuildInfo.Value("kotlinxHtmlJvmDep", Dep.unparse(build.Deps.RuntimeDeps.kotlinxHtmlJvm).get, "kotlinx-html-jvm dependency (used for Dokka)"), - BuildInfo.Value("freemarkerDep", Dep.unparse(build.Deps.RuntimeDeps.freemarker).get, "freemarker dependency (used for Dokka)") + BuildInfo.Value( + "kotlinxHtmlJvmDep", + Dep.unparse(build.Deps.RuntimeDeps.kotlinxHtmlJvm).get, + "kotlinx-html-jvm dependency (used for Dokka)" + ), + BuildInfo.Value( + "freemarkerDep", + Dep.unparse(build.Deps.RuntimeDeps.freemarker).get, + "freemarker dependency (used for Dokka)" + ) ) trait MillKotlinModule extends build.MillPublishScalaModule { diff --git a/main/init/package.mill b/main/init/package.mill index b23012dd01a..247672bc237 100644 --- a/main/init/package.mill +++ b/main/init/package.mill @@ -26,13 +26,16 @@ object `package` extends RootModule with build.MillPublishScalaModule { case None => "0.0.0" } - val data: Seq[(os.SubPath, String)] = build.dist.examplePathsWithArtifactName().map { case (path, str) => - val downloadUrl = build.Settings.projectUrl + "/releases/download/" + lastTag + "/" + str + ".zip" - val subPath = path.subRelativeTo(T.workspace / "example") - (subPath, downloadUrl) - } + val data: Seq[(os.SubPath, String)] = + build.dist.examplePathsWithArtifactName().map { case (path, str) => + val downloadUrl = + build.Settings.projectUrl + "/releases/download/" + lastTag + "/" + str + ".zip" + val subPath = path.subRelativeTo(T.workspace / "example") + (subPath, downloadUrl) + } - val libsSortOrder = List("scalalib", "javalib", "kotlinlib", "extending", "external", "thirdparty", "depth") + val libsSortOrder = + List("scalalib", "javalib", "kotlinlib", "extending", "external", "thirdparty", "depth") val categoriesSortOrder = List("basic", "builds", "web") def sortCriterium(strOpt: Option[String], sortOrderList: List[String]): Int = @@ -49,14 +52,16 @@ object `package` extends RootModule with build.MillPublishScalaModule { val libSortCriterium = sortCriterium(libOpt, libsSortOrder) val categorySortCriterium = sortCriterium(categoryOpt, categoriesSortOrder) - val nameSortCriterium = nameOpt.flatMap(_.takeWhile(_.isDigit).toIntOption).getOrElse(Int.MinValue) + val nameSortCriterium = + nameOpt.flatMap(_.takeWhile(_.isDigit).toIntOption).getOrElse(Int.MinValue) (libSortCriterium, libOpt, categorySortCriterium, categoryOpt, nameSortCriterium, nameOpt) } val stream = os.write.outputStream(T.dest / "exampleList.txt") val writer = new java.io.OutputStreamWriter(stream) try { - val json = upickle.default.writeTo(sortedData.map { case (p, s) => (p.toString(), s) }, writer) + val json = + upickle.default.writeTo(sortedData.map { case (p, s) => (p.toString(), s) }, writer) PathRef(T.dest) } catch { case ex: Throwable => T.log.error(ex.toString); throw ex diff --git a/main/package.mill b/main/package.mill index a55ee3d5882..10e9051b14a 100644 --- a/main/package.mill +++ b/main/package.mill @@ -21,7 +21,8 @@ object `package` extends RootModule with build.MillStableScalaModule with BuildI ) def compileIvyDeps = T { - if (ZincWorkerUtil.isScala3(scalaVersion())) Agg.empty else Agg(build.Deps.scalaReflect(scalaVersion())) + if (ZincWorkerUtil.isScala3(scalaVersion())) Agg.empty + else Agg(build.Deps.scalaReflect(scalaVersion())) } def buildInfoPackageName = "mill.main" @@ -59,8 +60,8 @@ object `package` extends RootModule with build.MillStableScalaModule with BuildI Some(T.ctx()), build.dist.coursierCacheCustomizer() )._2.minDependencies.toSeq - // change to this when bumping Mill - // ).getOrThrow.minDependencies.toSeq + // change to this when bumping Mill + // ).getOrThrow.minDependencies.toSeq .map(d => s"${d.module.organization.value}:${d.module.name.value}:${d.version}") ) // T.traverse(dev.moduleDeps)(_.publishSelfDependency)() diff --git a/pythonlib/package.mill b/pythonlib/package.mill index 8e9f58da976..435806645af 100644 --- a/pythonlib/package.mill +++ b/pythonlib/package.mill @@ -9,5 +9,6 @@ object `package` extends RootModule with build.MillPublishScalaModule { // we depend on scalalib for re-using some common infrastructure (e.g. License // management of projects), NOT for reusing build logic def moduleDeps = Seq(build.main, build.scalalib) - def testTransitiveDeps = super.testTransitiveDeps() ++ Seq(build.scalalib.backgroundwrapper.testDep()) + def testTransitiveDeps = + super.testTransitiveDeps() ++ Seq(build.scalalib.backgroundwrapper.testDep()) } diff --git a/scalalib/test/resources/scalafmt/core/src/Main.scala b/scalalib/test/resources/scalafmt/core/src/Main.scala index 02613d3a7d3..2973f24180d 100644 --- a/scalalib/test/resources/scalafmt/core/src/Main.scala +++ b/scalalib/test/resources/scalafmt/core/src/Main.scala @@ -1,8 +1,5 @@ - -object Main extends App{ +object Main extends App { val person = Person.fromString("rockjam:25") val greeting = s"hello ${person.name}, your age is: ${person.age}" println(greeting) } - - diff --git a/scalalib/test/resources/scalafmt/core/src/Person.scala b/scalalib/test/resources/scalafmt/core/src/Person.scala index b296cf85fca..03f0a851f71 100644 --- a/scalalib/test/resources/scalafmt/core/src/Person.scala +++ b/scalalib/test/resources/scalafmt/core/src/Person.scala @@ -3,10 +3,9 @@ object Person { val Array(name, age) = s.split(":") Person( name, - age.toInt) + age.toInt + ) } } - - case class Person(name: String, age: Int) diff --git a/scalalib/test/resources/scalafmt/core/util.sc b/scalalib/test/resources/scalafmt/core/util.sc index 84d974270b4..1fae1896643 100644 --- a/scalalib/test/resources/scalafmt/core/util.sc +++ b/scalalib/test/resources/scalafmt/core/util.sc @@ -1,2 +1,2 @@ - def sayHelloWorld() = -println("Hello World") +def sayHelloWorld() = + println("Hello World") diff --git a/scalalib/test/resources/testrunner/scalatest/src/ScalaTestSpec.scala b/scalalib/test/resources/testrunner/scalatest/src/ScalaTestSpec.scala index 832b3aa8f87..3b2eba3c771 100644 --- a/scalalib/test/resources/testrunner/scalatest/src/ScalaTestSpec.scala +++ b/scalalib/test/resources/testrunner/scalatest/src/ScalaTestSpec.scala @@ -19,7 +19,7 @@ class ScalaTestSpec extends AnyFreeSpec { } } - "should be tagged" taggedAs(TaggedTest) in { + "should be tagged" taggedAs (TaggedTest) in { assert(true) } } diff --git a/scalalib/test/resources/testrunner/scalatest/src/ScalaTestSpec2.scala b/scalalib/test/resources/testrunner/scalatest/src/ScalaTestSpec2.scala index a43a0a0ab67..ca0556b4ab8 100644 --- a/scalalib/test/resources/testrunner/scalatest/src/ScalaTestSpec2.scala +++ b/scalalib/test/resources/testrunner/scalatest/src/ScalaTestSpec2.scala @@ -17,7 +17,7 @@ class ScalaTestSpec2 extends AnyFreeSpec { } } - "should be tagged" taggedAs(TaggedTest) in { + "should be tagged" taggedAs (TaggedTest) in { assert(true) } } diff --git a/scalalib/test/resources/testrunner/scalatest/src/ScalaTestSpec3.scala b/scalalib/test/resources/testrunner/scalatest/src/ScalaTestSpec3.scala index 7c34ea5c81b..ef261307a49 100644 --- a/scalalib/test/resources/testrunner/scalatest/src/ScalaTestSpec3.scala +++ b/scalalib/test/resources/testrunner/scalatest/src/ScalaTestSpec3.scala @@ -17,7 +17,7 @@ class ScalaTestSpec3 extends AnyFreeSpec { } } - "should be tagged" taggedAs(TaggedTest) in { + "should be tagged" taggedAs (TaggedTest) in { assert(true) } } diff --git a/testkit/test/resources/example-test-example-project/build.mill b/testkit/test/resources/example-test-example-project/build.mill index 4a30be3ff78..7e76aabac84 100644 --- a/testkit/test/resources/example-test-example-project/build.mill +++ b/testkit/test/resources/example-test-example-project/build.mill @@ -4,19 +4,19 @@ import mill._ def testSource = Task.Source(millSourcePath / "source-file.txt") def testTask = Task { os.read(testSource().path).toUpperCase() } -/** Usage - -> ./mill testTask -...compiling 1 Scala source... - -> cat out/testTask.json -..."HELLO WORLD SOURCE FILE"... - -> sed -i.bak 's/file/file!!!/g' source-file.txt - -> ./mill testTask - -> cat out/testTask.json -..."HELLO WORLD SOURCE FILE!!!"... - -*/ \ No newline at end of file +/** + * Usage + * + * > ./mill testTask + * ...compiling 1 Scala source... + * + * > cat out/testTask.json + * ..."HELLO WORLD SOURCE FILE"... + * + * > sed -i.bak 's/file/file!!!/g' source-file.txt + * + * > ./mill testTask + * + * > cat out/testTask.json + * ..."HELLO WORLD SOURCE FILE!!!"... + */ From 000b2c0e820c2dd8f3518a57e02f0c0562854565 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 2 Jan 2025 15:06:54 +0000 Subject: [PATCH 3/3] Add 'Reformat with scalafmt 3.8.4-RC4' to .git-blame-ignore-revs --- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 970ab0049f8..7369c3e036b 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -53,3 +53,6 @@ ceef92f5d6f3d4066564d41b5165351df7cb5fbb # Format more code 39e36746ce8b5a254e0c276bc3cdbff9842d1224 + +# Scala Steward: Reformat with scalafmt 3.8.4-RC4 +8fdf54e06c520e74d6a913d8486512b47807a1cf