@@ -73,7 +73,7 @@ public override bool Execute()
7373 if ( ! validationResults . All ( r => r . Success ) )
7474 {
7575 sw . Stop ( ) ;
76- LogErrors ( validationResults . SelectMany ( r => r . Errors ) ) ;
76+ LogErrors ( validationResults . SelectMany ( r => r . Errors ) ) ;
7777
7878 return false ;
7979 }
@@ -82,7 +82,7 @@ public override bool Execute()
8282
8383 sw . Stop ( ) ;
8484 FlushLogger ( logger ) ;
85- PopulateFilesWritten ( results , dependencies . GetHostInteractions ( ) ) ;
85+ PopulateFilesWritten ( results , dependencies ) ;
8686 LogResults ( sw , results ) ;
8787
8888 return ! Log . HasLoggedErrors ;
@@ -113,8 +113,7 @@ private void LogResults(Stopwatch sw, IEnumerable<ILibraryOperationResult> resul
113113 }
114114 else
115115 {
116- int fileCount = results . Where ( r => r . Success ) . Sum ( r => r . InstallationState . Files . Count ) ;
117- if ( fileCount > 0 )
116+ if ( FilesWritten . Length > 0 )
118117 {
119118 string text = string . Format ( Resources . Text . Restore_NumberOfLibrariesSucceeded , results . Count ( ) , Math . Round ( sw . Elapsed . TotalSeconds , 2 ) ) ;
120119 Log . LogMessage ( MessageImportance . Normal , Environment . NewLine + text + Environment . NewLine ) ;
@@ -137,23 +136,18 @@ private void LogErrors(IEnumerable<IError> errors)
137136 Log . LogMessage ( MessageImportance . High , Environment . NewLine + text + Environment . NewLine ) ;
138137 }
139138
140- private void PopulateFilesWritten ( IEnumerable < ILibraryOperationResult > results , IHostInteraction hostInteraction )
139+ private void PopulateFilesWritten ( IEnumerable < ILibraryOperationResult > results , Dependencies dependencies )
141140 {
142141 IEnumerable < ILibraryInstallationState > states = results . Where ( r => r . Success ) . Select ( r => r . InstallationState ) ;
143142 var list = new List < ITaskItem > ( ) ;
144143
145144 foreach ( ILibraryInstallationState state in states )
146145 {
147- foreach ( string file in state . Files )
146+ IProvider provider = dependencies . GetProvider ( state . ProviderId ) ;
147+ OperationResult < LibraryInstallationGoalState > goalStateResult = provider . GetInstallationGoalStateAsync ( state , CancellationToken . None ) . Result ;
148+ if ( goalStateResult . Success )
148149 {
149- string absolutePath = Path . Combine ( hostInteraction . WorkingDirectory , state . DestinationPath , file ) ;
150- var absolute = new FileInfo ( absolutePath ) ;
151-
152- if ( absolute . Exists )
153- {
154- string relative = absolute . FullName . Replace ( ProjectDirectory , string . Empty ) . TrimStart ( '/' , '\\ ' ) ;
155- list . Add ( new TaskItem ( relative ) ) ;
156- }
150+ list . AddRange ( goalStateResult . Result . InstalledFiles . Select ( f => new TaskItem ( f . Key ) ) ) ;
157151 }
158152 }
159153
0 commit comments