commit | 30d1f701ef1ca8f525e5582d617523d496eb05f7 | [log] [tgz] |
---|---|---|
author | Luca Milanesio <luca.milanesio@gmail.com> | Sun Apr 27 00:32:33 2014 +0100 |
committer | Luca Milanesio <luca.milanesio@gmail.com> | Sun Apr 27 00:32:33 2014 +0100 |
tree | 2ec08b82e40078d92b386ca96100d5085885a3a9 | |
parent | bead0ed3e99f9c76ceab64f05f1fa29880222882 [diff] |
Allows multiple Scala scripts to be included in a single plugin When the 'plugin-version.scala' under /plugins is a directory all the Scala scripts inside the directory tree are loaded inside the same plugin environment. This allows to save precious PermGen JVM Heap and reuse the same plugin name space for multiple Scala scripts. Additionally allows to have a much better organisation of larger set of scripts in packages. Change-Id: Ic885d4c8d89ce93f801fc642869e21378abe4fd0
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”.