about summary refs log blame commit diff
path: root/third_party/gerrit_plugins/builder.nix
blob: 0b6501801cd11b82ea15e5956f0279ade9f262cc (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13

                     










                                             
 




                                                      
 













                                                         
 
{ depot, pkgs, ... }:
{
  buildGerritBazelPlugin =
    { name
    , src
    , depsOutputHash
    , overlayPluginCmd ? ''
        cp -R "${src}" "$out/plugins/${name}"
      ''
    , postPatch ? ""
    ,
    }: ((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"
      '';
      postPatch =
        if super ? postPatch then ''
          ${super.postPatch}
          ${postPatch}
        '' else postPatch;
    }));
}