Explicity set permissions on files in lib of Boot distribution

Previously, only the permissions for the scripts in bin/ were set. The
permissions for the files in lib/ were not explicity set, leaving them
with the same permissions as the source files in Gradle's cache. This
has proven to be a little brittle when building in certain
environments, leading to test failures. It also assumes that the
file permissions in Gradle's cache will be appropriate for entries in
a distribution archive. That may not always be a reasonable assumption
to make.

To avoid the above-described problems, this commit updates the copy
spec that's used to add files to lib/ in the archive so that each
file uses 0644 for its permissions.

Closes gh-14158
pull/14583/merge
Andy Wilkinson 6 years ago
parent 1b10d3fcbf
commit cf24d18139

@ -66,10 +66,11 @@ final class ApplicationPluginAction implements PluginApplicationAction {
.fromString(loadResource("/windowsStartScript.txt"))); .fromString(loadResource("/windowsStartScript.txt")));
project.getConfigurations().all((configuration) -> { project.getConfigurations().all((configuration) -> {
if ("bootArchives".equals(configuration.getName())) { if ("bootArchives".equals(configuration.getName())) {
distribution.getContents() CopySpec libCopySpec = project.copySpec().into("lib")
.with(project.copySpec().into("lib") .from((Callable<FileCollection>) () -> configuration
.from((Callable<FileCollection>) () -> configuration .getArtifacts().getFiles());
.getArtifacts().getFiles())); libCopySpec.setFileMode(0644);
distribution.getContents().with(libCopySpec);
bootStartScripts.setClasspath(configuration.getArtifacts().getFiles()); bootStartScripts.setClasspath(configuration.getArtifacts().getFiles());
} }
}); });

Loading…
Cancel
Save