@@ -615,12 +615,7 @@ private void printBreakdowns() {
615
615
616
616
public void printEpilog (String imageName , NativeImageGenerator generator , ImageClassLoader classLoader , Throwable error , OptionValues parsedHostedOptions ) {
617
617
executor .shutdown ();
618
-
619
- if (error != null && !NativeImageOptions .ErrorFileToStdout .getValue ()) {
620
- Path errorReportPath = NativeImageOptions .getErrorFilePath ();
621
- ReportUtils .report ("GraalVM Native Image Error Report" , errorReportPath , p -> VMErrorReporter .generateErrorReport (p , classLoader , error ), false );
622
- BuildArtifacts .singleton ().add (ArtifactType .MARKDOWN , errorReportPath );
623
- }
618
+ createAdditionalArtifacts (imageName , generator , classLoader , error , parsedHostedOptions );
624
619
625
620
if (imageName == null || generator == null ) {
626
621
printErrorMessage (error );
@@ -633,12 +628,14 @@ public void printEpilog(String imageName, NativeImageGenerator generator, ImageC
633
628
double totalSeconds = Utils .millisToSeconds (getTimer (TimerCollection .Registry .TOTAL ).getTotalTime ());
634
629
recordJsonMetric (ResourceUsageKey .TOTAL_SECS , totalSeconds );
635
630
631
+ if (jsonHelper != null ) {
632
+ BuildArtifacts .singleton ().add (ArtifactType .JSON , jsonHelper .printToFile ());
633
+ }
636
634
Map <ArtifactType , List <Path >> artifacts = generator .getBuildArtifacts ();
637
-
638
635
if (!artifacts .isEmpty ()) {
639
- l ().printLineSeparator ();
640
- printArtifacts (imageName , generator , parsedHostedOptions , artifacts , error );
636
+ BuildArtifacts .singleton ().add (ArtifactType .TXT , reportBuildArtifacts (NativeImageGenerator .generatedFiles (HostedOptionValues .singleton ()), imageName , artifacts ));
641
637
}
638
+ printArtifacts (artifacts );
642
639
643
640
l ().printHeadlineSeparator ();
644
641
@@ -654,6 +651,17 @@ public void printEpilog(String imageName, NativeImageGenerator generator, ImageC
654
651
printErrorMessage (error );
655
652
}
656
653
654
+ private static void createAdditionalArtifacts (String imageName , NativeImageGenerator generator , ImageClassLoader classLoader , Throwable error , OptionValues parsedHostedOptions ) {
655
+ if (error != null && !NativeImageOptions .ErrorFileToStdout .getValue ()) {
656
+ Path errorReportPath = NativeImageOptions .getErrorFilePath ();
657
+ ReportUtils .report ("GraalVM Native Image Error Report" , errorReportPath , p -> VMErrorReporter .generateErrorReport (p , classLoader , error ), false );
658
+ BuildArtifacts .singleton ().add (ArtifactType .MARKDOWN , errorReportPath );
659
+ }
660
+ if (generator .getBigbang () != null && ImageBuildStatistics .Options .CollectImageBuildStatistics .getValue (parsedHostedOptions )) {
661
+ BuildArtifacts .singleton ().add (ArtifactType .JSON , reportImageBuildStatistics (imageName , generator .getBigbang ()));
662
+ }
663
+ }
664
+
657
665
private void printErrorMessage (Throwable error ) {
658
666
if (error == null ) {
659
667
return ;
@@ -677,7 +685,11 @@ private void printErrorMessage(Throwable error) {
677
685
}
678
686
}
679
687
680
- private void printArtifacts (String imageName , NativeImageGenerator generator , OptionValues parsedHostedOptions , Map <ArtifactType , List <Path >> artifacts , Throwable error ) {
688
+ private void printArtifacts (Map <ArtifactType , List <Path >> artifacts ) {
689
+ if (artifacts .isEmpty ()) {
690
+ return ;
691
+ }
692
+ l ().printLineSeparator ();
681
693
l ().yellowBold ().a ("Produced artifacts:" ).reset ().println ();
682
694
// Use TreeMap to sort paths alphabetically.
683
695
Map <Path , List <String >> pathToTypes = new TreeMap <>();
@@ -686,15 +698,6 @@ private void printArtifacts(String imageName, NativeImageGenerator generator, Op
686
698
pathToTypes .computeIfAbsent (path , p -> new ArrayList <>()).add (artifactType .name ().toLowerCase ());
687
699
}
688
700
});
689
- if (error == null && jsonHelper != null ) {
690
- Path jsonMetric = jsonHelper .printToFile ();
691
- pathToTypes .computeIfAbsent (jsonMetric , p -> new ArrayList <>()).add ("json" );
692
- }
693
- if (generator .getBigbang () != null && ImageBuildStatistics .Options .CollectImageBuildStatistics .getValue (parsedHostedOptions )) {
694
- Path buildStatisticsPath = reportImageBuildStatistics (imageName , generator .getBigbang ());
695
- pathToTypes .computeIfAbsent (buildStatisticsPath , p -> new ArrayList <>()).add ("raw" );
696
- }
697
- pathToTypes .computeIfAbsent (reportBuildArtifacts (NativeImageGenerator .generatedFiles (HostedOptionValues .singleton ()), imageName , artifacts ), p -> new ArrayList <>()).add ("txt" );
698
701
pathToTypes .forEach ((path , typeNames ) -> {
699
702
l ().a (" " ).link (path ).dim ().a (" (" ).a (String .join (", " , typeNames )).a (")" ).reset ().println ();
700
703
});
0 commit comments