com-lihaoyi / mill

Your shiny new Java/Scala build tool!
https://mill-build.com/
MIT License
2k stars 308 forks source link

Detect assemblies with too many entries to fail shell script prepending #3140

Closed lefou closed 2 months ago

lefou commented 2 months ago

This is an attempt to fix the issue of invalid assembly files which occurs when the following two conditions are met:

The issue was reported and analyzed in the following tickets:

This issue also hits other build tools, but it seems Mill is the only tools which automatically enables shell script prepending by default.

Since there is no real fix available, we simply try to detect the issue after the fact and fail the assemble task with a actionable error message.

To make the fix binary compatible, I had to deprecated the upstreamAssembly target in favor to the new upstreamAssembly2 target, which returns also the added ZIP entry count. Since this can be a behavioral change when users have overridden the upstreamAssembly target, I also added some warning messages with will detect this at runtime and provide actionable help.