2024-07-08 00:58:14 +00:00
|
|
|
{ gerrit
|
|
|
|
, runCommandLocal
|
|
|
|
, lib
|
|
|
|
}:
|
|
|
|
|
|
|
|
{ name
|
|
|
|
, version
|
|
|
|
, src
|
|
|
|
, depsHash ? null
|
|
|
|
, overlayPluginCmd ? ''
|
|
|
|
cp -R "${src}" "$out/plugins/${name}"
|
|
|
|
echo "STABLE_BUILD_${lib.toUpper name}_LABEL v${version}-nix${if patches != [] then "-dirty" else ""}" >> $out/.version
|
|
|
|
''
|
|
|
|
, postOverlayPlugin ? ""
|
|
|
|
, postPatch ? ""
|
|
|
|
, patches ? [ ]
|
|
|
|
}: ((gerrit.override {
|
|
|
|
extraBazelPackageAttrs = (old: {
|
2024-07-01 17:49:32 +00:00
|
|
|
name = "${name}.jar";
|
|
|
|
|
|
|
|
src = runCommandLocal "${name}-src" { } ''
|
|
|
|
cp -R "${gerrit.src}" "$out"
|
2024-07-08 00:58:14 +00:00
|
|
|
chmod -R +w "$out"
|
2024-07-01 17:49:32 +00:00
|
|
|
${overlayPluginCmd}
|
2024-07-08 00:58:14 +00:00
|
|
|
${postOverlayPlugin}
|
2024-07-01 17:49:32 +00:00
|
|
|
'';
|
2024-07-08 00:58:14 +00:00
|
|
|
depsHash = (if depsHash != null then depsHash else old.depsHash);
|
|
|
|
|
|
|
|
bazelTargets = {
|
|
|
|
"//plugins/${name}" = "$out";
|
|
|
|
};
|
2024-07-01 17:49:32 +00:00
|
|
|
|
2024-07-08 00:58:14 +00:00
|
|
|
extraBuildInstall = "";
|
|
|
|
});
|
2024-07-01 17:49:32 +00:00
|
|
|
}).overrideAttrs (super: {
|
2024-07-08 00:58:14 +00:00
|
|
|
postPatch = ''
|
|
|
|
${super.postPatch or ""}
|
|
|
|
pushd "plugins/${name}"
|
|
|
|
${lib.concatMapStringsSep "\n" (patch: ''
|
|
|
|
patch -p1 < ${patch}
|
|
|
|
'') patches}
|
|
|
|
popd
|
|
|
|
${postPatch}
|
|
|
|
'';
|
|
|
|
}))
|