Merge branch '2.0.x'

pull/14420/head
Andy Wilkinson 6 years ago
commit e4b9316613

@ -80,7 +80,7 @@ final class ApplicationPluginAction implements PluginApplicationAction {
bootStartScripts.getConventionMapping().map("defaultJvmOpts",
applicationConvention::getApplicationDefaultJvmArgs);
CopySpec binCopySpec = project.copySpec().into("bin").from(bootStartScripts);
binCopySpec.setFileMode(0x755);
binCopySpec.setFileMode(0755);
distribution.getContents().with(binCopySpec);
}

@ -39,7 +39,7 @@ import org.springframework.boot.gradle.testkit.GradleBuild;
public final class GradleCompatibilitySuite extends Suite {
private static final List<String> GRADLE_VERSIONS = Arrays.asList("default", "4.1",
"4.2", "4.3", "4.4.1", "4.5.1", "4.6", "4.7", "4.8.1", "4.9");
"4.2", "4.3", "4.4.1", "4.5.1", "4.6", "4.7", "4.8.1", "4.9", "4.10");
public GradleCompatibilitySuite(Class<?> clazz) throws InitializationError {
super(clazz, createRunners(clazz));

@ -22,6 +22,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.function.Consumer;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@ -156,6 +157,26 @@ public class ApplicationPluginActionIntegrationTests {
"custom-boot/bin/custom.bat");
}
@Test
public void scriptsHaveCorrectPermissions() throws IOException {
assertThat(
this.gradleBuild.build("bootDistTar").task(":bootDistTar").getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
String name = this.gradleBuild.getProjectDir().getName();
File distribution = new File(this.gradleBuild.getProjectDir(),
"build/distributions/" + name + "-boot.tar");
assertThat(distribution).isFile();
tarEntries(distribution, (entry) -> {
int filePermissions = entry.getMode() & 0777;
if (entry.isFile() && !entry.getName().startsWith(name + "-boot/bin/")) {
assertThat(filePermissions).isEqualTo(0644);
}
else {
assertThat(filePermissions).isEqualTo(0755);
}
});
}
private List<String> zipEntryNames(File distribution) throws IOException {
List<String> entryNames = new ArrayList<>();
try (ZipFile zipFile = new ZipFile(distribution)) {
@ -179,4 +200,15 @@ public class ApplicationPluginActionIntegrationTests {
return entryNames;
}
private void tarEntries(File distribution, Consumer<TarArchiveEntry> consumer)
throws IOException {
try (TarArchiveInputStream input = new TarArchiveInputStream(
new FileInputStream(distribution))) {
TarArchiveEntry entry;
while ((entry = input.getNextTarEntry()) != null) {
consumer.accept(entry);
}
}
}
}

@ -0,0 +1,13 @@
buildscript {
dependencies {
classpath files(pluginClasspath.split(','))
}
}
apply plugin: 'org.springframework.boot'
apply plugin: 'application'
apply plugin: 'java'
bootJar {
mainClassName = 'com.example.ExampleApplication'
}
Loading…
Cancel
Save