Skip to content

Commit d80d8ea

Browse files
[autofix.ci] apply automated fixes
1 parent e8b5640 commit d80d8ea

File tree

5 files changed

+148
-112
lines changed

5 files changed

+148
-112
lines changed

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

+7-7
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

+16-6
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 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

+14-4
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

+11-6
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 can ignore all calls to methods that look like Targets when traversing
146149
// the call graph. We can do this because we assume `def` Targets are pure,
147150
// and so any changes in their behavior will be picked up by the runtime build
@@ -177,7 +180,7 @@ abstract class MillBuildRootModule()(implicit
177180
isSimpleTarget(callSiteSig.desc) && calledSig.name.contains("$anonfun")
178181
)
179182
}
180-
183+
181184
// We ignore Commands for the same reason as we ignore Targets, and also because
182185
// their implementations get gathered up all the via the `Discover` macro, but this
183186
// is primarily for use as external entrypoints and shouldn't really be counted as
@@ -195,21 +198,23 @@ abstract class MillBuildRootModule()(implicit
195198
calledSig.name == "millDiscover$lzyINIT1" ||
196199
calledSig.name == "millDiscover" ||
197200
callSiteOpt.exists(_.sig.name == "millDiscover")
198-
201+
199202
(isSimpleTarget(calledSig.desc) && !isForwarderCallsiteOrLambda) || isCommand || isMillDiscover
200203
}
201204

202205
def codeSignatures: T[Map[String, Int]] = Task(persistent = true) {
203206
os.remove.all(Task.dest / "previous")
204-
if (os.exists(Task.dest / "current")) os.move.over(Task.dest / "current", Task.dest / "previous")
207+
if (os.exists(Task.dest / "current"))
208+
os.move.over(Task.dest / "current", Task.dest / "previous")
205209

206210
val debugEnabled = Task.log.debugEnabled
207211

208212
val callAnalysis = mill.codesig.CodeSig
209213
.compute(
210214
classFiles = os.walk(compile().classes.path).filter(_.ext == "class"),
211215
upstreamClasspath = compileClasspath().toSeq.map(_.path),
212-
ignoreCall = (callSiteOpt, calledSig) => callGraphAnalysisIgnoreCalls(callSiteOpt, calledSig),
216+
ignoreCall =
217+
(callSiteOpt, calledSig) => callGraphAnalysisIgnoreCalls(callSiteOpt, calledSig),
213218
logger = new mill.codesig.Logger(
214219
Task.dest / "current",
215220
Option.when(debugEnabled)(Task.dest / "current")
@@ -221,7 +226,7 @@ abstract class MillBuildRootModule()(implicit
221226
)
222227
)
223228
)
224-
229+
225230
callAnalysis.transitiveCallGraphHashes
226231
}
227232

0 commit comments

Comments
 (0)