@@ -2,11 +2,10 @@ package mill.codesig
22
33import mill .codesig .JvmModel .*
44import mill .internal .{SpanningForest , Tarjans }
5- import ujson .{ Arr , Obj }
5+ import ujson .Obj
66import upickle .default .{Writer , writer }
77
88import scala .collection .immutable .SortedMap
9- import scala .collection .mutable
109
1110class CallGraphAnalysis (
1211 localSummary : LocalSummary ,
@@ -82,19 +81,18 @@ class CallGraphAnalysis(
8281 logger.mandatoryLog(transitiveCallGraphHashes0)
8382 logger.log(transitiveCallGraphHashes)
8483
85- lazy val ( spanningInvalidationTree : Obj , invalidClassNames : Arr ) = prevTransitiveCallGraphHashesOpt() match {
84+ lazy val spanningInvalidationTree : Obj = prevTransitiveCallGraphHashesOpt() match {
8685 case Some (prevTransitiveCallGraphHashes) =>
8786 CallGraphAnalysis .spanningInvalidationTree(
8887 prevTransitiveCallGraphHashes,
8988 transitiveCallGraphHashes0,
9089 indexToNodes,
9190 indexGraphEdges
9291 )
93- case None => ujson.Obj () -> ujson. Arr ()
92+ case None => ujson.Obj ()
9493 }
9594
9695 logger.mandatoryLog(spanningInvalidationTree)
97- logger.mandatoryLog(invalidClassNames)
9896}
9997
10098object CallGraphAnalysis {
@@ -117,7 +115,7 @@ object CallGraphAnalysis {
117115 transitiveCallGraphHashes0 : Array [(CallGraphAnalysis .Node , Int )],
118116 indexToNodes : Array [Node ],
119117 indexGraphEdges : Array [Array [Int ]]
120- ): ( ujson.Obj , ujson. Arr ) = {
118+ ): ujson.Obj = {
121119 val transitiveCallGraphHashes0Map = transitiveCallGraphHashes0.toMap
122120
123121 val nodesWithChangedHashes = indexGraphEdges
@@ -137,23 +135,10 @@ object CallGraphAnalysis {
137135 val reverseGraphEdges =
138136 indexGraphEdges.indices.map(reverseGraphMap.getOrElse(_, Array [Int ]())).toArray
139137
140- val spanningForest = SpanningForest .apply(reverseGraphEdges, nodesWithChangedHashes, false )
141-
142- val spanningInvalidationTree = SpanningForest .spanningTreeToJsonTree(
143- spanningForest,
138+ SpanningForest .spanningTreeToJsonTree(
139+ SpanningForest .apply(reverseGraphEdges, nodesWithChangedHashes, false ),
144140 k => indexToNodes(k).toString
145141 )
146-
147- val invalidSet = invalidClassNameSet(
148- spanningForest,
149- indexToNodes.map {
150- case LocalDef (call) => call.cls.name
151- case Call (call) => call.cls.name
152- case ExternalClsCall (cls) => cls.name
153- }
154- )
155-
156- (spanningInvalidationTree, invalidSet)
157142 }
158143
159144 def indexGraphEdges (
@@ -278,24 +263,6 @@ object CallGraphAnalysis {
278263 }
279264 }
280265
281- private def invalidClassNameSet (
282- spanningForest : SpanningForest .Node ,
283- indexToClassName : Array [String ]
284- ): Set [String ] = {
285- val queue = mutable.ArrayBuffer .empty[(Int , SpanningForest .Node )]
286- val result = mutable.Set .empty[String ]
287-
288- queue.appendAll(spanningForest.values)
289-
290- while (queue.nonEmpty) {
291- val (index, node) = queue.remove(0 )
292- result += indexToClassName(index)
293- queue.appendAll(node.values)
294- }
295-
296- result.toSet
297- }
298-
299266 /**
300267 * Represents the three types of nodes in our call graph. These are kept heterogeneous
301268 * because flattening them out into a homogenous graph of MethodDef -> MethodDef edges
0 commit comments