2022-09-19 07:25:29 +02:00
|
|
|
{ depot, lib, pkgs, ... }:
|
2020-07-26 14:51:49 +02:00
|
|
|
{
|
|
|
|
buildGerritBazelPlugin =
|
|
|
|
{ name
|
|
|
|
, src
|
|
|
|
, depsOutputHash
|
|
|
|
, overlayPluginCmd ? ''
|
|
|
|
cp -R "${src}" "$out/plugins/${name}"
|
|
|
|
''
|
2021-04-03 16:15:30 +02:00
|
|
|
, postPatch ? ""
|
2022-09-19 07:25:29 +02:00
|
|
|
, patches ? [ ]
|
2020-07-26 14:51:49 +02:00
|
|
|
}: ((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}
|
|
|
|
'';
|
|
|
|
|
2023-04-07 13:05:10 +02:00
|
|
|
bazelTargets = [ "//plugins/${name}" ];
|
2020-07-26 14:51:49 +02:00
|
|
|
}).overrideAttrs (super: {
|
|
|
|
deps = super.deps.overrideAttrs (superDeps: {
|
|
|
|
outputHash = depsOutputHash;
|
|
|
|
});
|
|
|
|
installPhase = ''
|
|
|
|
cp "bazel-bin/plugins/${name}/${name}.jar" "$out"
|
|
|
|
'';
|
2022-09-19 07:25:29 +02:00
|
|
|
postPatch = ''
|
|
|
|
${super.postPatch or ""}
|
|
|
|
pushd "plugins/${name}"
|
|
|
|
${lib.concatMapStringsSep "\n" (patch: ''
|
|
|
|
patch -p1 < ${patch}
|
|
|
|
'') patches}
|
|
|
|
popd
|
|
|
|
${postPatch}
|
|
|
|
'';
|
2020-07-26 14:51:49 +02:00
|
|
|
}));
|
|
|
|
}
|