Start buck from project root

This is required by new buck versions; see changes Ic1c79ad1 and
Ia5530b89 in Gerrit.

Change-Id: Ie6e848454ce047c777750d3d99dc4468ca2c5af1
diff --git a/java_doc.bucklet b/java_doc.bucklet
index 53c5b52..69df603 100644
--- a/java_doc.bucklet
+++ b/java_doc.bucklet
@@ -38,6 +38,7 @@
   genrule(
     name = name,
     cmd = ' '.join([
+      'while ! test -f .buckconfig; do cd ..; done;',
       'javadoc',
       '-quiet',
       '-protected',
diff --git a/tools/pack_war.py b/tools/pack_war.py
index 6c71d81..09ff054 100755
--- a/tools/pack_war.py
+++ b/tools/pack_war.py
@@ -15,7 +15,7 @@
 
 from __future__ import print_function
 from optparse import OptionParser
-from os import makedirs, path, symlink
+from os import getcwd, chdir, makedirs, path, symlink
 from subprocess import check_call
 import sys
 from util import check_output
@@ -33,6 +33,8 @@
 
 def link_jars(libs, directory):
   makedirs(directory)
+  while not path.isfile('.buckconfig'):
+    chdir('..')
   cp = check_output(['buck', 'audit', 'classpath'] + libs)
   for j in cp.strip().splitlines():
     if j not in jars: