gerrit_plugin: Allow to co-exist in tree and standalone plugins

Expose variable for plugin API that can be used from plugin build. The
path to plugin API artifacts is different between in tree and standalone
mode. To support the build that works for both mode, the plugin API vars
can be used to reference the plugin API. That way this works for both
modes: in gerrit tree and standalone.

Change-Id: I76776c52fb6050f210d5fe54aedc56ace7ff86ee
diff --git a/gerrit_plugin.bucklet b/gerrit_plugin.bucklet
index 0e7fc32..507955c 100644
--- a/gerrit_plugin.bucklet
+++ b/gerrit_plugin.bucklet
@@ -45,8 +45,10 @@
   '-XdisableCastChecking',
 ]
 
-GWT_PLUGIN_DEPS = [
-  '//lib/gerrit:gwtui-api',
+GERRIT_PLUGIN_API = ['//lib/gerrit:plugin-api']
+GERRIT_GWT_API = ['//lib/gerrit:gwtui-api']
+
+GWT_DEPS = [
   '//lib/gwt:user',
   '//lib/gwt:dev',
 ]
@@ -86,14 +88,14 @@
   gwt_deps = []
   static_jars = []
   if gwt_module:
-    gwt_deps = GWT_PLUGIN_DEPS
+    gwt_deps = GWT_DEPS + GERRIT_GWT_API
     static_jars = [':%s-static-jar' % name]
   java_library(
     name = name + '__plugin',
     srcs = srcs,
     resources = resources,
     deps = deps,
-    provided_deps = ['//lib/gerrit:%s-api' % type] + provided_deps + gwt_deps,
+    provided_deps = GERRIT_PLUGIN_API + provided_deps + gwt_deps,
     visibility = ['PUBLIC'],
   )
   if gwt_module: