@@ -675,42 +675,20 @@ module internal IncrementalBuild =
675675 | VectorBuildRule ve -> visitVector optSlot ve acc
676676
677677 /// Compute the max timestamp on all available inputs
678- let ComputeMaxTimeStamp ( Target ( output , optSlot )) bt acc =
679- let rec VisitVector optSlot ( ve : VectorBuildRule ) acc =
680- match ve with
681- | VectorInput _ -> acc
682- | VectorScanLeft(_ id,_ taskname, accumulatorExpr, inputExpr,_ func) ->
683- // Check each slot for an action that may be performed.
684- VisitVector None inputExpr ( VisitScalar accumulatorExpr acc)
685-
686- | VectorMap(_ id, _ taskname, inputExpr, _ func) ->
687- VisitVector optSlot inputExpr acc
688-
689- | VectorStamp(_ id, _ taskname, inputExpr, func) ->
690- let acc =
691- match GetVectorWidthByExpr( bt, ve) with
692- | Some( cardinality) ->
693- let CheckStamp acc slot =
694- match GetVectorExprResult( bt, inputExpr, slot) with
695- | Available( ires,_,_) -> max acc ( func ires)
696- | _ -> acc
697- [ 0 .. cardinality-1 ] |> List.fold CheckStamp acc
698- | None -> acc
699- VisitVector optSlot inputExpr acc
700-
701- | VectorMultiplex(_ id, _ taskname, inputExpr, _ func) ->
702- VisitScalar inputExpr acc
703-
704- and VisitScalar ( se : ScalarBuildRule ) acc =
705- match se with
706- | ScalarInput _ -> acc
707- | ScalarDemultiplex(_ id,_ taskname, inputExpr,_ func) -> VisitVector None inputExpr acc
708- | ScalarMap(_ id,_ taskname, inputExpr,_ func) -> VisitScalar inputExpr acc
709-
678+ let ComputeMaxTimeStamp output ( bt : PartialBuild ) acc =
710679 let expr = bt.Rules.RuleList |> List.find ( fun ( s , _ ) -> s = output) |> snd
711- match expr with
712- | ScalarBuildRule se -> VisitScalar se acc
713- | VectorBuildRule ve -> VisitVector optSlot ve acc
680+ match expr with
681+ | VectorBuildRule ( VectorStamp(_ id, _ taskname, inputExpr, func) as ve) ->
682+ match GetVectorWidthByExpr( bt, ve) with
683+ | Some( cardinality) ->
684+ let CheckStamp acc slot =
685+ match GetVectorExprResult( bt, inputExpr, slot) with
686+ | Available( ires,_,_) -> max acc ( func ires)
687+ | _ -> acc
688+ [ 0 .. cardinality-1 ] |> List.fold CheckStamp acc
689+ | None -> acc
690+
691+ | _ -> failwith " expected a VectorStamp"
714692
715693
716694 /// Given the result of a single action, apply that action to the Build
@@ -794,7 +772,6 @@ module internal IncrementalBuild =
794772 let MaxTimeStampInDependencies target bt =
795773 ComputeMaxTimeStamp target bt DateTime.MinValue
796774
797-
798775 /// Get a scalar vector. Result must be available
799776 let GetScalarResult < 'T >( node : Scalar < 'T >, bt ): ( 'T * DateTime ) option =
800777 match GetTopLevelExprByName( bt, node.Name) with
@@ -905,10 +882,8 @@ module internal IncrementalBuild =
905882 /// Creates a new vector with the same items but with
906883 /// timestamp specified by the passed-in function.
907884 let Stamp ( taskname : string ) ( task : 'I -> DateTime ) ( input : Vector < 'I >): Vector < 'I > =
908- let BoxingTouch i =
909- task( unbox i)
910885 let input = input.Expr
911- let expr = VectorStamp( NextId(), taskname, input, BoxingTouch )
886+ let expr = VectorStamp( NextId(), taskname, input, unbox >> task )
912887 { new Vector< 'I>
913888 interface IVector with
914889 override __.Name = taskname
@@ -1210,8 +1185,8 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
12101185 errorLogger.Warning( e)
12111186 DateTime.Now
12121187 yield ( Choice1Of2 r.resolvedPath, originalTimeStamp)
1213- for pr in projectReferences do
1214- yield Choice2Of2 pr, defaultArg ( pr.GetLogicalTimeStamp()) DateTime.Now]
1188+ for pr in projectReferences do
1189+ yield Choice2Of2 pr, defaultArg ( pr.GetLogicalTimeStamp()) DateTime.Now]
12151190
12161191 // The IncrementalBuilder needs to hold up to one item that needs to be disposed, which is the tcImports for the incremental
12171192 // build.
@@ -1533,6 +1508,8 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
15331508 // Outputs
15341509 let buildDescription = new BuildDescriptionScope ()
15351510
1511+ do buildDescription.DeclareVectorOutput stampedFileNamesNode
1512+ do buildDescription.DeclareVectorOutput stampedReferencedAssembliesNode
15361513 do buildDescription.DeclareVectorOutput parseTreesNode
15371514 do buildDescription.DeclareVectorOutput tcStatesNode
15381515 do buildDescription.DeclareScalarOutput initialTcAccNode
@@ -1549,10 +1526,10 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
15491526 let file = if FileSystem.IsPathRootedShim( referenceText) then referenceText else Path.Combine( projectDirectory, referenceText)
15501527 yield file
15511528
1552- for r in nonFrameworkResolutions do
1529+ for r in nonFrameworkResolutions do
15531530 yield r.resolvedPath
15541531
1555- for (_, f,_) in sourceFiles do
1532+ for (_, f,_) in sourceFiles do
15561533 yield f ]
15571534
15581535 let buildInputs = [ VectorInput ( fileNamesNode, sourceFiles)
@@ -1566,8 +1543,8 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
15661543 partialBuild <- newPartialBuild
15671544 newPartialBuild
15681545
1569- let MaxTimeStampInDependencies ( output : INode ) optSlot =
1570- IncrementalBuild.MaxTimeStampInDependencies ( Target ( output.Name, optSlot )) partialBuild
1546+ let MaxTimeStampInDependencies ( output : INode ) =
1547+ IncrementalBuild.MaxTimeStampInDependencies output.Name partialBuild
15711548
15721549 member this.IncrementUsageCount () =
15731550 assertNotDisposed()
@@ -1663,7 +1640,9 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
16631640 | None -> failwith " Build was not evaluated, expcted the results to be ready after 'Eval'."
16641641
16651642 member __.GetLogicalTimeStampForProject () =
1666- MaxTimeStampInDependencies finalizedTypeCheckNode None
1643+ let t1 = MaxTimeStampInDependencies stampedFileNamesNode
1644+ let t2 = MaxTimeStampInDependencies stampedReferencedAssembliesNode
1645+ max t1 t2
16671646
16681647 member __.GetSlotOfFileName ( filename : string ) =
16691648 // Get the slot of the given file and force it to build.
0 commit comments