Remove standalone build mode

Before this change, gc-conductor defined its own version of jgit used by
gc-executor. With this change, gc-conductor uses the same jgit version
used by gerrit core, as the only build mode supported is in Gerrit tree.
This removal is possible because Gerrit uses jgit as a submodule since
v3.1.

Therefore, the commands used to build gc-executor are adapted to reflect
how to build gc-executor in Gerrit tree.

LFS plugin had a similar change [1] and uses the same jgit version as
core's since stable-3.1.

[1] 2acd29ba7d82375656acf7be5fe172554a6c957a

Change-Id: I2f58bda270b08885c08fc64693a56610f64dcbef
diff --git a/.bazelignore b/.bazelignore
deleted file mode 100644
index 30f1613..0000000
--- a/.bazelignore
+++ /dev/null
@@ -1 +0,0 @@
-eclipse-out
diff --git a/.bazelrc b/.bazelrc
deleted file mode 100644
index 3ae03ff..0000000
--- a/.bazelrc
+++ /dev/null
@@ -1,2 +0,0 @@
-build --workspace_status_command="python ./tools/workspace_status.py"
-test --build_tests_only
diff --git a/.bazelversion b/.bazelversion
deleted file mode 100644
index 7c69a55..0000000
--- a/.bazelversion
+++ /dev/null
@@ -1 +0,0 @@
-3.7.0
diff --git a/.gitignore b/.gitignore
index 4e7cb7d..e5d39e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,12 +1,6 @@
 # LC_COLLATE=C sort
-/.apt_generated/
-/.classpath
-/.primary_build_tool
-/.project
 /.settings/
-/bazel-*
 /bin/gc-executor-pid
-/eclipse-out/
 /gc-executor.jar
 /gc.config
 /startup.log
