chore(3p/gerrit_plugins): add machinery for compiling Gerrit plugins from source
This looks particularly obnoxious for the owners plugin, because it's actually two plugins with a common library in the same repo. Other plugins are much cleaner to deal with (hence the default for overlayPluginCmd). Change-Id: Ibb9588c8a29b63e8509436fcbb70054e89349712 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1461 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
This commit is contained in:
parent
2b7fe6f957
commit
e780435d09
4 changed files with 58 additions and 10 deletions
28
third_party/gerrit_plugins/builder.nix
vendored
Normal file
28
third_party/gerrit_plugins/builder.nix
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ depot, pkgs, ... }:
|
||||
{
|
||||
buildGerritBazelPlugin = {
|
||||
name,
|
||||
src,
|
||||
depsOutputHash,
|
||||
overlayPluginCmd ? ''
|
||||
cp -R "${src}" "$out/plugins/${name}"
|
||||
'',
|
||||
}: ((depot.third_party.gerrit.override {
|
||||
name = "${name}.jar";
|
||||
|
||||
src = pkgs.runCommandLocal "${name}-src" {} ''
|
||||
cp -R "${depot.third_party.gerrit.src}" "$out"
|
||||
chmod +w "$out/plugins"
|
||||
${overlayPluginCmd}
|
||||
'';
|
||||
|
||||
bazelTarget = "//plugins/${name}";
|
||||
}).overrideAttrs (super: {
|
||||
deps = super.deps.overrideAttrs (superDeps: {
|
||||
outputHash = depsOutputHash;
|
||||
});
|
||||
installPhase = ''
|
||||
cp "bazel-bin/plugins/${name}/${name}.jar" "$out"
|
||||
'';
|
||||
}));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue