Add buck standalone support

Change-Id: Idfc5337d5cdb00aa9ff7f95a1ce5a0a9a31d3557
diff --git a/.buckconfig b/.buckconfig
new file mode 100644
index 0000000..65bac24
--- /dev/null
+++ b/.buckconfig
@@ -0,0 +1,14 @@
+[alias]
+  force-draft = //:force-draft
+  plugin = //:force-draft
+
+[java]
+  src_roots = java, resources
+
+[project]
+  ignore = .git
+
+[cache]
+  mode = dir
+  dir = buck-out/cache
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1d71845
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+/.buckd
+/.buckversion
+/.classpath
+/.project
+/.watchmanconfig
+/buck-out/
+/bucklets
diff --git a/BUCK b/BUCK
index 91ea82b..3af58c7 100644
--- a/BUCK
+++ b/BUCK
@@ -1,3 +1,5 @@
+include_defs('//bucklets/gerrit_plugin.bucklet')
+
 gerrit_plugin(
   name = 'force-draft',
   srcs = glob(['src/main/java/**/*.java']),
@@ -12,5 +14,5 @@
 
 java_library(
   name = 'classpath',
-  deps = [':force-draft__plugin'],
+  deps = GERRIT_PLUGIN_API + [':force-draft__plugin'],
 )
diff --git a/lib/gerrit/BUCK b/lib/gerrit/BUCK
new file mode 100644
index 0000000..bb14be3
--- /dev/null
+++ b/lib/gerrit/BUCK
@@ -0,0 +1,13 @@
+include_defs('//bucklets/maven_jar.bucklet')
+
+VER = '2.12-SNAPSHOT'
+REPO = MAVEN_LOCAL
+
+maven_jar(
+  name = 'plugin-api',
+  id = 'com.google.gerrit:gerrit-plugin-api:' + VER,
+  license = 'Apache2.0',
+  attach_source = False,
+  repository = REPO,
+)
+
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
new file mode 100644
index 0000000..1086a18
--- /dev/null
+++ b/src/main/resources/Documentation/build.md
@@ -0,0 +1,79 @@
+Build
+=====
+
+This @PLUGIN@ plugin is built with Buck.
+
+Two build modes are supported: Standalone and in Gerrit tree.
+The standalone build mode is recommended, as this mode doesn't require
+the Gerrit tree to exist locally.
+
+#### Build standalone
+
+Clone bucklets library:
+
+```
+  git clone https://gerrit.googlesource.com/bucklets
+
+```
+and link it to @PLUGIN@ plugin directory:
+
+```
+  cd @PLUGIN@ && ln -s ../bucklets .
+```
+
+Add link to the .buckversion file:
+
+```
+  cd @PLUGIN@ && ln -s bucklets/buckversion .buckversion
+```
+
+Add link to the .watchmanconfig file:
+
+```
+  cd @PLUGIN@ && ln -s bucklets/watchmanconfig .watchmanconfig
+```
+
+To build the plugin, issue the following command:
+
+```
+  buck build plugin
+```
+
+The output is created in
+
+```
+  buck-out/gen/@PLUGIN@.jar
+```
+
+This project can be imported into the Eclipse IDE:
+
+```
+  ./bucklets/tools/eclipse.py
+```
+
+#### Build in Gerrit tree
+
+Clone or link this plugin to the plugins directory of Gerrit's source
+tree, and issue the command:
+
+```
+  buck build plugins/@PLUGIN@
+```
+
+in the root of Gerrit's source tree to build
+
+The output is created in
+
+```
+  buck-out/gen/plugins/@PLUGIN@/@PLUGIN@.jar
+```
+
+This project can be imported into the Eclipse IDE:
+
+```
+  ./tools/eclipse/project.py
+```
+
+[Back to @PLUGIN@ documentation index][index]
+
+[index]: index.html