Skip to content

Commit 93c0ac9

Browse files
[autofix.ci] apply automated fixes
1 parent e63d0c4 commit 93c0ac9

File tree

9 files changed

+155
-116
lines changed

9 files changed

+155
-116
lines changed

core/codesig/src/mill/codesig/CodeSig.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import mill.codesig.JvmModel.*
55
object CodeSig {
66

77
private def callGraphAnalysis(
8-
classFiles: Seq[os.Path],
9-
upstreamClasspath: Seq[os.Path],
10-
ignoreCall: (Option[MethodDef], MethodSig) => Boolean
8+
classFiles: Seq[os.Path],
9+
upstreamClasspath: Seq[os.Path],
10+
ignoreCall: (Option[MethodDef], MethodSig) => Boolean
1111
)(implicit st: SymbolTable): CallGraphAnalysis = {
1212
val localSummary = LocalSummary.apply(classFiles.iterator.map(os.read.inputStream(_)))
1313

@@ -24,9 +24,9 @@ object CodeSig {
2424
}
2525

2626
def getCallGraphAnalysis(
27-
classFiles: Seq[os.Path],
28-
upstreamClasspath: Seq[os.Path],
29-
ignoreCall: (Option[MethodDef], MethodSig) => Boolean
27+
classFiles: Seq[os.Path],
28+
upstreamClasspath: Seq[os.Path],
29+
ignoreCall: (Option[MethodDef], MethodSig) => Boolean
3030
): CallGraphAnalysis = {
3131
implicit val st: SymbolTable = new SymbolTable()
3232

@@ -41,7 +41,7 @@ object CodeSig {
4141
prevTransitiveCallGraphHashesOpt: () => Option[Map[String, Int]]
4242
): CallGraphAnalysis = {
4343
implicit val st: SymbolTable = new SymbolTable()
44-
44+
4545
val callAnalysis = callGraphAnalysis(classFiles, upstreamClasspath, ignoreCall)
4646

4747
logger.log(callAnalysis.localSummary)

core/codesig/src/mill/codesig/ReachabilityAnalysis.scala

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class CallGraphAnalysis(
7474
.to(SortedMap)
7575

7676
def calculateSpanningInvalidationTree(
77-
prevTransitiveCallGraphHashesOpt: => Option[Map[String, Int]]
77+
prevTransitiveCallGraphHashesOpt: => Option[Map[String, Int]]
7878
): Obj = {
7979
prevTransitiveCallGraphHashesOpt match {
8080
case Some(prevTransitiveCallGraphHashes) =>
@@ -89,7 +89,7 @@ class CallGraphAnalysis(
8989
}
9090

9191
def calculateInvalidatedClassNames(
92-
prevTransitiveCallGraphHashesOpt: => Option[Map[String, Int]]
92+
prevTransitiveCallGraphHashesOpt: => Option[Map[String, Int]]
9393
): Set[String] = {
9494
prevTransitiveCallGraphHashesOpt match {
9595
case Some(prevTransitiveCallGraphHashes) =>
@@ -154,7 +154,12 @@ object CallGraphAnalysis {
154154
indexGraphEdges: Array[Array[Int]]
155155
): ujson.Obj = {
156156
SpanningForest.spanningTreeToJsonTree(
157-
getSpanningForest(prevTransitiveCallGraphHashes, transitiveCallGraphHashes0, indexToNodes, indexGraphEdges),
157+
getSpanningForest(
158+
prevTransitiveCallGraphHashes,
159+
transitiveCallGraphHashes0,
160+
indexToNodes,
161+
indexGraphEdges
162+
),
158163
k => indexToNodes(k).toString
159164
)
160165
}
@@ -168,12 +173,17 @@ object CallGraphAnalysis {
168173
indexToNodes: Array[Node],
169174
indexGraphEdges: Array[Array[Int]]
170175
): Set[String] = {
171-
val rootNode = getSpanningForest(prevTransitiveCallGraphHashes, transitiveCallGraphHashes0, indexToNodes, indexGraphEdges)
176+
val rootNode = getSpanningForest(
177+
prevTransitiveCallGraphHashes,
178+
transitiveCallGraphHashes0,
179+
indexToNodes,
180+
indexGraphEdges
181+
)
172182

173183
val jsonValueQueue = mutable.ArrayDeque[(Int, SpanningForest.Node)]()
174184
jsonValueQueue.appendAll(rootNode.values.toSeq)
175185
val builder = Set.newBuilder[String]
176-
186+
177187
while (jsonValueQueue.nonEmpty) {
178188
val (nodeIndex, node) = jsonValueQueue.removeHead()
179189
node.values.foreach { case (childIndex, childNode) =>

core/define/src/mill/define/Task.scala

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,18 @@ object Task extends TaskBase {
124124
inline def Command[T](inline t: Result[T])(implicit
125125
inline w: W[T],
126126
inline ctx: mill.define.ModuleCtx
127-
): Command[T] = ${ TaskMacros.commandImpl[T]('t)('w, 'ctx, exclusive = '{ false }, persistent = '{ false }) }
128-
127+
): Command[T] =
128+
${ TaskMacros.commandImpl[T]('t)('w, 'ctx, exclusive = '{ false }, persistent = '{ false }) }
129129

130130
/**
131131
* This version allow [[Command]] to be persistent
132132
*/
133133
inline def Command[T](inline persistent: Boolean)(inline t: Result[T])(implicit
134134
inline w: W[T],
135135
inline ctx: mill.define.ModuleCtx
136-
): Command[T] = ${ TaskMacros.commandImpl[T]('t)('w, 'ctx, exclusive = '{ false }, persistent = '{ persistent }) }
136+
): Command[T] = ${
137+
TaskMacros.commandImpl[T]('t)('w, 'ctx, exclusive = '{ false }, persistent = '{ persistent })
138+
}
137139

138140
/**
139141
* @param exclusive Exclusive commands run serially at the end of an evaluation,
@@ -557,7 +559,15 @@ private object TaskMacros {
557559
appImpl[Command, T](
558560
(in, ev) =>
559561
'{
560-
new Command[T]($in, $ev, $ctx, $w, ${ taskIsPrivate() }, exclusive = $exclusive, persistent = $persistent)
562+
new Command[T](
563+
$in,
564+
$ev,
565+
$ctx,
566+
$w,
567+
${ taskIsPrivate() },
568+
exclusive = $exclusive,
569+
persistent = $persistent
570+
)
561571
},
562572
t
563573
)

integration/feature/test-quick/resources/app/src/MyNumber.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import lib.*
55
final case class MyNumber(val value: Int)
66

77
object MyNumber {
8-
8+
99
given gCombinator: Combinator[MyNumber] = new Combinator[MyNumber] {
1010
def combine(a: MyNumber, b: MyNumber): MyNumber = MyNumber(a.value + b.value)
1111
}

integration/feature/test-quick/resources/app/src/MyString.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import lib.*
55
final case class MyString(val value: String)
66

77
object MyString {
8-
8+
99
given gCombinator: Combinator[MyString] = new Combinator[MyString] {
1010
def combine(a: MyString, b: MyString): MyString = MyString(a.value + b.value)
1111
}

integration/feature/test-quick/resources/app/test/src/MyNumberDefaultValueTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import utest.*
44
import app.MyNumber
55

66
object MyNumberDefaultValueTests extends TestSuite {
7-
def tests = Tests {
7+
def tests = Tests {
88
test("simple") {
99
val result = MyNumber.defaultValue
1010
assert(result == MyNumber(0))

integration/feature/test-quick/src/TestQuickTests.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ object TestQuickTests extends UtestIntegrationTestSuite {
102102
// Fourth run, Combinator.scala changed sematically, should run MyNumberCombinatorTests & MyStringCombinatorTests
103103
modifyFile(
104104
workspacePath / "lib" / "src" / "Combinator.scala",
105-
_.replace("def combine2(a: T, b: T, c: T): T = combine(combine(a, b), c)", "def combine2(a: T, b: T, c: T): T = combine(a, combine(b, c))")
105+
_.replace(
106+
"def combine2(a: T, b: T, c: T): T = combine(combine(a, b), c)",
107+
"def combine2(a: T, b: T, c: T): T = combine(a, combine(b, c))"
108+
)
106109
)
107110
val fourthRun = eval("app.test.testQuick")
108111
val fourthRunOutLines = fourthRun.out.linesIterator.toSeq

runner/meta/src/mill/runner/meta/MillBuildRootModule.scala

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,10 @@ class MillBuildRootModule()(implicit
171171
}
172172

173173
@internal
174-
override protected def callGraphAnalysisIgnoreCalls(callSiteOpt: Option[MethodDef], calledSig: MethodSig): Boolean = {
174+
override protected def callGraphAnalysisIgnoreCalls(
175+
callSiteOpt: Option[MethodDef],
176+
calledSig: MethodSig
177+
): Boolean = {
175178
// We can ignore all calls to methods that look like Targets when traversing
176179
// the call graph. We can do this because we assume `def` Targets are pure,
177180
// and so any changes in their behavior will be picked up by the runtime build
@@ -207,7 +210,7 @@ class MillBuildRootModule()(implicit
207210
isSimpleTarget(callSiteSig.desc) && calledSig.name.contains("$anonfun")
208211
)
209212
}
210-
213+
211214
// We ignore Commands for the same reason as we ignore Targets, and also because
212215
// their implementations get gathered up all the via the `Discover` macro, but this
213216
// is primarily for use as external entrypoints and shouldn't really be counted as
@@ -225,21 +228,23 @@ class MillBuildRootModule()(implicit
225228
calledSig.name == "millDiscover$lzyINIT1" ||
226229
calledSig.name == "millDiscover" ||
227230
callSiteOpt.exists(_.sig.name == "millDiscover")
228-
231+
229232
(isSimpleTarget(calledSig.desc) && !isForwarderCallsiteOrLambda) || isCommand || isMillDiscover
230233
}
231234

232235
def codeSignatures: T[Map[String, Int]] = Task(persistent = true) {
233236
os.remove.all(Task.dest / "previous")
234-
if (os.exists(Task.dest / "current")) os.move.over(Task.dest / "current", Task.dest / "previous")
237+
if (os.exists(Task.dest / "current"))
238+
os.move.over(Task.dest / "current", Task.dest / "previous")
235239

236240
val debugEnabled = Task.log.debugEnabled
237241

238242
val callAnalysis = mill.codesig.CodeSig
239243
.compute(
240244
classFiles = os.walk(compile().classes.path).filter(_.ext == "class"),
241245
upstreamClasspath = compileClasspath().toSeq.map(_.path),
242-
ignoreCall = (callSiteOpt, calledSig) => callGraphAnalysisIgnoreCalls(callSiteOpt, calledSig),
246+
ignoreCall =
247+
(callSiteOpt, calledSig) => callGraphAnalysisIgnoreCalls(callSiteOpt, calledSig),
243248
logger = new mill.codesig.Logger(
244249
Task.dest / "current",
245250
Option.when(debugEnabled)(Task.dest / "current")
@@ -251,7 +256,7 @@ class MillBuildRootModule()(implicit
251256
)
252257
)
253258
)
254-
259+
255260
callAnalysis.transitiveCallGraphHashes
256261
}
257262

0 commit comments

Comments
 (0)