Class JGitBuildTimestampProvider
java.lang.Object
org.eclipse.tycho.extras.buildtimestamp.jgit.JGitBuildTimestampProvider
- All Implemented Interfaces:
BuildTimestampProvider
@Component(role=org.eclipse.tycho.build.BuildTimestampProvider.class,
hint="jgit")
public class JGitBuildTimestampProvider
extends Object
implements BuildTimestampProvider
Build timestamp provider that returns date of the most recent git commit that
touches any file under project basedir. Because this timestamp provider is
meant to be used for reproducible builds, by default an exception is thrown
if
git status is not clean (i.e. uncommitted changes are
detected).
If uncommitted changes should be tolerated with a warning, configure
<jgit.dirtyWorkingTree>warning</jgit.dirtyWorkingTree>In this case, this timestamp provider will delegate to the default timestamp provider which uses the current build timestamp. For additional flexibility, some files can be ignored using gitignore patterns specified in <jgit.ignore> element of tycho-packaging-plugin configuration block.
Typical usage
...
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho-version}</version>
<dependencies>
<dependency>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-buildtimestamp-jgit</artifactId>
<version>${tycho-version}</version>
</dependency>
</dependencies>
<configuration>
<timestampProvider>jgit</timestampProvider>
<jgit.ignore>pom.xml</jgit.ignore>
</configuration>
</plugin>
...
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetTimestamp(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project, org.apache.maven.plugin.MojoExecution execution) voidsetQuiet(boolean quiet)
-
Constructor Details
-
JGitBuildTimestampProvider
public JGitBuildTimestampProvider()
-
-
Method Details
-
getTimestamp
public Date getTimestamp(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project, org.apache.maven.plugin.MojoExecution execution) throws org.apache.maven.plugin.MojoExecutionException - Specified by:
getTimestampin interfaceBuildTimestampProvider- Throws:
org.apache.maven.plugin.MojoExecutionException
-
setQuiet
public void setQuiet(boolean quiet) - Specified by:
setQuietin interfaceBuildTimestampProvider
-