Implement buck driven build
Bug: Issue 2684
Change-Id: I0f7ccf1799003b50b4a80c8f4af2e76537a634b1
diff --git a/BUCK b/BUCK
new file mode 100644
index 0000000..84d4f74
--- /dev/null
+++ b/BUCK
@@ -0,0 +1,63 @@
+gerrit_plugin(
+ name = 'its-bugzilla',
+ srcs = glob(['src/main/java/**/*.java']),
+ resources = glob(['src/main/resources/**/*']),
+ manifest_entries = [
+ 'Gerrit-PluginName: its-bugzilla',
+ 'Gerrit-Module: com.googlesource.gerrit.plugins.hooks.bz.BugzillaModule',
+ 'Gerrit-InitStep: com.googlesource.gerrit.plugins.hooks.bz.InitBugzilla',
+ 'Gerrit-ReloadMode: reload',
+ 'Implementation-Title: Plugin its-bugzilla',
+ 'Implementation-URL: https://www.wikimediafoundation.org',
+ ],
+ deps = [
+ '//plugins/its-base:its-base__plugin',
+ '//plugins/its-bugzilla/lib:j2bugzilla',
+ ],
+)
+
+TEST_UTIL_SRC = glob(['src/test/java/com/googlesource/gerrit/plugins/hooks/testutil/**/*.java'])
+
+java_library(
+ name = 'its-bugzilla_tests-utils',
+ srcs = TEST_UTIL_SRC,
+ deps = [
+ '//lib:guava',
+ '//lib/easymock:easymock',
+ '//lib/log:impl_log4j',
+ '//lib/log:log4j',
+ '//lib:junit',
+ '//lib/powermock:powermock-api-easymock',
+ '//lib/powermock:powermock-api-support',
+ '//lib/powermock:powermock-core',
+ '//lib/powermock:powermock-module-junit4',
+ '//lib/powermock:powermock-module-junit4-common',
+ ],
+)
+
+java_test(
+ name = 'its-bugzilla_tests',
+ srcs = glob(
+ ['src/test/java/**/*.java'],
+ excludes = TEST_UTIL_SRC
+ ),
+ labels = ['its-bugzilla'],
+ source_under_test = [':its-bugzilla__plugin'],
+ deps = [
+ ':its-bugzilla__plugin',
+ ':its-bugzilla_tests-utils',
+ '//gerrit-plugin-api:lib',
+ '//lib/easymock:easymock',
+ '//lib:guava',
+ '//lib/guice:guice',
+ '//lib/jgit:jgit',
+ '//lib:junit',
+ '//lib/log:api',
+ '//lib/log:impl_log4j',
+ '//lib/log:log4j',
+ '//lib/powermock:powermock-api-easymock',
+ '//lib/powermock:powermock-api-support',
+ '//lib/powermock:powermock-core',
+ '//lib/powermock:powermock-module-junit4',
+ ],
+)
diff --git a/lib/BUCK b/lib/BUCK
new file mode 100644
index 0000000..b889b94
--- /dev/null
+++ b/lib/BUCK
@@ -0,0 +1,43 @@
+include_defs('//lib/maven.defs')
+
+maven_jar(
+ name = 'j2bugzilla',
+ id = 'com.j2bugzilla:j2bugzilla:2.2',
+ sha1 = 'abd2c9290e6e4ec3222c89a99c79d9c5bbc79300',
+ license = 'Apache2.0',
+ deps = [':xmlrpc-client'],
+)
+
+maven_jar(
+ name = 'xmlrpc-client',
+ id = 'org.apache.xmlrpc:xmlrpc-client:3.1.3',
+ sha1 = 'e486ad917028b52265610206fb5a1e2b5914b94b',
+ license = 'Apache2.0',
+ deps = [':xmlrpc-common'],
+ visibility = [],
+)
+
+maven_jar(
+ name = 'xmlrpc-common',
+ id = 'org.apache.xmlrpc:xmlrpc-common:3.1.3',
+ sha1 = '415daf1f1473a947452588906dc9f5b3575fb44d',
+ license = 'Apache2.0',
+ deps = [':ws-commons-util'],
+ visibility = [],
+)
+
+maven_jar(
+ name = 'ws-commons-util',
+ id = 'org.apache.ws.commons.util:ws-commons-util:1.0.2',
+ sha1 = '3f478e6def772c19d1053f61198fa1f6a6119238',
+ license = 'Apache2.0',
+ deps = [':xml-apis'],
+ visibility = [],
+)
+
+maven_jar(
+ name = 'xml-apis',
+ id = 'xml-apis:xml-apis:1.0.b2',
+ sha1 = '3136ca936f64c9d68529f048c2618bd356bf85c9',
+ license = 'Apache2.0',
+)
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
new file mode 100644
index 0000000..5e696e9
--- /dev/null
+++ b/src/main/resources/Documentation/build.md
@@ -0,0 +1,44 @@
+Build
+=====
+
+This plugin is built with Buck.
+
+Clone or link this plugin to the plugins directory of Gerrit's source
+tree, and issue the command:
+
+```
+ buck build plugins/its-bugzilla
+```
+
+The output is created in
+
+```
+ buck-out/gen/plugins/its-bugzilla/its-bugzilla.jar
+```
+
+This project can be imported into the Eclipse IDE:
+
+```
+ ./tools/eclipse/project.py
+```
+
+To execute the tests run:
+
+```
+ buck test --all --include its-bugzilla
+```
+
+Note that for compatibility reasons a Maven build is provided, but is considered
+to be deprecated and will be removed in a future version of this plugin.
+
+To build with Maven, change directory to the plugin folder and issue the
+command:
+
+```
+ mvn clean package
+```
+
+When building with Maven, the Gerrit Plugin API must be available.
+
+How to build the Gerrit Plugin API is described in the [Gerrit
+documentation](../../../Documentation/dev-buck.html#_extension_and_plugin_api_jar_files).