gnodet commented on PR #1726:
URL: https://github.com/apache/maven/pull/1726#issuecomment-2376661550

   > > So even if we have a smarter api, we'll need stable artifacts during a 
build, else we'll loose any possibility of optimisation.
   > 
   > My idea was to ensure that "stable artifacts" means "not rewritten" rather 
than "rewritten identically", in which case the situation (for the purpose of 
optimization) become equivalent to reproducible build.
   
   Yes, that would be better.  Again, if you run `mvn -DskipTests package`, the 
artifacts are stable as in "not rewritten".  This is done by either plugins not 
doing anything, or by plugins leveraging a caching output stream which actually 
skip any writes if writing the same thing, actually leading to no writes to 
disk at all.  It cascades down to the jars.  This is definitely not perfect, as 
any plugin which does not respect these rules may cause a cascading effect in 
the whole build.  But whatever method you use would lead to the same effect.
   
   > > Try it on maven. Just run mvn -DskipTests package multiple times. No 
jars will be modified.
   > 
   > In that case, we are already close to above-mentioned equivalence, isn't 
it? If the optimization doesn't work yet, in my understanding on the compiler 
plugin side, it seems to be a bug (the change detection algorithm in 
"incremental compilation" is comparing relative paths against absolute paths, 
thus always thinks that there is changes). Therefore, reproducible build would 
be a workaround for such bugs rather than something fundamentally needed for 
optimization. But the same workaround would work with semantic equivalence if 
we compute the SHA1 on ZIP entries instead of the ZIP file (admittedly maybe 
not using standard Unix tools).
   
   The compiler plugin checks the timestamps of the dependencies and if 
anything changed, it will recompile all the classes.  This is the only way to 
ensure a valid output.  The plugin has no knowledge of any kind of 
"equivalence".  While this is doable, I don't see the real benefits if we can 
already have the same without having to unzip/sha1 all the class path (for the 
compiler).
   
   That said, we still have the following PR which we could use to get a 
smarter computation and allow plugins to more easily skip parts of their work 
(and not only all or none): https://github.com/apache/maven/pull/1118
   
   > 
   > Note: I'm all in favour of the _goals_ behind reproducible builds. I just 
think that throwing away metadata like timestamps is going a bit too far, and 
that semantic equivalence as Microsoft and Eclipse Tycho do would allow us to 
have the best of both worlds.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to