Skip to content

Commit

Permalink
[MSITE-997] Non-localized site directory DocumentRenderingContext passed
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-o committed Dec 14, 2023
1 parent fdb02ab commit 5488257
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,17 @@ protected Map<String, MavenReport> locateReports(
getLog().info("Skipped \"" + report.getName(locale) + "\" report" + reportMojoInfo + ", file \""
+ filename + "\" already exists.");
} else {
File localizedSiteDirectory;
if (!locale.equals(SiteTool.DEFAULT_LOCALE)) {
localizedSiteDirectory = new File(siteDirectory, locale.toString());
} else {
localizedSiteDirectory = siteDirectory;
}
String generator = mavenReportExecution.getGoal() == null
? null
: mavenReportExecution.getPlugin().getId() + ':' + mavenReportExecution.getGoal();
DocumentRenderingContext docRenderingContext =
new DocumentRenderingContext(siteDirectory, outputName, generator);
new DocumentRenderingContext(localizedSiteDirectory, outputName, generator);
DocumentRenderer docRenderer =
new ReportDocumentRenderer(mavenReportExecution, docRenderingContext, getLog());
documents.put(filename, docRenderer);
Expand Down Expand Up @@ -428,13 +434,20 @@ protected Map<String, DocumentRenderer> locateDocuments(
siteTool.populateReportsMenu(context.getSiteModel(), locale, categories);
populateReportItems(context.getSiteModel(), locale, reportsByOutputName);

File localizedSiteDirectory;
if (!locale.equals(SiteTool.DEFAULT_LOCALE)) {
localizedSiteDirectory = new File(siteDirectory, locale.toString());
} else {
localizedSiteDirectory = siteDirectory;
}

if (categories.containsKey(MavenReport.CATEGORY_PROJECT_INFORMATION) && generateProjectInfo) {
// add "Project Information" category summary document
List<MavenReport> categoryReports = categories.get(MavenReport.CATEGORY_PROJECT_INFORMATION);
MojoExecution subMojoExecution =
new MojoExecution(mojoExecution.getPlugin(), "project-info", mojoExecution.getExecutionId());
DocumentRenderingContext docRenderingContext = new DocumentRenderingContext(
siteDirectory,
localizedSiteDirectory,
subMojoExecution.getGoal(),
subMojoExecution.getPlugin().getId() + ':' + subMojoExecution.getGoal());
String title = i18n.getString("site-plugin", locale, "report.information.title");
Expand All @@ -457,7 +470,7 @@ protected Map<String, DocumentRenderer> locateDocuments(
MojoExecution subMojoExecution =
new MojoExecution(mojoExecution.getPlugin(), "project-reports", mojoExecution.getExecutionId());
DocumentRenderingContext docRenderingContext = new DocumentRenderingContext(
siteDirectory,
localizedSiteDirectory,
subMojoExecution.getGoal(),
subMojoExecution.getPlugin().getId() + ':' + subMojoExecution.getGoal());
String title = i18n.getString("site-plugin", locale, "report.project.title");
Expand All @@ -478,7 +491,7 @@ protected Map<String, DocumentRenderer> locateDocuments(
MojoExecution subMojoExecution =
new MojoExecution(mojoExecution.getPlugin(), "sitemap", mojoExecution.getExecutionId());
DocumentRenderingContext docRenderingContext = new DocumentRenderingContext(
siteDirectory,
localizedSiteDirectory,
subMojoExecution.getGoal(),
subMojoExecution.getPlugin().getId() + ':' + subMojoExecution.getGoal());
String title = i18n.getString("site-plugin", locale, "site.sitemap.title");
Expand Down

0 comments on commit 5488257

Please sign in to comment.