Update Buck to newest version
The new Buck version fixed annoying stdout spamming bug on unit test failures: [1]. Now we can revert our monkey patching hack to prevent that. Since [2] Buck interferes with files in buck-out directory: [3]. Switch to using eclipse-out directory as Eclipse output directory instead. For this change it's necessary to clean up buck-out directory, otherwise `buck test` would fail. This version also fixed "Python client lost connection" bug: [4]. This reverts commit94e93aaad2
. [1] https://github.com/facebook/buck/issues/505 [2]35cb495b57
[3] https://github.com/facebook/buck/issues/527 [4] https://github.com/facebook/buck/issues/534 Change-Id: I4cd1a99ce9d0615713c235d873e6cdd61b1854bb
This commit is contained in:

committed by
Dave Borowitz

parent
0924ebbc15
commit
58cb4b4881
@@ -32,6 +32,7 @@ import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.CodeSource;
|
||||
@@ -599,13 +600,27 @@ public final class GerritLauncher {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Locate the path of the {@code eclipse-out} directory in a source tree.
|
||||
*
|
||||
* @throws FileNotFoundException if the directory cannot be found.
|
||||
*/
|
||||
public static Path getDeveloperEclipseOut() throws FileNotFoundException {
|
||||
return resolveInSourceRoot("eclipse-out");
|
||||
}
|
||||
|
||||
/**
|
||||
* Locate the path of the {@code buck-out} directory in a source tree.
|
||||
*
|
||||
* @throws FileNotFoundException if the directory cannot be found.
|
||||
*/
|
||||
public static Path getDeveloperBuckOut() throws FileNotFoundException {
|
||||
// Find ourselves in the CLASSPATH, we should be a loose class file.
|
||||
return resolveInSourceRoot("buck-out");
|
||||
}
|
||||
|
||||
private static Path resolveInSourceRoot(String name)
|
||||
throws FileNotFoundException {
|
||||
// Find ourselves in the classpath, as a loose class file or jar.
|
||||
Class<GerritLauncher> self = GerritLauncher.class;
|
||||
URL u = self.getResource(self.getSimpleName() + ".class");
|
||||
if (u == null) {
|
||||
@@ -622,30 +637,32 @@ public final class GerritLauncher {
|
||||
}
|
||||
}
|
||||
if (!"file".equals(u.getProtocol())) {
|
||||
throw new FileNotFoundException("Cannot find extract path from " + u);
|
||||
throw new FileNotFoundException("Cannot extract path from " + u);
|
||||
}
|
||||
|
||||
// Pop up to the top level classes folder that contains us.
|
||||
// Pop up to the top-level source folder by looking for .buckconfig.
|
||||
Path dir = Paths.get(u.getPath());
|
||||
while (!name(dir).equals("buck-out")) {
|
||||
while (!Files.isRegularFile(dir.resolve(".buckconfig"))) {
|
||||
Path parent = dir.getParent();
|
||||
if (parent == null || parent.equals(dir)) {
|
||||
throw new FileNotFoundException("Cannot find buck-out from " + u);
|
||||
if (parent == null) {
|
||||
throw new FileNotFoundException("Cannot find source root from " + u);
|
||||
}
|
||||
dir = parent;
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
private static String name(Path dir) {
|
||||
return dir.getFileName().toString();
|
||||
Path ret = dir.resolve(name);
|
||||
if (!Files.exists(ret)) {
|
||||
throw new FileNotFoundException(
|
||||
name + " not found in source root " + dir);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static ClassLoader useDevClasspath()
|
||||
throws MalformedURLException, FileNotFoundException {
|
||||
Path out = getDeveloperBuckOut();
|
||||
Path out = getDeveloperEclipseOut();
|
||||
List<URL> dirs = new ArrayList<>();
|
||||
dirs.add(out.resolve("eclipse").resolve("classes").toUri().toURL());
|
||||
dirs.add(out.resolve("classes").toUri().toURL());
|
||||
ClassLoader cl = GerritLauncher.class.getClassLoader();
|
||||
for (URL u : ((URLClassLoader) cl).getURLs()) {
|
||||
if (includeJar(u)) {
|
||||
|
Reference in New Issue
Block a user