|
53 | 53 | import java.util.stream.Collectors; |
54 | 54 | import java.util.stream.Stream; |
55 | 55 |
|
56 | | -import com.oracle.svm.core.RuntimeAssertionsSupport; |
57 | | -import com.oracle.svm.core.util.UserError; |
58 | | -import com.oracle.svm.util.LogUtils; |
59 | 56 | import org.graalvm.nativeimage.ImageSingletons; |
60 | 57 | import org.graalvm.nativeimage.hosted.Feature; |
61 | 58 | import org.graalvm.nativeimage.impl.ImageSingletonsSupport; |
|
71 | 68 | import com.oracle.svm.common.option.CommonOptionParser; |
72 | 69 | import com.oracle.svm.core.BuildArtifacts; |
73 | 70 | import com.oracle.svm.core.BuildArtifacts.ArtifactType; |
| 71 | +import com.oracle.svm.core.RuntimeAssertionsSupport; |
74 | 72 | import com.oracle.svm.core.SubstrateGCOptions; |
75 | 73 | import com.oracle.svm.core.SubstrateOptions; |
76 | 74 | import com.oracle.svm.core.SubstrateUtil; |
|
94 | 92 | import com.oracle.svm.core.traits.SingletonTraits; |
95 | 93 | import com.oracle.svm.core.util.ByteFormattingUtil; |
96 | 94 | import com.oracle.svm.core.util.TimeUtils; |
| 95 | +import com.oracle.svm.core.util.UserError; |
97 | 96 | import com.oracle.svm.core.util.VMError; |
98 | 97 | import com.oracle.svm.hosted.ProgressReporterFeature.UserRecommendation; |
99 | 98 | import com.oracle.svm.hosted.ProgressReporterJsonHelper.AnalysisResults; |
|
109 | 108 | import com.oracle.svm.hosted.util.DiagnosticUtils; |
110 | 109 | import com.oracle.svm.hosted.util.VMErrorReporter; |
111 | 110 | import com.oracle.svm.util.ImageBuildStatistics; |
| 111 | +import com.oracle.svm.util.LogUtils; |
112 | 112 | import com.sun.management.OperatingSystemMXBean; |
113 | 113 |
|
114 | 114 | import jdk.graal.compiler.options.OptionDescriptor; |
@@ -908,7 +908,32 @@ private void printArtifacts(BuildArtifacts artifacts) { |
908 | 908 | pathToTypes.computeIfAbsent(path, _ -> new ArrayList<>()).add(artifactType.name().toLowerCase(Locale.ROOT)); |
909 | 909 | } |
910 | 910 | }); |
911 | | - pathToTypes.forEach((path, typeNames) -> l().a(" ").link(path).dim().a(" (").a(String.join(", ", typeNames)).a(")").reset().println()); |
| 911 | + pathToTypes.forEach((path, typeNames) -> { |
| 912 | + String artifactTypesString = String.join(", ", typeNames); |
| 913 | + long artifactSize = getArtifactSize(path); |
| 914 | + String artifactSizeString = artifactSize >= 0 ? ByteFormattingUtil.bytesToHuman(artifactSize) : "unknown size"; |
| 915 | + l().a(" ").link(path).dim().a(" (").a(artifactTypesString).a(", ").a(artifactSizeString).a(")").reset().println(); |
| 916 | + }); |
| 917 | + } |
| 918 | + |
| 919 | + private static long getArtifactSize(Path artifactPath) { |
| 920 | + try { |
| 921 | + if (Files.isRegularFile(artifactPath)) { |
| 922 | + return Files.size(artifactPath); |
| 923 | + } else { |
| 924 | + try (Stream<Path> artifactDirectorySubPaths = Files.walk(artifactPath)) { |
| 925 | + return artifactDirectorySubPaths.filter(Files::isRegularFile).mapToLong(filePath -> { |
| 926 | + try { |
| 927 | + return Files.size(filePath); |
| 928 | + } catch (IOException e) { |
| 929 | + return 0; |
| 930 | + } |
| 931 | + }).sum(); |
| 932 | + } |
| 933 | + } |
| 934 | + } catch (IOException e) { |
| 935 | + return -1; |
| 936 | + } |
912 | 937 | } |
913 | 938 |
|
914 | 939 | private Path reportBuildOutput(Path jsonOutputFile) { |
|
0 commit comments