feat(ops/gerrit-tvl): init TVL Gerrit plugin
This is just going to be a grab bag of things which do TVL-specific things to Gerrit, whether that be exposing new Prolog predicates or, as I intend to do as the first thing, expose Buildkite builds as checks. Change-Id: Iaeab987a1fdbd078b85e274691c986489903bf3a Reviewed-on: https://cl.tvl.fyi/c/depot/+/2872 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
parent
79aa142788
commit
21765a1407
6 changed files with 59 additions and 1 deletions
14
ops/gerrit-tvl/HttpModule.java
Normal file
14
ops/gerrit-tvl/HttpModule.java
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
package su.tvl.gerrit;
|
||||||
|
|
||||||
|
import com.google.gerrit.extensions.registration.DynamicSet;
|
||||||
|
import com.google.gerrit.extensions.webui.JavaScriptPlugin;
|
||||||
|
import com.google.gerrit.extensions.webui.WebUiPlugin;
|
||||||
|
import com.google.inject.servlet.ServletModule;
|
||||||
|
|
||||||
|
public final class HttpModule extends ServletModule {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configureServlets() {
|
||||||
|
DynamicSet.bind(binder(), WebUiPlugin.class).toInstance(new JavaScriptPlugin("tvl.js"));
|
||||||
|
}
|
||||||
|
}
|
2
ops/gerrit-tvl/MANIFEST.MF
Normal file
2
ops/gerrit-tvl/MANIFEST.MF
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
Gerrit-HttpModule: su.tvl.gerrit.HttpModule
|
||||||
|
Gerrit-PluginName: tvl
|
6
ops/gerrit-tvl/README.md
Normal file
6
ops/gerrit-tvl/README.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# gerrit-tvl
|
||||||
|
|
||||||
|
A Gerrit plugin that does TVL-specific things.
|
||||||
|
|
||||||
|
You probably want to take inspiration from this rather than using it directly,
|
||||||
|
as it has a variety of TVL-ish assumptions baked into it.
|
33
ops/gerrit-tvl/default.nix
Normal file
33
ops/gerrit-tvl/default.nix
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{ depot, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
classPath = lib.concatStringsSep ":" [
|
||||||
|
"${depot.third_party.gerrit}/share/api/extension-api_deploy.jar"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
pkgs.stdenvNoCC.mkDerivation rec {
|
||||||
|
name = "${pname}-${version}.jar";
|
||||||
|
pname = "gerrit-tvl";
|
||||||
|
version = "0.0.1";
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
jdk
|
||||||
|
];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
mkdir $NIX_BUILD_TOP/build
|
||||||
|
|
||||||
|
# Build Java components.
|
||||||
|
export JAVAC="javac -cp ${classPath} -d $NIX_BUILD_TOP/build --release 11"
|
||||||
|
$JAVAC ./HttpModule.java
|
||||||
|
|
||||||
|
# Install static files.
|
||||||
|
cp -R static $NIX_BUILD_TOP/build/static
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
jar --create --file $out --manifest $src/MANIFEST.MF -C $NIX_BUILD_TOP/build .
|
||||||
|
'';
|
||||||
|
}
|
3
ops/gerrit-tvl/static/tvl.js
Normal file
3
ops/gerrit-tvl/static/tvl.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Gerrit.install(plugin => {
|
||||||
|
console.log('TVL plugin initialising');
|
||||||
|
});
|
|
@ -18,9 +18,9 @@ in {
|
||||||
];
|
];
|
||||||
|
|
||||||
plugins = with depot.third_party.gerrit_plugins; [
|
plugins = with depot.third_party.gerrit_plugins; [
|
||||||
checks
|
|
||||||
owners
|
owners
|
||||||
oauth
|
oauth
|
||||||
|
depot.ops.gerrit-tvl
|
||||||
];
|
];
|
||||||
|
|
||||||
package = depot.third_party.gerrit;
|
package = depot.third_party.gerrit;
|
||||||
|
|
Loading…
Reference in a new issue