Skip to content

Commit

Permalink
Format code (#3526)
Browse files Browse the repository at this point in the history
Settings, see #3511

Pull request: #3526
  • Loading branch information
alexarchambault authored Sep 13, 2024
1 parent b5e5563 commit 39e3674
Show file tree
Hide file tree
Showing 45 changed files with 126 additions and 104 deletions.
8 changes: 6 additions & 2 deletions bsp/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import mill._
import mill.contrib.buildinfo.BuildInfo
import mill.T


object `package` extends RootModule with build.MillPublishScalaModule with BuildInfo {
def compileModuleDeps = Seq(build.scalalib)
def testModuleDeps = super.testModuleDeps ++ compileModuleDeps
Expand Down Expand Up @@ -33,7 +32,12 @@ object `package` extends RootModule with build.MillPublishScalaModule with Build
}

object worker extends build.MillPublishScalaModule {
def compileModuleDeps = Seq(build.bsp, build.scalalib, build.testrunner, build.runner) ++ build.scalalib.compileModuleDeps
def compileModuleDeps = Seq(
build.bsp,
build.scalalib,
build.testrunner,
build.runner
) ++ build.scalalib.compileModuleDeps
def ivyDeps = Agg(build.Deps.bsp4j, build.Deps.sbtTestInterface)
}
}
2 changes: 1 addition & 1 deletion ci/package.mill
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package build.ci
package build.ci
1 change: 1 addition & 0 deletions ci/shared.mill
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package build.ci

