2022-09-19 07:25:29 +02:00
|
|
|
{ depot, lib, pkgs, ... }:
|
2020-07-26 14:51:49 +02:00
|
|
|
{
|
2022-01-30 17:06:58 +01:00
|
|
|
buildGerritBazelPlugin =
|
|
|
|
{ name
|
|
|
|
, src
|
|
|
|
, depsOutputHash
|
|
|
|
, overlayPluginCmd ? ''
|
|
|
|
cp -R "${src}" "$out/plugins/${name}"
|
|
|
|
''
|
|
|
|
, postPatch ? ""
|
2022-09-19 07:25:29 +02:00
|
|
|
, patches ? [ ]
|
2022-01-30 17:06:58 +01:00
|
|
|
}: ((depot.third_party.gerrit.override {
|
|
|
|
name = "${name}.jar";
|
2020-07-26 14:51:49 +02:00
|
|
|
|
2022-01-30 17:06:58 +01:00
|
|
|
src = pkgs.runCommandLocal "${name}-src" { } ''
|
|
|
|
cp -R "${depot.third_party.gerrit.src}" "$out"
|
|
|
|
chmod +w "$out/plugins"
|
|
|
|
${overlayPluginCmd}
|
|
|
|
'';
|
2020-07-26 14:51:49 +02:00
|
|
|
|
2023-04-07 13:05:10 +02:00
|
|
|
bazelTargets = [ "//plugins/${name}" ];
|
2022-01-30 17:06:58 +01: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}
|
|
|
|
'';
|
2022-01-30 17:06:58 +01:00
|
|
|
}));
|
2020-07-26 14:51:49 +02:00
|
|
|
}
|