3232import io .papermc .codebook .config .CodeBookUriResource ;
3333import io .papermc .codebook .config .CodeBookVersionInput ;
3434import io .papermc .codebook .exceptions .UserErrorException ;
35+ import io .papermc .codebook .report .ReportType ;
36+ import io .papermc .codebook .report .Reports ;
3537import io .papermc .codebook .util .Downloader ;
3638import java .io .IOException ;
3739import java .net .URI ;
3840import java .nio .file .Files ;
3941import java .nio .file .Path ;
4042import java .util .List ;
43+ import java .util .Set ;
4144import java .util .concurrent .Callable ;
4245import java .util .function .Function ;
4346import java .util .zip .ZipFile ;
5962 usageHelpAutoWidth = true )
6063public final class Main implements Callable <Integer > {
6164
65+ @ CommandLine .ArgGroup (multiplicity = "1" , exclusive = false )
66+ private @ Nullable ReportOptions reports ;
67+
68+ static final class ReportOptions {
69+
70+ @ CommandLine .Option (
71+ names = "--reports-dir" ,
72+ paramLabel = "<reports-dir>" ,
73+ description = "Parent directory to output any generated reports" ,
74+ hidden = true )
75+ private @ Nullable Path reportsDir ;
76+
77+ @ CommandLine .ArgGroup (multiplicity = "1" )
78+ private SelectedReports selectedReports ;
79+
80+ static final class SelectedReports {
81+
82+ @ CommandLine .Option (
83+ names = "--report" ,
84+ paramLabel = "<report>" ,
85+ description = "Set of report types to generate" ,
86+ hidden = true )
87+ private Set <ReportType > reports ;
88+
89+ @ CommandLine .Option (
90+ names = "--all-reports" ,
91+ paramLabel = "<all-reports>" ,
92+ description = "Generate all reports" ,
93+ hidden = true )
94+ private boolean allReports ;
95+ }
96+ }
97+
6298 @ CommandLine .ArgGroup (
6399 multiplicity = "1" ,
64100 heading = "%n%nThe remapper must be an executable tiny-remapper jar. "
@@ -86,13 +122,6 @@ static final class RemapperOptions {
86122 description =
87123 "A download URL for the executable AutoRenamingTool jar to use for the remapping process." )
88124 private @ Nullable URI remapperUri ;
89-
90- @ CommandLine .Option (
91- names = "--log-missing-lvt-suggestions" ,
92- paramLabel = "<log-missing-lvt-suggestions>" ,
93- description = "Include a report of missing lvt name suggestions in the remapping log" ,
94- hidden = true )
95- private boolean logMissingLvtSuggestions ;
96125 }
97126
98127 @ CommandLine .ArgGroup (
@@ -421,6 +450,17 @@ private CodeBookContext createContext() {
421450 return new Coords (c .constantsCoords , "constants" , null , this .unpickMavenBaseUrl );
422451 });
423452
453+ @ Nullable Reports reports = null ;
454+ if (this .reports != null && this .reports .reportsDir != null ) {
455+ final Set <ReportType > reportsToGenerate ;
456+ if (this .reports .selectedReports .allReports ) {
457+ reportsToGenerate = Set .of (ReportType .values ());
458+ } else {
459+ reportsToGenerate = this .reports .selectedReports .reports ;
460+ }
461+ reports = new Reports (this .reports .reportsDir , reportsToGenerate );
462+ }
463+
424464 return CodeBookContext .builder ()
425465 .remapperJar (remapper )
426466 .mappings (mappings )
@@ -430,7 +470,7 @@ private CodeBookContext createContext() {
430470 .outputJar (this .outputJar )
431471 .overwrite (this .forceWrite )
432472 .input (input )
433- .logMissingLvtSuggestions ( this . remapper . logMissingLvtSuggestions )
473+ .reports ( reports )
434474 .build ();
435475 }
436476
0 commit comments