diff --git a/WORKSPACE b/WORKSPACE
deleted file mode 100644
index 35699f0..0000000
--- a/WORKSPACE
+++ /dev/null
@@ -1,19 +0,0 @@
-workspace(name = "gc_executor")
-
-load("//:bazlets.bzl", "load_bazlets")
-
-load_bazlets(
-    commit = "20079f696c22c733053077b13c0dc6d9902e6b8e",
-    #local_path = "/home/<user>/projects/bazlets",
-)
-
-load(
-    "@com_googlesource_gerrit_bazlets//:gerrit_api.bzl",
-    "gerrit_api",
-)
-
-gerrit_api()
-
-load("//:external_plugin_deps.bzl", "external_plugin_deps")
-
-external_plugin_deps()
diff --git a/bazlets.bzl b/bazlets.bzl
deleted file mode 100644
index f089af4..0000000
--- a/bazlets.bzl
+++ /dev/null
@@ -1,18 +0,0 @@
-load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
-
-NAME = "com_googlesource_gerrit_bazlets"
-
-def load_bazlets(
-        commit,
-        local_path = None):
-    if not local_path:
-        git_repository(
-            name = NAME,
-            remote = "https://gerrit.googlesource.com/bazlets",
-            commit = commit,
-        )
-    else:
-        native.local_repository(
-            name = NAME,
-            path = local_path,
-        )
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
index 4e7b7ce..95f1d95 100644
--- a/external_plugin_deps.bzl
+++ b/external_plugin_deps.bzl
@@ -98,13 +98,6 @@
     )
 
     maven_jar(
-        name = "jgit",
-        artifact =
-            "org.eclipse.jgit:org.eclipse.jgit:5.8.0.202006091008-r",
-        sha1 = "1d8b1a904ae018e9973f6bd92f71065c629393e3",
-    )
-
-    maven_jar(
         name = "javaewah",
         artifact = "com.googlecode.javaewah:JavaEWAH:1.1.6",
         sha1 = "94ad16d728b374d65bd897625f3fbb3da223a2b6",
diff --git a/lib/BUILD b/lib/BUILD
deleted file mode 100644
index dd99fbc..0000000
--- a/lib/BUILD
+++ /dev/null
@@ -1,7 +0,0 @@
-load("@rules_java//java:defs.bzl", "java_library")
-
-java_library(
-    name = "jgit",
-    visibility = ["//visibility:public"],
-    exports = ["@jgit//jar"],
-)
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index 24ec423..34881f6 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -1,13 +1,9 @@
 Build
 =====
 
-This plugin is built with Bazel and two build modes are supported:
+This plugin is built with Bazel.
 
-* Standalone
-* In Gerrit tree.
-
-Standalone build mode is recommended, as this mode doesn't require local Gerrit
-tree to exist. This plugin has a side component, gc-executor, to build as well.
+This plugin has a side component, gc-executor, to build as well.
 
 Successfully running some of the tests requires Docker,
 which are skipped if Docker is not available.
@@ -15,58 +11,18 @@
 Bazel currently does not show
 link:https://github.com/bazelbuild/bazel/issues/3476[skipped tests].
 
-## Build standalone
-
-To build the plugin, issue the following command:
-
-```
-  bazel build @PLUGIN@
-```
-
-The output is created in
-
-```
-  bazel-bin/@PLUGIN@.jar
-```
-
-To package the plugin sources run:
-
-```
-  bazel build lib@PLUGIN@__plugin-src.jar
-```
-
-The output is created in:
-
-```
-  bazel-bin/lib@PLUGIN@__plugin-src.jar
-```
-
-To execute the tests run:
-
-```
-  bazel test //...
-```
-
-This project can be imported into the Eclipse IDE. Execute:
-
-```
-  ./tools/eclipse/project.py
-```
-
-to generate the required files and then import the project.
-
 ## Building gc-executor
 
 To build the executor, issue the following command:
 
 ```
-  bazel build gc-executor_deploy.jar
+  bazel build plugins/@PLUGIN@:gc-executor_deploy.jar
 ```
 
 The output is created in:
 
 ```
-  bazel-bin/gc-executor_deploy.jar
+  bazel-bin/plugins/@PLUGIN@/gc-executor_deploy.jar
 ```
 
 This jar should be renamed to gc-executor.jar before deployment.
@@ -75,7 +31,7 @@
 should be manually copied over to the gerrit site /lib folder; on macOS:
 
 ```
-  bazel-out/darwin-fastbuild/bin/gc-executor.runfiles/gc_executor/external/postgresql/jar/postgresql-42.2.5.jar
+  bazel-out/darwin-fastbuild/bin/plugins/@PLUGIN@/gc-executor.runfiles/postgresql/jar/postgresql-42.2.5.jar
 ```
 
 That file has to be in accordance with potentially existing database driver
diff --git a/tools/BUILD b/tools/BUILD
deleted file mode 100644
index 1fa2160..0000000
--- a/tools/BUILD
+++ /dev/null
@@ -1 +0,0 @@
-# Empty file - bazel treat directories with BUILD file as a package
\ No newline at end of file
diff --git a/tools/bzl/BUILD b/tools/bzl/BUILD
deleted file mode 100644
index c5ed0b7..0000000
--- a/tools/bzl/BUILD
+++ /dev/null
@@ -1 +0,0 @@
-# Empty file required by Bazel
diff --git a/tools/bzl/classpath.bzl b/tools/bzl/classpath.bzl
deleted file mode 100644
index c921d01..0000000
--- a/tools/bzl/classpath.bzl
+++ /dev/null
@@ -1,6 +0,0 @@
-load(
-    "@com_googlesource_gerrit_bazlets//tools:classpath.bzl",
-    _classpath_collector = "classpath_collector",
-)
-
-classpath_collector = _classpath_collector
diff --git a/tools/bzl/junit.bzl b/tools/bzl/junit.bzl
deleted file mode 100644
index 97307bd..0000000
--- a/tools/bzl/junit.bzl
+++ /dev/null
@@ -1,6 +0,0 @@
-load(
-    "@com_googlesource_gerrit_bazlets//tools:junit.bzl",
-    _junit_tests = "junit_tests",
-)
-
-junit_tests = _junit_tests
diff --git a/tools/bzl/maven_jar.bzl b/tools/bzl/maven_jar.bzl
deleted file mode 100644
index 35ea8ce..0000000
--- a/tools/bzl/maven_jar.bzl
+++ /dev/null
@@ -1,3 +0,0 @@
-load("@com_googlesource_gerrit_bazlets//tools:maven_jar.bzl", _maven_jar = "maven_jar")
-
-maven_jar = _maven_jar
diff --git a/tools/bzl/plugin.bzl b/tools/bzl/plugin.bzl
deleted file mode 100644
index 4d2dbdd..0000000
--- a/tools/bzl/plugin.bzl
+++ /dev/null
@@ -1,10 +0,0 @@
-load(
-    "@com_googlesource_gerrit_bazlets//:gerrit_plugin.bzl",
-    _gerrit_plugin = "gerrit_plugin",
-    _plugin_deps = "PLUGIN_DEPS",
-    _plugin_test_deps = "PLUGIN_TEST_DEPS",
-)
-
-gerrit_plugin = _gerrit_plugin
-PLUGIN_DEPS = _plugin_deps
-PLUGIN_TEST_DEPS = _plugin_test_deps
diff --git a/tools/eclipse/BUILD b/tools/eclipse/BUILD
deleted file mode 100644
index 35a7598..0000000
--- a/tools/eclipse/BUILD
+++ /dev/null
@@ -1,9 +0,0 @@
-load("//tools/bzl:classpath.bzl", "classpath_collector")
-
-classpath_collector(
-    name = "main_classpath_collect",
-    testonly = 1,
-    deps = [
-        "//:gc-conductor__plugin_test_deps",
-    ],
-)
diff --git a/tools/eclipse/project.sh b/tools/eclipse/project.sh
deleted file mode 100755
index 2c64166..0000000
--- a/tools/eclipse/project.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2017 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-`bazel query @com_googlesource_gerrit_bazlets//tools/eclipse:project --output location | sed s/BUILD:.*//`project.py -n gc-conductor -r .
diff --git a/tools/sonar/sonar.sh b/tools/sonar/sonar.sh
deleted file mode 100755
index 8df06d3..0000000
--- a/tools/sonar/sonar.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2018 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-`bazel query @com_googlesource_gerrit_bazlets//tools/sonar:sonar --output location | sed s/BUILD:.*//`sonar.py
diff --git a/tools/workspace_status.py b/tools/workspace_status.py
deleted file mode 100644
index 9355c6c..0000000
--- a/tools/workspace_status.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-
-# This script will be run by bazel when the build process starts to
-# generate key-value information that represents the status of the
-# workspace. The output should be like
-#
-# KEY1 VALUE1
-# KEY2 VALUE2
-#
-# If the script exits with non-zero code, it's considered as a failure
-# and the output will be discarded.
-
-from __future__ import print_function
-import subprocess
-import sys
-
-CMD = ['git', 'describe', '--always', '--match', 'v[0-9].*', '--dirty']
-
-
-def revision():
-    try:
-        return subprocess.check_output(CMD).strip().decode("utf-8")
-    except OSError as err:
-        print('could not invoke git: %s' % err, file=sys.stderr)
-        sys.exit(1)
-    except subprocess.CalledProcessError as err:
-        print('error using git: %s' % err, file=sys.stderr)
-        sys.exit(1)
-
-
-print("STABLE_BUILD_GC-CONDUCTOR_LABEL %s" % revision())