Implement Buck driven build

Clone or link this plugin to the plugins directory of Gerrit tree
and issue the command:

  buck build plugins/gitblit

The output is created in

  buck-out/gen/plugins/gitblit/gitblit.jar

The project can be imported into the Eclipse IDE:

  ./tools/eclipse/project.py

Change-Id: I0026d8cbdd7a70c0ddca8fb41ac387a2ce73a845
diff --git a/BUCK b/BUCK
new file mode 100644
index 0000000..a66e8d2
--- /dev/null
+++ b/BUCK
@@ -0,0 +1,46 @@
+gerrit_plugin(
+  name = 'gitblit',
+  srcs = glob(['src/main/java/**/*.java']),
+  manifest_entries = [
+    'Gerrit-PluginName: gitblit',
+    'Gerrit-Module: com.googlesource.gerrit.plugins.gitblit.GitBlitModule',
+    'Gerrit-HttpModule: com.googlesource.gerrit.plugins.gitblit.GitBlitServletModule',
+    'Gerrit-InitStep: com.googlesource.gerrit.plugins.gitblit.GitBlitInitStep',
+    'Gerrit-ReloadMode: restart',
+  ],
+  deps = [
+    '//lib/commons:httpcore',
+    '//lib/commons:net',
+    '//lib/commons:codec',
+    '//plugins/gitblit/lib:gitblit-jar',
+    '//plugins/gitblit/lib:wicket',
+    '//plugins/gitblit/lib:wicket-extensions',
+    '//plugins/gitblit/lib:wicketstuff',
+    '//plugins/gitblit/lib:javax-mail',
+    '//plugins/gitblit/lib:groovy',
+    '//plugins/gitblit/lib:beust-jcommander',
+    '//plugins/gitblit/lib:jdom',
+    '//plugins/gitblit/lib:lucene-core',
+    '//plugins/gitblit/lib:lucene-highlighter',
+    '//plugins/gitblit/lib:lucene-memory',
+    '//plugins/gitblit/lib:markdownpapers',
+    '//plugins/gitblit/lib:rome',
+    '//plugins/gitblit/lib:unboundid',
+    ':gitblit-properties-jar',
+  ]
+)
+
+prebuilt_jar(
+  name = 'gitblit-properties-jar',
+  binary_jar = genfile('gitblit-properties.zip'),
+  deps = [':gitblit-properties'],
+)
+
+genrule(
+  name = 'gitblit-properties',
+  cmd = 'cp $SRCDIR/src/main/resources/gitblit.properties $TMP'
+    + ';cd $TMP'
+    + ';zip -q $OUT *',
+  srcs = ['src/main/resources/gitblit.properties'],
+  out = 'gitblit-properties.zip',
+)
diff --git a/lib/BUCK b/lib/BUCK
new file mode 100644
index 0000000..f3892f0
--- /dev/null
+++ b/lib/BUCK
@@ -0,0 +1,111 @@
+include_defs('//lib/maven.defs')
+GERRITFORGE = 'http://gerritforge.com/snapshot'
+
+maven_jar(
+  name = 'gitblit-jar',
+  id = 'com.gitblit:gitblit:1.4.0-SNAPSHOT',
+  sha1 = '5d1a6df0ed4ee0517e1f61cdf92b7fb47b4b1119',
+  license = 'Apache2.0',
+  repository = GERRITFORGE,
+)
+
+maven_jar(
+  name = 'wicket',
+  id = 'org.apache.wicket:wicket:1.4.21-selfload',
+  sha1 = 'b822e4ce05232f39cc60adc59d3866452f919d6d',
+  license = 'Apache2.0',
+  repository = GERRITFORGE,
+)
+
+maven_jar(
+  name = 'wicket-auth-roles',
+  id = 'org.apache.wicket:wicket-auth-roles:1.4.21',
+  sha1 = '1b130dbf5578ace37507430a4a523f6594bf34fa',
+  license = 'Apache2.0',
+)
+
+maven_jar(
+  name = 'wicket-extensions',
+  id = 'org.apache.wicket:wicket-extensions:1.4.21',
+  sha1 = 'fac510c7ee4399a29b927405ec3de40b67d105d8',
+  license = 'Apache2.0',
+)
+
+maven_jar(
+  name = 'wicketstuff',
+  id = 'org.wicketstuff:googlecharts:1.4.21',
+  sha1 = '73d7540267afc3a0e91ca6148d3073e050dba180',
+  license = 'Apache2.0',
+)
+
+maven_jar(
+  name = 'javax-mail',
+  id = 'javax.mail:mail:1.4',
+  sha1 = '1aa1579ae5ecd41920c4f355b0a9ef40b68315dd',
+  license = 'Apache2.0',
+)
+
+maven_jar(
+  name = 'groovy',
+  id = 'org.codehaus.groovy:groovy-all:1.8.8',
+  sha1 = '98a489343d3c30da817d36cbea5de11ed07bef31',
+  license = 'Apache2.0',
+)
+
+maven_jar(
+  name = 'beust-jcommander',
+  id = 'com.beust:jcommander:1.17',
+  sha1 = '219a3540f3b27d7cc3b1d91d6ea046cd8723290e',
+  license = 'Apache2.0',
+)
+
+maven_jar(
+  name = 'jdom',
+  id = 'jdom:jdom:1.0',
+  sha1 = 'a2ac1cd690ab4c80defe7f9bce14d35934c35cec',
+  license = 'Apache2.0',
+)
+
+# Unfortunately an older version than used by Gerrit itself
+maven_jar(
+  name = 'lucene-core',
+  id = 'org.apache.lucene:lucene-core:3.6.0',
+  sha1 = '8a0429de6b7c9918841fa2c441a6ef4cc07f2a18',
+  license = 'Apache2.0',
+)
+
+maven_jar(
+  name = 'lucene-highlighter',
+  id = 'org.apache.lucene:lucene-highlighter:3.6.0',
+  sha1 = '9ee691f1dcc60f093df433c165d6a686c6d24553',
+  license = 'Apache2.0',
+)
+
+maven_jar(
+  name = 'lucene-memory',
+  id = 'org.apache.lucene:lucene-memory:3.6.1',
+  sha1 = '8c7ca5572edea50973dc0d26cf75c27047eebe7e',
+  license = 'Apache2.0',
+)
+
+maven_jar(
+  name = 'markdownpapers',
+  id = 'org.tautua.markdownpapers:markdownpapers-core:1.3.2',
+  sha1 = 'da22db6660e90b9a677bbdfc2c511c619ea5c249',
+  license = 'Apache2.0',
+)
+
+maven_jar(
+  name = 'rome',
+  id = 'rome:rome:1.0-selfload',
+  sha1 = 'e8d80293c9c13b557f4e570d3e12afcaf64ac6d4',
+  license = 'Apache2.0',
+  repository = GERRITFORGE
+)
+
+maven_jar(
+  name = 'unboundid',
+  id = 'com.unboundid:unboundid-ldapsdk:2.3.0',
+  sha1 = '6fde8d9fb4ee3e7e3d7e764e3ea57195971e2eb2',
+  license = 'Apache2.0',
+)