Skip to content

Commit 91ca3f2

Browse files
[autofix.ci] apply automated fixes
1 parent cce94ef commit 91ca3f2

File tree

6 files changed

+147
-114
lines changed

6 files changed

+147
-114
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: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package mill.codesig
22

33
import mill.codesig.JvmModel.*
44
import mill.internal.{SpanningForest, Tarjans}
5-
import ujson.{Obj, Arr}
5+
import ujson.Obj
66
import upickle.default.{Writer, writer}
77

88
import scala.collection.immutable.SortedMap
@@ -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 calculateInvalidClassName(
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 invalidClassNames = Set.newBuilder[String]
176-
186+
177187
while (jsonValueQueue.nonEmpty) {
178188
val (nodeIndex, node) = jsonValueQueue.removeHead()
179189
node.values.foreach { case (childIndex, childNode) =>
@@ -182,7 +192,8 @@ object CallGraphAnalysis {
182192
indexToNodes(nodeIndex) match {
183193
case CallGraphAnalysis.LocalDef(methodDef) => invalidClassNames.addOne(methodDef.cls.name)
184194
case CallGraphAnalysis.Call(methodCall) => invalidClassNames.addOne(methodCall.cls.name)
185-
case CallGraphAnalysis.ExternalClsCall(externalCls) => invalidClassNames.addOne(externalCls.name)
195+
case CallGraphAnalysis.ExternalClsCall(externalCls) =>
196+
invalidClassNames.addOne(externalCls.name)
186197
}
187198
}
188199

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

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

127127
/**
128128
* This version allow [[Command]] to be persistent
129129
*/
130130
inline def Command[T](inline persistent: Boolean)(inline t: Result[T])(implicit
131131
inline w: W[T],
132132
inline ctx: mill.define.Ctx
133-
): Command[T] = ${ TaskMacros.commandImpl[T]('t)('w, 'ctx, exclusive = '{ false }, persistent = '{ persistent }) }
133+
): Command[T] = ${
134+
TaskMacros.commandImpl[T]('t)('w, 'ctx, exclusive = '{ false }, persistent = '{ persistent })
135+
}
134136

135137
/**
136138
* @param exclusive Exclusive commands run serially at the end of an evaluation,
@@ -553,7 +555,15 @@ private object TaskMacros {
553555
appImpl[Command, T](
554556
(in, ev) =>
555557
'{
556-
new Command[T]($in, $ev, $ctx, $w, ${ taskIsPrivate() }, exclusive = $exclusive, persistent = $persistent)
558+
new Command[T](
559+
$in,
560+
$ev,
561+
$ctx,
562+
$w,
563+
${ taskIsPrivate() },
564+
exclusive = $exclusive,
565+
persistent = $persistent
566+
)
557567
},
558568
t
559569
)

runner/src/mill/runner/MillBuildRootModule.scala

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ abstract class MillBuildRootModule()(implicit
141141
}
142142

143143
@internal
144-
override protected def callGraphAnalysisIgnoreCalls(callSiteOpt: Option[MethodDef], calledSig: MethodSig): Boolean = {
144+
override protected def callGraphAnalysisIgnoreCalls(
145+
callSiteOpt: Option[MethodDef],
146+
calledSig: MethodSig
147+
): Boolean = {
145148
// We ignore Commands for the same reason as we ignore Targets, and also because
146149
// their implementations get gathered up all the via the `Discover` macro, but this
147150
// is primarily for use as external entrypoints and shouldn't really be counted as
@@ -159,21 +162,23 @@ abstract class MillBuildRootModule()(implicit
159162
calledSig.name == "millDiscover$lzyINIT1" ||
160163
calledSig.name == "millDiscover" ||
161164
callSiteOpt.exists(_.sig.name == "millDiscover")
162-
165+
163166
super.callGraphAnalysisIgnoreCalls(callSiteOpt, calledSig) || isCommand || isMillDiscover
164167
}
165168

166169
def codeSignatures: T[Map[String, Int]] = Task(persistent = true) {
167170
os.remove.all(Task.dest / "previous")
168-
if (os.exists(Task.dest / "current")) os.move.over(Task.dest / "current", Task.dest / "previous")
171+
if (os.exists(Task.dest / "current"))
172+
os.move.over(Task.dest / "current", Task.dest / "previous")
169173

170174
val debugEnabled = Task.log.debugEnabled
171175

172176
val callAnalysis = mill.codesig.CodeSig
173177
.compute(
174178
classFiles = os.walk(compile().classes.path).filter(_.ext == "class"),
175179
upstreamClasspath = compileClasspath().toSeq.map(_.path),
176-
ignoreCall = (callSiteOpt, calledSig) => callGraphAnalysisIgnoreCalls(callSiteOpt, calledSig),
180+
ignoreCall =
181+
(callSiteOpt, calledSig) => callGraphAnalysisIgnoreCalls(callSiteOpt, calledSig),
177182
logger = new mill.codesig.Logger(
178183
Task.dest / "current",
179184
Option.when(debugEnabled)(Task.dest / "current")
@@ -185,7 +190,7 @@ abstract class MillBuildRootModule()(implicit
185190
)
186191
)
187192
)
188-
193+
189194
callAnalysis.transitiveCallGraphHashes
190195
}
191196

0 commit comments

Comments
 (0)