Update Buck

$DEPS is now funny, it is an unexpanded string using the shell
variable $GEN_DIR. Upstream buck suggests using $(eval echo $DEPS)
to access the string value as $DEPS will not expand to the complete
file paths.

Instead of using eval modify our only use of $DEPS inside of the
GWT compiler helper to replace $GEN_DIR at the start of a string
with the value from the environment.

The JUnit support in Buck was updated recently and PrologTestCase
is being identified as a test to run. Rename its execution method
to prevent it from being identified as a test and push real call
down into the concrete base class.

Change-Id: Ic7e119cd26e72ee95e155e8507785c77b7692acf
diff --git a/.buckversion b/.buckversion
index 16095d3..4b453f2 100644
--- a/.buckversion
+++ b/.buckversion
@@ -1 +1 @@
-902da64779068acd3acb5bc193045ee15a34dc85
+5fc60079d9dbaaf8a1e7d542dcb21fd901f68245
diff --git a/gerrit-server/BUCK b/gerrit-server/BUCK
index c4539f6..f12fac1 100644
--- a/gerrit-server/BUCK
+++ b/gerrit-server/BUCK
@@ -58,13 +58,44 @@
   visibility = ['PUBLIC'],
 )
 
-java_test(
-  name = 'server_tests',
-  srcs = glob(['src/test/java/**/*.java']),
-  resources = glob(['src/test/resources/**/*']),
+PROLOG_TEST_CASE = [
+  'src/test/java/com/google/gerrit/rules/PrologTestCase.java',
+]
+PROLOG_TESTS = glob(
+  ['src/test/java/com/google/gerrit/rules/**/*.java'],
+  excludes = PROLOG_TEST_CASE,
+)
+
+java_library(
+  name = 'prolog_test_case',
+  srcs = PROLOG_TEST_CASE,
   deps = [
     ':server',
+    '//lib:junit',
+    '//lib/guice:guice',
+    '//lib/prolog:prolog-cafe',
+  ],
+  export_deps = True,
+)
+
+java_test(
+  name = 'prolog_tests',
+  srcs = PROLOG_TESTS,
+  resources = glob(['src/test/resources/com/google/gerrit/rules/**/*']),
+  deps = [
+    ':prolog_test_case',
     '//gerrit-server/src/main/prolog:common',
+  ],
+)
+
+java_test(
+  name = 'server_tests',
+  srcs = glob(
+    ['src/test/java/**/*.java'],
+    excludes = PROLOG_TESTS + PROLOG_TEST_CASE
+  ),
+  deps = [
+    ':server',
     '//gerrit-antlr:query_exception',
     '//gerrit-antlr:query_parser',
     '//gerrit-common:server',
diff --git a/gerrit-server/src/test/java/com/google/gerrit/rules/GerritCommonTest.java b/gerrit-server/src/test/java/com/google/gerrit/rules/GerritCommonTest.java
index 4862f2d..6c605d2 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/rules/GerritCommonTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/rules/GerritCommonTest.java
@@ -69,6 +69,10 @@
         new Branch.NameKey(projects.allProjectsName, "master")));
   }
 
+  public void testGerritCommon() {
+    runPrologBasedTests();
+  }
+
   private static LabelValue value(int value, String text) {
     return new LabelValue((short) value, text);
   }
diff --git a/gerrit-server/src/test/java/com/google/gerrit/rules/PrologTestCase.java b/gerrit-server/src/test/java/com/google/gerrit/rules/PrologTestCase.java
index 14ab7d9..4d86596a 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/rules/PrologTestCase.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/rules/PrologTestCase.java
@@ -114,7 +114,7 @@
     return env.execute(Prolog.BUILTIN, "clause", head, new VariableTerm());
   }
 
-  public void testRunPrologTestCases() {
+  public void runPrologBasedTests() {
     int errors = 0;
     long start = System.currentTimeMillis();
 
diff --git a/lib/gwt/compiler.py b/lib/gwt/compiler.py
index 4318aac..29a8609 100755
--- a/lib/gwt/compiler.py
+++ b/lib/gwt/compiler.py
@@ -26,7 +26,7 @@
 for a in argv[3:]:
   if end:
     if a.endswith('.jar'):
-      cp.append(a)
+      cp.append(path.expandvars(a))
   elif a == '--':
     end = True
   else:
@@ -36,7 +36,6 @@
   print("%s must end with .zip" % outzip, file=stderr)
   exit(1)
 
-rebuild = outzip[:-4] + '.rebuild'
 for d in ['deploy', 'unit_cache', 'work']:
   mkdir(path.join(TMP, d))
 if not path.exists(path.dirname(outzip)):