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
@@ -24,7 +24,7 @@
|
|||||||
src_roots = java, resources
|
src_roots = java, resources
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
ignore = .git
|
ignore = .git, eclipse-out
|
||||||
|
|
||||||
[cache]
|
[cache]
|
||||||
mode = dir
|
mode = dir
|
||||||
|
@@ -1 +1 @@
|
|||||||
1b03b4313b91b634bd604fc3487a05f877e59dee
|
6659a474fb2ba6e921bb38c1b55d4c9ba6073cfa
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -15,6 +15,7 @@
|
|||||||
/.buckd
|
/.buckd
|
||||||
/buck-cache
|
/buck-cache
|
||||||
/buck-out
|
/buck-out
|
||||||
|
/eclipse-out
|
||||||
/extras
|
/extras
|
||||||
/local.properties
|
/local.properties
|
||||||
*.pyc
|
*.pyc
|
||||||
|
@@ -32,6 +32,7 @@ import java.net.URL;
|
|||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.nio.file.FileSystem;
|
import java.nio.file.FileSystem;
|
||||||
import java.nio.file.FileSystems;
|
import java.nio.file.FileSystems;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.security.CodeSource;
|
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.
|
* Locate the path of the {@code buck-out} directory in a source tree.
|
||||||
*
|
*
|
||||||
* @throws FileNotFoundException if the directory cannot be found.
|
* @throws FileNotFoundException if the directory cannot be found.
|
||||||
*/
|
*/
|
||||||
public static Path getDeveloperBuckOut() throws FileNotFoundException {
|
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;
|
Class<GerritLauncher> self = GerritLauncher.class;
|
||||||
URL u = self.getResource(self.getSimpleName() + ".class");
|
URL u = self.getResource(self.getSimpleName() + ".class");
|
||||||
if (u == null) {
|
if (u == null) {
|
||||||
@@ -622,30 +637,32 @@ public final class GerritLauncher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!"file".equals(u.getProtocol())) {
|
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());
|
Path dir = Paths.get(u.getPath());
|
||||||
while (!name(dir).equals("buck-out")) {
|
while (!Files.isRegularFile(dir.resolve(".buckconfig"))) {
|
||||||
Path parent = dir.getParent();
|
Path parent = dir.getParent();
|
||||||
if (parent == null || parent.equals(dir)) {
|
if (parent == null) {
|
||||||
throw new FileNotFoundException("Cannot find buck-out from " + u);
|
throw new FileNotFoundException("Cannot find source root from " + u);
|
||||||
}
|
}
|
||||||
dir = parent;
|
dir = parent;
|
||||||
}
|
}
|
||||||
return dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String name(Path dir) {
|
Path ret = dir.resolve(name);
|
||||||
return dir.getFileName().toString();
|
if (!Files.exists(ret)) {
|
||||||
|
throw new FileNotFoundException(
|
||||||
|
name + " not found in source root " + dir);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ClassLoader useDevClasspath()
|
private static ClassLoader useDevClasspath()
|
||||||
throws MalformedURLException, FileNotFoundException {
|
throws MalformedURLException, FileNotFoundException {
|
||||||
Path out = getDeveloperBuckOut();
|
Path out = getDeveloperEclipseOut();
|
||||||
List<URL> dirs = new ArrayList<>();
|
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();
|
ClassLoader cl = GerritLauncher.class.getClassLoader();
|
||||||
for (URL u : ((URLClassLoader) cl).getURLs()) {
|
for (URL u : ((URLClassLoader) cl).getURLs()) {
|
||||||
if (includeJar(u)) {
|
if (includeJar(u)) {
|
||||||
|
@@ -2,7 +2,12 @@ include_defs('//lib/js.defs')
|
|||||||
|
|
||||||
WCT_TEST_PATTERNS = ['test/**']
|
WCT_TEST_PATTERNS = ['test/**']
|
||||||
PY_TEST_PATTERNS = ['polygerrit_wct_tests.py']
|
PY_TEST_PATTERNS = ['polygerrit_wct_tests.py']
|
||||||
APP_SRCS = glob(['**'], excludes = WCT_TEST_PATTERNS + PY_TEST_PATTERNS)
|
APP_SRCS = glob(
|
||||||
|
['**'],
|
||||||
|
excludes = [
|
||||||
|
'BUCK',
|
||||||
|
'index.html',
|
||||||
|
] + WCT_TEST_PATTERNS + PY_TEST_PATTERNS)
|
||||||
|
|
||||||
WEBJS = 'bower_components/webcomponentsjs/webcomponents-lite.js'
|
WEBJS = 'bower_components/webcomponentsjs/webcomponents-lite.js'
|
||||||
|
|
||||||
|
@@ -27,7 +27,6 @@ from multiprocessing import cpu_count
|
|||||||
# Set defaults on java rules:
|
# Set defaults on java rules:
|
||||||
# - Add AutoValue annotation processing support.
|
# - Add AutoValue annotation processing support.
|
||||||
# - Treat source files as UTF-8.
|
# - Treat source files as UTF-8.
|
||||||
# - std_out_log_level = info (the default is too spammy)
|
|
||||||
|
|
||||||
_buck_java_library = java_library
|
_buck_java_library = java_library
|
||||||
def java_library(*args, **kwargs):
|
def java_library(*args, **kwargs):
|
||||||
@@ -37,9 +36,9 @@ def java_library(*args, **kwargs):
|
|||||||
_buck_java_test = java_test
|
_buck_java_test = java_test
|
||||||
def java_test(*args, **kwargs):
|
def java_test(*args, **kwargs):
|
||||||
_munge_args(kwargs)
|
_munge_args(kwargs)
|
||||||
_do_not_spam_std_out(kwargs)
|
|
||||||
_buck_java_test(*args, **kwargs)
|
_buck_java_test(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
# Munge kwargs to set Gerrit-specific defaults.
|
# Munge kwargs to set Gerrit-specific defaults.
|
||||||
def _munge_args(kwargs):
|
def _munge_args(kwargs):
|
||||||
_set_auto_value(kwargs)
|
_set_auto_value(kwargs)
|
||||||
@@ -57,11 +56,6 @@ def _set_extra_arguments(kwargs):
|
|||||||
|
|
||||||
extra_args.extend(['-encoding', 'UTF-8'])
|
extra_args.extend(['-encoding', 'UTF-8'])
|
||||||
|
|
||||||
def _do_not_spam_std_out(kwargs):
|
|
||||||
level = 'std_out_log_level'
|
|
||||||
if level not in kwargs:
|
|
||||||
kwargs[level] = 'INFO'
|
|
||||||
|
|
||||||
def _set_auto_value(kwargs):
|
def _set_auto_value(kwargs):
|
||||||
apk = 'annotation_processors'
|
apk = 'annotation_processors'
|
||||||
if apk not in kwargs:
|
if apk not in kwargs:
|
||||||
|
@@ -76,7 +76,7 @@ def gen_plugin_classpath(root):
|
|||||||
if path.exists(path.join(root, 'src', 'test', 'java')):
|
if path.exists(path.join(root, 'src', 'test', 'java')):
|
||||||
testpath = """
|
testpath = """
|
||||||
<classpathentry kind="src" path="src/test/java"\
|
<classpathentry kind="src" path="src/test/java"\
|
||||||
out="buck-out/eclipse/test"/>"""
|
out="eclipse-out/test"/>"""
|
||||||
else:
|
else:
|
||||||
testpath = ""
|
testpath = ""
|
||||||
print("""\
|
print("""\
|
||||||
@@ -85,7 +85,7 @@ def gen_plugin_classpath(root):
|
|||||||
<classpathentry kind="src" path="src/main/java"/>%(testpath)s
|
<classpathentry kind="src" path="src/main/java"/>%(testpath)s
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/gerrit"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/gerrit"/>
|
||||||
<classpathentry kind="output" path="buck-out/eclipse/classes"/>
|
<classpathentry kind="output" path="eclipse-out/classes"/>
|
||||||
</classpath>""" % {"testpath": testpath}, file=fd)
|
</classpath>""" % {"testpath": testpath}, file=fd)
|
||||||
|
|
||||||
def gen_classpath():
|
def gen_classpath():
|
||||||
@@ -141,12 +141,12 @@ def gen_classpath():
|
|||||||
out = None
|
out = None
|
||||||
|
|
||||||
if s.startswith('lib/'):
|
if s.startswith('lib/'):
|
||||||
out = 'buck-out/eclipse/lib'
|
out = 'eclipse-out/lib'
|
||||||
elif s.startswith('plugins/'):
|
elif s.startswith('plugins/'):
|
||||||
if args.plugins:
|
if args.plugins:
|
||||||
plugins.add(s)
|
plugins.add(s)
|
||||||
continue
|
continue
|
||||||
out = 'buck-out/eclipse/' + s
|
out = 'eclipse-out/' + s
|
||||||
|
|
||||||
p = path.join(s, 'java')
|
p = path.join(s, 'java')
|
||||||
if path.exists(p):
|
if path.exists(p):
|
||||||
@@ -158,7 +158,7 @@ def gen_classpath():
|
|||||||
if out:
|
if out:
|
||||||
o = out + '/' + env
|
o = out + '/' + env
|
||||||
elif env == 'test':
|
elif env == 'test':
|
||||||
o = 'buck-out/eclipse/test'
|
o = 'eclipse-out/test'
|
||||||
|
|
||||||
for srctype in ['java', 'resources']:
|
for srctype in ['java', 'resources']:
|
||||||
p = path.join(s, 'src', env, srctype)
|
p = path.join(s, 'src', env, srctype)
|
||||||
@@ -179,10 +179,10 @@ def gen_classpath():
|
|||||||
for s in sorted(gwt_src):
|
for s in sorted(gwt_src):
|
||||||
p = path.join(ROOT, s, 'src', 'main', 'java')
|
p = path.join(ROOT, s, 'src', 'main', 'java')
|
||||||
if path.exists(p):
|
if path.exists(p):
|
||||||
classpathentry('lib', p, out='buck-out/eclipse/gwtsrc')
|
classpathentry('lib', p, out='eclipse-out/gwtsrc')
|
||||||
|
|
||||||
classpathentry('con', JRE)
|
classpathentry('con', JRE)
|
||||||
classpathentry('output', 'buck-out/eclipse/classes')
|
classpathentry('output', 'eclipse-out/classes')
|
||||||
|
|
||||||
p = path.join(ROOT, '.classpath')
|
p = path.join(ROOT, '.classpath')
|
||||||
with open(p, 'w') as fd:
|
with open(p, 'w') as fd:
|
||||||
|
Reference in New Issue
Block a user