On Mon, 11 Mar 2024 13:06:55 GMT, Erik Joelsson <er...@openjdk.org> wrote:

>> Why the rm? Because jlink refuses to run if the output dir already exists.
>
> I don't see a race. The `rm` was there in the original code and is no scarier 
> in the modified version. The jdk image is constructed by a combination of 
> targets and recipes. The first one to run has to be jlink, then we overlay 
> more stuff on top. If the makefile dependency resolution concludes that we 
> need to rerun the jlink step, we clear out the directory completely to make 
> sure we aren't leaving anything in there that's no longer valid. This is 
> basically a precaution to guarantee a correct incremental build. It's not 
> incurring a big build time penalty as jlink would have overwritten all files 
> it would have created anyway. However, if a module was removed, or a file was 
> removed from a module, the `rm` helps guarantee that we don't include such a 
> removed file from a previous build attempt in the final image.
> 
> Or it may even be as Severin says, that jlink refuses to run, I don't 
> remember.

Ok, good, thanks. I did not see the whole picture there.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14787#discussion_r1521535618

Reply via email to