Add support for Bazel in Gerrit tree build

also remove buck build.

Change-Id: I901639c1e7afe019a6f29c1fc1b9bebe56871106
diff --git a/BUCK b/BUCK
deleted file mode 100644
index 7887a62..0000000
--- a/BUCK
+++ /dev/null
@@ -1,34 +0,0 @@
-include_defs('//bucklets/gerrit_plugin.bucklet')
-include_defs('//lib/maven.defs')
-
-gerrit_plugin(
-  name = 'analytics',
-  srcs = glob(['src/main/java/**/*.java']),
-  resources = glob(['src/main/resources/**/*']),
-  manifest_entries = [
-    'Gerrit-PluginName: analytics',
-    'Gerrit-Module: com.googlesource.gerrit.plugins.analytics.Module',
-    'Gerrit-SshModule: com.googlesource.gerrit.plugins.analytics.SshModule',
-    'Implementation-Title: Analytics plugin',
-    'Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/analytics',
-  ],
-  deps = [
-    ':gitective-core',
-  ],
-)
-
-java_test(
-  name = 'analytics_tests',
-  srcs = glob(['src/test/java/**/*.java']),
-  labels = ['analytics'],
-  deps = GERRIT_PLUGIN_API + GERRIT_TESTS + [
-    ':analytics__plugin',
-  ],
-)
-
-maven_jar(
-  name = 'gitective-core',
-  id = 'io.fabric8:gitective-core:0.9.18-1',
-  repository = MAVEN_LOCAL,
-  license = 'Apache2.0',
-)
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..1f0f6ae
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,32 @@
+load("//tools/bzl:junit.bzl", "junit_tests")
+load(
+    "//tools/bzl:plugin.bzl",
+    "gerrit_plugin",
+    "PLUGIN_DEPS",
+    "PLUGIN_TEST_DEPS",
+)
+
+gerrit_plugin(
+    name = "analytics",
+    srcs = glob(["src/main/java/**/*.java"]),
+    resources = glob(["src/main/resources/**/*"]),
+    manifest_entries = [
+        "Gerrit-PluginName: analytics",
+        "Gerrit-Module: com.googlesource.gerrit.plugins.analytics.Module",
+        "Gerrit-SshModule: com.googlesource.gerrit.plugins.analytics.SshModule",
+        "Implementation-Title: Analytics plugin",
+        "Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/analytics",
+    ],
+    deps = [
+        "@gitective-core//jar",
+    ],
+)
+
+junit_tests(
+    name = "analytics_tests",
+    srcs = glob(["src/test/java/**/*.java"]),
+    tags = ["analytics"],
+    deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
+        ":analytics__plugin",
+    ],
+)
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
new file mode 100644
index 0000000..7a5dcb2
--- /dev/null
+++ b/external_plugin_deps.bzl
@@ -0,0 +1,8 @@
+load("//tools/bzl:maven_jar.bzl", "maven_jar")
+
+def external_plugin_deps():
+  maven_jar(
+      name = 'gitective-core',
+      artifact = 'io.fabric8:gitective-core:0.9.18',
+      sha1 = 'e9e3cd5c83da434ad64eadd08efd02a1e33fb3fb',
+  )