Closed mzeijen closed 4 months ago
Hello,
thanks for the PR. Is there a use case behind this PR, e.g. you tried to add an executable file which doesn't turn up executable in the archive?
Yes, in my company we have a application build upon Spring Initializr and we just added new generated shell files that need to be executable. Out of the box these new files are not made executable in the zip/tgz archive as only the Maven and Gradle wrapper scripts are made executable. We had to implement a very ugly hack to get it working.
We would really like to have Spring Initializr to support having any file executable so that we can get rid of the ugly workaround.
FYI: I also created a ticket with Jetbrains regarding their Spring Initializr integration, because Intellij also only makes the Maven and Gradle wrapper scripts executable, even if other files in the archive are executable. Luckily we also have a web GUI that uses our variant of Spring Initializr that is more often used nowadays to generate projects.
Thanks. So my problem with the approach in the PR is that it uses the executable bit from the filesystem to check if the file should be executable in the archive. That means, running that on windows will make every file in the archive executable. I think we should add some other functionality (e.g. archive customizer) to initializr, which supports your use case.
I've opened #1549 for that. Thanks for the PR anyway!
Ah, I hadn't thought of the Windows use-case. I totally agree that this then isn't an acceptable solution.
This change fixes that any file generated with the executable file permission is stored within the tgz or zip archive with executable file permission.
Before this change only Maven and Gradle wrapper scrips would get executable file permission within the archive, even though classes like MultipleResourcesProjectContributor allow for setting the executable file permission on other generated files.