From e780435d09207b84dff49c870e875ad3f052b2fe Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sun, 26 Jul 2020 13:51:49 +0100 Subject: chore(3p/gerrit_plugins): add machinery for compiling Gerrit plugins from source This looks particularly obnoxious for the owners plugin, because it's actually two plugins with a common library in the same repo. Other plugins are much cleaner to deal with (hence the default for overlayPluginCmd). Change-Id: Ibb9588c8a29b63e8509436fcbb70054e89349712 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1461 Tested-by: BuildkiteCI Reviewed-by: glittershark --- third_party/gerrit_plugins/default.nix | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'third_party/gerrit_plugins/default.nix') diff --git a/third_party/gerrit_plugins/default.nix b/third_party/gerrit_plugins/default.nix index 932b98c356..929d1bba9f 100644 --- a/third_party/gerrit_plugins/default.nix +++ b/third_party/gerrit_plugins/default.nix @@ -1,10 +1,25 @@ -{ pkgs, ... }: +{ depot, pkgs, ... }@args: -let inherit (pkgs) fetchurl; -in { +let + inherit (import ./builder.nix args) buildGerritBazelPlugin; +in +{ # https://gerrit.googlesource.com/plugins/owners - owners = fetchurl { - url = "https://storage.googleapis.com/tazjins-data/tvl/owners_3.2.jar"; - sha256 = "1xw1q3g0353aw5jqxp69n85f8y57l2p51np37n8r34kzbn5r4iz7"; - } // { name = "owners"; }; + owners = buildGerritBazelPlugin rec { + name = "owners"; + depsOutputHash = "0j60yn65kn27s7cjkj3z6irymq7j7rj3q5h3n6xfrs5inm4md2ad"; + src = pkgs.fetchgit { + url = "https://gerrit.googlesource.com/plugins/owners"; + rev = "17817c9e319073c03513f9d5177b6142b8fd567b"; + sha256 = "1p089shybp50svckcq51d0hfisjvbggndmvmhh8pvzvi6w8n9d89"; + deepClone = true; + leaveDotGit = true; + }; + overlayPluginCmd = '' + chmod +w "$out" "$out/plugins/external_plugin_deps.bzl" + cp -R "${src}/owners" "$out/plugins/owners" + cp "${src}/external_plugin_deps.bzl" "$out/plugins/external_plugin_deps.bzl" + cp -R "${src}/owners-common" "$out/owners-common" + ''; + }; } -- cgit 1.4.1