commit | 1a83ae5cf2aa0ef651b89f2c7f1cfad8132ce27b | [log] [tgz] |
---|---|---|
author | Luca Milanesio <luca.milanesio@gmail.com> | Sun Apr 20 02:13:56 2014 +0100 |
committer | Luca Milanesio <luca.milanesio@gmail.com> | Tue Apr 22 09:08:17 2014 +0100 |
tree | 1f1a3a7dc63e0caead0d9b34b22c46f2782b3759 |
Initial version of Scala scripting provider Allows script files with .scala extension under $GERRIT_SITE/plugins to be loaded as ServerPlugins. Manifest is automatically generated on-the-fly based on the Guice Module classes defined in the Scala script. When no Guice Modules are defined, classes are automatically registered as in standard Jar plugins. At the moment all Scala scripts are defined as PLUGIN type: it is not yet possible to define a Gerrit EXTENSION type. All Scala script plugins are defined as hot-reloadable. Change-Id: Id7ad0b51bf07b57b093ddf3148165bdfc51fd685
This plugin provides Scala runtime environment for Gerrit plugins in Scala.
To test this series must be applied on top of Gerrit master [1].
To build link this directory under Gerrit's tree plugins directory and run:
buck build plugins/scala-provider:scala-provider
The resulting artifact can be found under:
buck-out/gen/plugins/scala-provider/scala-provider.jar
A sample Scala hello world script is:
import com.google.gerrit.sshd._ import com.google.gerrit.extensions.annotations._ @Export("scala") class ScalaCommand extends SshCommand { override def run = stdout println "Hello from Scala!" }
Copy and past the above sample Scala fragment into the file $GERRIT_SITE/plugin/hello-1.0.scala.
The “hello” plugin version 1.0 will be automatically loaded into Gerrit and will provide a new SSH command “hello scala”.