@@ -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
@@ -1211,7 +1186,7 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
12111186 errorLogger.Warning( e)
12121187 DateTime.Now
12131188 yield ( Choice1Of2 r.resolvedPath, originalTimeStamp)
1214- for pr in projectReferences do
1189+ for pr in projectReferences do
12151190 yield Choice2Of2 pr, defaultArg ( pr.GetLogicalTimeStamp()) DateTime.Now]
12161191
12171192 // The IncrementalBuilder needs to hold up to one item that needs to be disposed, which is the tcImports for the incremental
@@ -1534,6 +1509,8 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
15341509 // Outputs
15351510 let buildDescription = new BuildDescriptionScope ()
15361511
1512+ do buildDescription.DeclareVectorOutput stampedFileNamesNode
1513+ do buildDescription.DeclareVectorOutput stampedReferencedAssembliesNode
15371514 do buildDescription.DeclareVectorOutput parseTreesNode
15381515 do buildDescription.DeclareVectorOutput tcStatesNode
15391516 do buildDescription.DeclareScalarOutput initialTcAccNode
@@ -1550,10 +1527,10 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
15501527 let file = if FileSystem.IsPathRootedShim( referenceText) then referenceText else Path.Combine( projectDirectory, referenceText)
15511528 yield file
15521529
1553- for r in nonFrameworkResolutions do
1530+ for r in nonFrameworkResolutions do
15541531 yield r.resolvedPath
15551532
1556- for (_, f,_) in sourceFiles do
1533+ for (_, f,_) in sourceFiles do
15571534 yield f ]
15581535
15591536 let buildInputs = [ VectorInput ( fileNamesNode, sourceFiles)
@@ -1567,8 +1544,8 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
15671544 partialBuild <- newPartialBuild
15681545 newPartialBuild
15691546
1570- let MaxTimeStampInDependencies ( output : INode ) optSlot =
1571- IncrementalBuild.MaxTimeStampInDependencies ( Target ( output.Name, optSlot )) partialBuild
1547+ let MaxTimeStampInDependencies ( output : INode ) =
1548+ IncrementalBuild.MaxTimeStampInDependencies output.Name partialBuild
15721549
15731550 member this.IncrementUsageCount () =
15741551 assertNotDisposed()
@@ -1664,7 +1641,9 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
16641641 | None -> failwith " Build was not evaluated, expcted the results to be ready after 'Eval'."
16651642
16661643 member __.GetLogicalTimeStampForProject () =
1667- MaxTimeStampInDependencies finalizedTypeCheckNode None
1644+ let t1 = MaxTimeStampInDependencies stampedFileNamesNode
1645+ let t2 = MaxTimeStampInDependencies stampedReferencedAssembliesNode
1646+ max t1 t2
16681647
16691648 member __.GetSlotOfFileName ( filename : string ) =
16701649 // Get the slot of the given file and force it to build.
0 commit comments