Add support for Bazel in Gerrit tree build Change-Id: Ic1a46a529df6af6c0334b5d0142129546df1c8ea
diff --git a/BUILD b/BUILD new file mode 100644 index 0000000..7b9ccaf --- /dev/null +++ b/BUILD
@@ -0,0 +1,16 @@ +load("//tools/bzl:plugin.bzl", "gerrit_plugin") + +gerrit_plugin( + name = "scala-provider", + srcs = glob(["src/main/java/**/*.java"]), + resources = glob(["src/main/resources/**/*"]), + manifest_entries = [ + "Implementation-Title: Scala Provider", + "Implementation-URL: https://gerrit.googlesource.com/plugins/scripting/scala-provider", + "Gerrit-PluginName: scala-provider", + "Gerrit-Module: com.googlesource.gerrit.plugins.scripting.scala.Module" + ], + deps = [ + "@scala_compiler//jar", + ], +)
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl new file mode 100644 index 0000000..570bef1 --- /dev/null +++ b/external_plugin_deps.bzl
@@ -0,0 +1,26 @@ +load("//tools/bzl:maven_jar.bzl", "maven_jar") + +def external_plugin_deps(): + maven_jar( + name = 'scala_compiler', + artifact = 'org.scala-lang:scala-compiler:2.11.6', + sha1 = 'fa7d8a52d53c6571bce334b2c1d3d9546314dde3', + exports = [ + '@scala_reflect//jar', + ], + ) + + maven_jar( + name = 'scala_reflect', + artifact = 'org.scala-lang:scala-reflect:2.11.6', + sha1 = 'f539c9c9cf312472b3a7771ac85ecda859657a1d', + exports = [ + '@scala_library//jar', + ], + ) + + maven_jar( + name = 'scala_library', + artifact = 'org.scala-lang:scala-library:2.11.6', + sha1 = 'be3457b4b748df35bffba675d8cddf44e9df4f7b', + )
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md index c4fe2d1..5581ebe 100644 --- a/src/main/resources/Documentation/build.md +++ b/src/main/resources/Documentation/build.md
@@ -1,22 +1,36 @@ Build ===== -This plugin is built with Buck. +This plugin is built with Bazel. -Clone or link this plugin to the plugins directory of Gerrit's source -tree, and issue the command: +Clone (or link) this plugin to the `plugins` directory of Gerrit's source tree. + +Put the external dependency Bazel build file into the Gerrit /plugins directory, +replacing the existing empty one. ``` - buck build plugins/scala-provider + cd gerrit/plugins + rm external_plugin_deps.bzl + ln -s scala-provider/external_plugin_deps.bzl . ``` +Then issue + +``` + bazel build plugins/scala-provider +``` + +in the root of Gerrit's source tree to build + The output is created in ``` - buck-out/gen/plugins/scala-provider/scala-provider.jar + bazel-genfiles/plugins/scala-provider/scala-provider.jar ``` -This project can be imported into the Eclipse IDE: +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