Bazel: Generate eclipse project

servlet_api_2_5 can be exculded from the generated .classpath to avoid
classpath collisions between Servlet API 2.5 and Servlet API 3.0. To do
that, pass -x parameter to project.py invocation in project.sh:

  ... -n gitiles -r . -x servlet_api_2_5

TEST PLAN:

  $ tools/eclipse/project.sh

Open the project in Eclipse IDE and verify that it can be compiled and
the tests can be run.

Change-Id: If318321fb1a94888a9adea635458afee2b463682
diff --git a/tools/eclipse/BUILD b/tools/eclipse/BUILD
new file mode 100644
index 0000000..45ad493
--- /dev/null
+++ b/tools/eclipse/BUILD
@@ -0,0 +1,31 @@
+load("@com_googlesource_gerrit_bazlets//tools:classpath.bzl", "classpath_collector")
+load("@com_googlesource_gerrit_bazlets//tools:py_binary_path.bzl", "py_binary_path")
+
+DEPS = [
+    "//gitiles-servlet:servlet",
+    "//gitiles-dev:lib",
+]
+
+java_library(
+    name = "classpath",
+    runtime_deps = DEPS,
+)
+
+classpath_collector(
+    name = "main_classpath_collect",
+    testonly = 1,
+    deps = DEPS + [
+        "//gitiles-servlet:servlet_tests",
+    ],
+)
+
+# TODO(davido): This is a hack:
+# https://github.com/bazelbuild/bazel/issues/2452
+# We know the py_binary rule,  but for *reasons* we cannot
+# use `buck run <rule>. Unfortunately, a query to retrieve
+# the path was removed in Bazel. So we are forced to do this
+# hack to access python script outside of the Bazel.
+py_binary_path(
+    name = "project.py",
+    py_binary_label = "@com_googlesource_gerrit_bazlets//tools/eclipse:project",
+)