Skip to content

Commit

Permalink
[MSITE-973] Have ${project.build.outputTimestamp} injected as @parameter
Browse files Browse the repository at this point in the history


This closes #158
  • Loading branch information
michael-o committed Jul 20, 2024
1 parent 83a0634 commit 2fdfa66
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.site.descriptor.AbstractSiteDescriptorMojo;
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.MavenReport;
import org.apache.maven.reporting.MavenReportException;
import org.apache.maven.reporting.exec.MavenReportExecution;
Expand Down Expand Up @@ -167,6 +166,16 @@ public abstract class AbstractSiteRenderingMojo extends AbstractSiteDescriptorMo
@Parameter(property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}")
private String outputEncoding;

/**
* Timestamp for reproducible output archive entries, either formatted as ISO 8601
* <code>yyyy-MM-dd'T'HH:mm:ssXXX</code> or as an int representing seconds since the epoch (like
* <a href="https://reproducible-builds.org/docs/source-date-epoch/">SOURCE_DATE_EPOCH</a>).
*
* @since 3.9.0
*/
@Parameter(defaultValue = "${project.build.outputTimestamp}")
protected String outputTimestamp;

@Component
protected MavenReportExecutor mavenReportExecutor;

Expand Down Expand Up @@ -299,8 +308,6 @@ protected SiteRenderingContext createSiteRenderingContext(Locale locale)
}

// Add publish date
MavenProject p = attributes.get("project") != null ? (MavenProject) attributes.get("project") : project;
String outputTimestamp = p.getProperties().getProperty("project.build.outputTimestamp");
MavenArchiver.parseBuildOutputTimestamp(outputTimestamp).ifPresent(v -> {
context.setPublishDate(Date.from(v));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,6 @@ public class SiteJarMojo extends SiteMojo {
@Parameter
private String[] archiveExcludes;

/**
* Timestamp for reproducible output archive entries, either formatted as ISO 8601
* <code>yyyy-MM-dd'T'HH:mm:ssXXX</code> or as an int representing seconds since the epoch (like
* <a href="https://reproducible-builds.org/docs/source-date-epoch/">SOURCE_DATE_EPOCH</a>).
*
* @since 3.9.0
*/
@Parameter(defaultValue = "${project.build.outputTimestamp}")
private String outputTimestamp;

/**
* @see org.apache.maven.plugin.Mojo#execute()
*/
Expand Down

0 comments on commit 2fdfa66

Please sign in to comment.