Add support for Bazel in Gerrit tree build

Also remove wrapper for JGit lfs dependencies and consume them directly
from the external package.

Change-Id: I29692a82a8975e75de792778b4acc838f55ad5d8
diff --git a/BUILD b/BUILD
index 48c5d1c..89b6dc4 100644
--- a/BUILD
+++ b/BUILD
@@ -1,18 +1,34 @@
-load("//tools/bzl:plugin.bzl", "gerrit_plugin")
+load("//tools/bzl:junit.bzl", "junit_tests")
+load(
+    "//tools/bzl:plugin.bzl",
+    "gerrit_plugin",
+    "PLUGIN_DEPS",
+    "PLUGIN_TEST_DEPS",
+)
 
 gerrit_plugin(
     name = "lfs",
     srcs = glob(["src/main/java/**/*.java"]),
+    resources = glob(["src/main/resources/**/*"]),
     manifest_entries = [
         "Gerrit-PluginName: lfs",
         "Gerrit-Module: com.googlesource.gerrit.plugins.lfs.Module",
         "Gerrit-HttpModule: com.googlesource.gerrit.plugins.lfs.HttpModule",
         "Gerrit-SshModule: com.googlesource.gerrit.plugins.lfs.SshModule",
     ],
-    resources = glob(["src/main/resources/**/*"]),
     deps = [
-        "//lib/jgit:jgit-http-apache",
-        "//lib/jgit:jgit-lfs",
-        "//lib/jgit:jgit-lfs-server",
+        "@jgit_http_apache//jar",
+        "@jgit_lfs//jar",
+        "@jgit_lfs_server//jar",
+    ],
+)
+
+junit_tests(
+    name = "lfs_tests",
+    srcs = glob(["src/test/java/**/*.java"]),
+    tags = ["lfs"],
+    deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
+        ":lfs__plugin",
+        "@jgit_lfs//jar",
     ],
 )