Skip to content

Commit

Permalink
[FELIX-6469] activate Reproducible Builds with outputTimestamp property
Browse files Browse the repository at this point in the history
  • Loading branch information
hboutemy committed Nov 9, 2021
1 parent be53703 commit 957e5c9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
9 changes: 3 additions & 6 deletions tools/maven-bundle-plugin/src/it/reproducible/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ under the License.
<artifactId>reproducible</artifactId>
<version>1-SNAPSHOT</version>
<packaging>bundle</packaging>
<properties>
<project.build.outputTimestamp>1</project.build.outputTimestamp>
</properties>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
Expand All @@ -43,12 +46,6 @@ under the License.
<artifactId>maven-bundle-plugin</artifactId>
<version>@project.version@</version>
<extensions>true</extensions>
<configuration>
<instructions>
<!--_removeheaders>Build-Jdk,Built-By</_removeheaders-->
<_reproducible>true</_reproducible>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,16 @@ public class BundlePlugin extends AbstractMojo
@Parameter( defaultValue = "${session}", readonly = true, required = true )
private MavenSession m_mavenSession;

/**
* 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 5.1.3
*/
@Parameter( defaultValue = "${project.build.outputTimestamp}" )
private String outputTimestamp;

@Component
protected BuildContext buildContext;

Expand Down Expand Up @@ -367,7 +377,7 @@ public void execute() throws MojoExecutionException

try
{
execute( instructions, getClasspath( project) );
execute( instructions, getClasspath( project ) );
}
catch ( IOException e )
{
Expand Down Expand Up @@ -533,6 +543,11 @@ protected Builder getOSGiBuilder( MavenProject currentProject, Map<String, Strin
properties.putAll( getDefaultProperties( currentProject ) );
properties.putAll( transformDirectives( originalInstructions ) );

if ( new MavenArchiver().parseOutputTimestamp( outputTimestamp ) != null )
{
properties.put( "-reproducible", "true" );
}

// process overrides from project
final Map<String, String> addProps = new HashMap<>();
for ( Entry<Object, Object> entry : currentProject.getProperties().entrySet() )
Expand Down

0 comments on commit 957e5c9

Please sign in to comment.