@@ -195,19 +195,14 @@ private void compareWithReference(Map<Artifact, String> artifacts, File referenc
195195 int missing = reference .size () / 3 /* 3 property keys par file: filename, length and checksums.sha512 */ ;
196196
197197 if (ko + missing > 0 ) {
198- getLog ().error ("Reproducible Build output summary : "
199- + MessageUtils .buffer ().success (ok + " files ok " )
200- + ", " + MessageUtils .buffer ().failure (ko + " different " )
198+ getLog ().error ("[ Reproducible Builds] rebuild comparison result : "
199+ + MessageUtils .buffer ().success (ok + " files match " )
200+ + ", " + MessageUtils .buffer ().failure (ko + " differ " )
201201 + ((missing == 0 ) ? "" : (", " + MessageUtils .buffer ().failure (missing + " missing" )))
202202 + ((ignored .isEmpty ()) ? "" : (", " + MessageUtils .buffer ().warning (ignored .size () + " ignored" ))));
203- getLog ().error ("see "
204- + MessageUtils .buffer ()
205- .project ("diff " + relative (referenceBuildinfo ) + " " + relative (buildinfoFile ))
206- .build ());
207- getLog ().error ("see also https://maven.apache.org/guides/mini/guide-reproducible-builds.html" );
208203 } else {
209- getLog ().info ("Reproducible Build output summary : "
210- + MessageUtils .buffer ().success (ok + " files ok " )
204+ getLog ().info ("[ Reproducible Builds] rebuild comparison result : "
205+ + MessageUtils .buffer ().success (ok + " files match " )
211206 + ((ignored .isEmpty ()) ? "" : (", " + MessageUtils .buffer ().warning (ignored .size () + " ignored" ))));
212207 }
213208
@@ -243,15 +238,27 @@ private void compareWithReference(Map<Artifact, String> artifacts, File referenc
243238 p .print ("# " );
244239 p .println (diffoscope );
245240 }
246- getLog ().info ("Reproducible Build output comparison saved to " + buildcompare );
247241 } catch (IOException e ) {
248242 throw new MojoExecutionException ("Error creating file " + buildcompare , e );
249243 }
250244
251- copyAggregateToRoot (buildcompare );
245+ String saved = " saved to " + relative (buildcompare );
246+ if (ko + missing > 0 ) {
247+ getLog ().error (saved );
248+ } else {
249+ getLog ().info (saved );
250+ }
251+ buildcompare = copyAggregateToRoot (buildcompare );
252+
253+ if (ko + missing > 0 ) {
254+ getLog ().error ("[Reproducible Builds] to analyze the differences, see diffoscope instructions in "
255+ + relative (buildcompare ));
256+ getLog ().error (
257+ " see also https://maven.apache.org/guides/mini/guide-reproducible-builds.html" );
252258
253- if (fail && (ko + missing > 0 )) {
254- throw new MojoExecutionException ("Build artifacts are different from reference" );
259+ if (fail ) {
260+ throw new MojoExecutionException ("Rebuilt artifacts are different from reference" );
261+ }
255262 }
256263 }
257264
@@ -300,13 +307,6 @@ private String getRepositoryFilename(Artifact a) {
300307 return path .substring (path .lastIndexOf ('/' ));
301308 }
302309
303- private String relative (File file ) {
304- File basedir = session .getTopLevelProject ().getBasedir ();
305- int length = basedir .getPath ().length ();
306- String path = file .getPath ();
307- return path .substring (length + 1 );
308- }
309-
310310 private static String findPrefix (Properties reference , String actualGroupId , String actualFilename ) {
311311 for (String name : reference .stringPropertyNames ()) {
312312 if (name .endsWith (".filename" ) && actualFilename .equals (reference .getProperty (name ))) {
0 commit comments