274 this.configBytes = cfBytes;
275 this.size = total;
276 this.debugInfoLibCount = dizLibCount;
277 this.debugInfoLibBytes = dizLibBytes;
278 this.debugInfoCmdCount = dizCmdCount;
279 this.debugInfoCmdBytes = dizCmdBytes;
280 }
281 }
282
283 static final String NATIVE_LIBS = "native";
284 static final String NATIVE_CMDS = "bin";
285 static final String CLASSES = "classes";
286 static final String CONFIG = "conf";
287
288 static final String MODULE_ID = "module/id";
289 static final String MODULE_MAIN_CLASS = "module/main-class";
290 }
291
292 static Configuration resolve(Set<String> roots) {
293 return Configuration.empty()
294 .resolveRequires(ModuleFinder.ofSystem(),
295 ModuleFinder.of(),
296 roots);
297 }
298
299 static class HtmlDocument {
300 final String title;
301 final Map<String, ModuleSummary> modules;
302 boolean requiresTransitiveNote = false;
303 boolean aggregatorNote = false;
304 boolean totalBytesNote = false;
305 HtmlDocument(String title, Map<String, ModuleSummary> modules) {
306 this.title = title;
307 this.modules = modules;
308 }
309
310 void writeTo(PrintStream out, Set<ModuleDescriptor> selectedModules) {
311 out.format("<html><head>%n");
312 out.format("<title>%s</title>%n", title);
313 // stylesheet
314 Arrays.stream(HtmlDocument.STYLES).forEach(out::println);
475 sb.append(toTableRow(String.format("Total jmod bytes (%d %s)", deps.size(), files), reqJmodFileSize));
476
477 if (aggregator && !aggregatorNote) {
478 aggregatorNote = true;
479 sb.append(blankRow());
480 sb.append(toTableRow("<i>* aggregator is a module with module-info.class only</i>", BR));
481 }
482 if (!totalBytesNote) {
483 totalBytesNote = true;
484 sb.append(blankRow());
485 sb.append(toTableRow("<i><sup>1</sup>sum of all files including debug files</i>", BR));
486 sb.append(toTableRow("<i><sup>2</sup>sum of direct and indirect dependencies</i>", BR));
487 }
488 sb.append("</table>").append("</td>");
489 return sb.toString();
490 }
491
492 private String moduleName(String mn) {
493 if (aggregator) {
494 StringBuilder sb = new StringBuilder();
495 sb.append(String.format("<tr><td colspan=\"2\"><span class=\"%s\">", AGGREGATOR))
496 .append(mn)
497 .append("</span>").append(" ");
498 if (!aggregatorNote) {
499 sb.append("(aggregator<sup>*</sup>)");
500 } else {
501 sb.append("(aggregator)");
502 }
503 sb.append("</td></tr>");
504 return sb.toString();
505 } else {
506 return toTableRow(mn, MODULE_DEF);
507 }
508 }
509
510 public String requiresColumn() {
511 StringBuilder sb = new StringBuilder();
512 sb.append(String.format("<td>"));
513 boolean footnote = requiresTransitiveNote;
514 ms.descriptor().requires().stream()
515 .sorted(Comparator.comparing(Requires::name))
635 }
636 builder.data(bytes);
637 return builder.build();
638 }
639
640 class TableDataBuilder {
641 private final StringBuilder sb;
642 TableDataBuilder() {
643 this.sb = new StringBuilder("<tr>");
644 }
645 TableDataBuilder data(String s) {
646 data(BR, s);
647 return this;
648 }
649 TableDataBuilder data(long num) {
650 data(NUMBER, String.format("%,d", num));
651 return this;
652 }
653 TableDataBuilder colspan(Selector selector, int columns, String data) {
654 sb.append("<td colspan=\"").append(columns).append("\">");
655 sb.append("<span class=\"").append(selector).append("\">");
656 sb.append(data).append("</span></td>");
657 return this;
658 }
659
660 TableDataBuilder data(Selector selector, String data) {
661 sb.append("<td class=\"").append(selector).append("\">");
662 sb.append(data).append("</td>");
663 return this;
664 }
665 String build() {
666 sb.append("</tr>");
667 return sb.toString();
668 }
669 }
670 }
671
672 private static final String[] STYLES = new String[]{
673 "<link rel=\"stylesheet\" type=\"text/css\" href=\"/.fonts/dejavu.css\"/>",
674 "<style type=\"text/css\">",
675 " HTML, BODY, DIV, SPAN, APPLET, OBJECT, IFRAME, H1, H2, H3, H4, H5, H6, P,",
|
274 this.configBytes = cfBytes;
275 this.size = total;
276 this.debugInfoLibCount = dizLibCount;
277 this.debugInfoLibBytes = dizLibBytes;
278 this.debugInfoCmdCount = dizCmdCount;
279 this.debugInfoCmdBytes = dizCmdBytes;
280 }
281 }
282
283 static final String NATIVE_LIBS = "native";
284 static final String NATIVE_CMDS = "bin";
285 static final String CLASSES = "classes";
286 static final String CONFIG = "conf";
287
288 static final String MODULE_ID = "module/id";
289 static final String MODULE_MAIN_CLASS = "module/main-class";
290 }
291
292 static Configuration resolve(Set<String> roots) {
293 return Configuration.empty()
294 .resolve(ModuleFinder.ofSystem(),
295 ModuleFinder.of(),
296 roots);
297 }
298
299 static class HtmlDocument {
300 final String title;
301 final Map<String, ModuleSummary> modules;
302 boolean requiresTransitiveNote = false;
303 boolean aggregatorNote = false;
304 boolean totalBytesNote = false;
305 HtmlDocument(String title, Map<String, ModuleSummary> modules) {
306 this.title = title;
307 this.modules = modules;
308 }
309
310 void writeTo(PrintStream out, Set<ModuleDescriptor> selectedModules) {
311 out.format("<html><head>%n");
312 out.format("<title>%s</title>%n", title);
313 // stylesheet
314 Arrays.stream(HtmlDocument.STYLES).forEach(out::println);
475 sb.append(toTableRow(String.format("Total jmod bytes (%d %s)", deps.size(), files), reqJmodFileSize));
476
477 if (aggregator && !aggregatorNote) {
478 aggregatorNote = true;
479 sb.append(blankRow());
480 sb.append(toTableRow("<i>* aggregator is a module with module-info.class only</i>", BR));
481 }
482 if (!totalBytesNote) {
483 totalBytesNote = true;
484 sb.append(blankRow());
485 sb.append(toTableRow("<i><sup>1</sup>sum of all files including debug files</i>", BR));
486 sb.append(toTableRow("<i><sup>2</sup>sum of direct and indirect dependencies</i>", BR));
487 }
488 sb.append("</table>").append("</td>");
489 return sb.toString();
490 }
491
492 private String moduleName(String mn) {
493 if (aggregator) {
494 StringBuilder sb = new StringBuilder();
495 sb.append(String.format("<tr><td colspan=\"2\"><span class=\"%s\">", AGGREGATOR))
496 .append(mn)
497 .append("</span>").append(" ");
498 if (!aggregatorNote) {
499 sb.append("(aggregator<sup>*</sup>)");
500 } else {
501 sb.append("(aggregator)");
502 }
503 sb.append("</td></tr>");
504 return sb.toString();
505 } else {
506 return toTableRow(mn, MODULE_DEF);
507 }
508 }
509
510 public String requiresColumn() {
511 StringBuilder sb = new StringBuilder();
512 sb.append(String.format("<td>"));
513 boolean footnote = requiresTransitiveNote;
514 ms.descriptor().requires().stream()
515 .sorted(Comparator.comparing(Requires::name))
635 }
636 builder.data(bytes);
637 return builder.build();
638 }
639
640 class TableDataBuilder {
641 private final StringBuilder sb;
642 TableDataBuilder() {
643 this.sb = new StringBuilder("<tr>");
644 }
645 TableDataBuilder data(String s) {
646 data(BR, s);
647 return this;
648 }
649 TableDataBuilder data(long num) {
650 data(NUMBER, String.format("%,d", num));
651 return this;
652 }
653 TableDataBuilder colspan(Selector selector, int columns, String data) {
654 sb.append("<td colspan=\"").append(columns).append("\">");
655 sb.append("<span class=\"").append(selector).append("\">");
656 sb.append(data).append("</span></td>");
657 return this;
658 }
659
660 TableDataBuilder data(Selector selector, String data) {
661 sb.append("<td class=\"").append(selector).append("\">");
662 sb.append(data).append("</td>");
663 return this;
664 }
665 String build() {
666 sb.append("</tr>");
667 return sb.toString();
668 }
669 }
670 }
671
672 private static final String[] STYLES = new String[]{
673 "<link rel=\"stylesheet\" type=\"text/css\" href=\"/.fonts/dejavu.css\"/>",
674 "<style type=\"text/css\">",
675 " HTML, BODY, DIV, SPAN, APPLET, OBJECT, IFRAME, H1, H2, H3, H4, H5, H6, P,",
|