about summary refs log tree commit diff
path: root/third_party/gerrit_plugins/builder.nix
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/gerrit_plugins/builder.nix')
-rw-r--r--third_party/gerrit_plugins/builder.nix20
1 files changed, 12 insertions, 8 deletions
diff --git a/third_party/gerrit_plugins/builder.nix b/third_party/gerrit_plugins/builder.nix
index 0b6501801c..50a4e78ae7 100644
--- a/third_party/gerrit_plugins/builder.nix
+++ b/third_party/gerrit_plugins/builder.nix
@@ -1,4 +1,4 @@
-{ depot, pkgs, ... }:
+{ depot, lib, pkgs, ... }:
 {
   buildGerritBazelPlugin =
     { name
@@ -8,7 +8,7 @@
         cp -R "${src}" "$out/plugins/${name}"
       ''
     , postPatch ? ""
-    ,
+    , patches ? [ ]
     }: ((depot.third_party.gerrit.override {
       name = "${name}.jar";
 
@@ -18,7 +18,7 @@
         ${overlayPluginCmd}
       '';
 
-      bazelTarget = "//plugins/${name}";
+      bazelTargets = [ "//plugins/${name}" ];
     }).overrideAttrs (super: {
       deps = super.deps.overrideAttrs (superDeps: {
         outputHash = depsOutputHash;
@@ -26,10 +26,14 @@
       installPhase = ''
         cp "bazel-bin/plugins/${name}/${name}.jar" "$out"
       '';
-      postPatch =
-        if super ? postPatch then ''
-          ${super.postPatch}
-          ${postPatch}
-        '' else postPatch;
+      postPatch = ''
+        ${super.postPatch or ""}
+        pushd "plugins/${name}"
+        ${lib.concatMapStringsSep "\n" (patch: ''
+          patch -p1 < ${patch}
+        '') patches}
+        popd
+        ${postPatch}
+      '';
     }));
 }