Implement in gerrit tree Bazel build and remove Buck build
Change-Id: Iaa324b56a17b348961992e4aae121c8d3879debc
diff --git a/.buckconfig b/.buckconfig
deleted file mode 100644
index a73f7b8..0000000
--- a/.buckconfig
+++ /dev/null
@@ -1,8 +0,0 @@
-[alias]
- plugin = //:delete-project
-
-[java]
- src_roots = java, resources
-
-[project]
- ignore = .git, eclipse-out
diff --git a/.gitignore b/.gitignore
index f5b756a..dba3be4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,8 +3,4 @@
.project
/.settings/org.maven.ide.eclipse.prefs
/.settings/org.eclipse.m2e.core.prefs
-.buckd
-.buckversion
-buck-out
-bucklets
eclipse-out
diff --git a/BUCK b/BUCK
deleted file mode 100644
index a29218e..0000000
--- a/BUCK
+++ /dev/null
@@ -1,31 +0,0 @@
-include_defs('//bucklets/gerrit_plugin.bucklet')
-
-gerrit_plugin(
- name = 'delete-project',
- srcs = glob(['src/main/java/**/*.java']),
- resources = glob(['src/main/resources/**/*']),
- manifest_entries = [
- 'Gerrit-PluginName: deleteproject',
- 'Gerrit-Module: com.googlesource.gerrit.plugins.deleteproject.Module',
- 'Gerrit-HttpModule: com.googlesource.gerrit.plugins.deleteproject.HttpModule',
- 'Gerrit-SshModule: com.googlesource.gerrit.plugins.deleteproject.SshModule',
- ],
- provided_deps = [
- '//lib:gson',
- '//lib/log:log4j',
- ],
-)
-
-java_library(
- name = 'classpath',
- deps = GERRIT_PLUGIN_API + [
- ':delete-project__plugin',
- ],
-)
-
-java_test(
- name = 'delete-project_tests',
- srcs = glob(['src/test/java/**/*.java']),
- labels = ['delete-project'],
- deps = GERRIT_PLUGIN_API + GERRIT_TESTS + [':delete-project__plugin'],
-)
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..9213a7c
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,26 @@
+load("//tools/bzl:junit.bzl", "junit_tests")
+load(
+ "//tools/bzl:plugin.bzl",
+ "gerrit_plugin",
+ "PLUGIN_DEPS",
+ "PLUGIN_TEST_DEPS",
+)
+
+gerrit_plugin(
+ name = "delete-project",
+ srcs = glob(["src/main/java/**/*.java"]),
+ manifest_entries = [
+ "Gerrit-PluginName: deleteproject",
+ "Gerrit-Module: com.googlesource.gerrit.plugins.deleteproject.Module",
+ "Gerrit-HttpModule: com.googlesource.gerrit.plugins.deleteproject.HttpModule",
+ "Gerrit-SshModule: com.googlesource.gerrit.plugins.deleteproject.SshModule",
+ ],
+ resources = glob(["src/main/resources/**/*"]),
+)
+
+junit_tests(
+ name = "delete_project_tests",
+ srcs = glob(["src/test/java/**/*.java"]),
+ tags = ["delete-project"],
+ deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [":delete-project__plugin"],
+)
diff --git a/README.md b/README.md
index 092c100..92bea1f 100644
--- a/README.md
+++ b/README.md
@@ -3,4 +3,4 @@
A plugin which allows projects to be deleted from Gerrit via an SSH command,
REST API or the Project settings screen.
-[![Build Status](https://gerrit-ci.gerritforge.com/buildStatus/icon?job=plugin-delete-project-master)](https://gerrit-ci.gerritforge.com/job/plugin-delete-project-master/)
+[![Build Status](https://gerrit-ci.gerritforge.com/job/plugin-delete-project-bazel-master/badge/icon)
diff --git a/lib/BUCK b/lib/BUCK
deleted file mode 100644
index 8892994..0000000
--- a/lib/BUCK
+++ /dev/null
@@ -1,8 +0,0 @@
-include_defs('//bucklets/maven_jar.bucklet')
-
-maven_jar(
- name = 'gson',
- id = 'com.google.code.gson:gson:2.1',
- sha1 = '2e66da15851f9f5b5079228f856c2f090ba98c38',
- license = 'Apache2.0',
-)
diff --git a/lib/gerrit/BUCK b/lib/gerrit/BUCK
deleted file mode 100644
index 11b2df4..0000000
--- a/lib/gerrit/BUCK
+++ /dev/null
@@ -1,20 +0,0 @@
-include_defs('//bucklets/maven_jar.bucklet')
-
-VER = '2.14-SNAPSHOT'
-REPO = MAVEN_LOCAL
-
-maven_jar(
- name = 'plugin-api',
- id = 'com.google.gerrit:gerrit-plugin-api:' + VER,
- attach_source = False,
- repository = REPO,
- license = 'Apache2.0',
-)
-
-maven_jar(
- name = 'acceptance-framework',
- id = 'com.google.gerrit:gerrit-acceptance-framework:' + VER,
- license = 'Apache2.0',
- attach_source = False,
- repository = REPO,
-)
diff --git a/lib/log/BUCK b/lib/log/BUCK
deleted file mode 100644
index 1ae0c8e..0000000
--- a/lib/log/BUCK
+++ /dev/null
@@ -1,9 +0,0 @@
-include_defs('//bucklets/maven_jar.bucklet')
-
-maven_jar(
- name = 'log4j',
- id = 'log4j:log4j:1.2.17',
- sha1 = '5af35056b4d257e4b64b9e8069c0746e8b08629f',
- license = 'Apache2.0',
- exclude = ['META-INF/LICENSE', 'META-INF/NOTICE'],
-)
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index 0e0065d..40dc525 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -1,63 +1,37 @@
Build
=====
-This plugin is built with Buck.
-
-Two build modes are supported: Standalone and in Gerrit tree. Standalone
-build mode is recommended, as this mode doesn't require local Gerrit
-tree to exist.
-
-Build standalone
-----------------
-
-Clone bucklets library:
-
-```
- git clone https://gerrit.googlesource.com/bucklets
-
-```
-and link it to delete-project directory:
-
-```
- cd delete-project && ln -s ../bucklets .
-```
-
-Add link to the .buckversion file:
-
-```
- cd delete_project && ln -s bucklets/buckversion .buckversion
-```
-
-To build the plugin, issue the following command:
-
-
-```
- buck build plugin
-```
-
-The output is created in
-
-```
- buck-out/gen/delete-project/delete-project.jar
-```
-
-Build in Gerrit tree
---------------------
+This plugin is built with Bazel. Only the Gerrit in-tree build is
+supported.
Clone or link this plugin to the plugins directory of Gerrit's source
tree, and issue the command:
```
- buck build plugins/delete-project:delete-project
+ bazel build plugins/@PLUGIN@
```
The output is created in
```
- buck-out/gen/plugins/delete-project/delete-project.jar
+ bazel-genfiles/plugins/@PLUGIN@/@PLUGIN@.jar
```
-This project can be imported into the Eclipse IDE:
+To execute the tests run:
+
+```
+ bazel test plugins/@PLUGIN@:delete_project_tests
+```
+
+or filtering using the comma separated tags:
+
+````
+ bazel test --test_tag_filters=@PLUGIN@ //...
+````
+
+This project can be imported into the Eclipse IDE.
+Add the plugin name to the `CUSTOM_PLUGINS` set in
+Gerrit core in `tools/bzl/plugins.bzl`, and execute:
```
./tools/eclipse/project.py