Skip to content

Commit

Permalink
[MSOURCES-123] set archiver reproducible mode earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
hboutemy committed Dec 13, 2019
1 parent 258d666 commit d5b9878
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/it/reproducible/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.

invoker.goals=source:jar deploy:deploy
invoker.goals=remote-resources:process source:jar deploy:deploy
10 changes: 10 additions & 0 deletions src/it/reproducible/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@
<altDeploymentRepository>mine::default::file://${basedir}/target/repo</altDeploymentRepository>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.5</version>
<configuration>
<resourceBundles>
<resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle>
</resourceBundles>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
2 changes: 1 addition & 1 deletion src/it/reproducible/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ zipFile.close();
String buf = r.toString()
println buf

assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = c505d059e036128fae3fcdd265fa51e14d7ae241" )
assert buf.startsWith( "reproducible-1.0-sources.jar sha1 = 3a3687b063cfc164fbbccd1b9573b4232f540e8a" )
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,6 @@ protected void packageSources( List<MavenProject> theProjects )
}

MavenArchiver archiver = createArchiver();

// configure for Reproducible Builds based on outputTimestamp value
archiver.configureReproducible( outputTimestamp );

for ( MavenProject pItem : theProjects )
{
Expand Down Expand Up @@ -312,6 +309,7 @@ protected void packageSources( List<MavenProject> theProjects )
archiver.setOutputFile( outputFile );
archive.setForced( forceCreation );

getLog().debug( "create archive " + outputFile );
archiver.createArchive( session, project, archive );
}
catch ( IOException e )
Expand Down Expand Up @@ -424,6 +422,10 @@ protected MavenArchiver createArchiver()
archiver.setCreatedBy( "Maven Source Plugin", "org.apache.maven.plugins", "maven-source-plugin" );
archiver.setBuildJdkSpecDefaultEntry( false );


// configure for Reproducible Builds based on outputTimestamp value
archiver.configureReproducible( outputTimestamp );

if ( project.getBuild() != null )
{
List<Resource> resources = project.getBuild().getResources();
Expand Down Expand Up @@ -454,6 +456,7 @@ protected void addDirectory( Archiver archiver, File sourceDirectory, String[] p
{
try
{
getLog().debug( "add directory " + sourceDirectory + " to archiver" );
// archiver.addFileSet( fileSet );
archiver.addDirectory( sourceDirectory, pIncludes, pExcludes );
}
Expand All @@ -477,6 +480,7 @@ protected void addDirectory( Archiver archiver, File sourceDirectory, String pre
{
try
{
getLog().debug( "add directory " + sourceDirectory + " to archiver with prefix " + prefix );
archiver.addDirectory( sourceDirectory, prefix, pIncludes, pExcludes );
}
catch ( ArchiverException e )
Expand Down

0 comments on commit d5b9878

Please sign in to comment.