/**
* Utility code that is shared between our SBT build and our Mill build. SBT
* calls this by shelling out to Ammonite in a subprocess, while Mill loads it
Expand Down
6 changes: 4 additions & 2 deletions contrib/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ object `package` extends RootModule {

object buildinfo extends ContribModule {
def compileModuleDeps = Seq(build.scalalib, build.scalajslib, build.scalanativelib)
def testModuleDeps = super.testModuleDeps ++ Seq(build.scalalib, build.scalajslib, build.scalanativelib)
def testModuleDeps =
super.testModuleDeps ++ Seq(build.scalalib, build.scalajslib, build.scalanativelib)
}

object proguard extends ContribModule {
Expand Down Expand Up @@ -233,7 +234,8 @@ object `package` extends RootModule {
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))
def buildInfoMembers =
Seq(BuildInfo.Value("errorProneVersion", Deps.RuntimeDeps.errorProneCore.version))
}

object checkstyle extends ContribModule {
Expand Down
23 changes: 12 additions & 11 deletions docs/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import mill.util.Jvm
import mill._, scalalib._
import build.contrib
import de.tobiasroeser.mill.vcs.version.VcsVersion

/** Generates the mill documentation with Antora. */
object `package` extends RootModule {
// This module isn't really a ScalaModule, but we use it to generate
Expand Down Expand Up @@ -36,7 +37,7 @@ object `package` extends RootModule {
}

def runAntora(npmDir: os.Path, workDir: os.Path, args: Seq[String])(implicit
ctx: mill.api.Ctx.Log
ctx: mill.api.Ctx.Log
) = {

prepareAntora(npmDir)
Expand Down Expand Up @@ -102,11 +103,11 @@ object `package` extends RootModule {
}

def sanitizeAntoraYml(
dest: os.Path,
version: String,
millVersion: String,
millLastTag: String
): Unit = {
dest: os.Path,
version: String,
millVersion: String,
millLastTag: String
): Unit = {
val isPreRelease = (millVersion != millLastTag) || Seq("-M", "-RC").exists(millVersion.contains)
val lines = os.read(dest / "antora.yml").linesIterator.map {
case s"version:$_" =>
Expand Down Expand Up @@ -247,11 +248,11 @@ object `package` extends RootModule {
}

def sanitizeDevUrls(
dir: os.Path,
sourceDir: os.Path,
newSourceDir: os.Path,
baseDir: os.Path
): Unit = {
dir: os.Path,
sourceDir: os.Path,
newSourceDir: os.Path,
baseDir: os.Path
): Unit = {

val pathToRemove = sourceDir.relativeTo(baseDir).toString()
val replacePath = newSourceDir.relativeTo(baseDir).toString()
Expand Down
2 changes: 1 addition & 1 deletion integration/failure/compile-error/resources/bar.mill
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ def myScalaVersion = "2.13.8"

println(doesntExist)

// Scattered throughout
// Scattered throughout
2 changes: 1 addition & 1 deletion integration/failure/compile-error/resources/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ object foo extends ScalaModule {
def scalaVersion = bar.myScalaVersion
}

foo.noSuchMethod
foo.noSuchMethod
2 changes: 1 addition & 1 deletion integration/failure/compile-error/resources/qux.mill
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package build
def myMsg = "<h1>world</h1>"

def myOtherMsg = myMsg.substring("0")
def myOtherMsg = myMsg.substring("0")
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package build
import mill._
object `package`
object `package`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package `sub-2`
package `sub-2`
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package build
package build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package build
import mill._

object foo extends RootModule
object foo extends RootModule
16 changes: 8 additions & 8 deletions integration/failure/module-init-error/resources/build.mill
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package build
import mill._, scalalib._

def rootTarget = T{ println("Running rootTarget"); "rootTarget" }
def rootCommand(s: String) = T.command{ println(s"Running rootCommand $s") }
def rootTarget = T { println("Running rootTarget"); "rootTarget" }
def rootCommand(s: String) = T.command { println(s"Running rootCommand $s") }

object foo extends Module{
def fooTarget = T{ println(s"Running fooTarget"); 123 }
def fooCommand(s: String) = T.command{ println(s"Running fooCommand $s") }
object foo extends Module {
def fooTarget = T { println(s"Running fooTarget"); 123 }
def fooCommand(s: String) = T.command { println(s"Running fooCommand $s") }
throw new Exception("Foo Boom")
}

object bar extends Module {
def barTarget = T { println(s"Running barTarget"); "abc" }
def barCommand(s: String) = T.command{ println(s"Running barCommand $s") }
def barCommand(s: String) = T.command { println(s"Running barCommand $s") }

object qux extends Module{
object qux extends Module {
def quxTarget = T { println(s"Running quxTarget"); "xyz" }
def quxCommand(s: String) = T.command{ println(s"Running quxCommand $s") }
def quxCommand(s: String) = T.command { println(s"Running quxCommand $s") }
throw new Exception("Qux Boom")
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package build
import mill._


object invalidModule extends Module

object `package` extends RootModule
object `package` extends RootModule
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package build
package build
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package build
import mill._
object foo extends Module
object foo extends Module
1 change: 0 additions & 1 deletion integration/failure/parse-error/resources/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ import $file.bar
object foo extends ScalaModule {
def scalaVersion = bar.myScalaVersion
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ object `package` extends RootModule with UnknownRootModule {
def scalaVersion = unknownRootInternalDef
}

object after extends UnknownAfterModule
object after extends UnknownAfterModule
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ object `package` extends RootModule with UnknownFooModule {
def scalaVersion = unknownFooInternalDef
}

object after extends UnknownAfterFooModule
object after extends UnknownAfterFooModule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package build
import mill._

object sub extends Module
object sub extends Module
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package build
package build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package build
package build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package build
import mill._

val x = sub.y
val x = sub.y
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package build.sub

import mill._
object `package` extends RootModule{
object `package` extends RootModule {
def y = 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ import mill._

def invalidTarget = 123


object `package` extends RootModule
object `package` extends RootModule
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ import mill.playlib._
object app extends PlayApiModule {
def scalaVersion = "2.13.10"
def playVersion = "2.8.19"
}
}
2 changes: 1 addition & 1 deletion integration/feature/scoverage/resources/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ object extra extends ScalaModule with ScoverageModule {
override lazy val scoverage: ScoverageData = new ScoverageData {
// some customizations
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

5 changes: 2 additions & 3 deletions integration/feature/subprocess-stdout/resources/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package build
import scala.util.Properties
import mill._


def inheritInterleaved = T {
for (i <- Range.inclusive(1, 9)) {
println("print stdout" + i)
Expand All @@ -18,7 +17,7 @@ def inheritInterleaved = T {
}
}

def inheritRaw = T{
def inheritRaw = T {
println("print stdoutRaw")
val echoCommandStdoutRaw =
if (Properties.isWin) Seq("cmd.exe", "/C", "echo proc stdoutRaw")
Expand All @@ -29,4 +28,4 @@ def inheritRaw = T{
if (Properties.isWin) Seq("cmd.exe", "/C", "echo proc stderrRaw>&2")
else Seq("bash", "-c", "echo proc stderrRaw >&2")
os.proc(echoCommandStderrRaw).call(stderr = os.InheritRaw)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import mill.scalalib._

object `package` extends MillBuildRootModule {
def ivyDeps = Agg(ivy"org.scalameta::munit:0.7.29")
}
}
2 changes: 1 addition & 1 deletion integration/ide/gen-idea/resources/hello-idea/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ object moduleE extends JavaModule
object moduleF extends JavaModule {
override def compileModuleDeps = Seq(moduleC)
override def moduleDeps = Seq(moduleB, moduleA)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import mill._
val valueFoo = 0
val valueFooUsedInBar = 0
def helperFoo = { println("running helperFoo"); 1 + valueFoo }
def foo = T{ println("running foo"); helperFoo }
def foo = T { println("running foo"); helperFoo }
24 changes: 13 additions & 11 deletions integration/invalidation/codesig-nested/resources/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,39 @@ import mill._
val valueFoo = 0
val valueFooUsedInBar = 0
def helperFoo = { println("running helperFoo"); 1 + valueFoo }
def foo = T{ println("running foo"); helperFoo }
def foo = T { println("running foo"); helperFoo }

object outer extends Module{
object outer extends Module {
val valueBar = 0
val valueBarUsedInQux = 0
def helperBar = { println("running helperBar"); 20 }
def bar = T{ println("running bar"); helperBar + valueBar + valueFooUsedInBar }
def bar = T { println("running bar"); helperBar + valueBar + valueFooUsedInBar }

trait InnerModule extends Module{
trait InnerModule extends Module {
val valueQux = 0
def helperQux = { println("running helperQux"); 300 + valueQux + valueBarUsedInQux }
def qux = T{ println("running qux"); foo() + bar() + helperQux }
def qux = T { println("running qux"); foo() + bar() + helperQux }
}
object inner extends InnerModule
}

trait TraitOuter extends Module{
trait TraitOuter extends Module {
val valueTraitOuter = 0
def helperTraitOuter = { println("running helperTraitOuter"); 300 + valueTraitOuter }
def outer = T{ println("running outer"); foo() + helperTraitOuter }
def outer = T { println("running outer"); foo() + helperTraitOuter }

object traitInner extends Module{
object traitInner extends Module {
val valueTraitInner = 0
def helperTraitInner = { println("running helperTraitInner"); 300 + valueTraitOuter + valueTraitInner }
def inner = T{ println("running inner"); foo() + outer() + helperTraitInner }
def helperTraitInner = {
println("running helperTraitInner"); 300 + valueTraitOuter + valueTraitInner
}
def inner = T { println("running inner"); foo() + outer() + helperTraitInner }
}
}

object traitOuter extends TraitOuter

object crossOuter extends Cross[CrossOuter](1337, 31337, 31415926)
trait CrossOuter extends TraitOuter with Cross.Module[Int]{
trait CrossOuter extends TraitOuter with Cross.Module[Int] {
override val valueTraitOuter = crossValue
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import mill._, scalalib._
object foo extends ScalaModule {
def scalaVersion = "2.13.8"

def sources = T{
def sources = T {
println("Foo generating sources...")
os.write(
T.dest / "Foo.scala",
Expand Down Expand Up @@ -91,4 +91,4 @@ object qux extends ScalaModule {
println("Qux assembly...")
super.assembly()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package build
import $meta._
import mill._, scalalib._

object `package` extends MillBuildRootModule{
object `package` extends MillBuildRootModule {
def ivyDeps = Agg(ivy"com.lihaoyi::scalatags:${constant.MetaConstant.scalatagsVersion}")

def generatedSources = T {
Expand All @@ -16,4 +16,4 @@ object `package` extends MillBuildRootModule{
)
super.generatedSources() ++ Seq(PathRef(T.dest / "Constant.scala"))
}
}
}
Loading

0 comments on commit 39e3674

Please sign in to comment.