File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -384,6 +384,39 @@ private static void ReportSummary(BuildSummary summary)
384384 {
385385 LogError ( summaryText ) ;
386386 }
387+
388+ // Archive the build report to metadata folder
389+ ArchiveBuildReport ( summary . outputPath ) ;
390+ }
391+
392+ private static void ArchiveBuildReport ( string buildOutputPath )
393+ {
394+ try
395+ {
396+ string buildReportPath = "Library/LastBuild.buildreport" ;
397+ if ( ! File . Exists ( buildReportPath ) )
398+ {
399+ LogWarning ( $ "Build report not found at { buildReportPath } ") ;
400+ return ;
401+ }
402+
403+ string buildDirectory = Path . GetDirectoryName ( buildOutputPath ) ;
404+ if ( string . IsNullOrEmpty ( buildDirectory ) )
405+ {
406+ buildDirectory = "." ;
407+ }
408+
409+
410+ string destinationFolder = Path . Combine ( buildDirectory , "metadata" ) ;
411+ Directory . CreateDirectory ( destinationFolder ) ;
412+ string destinationPath = Path . Combine ( destinationFolder , "LastBuild.buildreport" ) ;
413+ File . Copy ( buildReportPath , destinationPath , true ) ;
414+ Log ( $ "Build report archived to: { destinationPath } ") ;
415+ }
416+ catch ( Exception ex )
417+ {
418+ LogWarning ( $ "Failed to archive build report: { ex . Message } ") ;
419+ }
387420 }
388421
389422 private static void ExitWithResult ( BuildResult result )
You can’t perform that action at this time.
0 commit comments