Skip to content

Commit

Permalink
make stuff run if we have no reports
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniDigger committed Jan 14, 2024
1 parent 0e485dc commit cce7c7d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@

public class Reports extends AbstractModule {

@SuppressWarnings({"DataFlowIssue"})
public static final Reports NOOP = new Reports(null, Set.of()) {
@Override
public void generateReports() {
// NO-OP
}

@Override
protected void configure() {
// NO-OP
}
};

private final Path reportsDir;
private final Set<ReportType> typesToGenerate;
private final Map<ReportType, Report> reports;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/papermc/codebook/CodeBook.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import io.papermc.codebook.pages.RemapJarPage;
import io.papermc.codebook.pages.RemapLvtPage;
import io.papermc.codebook.pages.UnpickPage;
import io.papermc.codebook.report.Reports;
import io.papermc.codebook.util.IOUtil;
import java.io.IOException;
import java.nio.file.Files;
Expand Down Expand Up @@ -185,7 +186,8 @@ protected void configure() {
this.bind(CodeBookPage.Report.KEY).toInstance(CodeBook.this.ctx.reports());
this.install(CodeBook.this.ctx.reports());
} else {
this.bind(CodeBookPage.Report.KEY).toProvider(Providers.of(null));
this.bind(CodeBookPage.Report.KEY).toInstance(Reports.NOOP);
this.install(Reports.NOOP);
}
}
};
Expand Down

0 comments on commit cce7c7d

Please sign in to comment.