2022-09-19 07:25:29 +02:00
|
|
|
{ depot, lib, pkgs, ... }:
|
2020-07-26 14:51:49 +02:00
|
|
|
{
|
|
|
|
buildGerritBazelPlugin =
|
|
|
|
{ name
|
2024-07-07 20:12:28 +02:00
|
|
|
, version
|
2020-07-26 14:51:49 +02:00
|
|
|
, src
|
2024-07-28 18:58:22 +02:00
|
|
|
, depsHash ? null
|
2020-07-26 14:51:49 +02:00
|
|
|
, overlayPluginCmd ? ''
|
|
|
|
cp -R "${src}" "$out/plugins/${name}"
|
2024-07-07 20:12:28 +02:00
|
|
|
echo "STABLE_BUILD_${lib.toUpper name}_LABEL v${version}-nix${if patches != [] then "-dirty" else ""}" >> $out/.version
|
2020-07-26 14:51:49 +02:00
|
|
|
''
|
2024-07-07 20:12:28 +02:00
|
|
|
, postOverlayPlugin ? ""
|
2021-04-03 16:15:30 +02:00
|
|
|
, postPatch ? ""
|
2022-09-19 07:25:29 +02:00
|
|
|
, patches ? [ ]
|
2024-07-07 20:12:28 +02:00
|
|
|
}: ((depot.third_party.gerrit.override (old: {
|
2020-07-26 14:51:49 +02:00
|
|
|
name = "${name}.jar";
|
|
|
|
|
|
|
|
src = pkgs.runCommandLocal "${name}-src" { } ''
|
|
|
|
cp -R "${depot.third_party.gerrit.src}" "$out"
|
2024-07-07 20:12:28 +02:00
|
|
|
chmod -R +w "$out"
|
2020-07-26 14:51:49 +02:00
|
|
|
${overlayPluginCmd}
|
2024-07-07 20:12:28 +02:00
|
|
|
${postOverlayPlugin}
|
2020-07-26 14:51:49 +02:00
|
|
|
'';
|
2024-07-07 20:12:28 +02:00
|
|
|
depsHash = (if depsHash != null then depsHash else old.depsHash);
|
2020-07-26 14:51:49 +02:00
|
|
|
|
2024-07-07 20:12:28 +02:00
|
|
|
bazelTargets = {
|
|
|
|
"//plugins/${name}" = "$out";
|
|
|
|
};
|
|
|
|
|
|
|
|
extraBuildInstall = "";
|
|
|
|
})).overrideAttrs (super: {
|
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
|
|
|
}));
|
|
|
|
}
|