Fix backwards compatibility with pre-Java11 build-tools users (#45633)

This commit is contained in:
Mark Vieira 2019-08-15 18:39:11 -07:00 committed by GitHub
parent a635eca5f8
commit 1f6cd5c6e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 11 deletions

View File

@ -71,12 +71,6 @@ sourceSets {
minimumRuntime { }
}
allprojects {
apply plugin: 'java'
targetCompatibility = 11
sourceCompatibility = 11
}
configurations {
reaper
}
@ -160,8 +154,8 @@ if (project != rootProject) {
apply plugin: 'nebula.maven-scm'
allprojects {
targetCompatibility = 11
sourceCompatibility = 11
targetCompatibility = 10
sourceCompatibility = 10
}
// groovydoc succeeds, but has some weird internal exception...

View File

@ -1,3 +1,5 @@
apply plugin: 'java'
jar {
archiveName = "${project.name}.jar"
manifest {

View File

@ -24,6 +24,7 @@ import org.gradle.api.GradleException;
import org.gradle.api.logging.Logger;
import org.gradle.internal.jvm.Jvm;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -31,6 +32,7 @@ import java.io.UncheckedIOException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -68,8 +70,8 @@ public class ReaperService {
public void registerCommand(String serviceId, String... command) {
ensureReaperStarted();
try {
Files.writeString(getCmdFile(serviceId), String.join(" ", command));
try (FileWriter writer = new FileWriter(getCmdFile(serviceId).toFile())) {
writer.write(String.join(" ", command));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
@ -143,7 +145,7 @@ public class ReaperService {
if (matcher.matches()) {
String path = matcher.group(1);
return Path.of(
return Paths.get(
OS.<String>conditional()
.onWindows(() -> path.substring(1))
.onUnix(() -> path)