2024-07-08 00:58:14 +00:00
|
|
|
{ buildBazelPackageNG
|
|
|
|
, lib
|
|
|
|
, fetchgit
|
|
|
|
, bazel_7
|
|
|
|
, python3
|
|
|
|
, openjdk21_headless
|
|
|
|
, curl
|
|
|
|
, unzip
|
|
|
|
, extraBazelPackageAttrs ? {}
|
2024-07-01 17:49:32 +00:00
|
|
|
}:
|
2024-07-08 00:58:14 +00:00
|
|
|
|
2024-07-01 17:49:32 +00:00
|
|
|
let
|
2024-07-08 00:58:14 +00:00
|
|
|
inherit (buildBazelPackageNG) bazelRulesJavaHook bazelRulesNodeJS5Hook;
|
2024-07-01 17:49:32 +00:00
|
|
|
in
|
2024-07-08 00:58:14 +00:00
|
|
|
(buildBazelPackageNG rec {
|
|
|
|
pname = "gerrit";
|
|
|
|
version = "3.10.0";
|
|
|
|
|
|
|
|
bazel = bazel_7;
|
|
|
|
|
|
|
|
src = (fetchgit {
|
|
|
|
url = "https://gerrit.googlesource.com/gerrit";
|
|
|
|
rev = "v${version}";
|
|
|
|
fetchSubmodules = true;
|
|
|
|
deepClone = true;
|
|
|
|
hash = "sha256-FpKuzityHuHNYBIOL8YUjCLlkuVBfxjvHECb26NsZNE=";
|
|
|
|
}).overrideAttrs (_: {
|
|
|
|
env.NIX_PREFETCH_GIT_CHECKOUT_HOOK = ''
|
|
|
|
pushd "$dir" >/dev/null
|
|
|
|
${python3}/bin/python tools/workspace_status_release.py | sort > .version
|
|
|
|
popd >/dev/null
|
|
|
|
|
|
|
|
# delete all the .git; we can't do this using fetchgit if deepClone is on,
|
|
|
|
# but our mischief has already been achieved by the python command above :)
|
|
|
|
find "$dir" -name .git -print0 | xargs -0 rm -rf
|
|
|
|
'';
|
|
|
|
});
|
2024-07-08 13:59:31 +00:00
|
|
|
depsHash = "sha256-OS2kLXjtuWf+XRyQO2qGvEaAOvxqu20+gXR+fsCvpMc=";
|
2024-07-01 17:49:32 +00:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
./0001-Syntax-highlight-nix.patch
|
|
|
|
./0002-Syntax-highlight-rules.pl.patch
|
|
|
|
./0003-Add-titles-to-CLs-over-HTTP.patch
|
|
|
|
];
|
|
|
|
|
2024-07-08 00:58:14 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
bazelRulesJavaHook
|
|
|
|
bazelRulesNodeJS5Hook
|
2024-07-01 17:49:32 +00:00
|
|
|
|
2024-07-08 00:58:14 +00:00
|
|
|
curl
|
|
|
|
openjdk21_headless
|
|
|
|
python3
|
|
|
|
unzip
|
2024-07-01 17:49:32 +00:00
|
|
|
];
|
|
|
|
|
2024-07-08 00:58:14 +00:00
|
|
|
prePatch = ''
|
|
|
|
rm .bazelversion
|
2024-07-01 17:49:32 +00:00
|
|
|
|
2024-07-08 00:58:14 +00:00
|
|
|
ln -sf ${./bazelrc} user.bazelrc
|
2024-07-01 17:49:32 +00:00
|
|
|
|
2024-07-08 00:58:14 +00:00
|
|
|
ln -sf ${./workspace_overrides.bzl} workspace_overrides.bzl
|
|
|
|
substituteInPlace WORKSPACE \
|
|
|
|
--replace-fail 'load("@io_bazel_rules_webtesting//web:repositories.bzl"' 'load("//:workspace_overrides.bzl"' \
|
|
|
|
--replace-fail 'load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.3.bzl"' 'load("//:workspace_overrides.bzl"'
|
2024-07-01 17:49:32 +00:00
|
|
|
|
2024-07-08 00:58:14 +00:00
|
|
|
patchShebangs Documentation/replace_macros.py
|
|
|
|
'';
|
2024-07-01 17:49:32 +00:00
|
|
|
|
2024-07-08 00:58:14 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -Ei 's,^(STABLE_BUILD_GERRIT_LABEL.*)$,\1-dirty-nix,' .version
|
|
|
|
'';
|
2024-07-01 17:49:32 +00:00
|
|
|
|
2024-07-08 00:58:14 +00:00
|
|
|
preBuild = ''
|
|
|
|
export GERRIT_CACHE_HOME=$HOME/gerrit-cache
|
|
|
|
'';
|
|
|
|
|
|
|
|
extraCacheInstall = ''
|
|
|
|
cp -R $GERRIT_CACHE_HOME $out/gerrit-cache
|
|
|
|
'';
|
|
|
|
|
|
|
|
extraBuildSetup = ''
|
|
|
|
ln -sf $cache/gerrit-cache $GERRIT_CACHE_HOME
|
|
|
|
'';
|
|
|
|
extraBuildInstall = ''
|
|
|
|
mkdir -p "$out"/share/api/
|
|
|
|
unzip bazel-bin/api-skip-javadoc.zip -d "$out"/share/api
|
|
|
|
'';
|
|
|
|
|
|
|
|
bazelTargets = {
|
|
|
|
"//:release" = "$out/webapps/gerrit-${version}.war";
|
|
|
|
"//:api-skip-javadoc" = null;
|
2024-07-01 17:49:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
# A list of plugins that are part of the gerrit.war file.
|
|
|
|
# Use `java -jar gerrit.war ls | grep -Po '(?<=plugins/)[^.]+' | sed -e 's,^,",' -e 's,$,",' | sort` to generate that list.
|
|
|
|
plugins = [
|
|
|
|
"codemirror-editor"
|
|
|
|
"commit-message-length-validator"
|
|
|
|
"delete-project"
|
|
|
|
"download-commands"
|
|
|
|
"gitiles"
|
|
|
|
"hooks"
|
|
|
|
"plugin-manager"
|
|
|
|
"replication"
|
|
|
|
"reviewnotes"
|
|
|
|
"singleusergroup"
|
|
|
|
"webhooks"
|
|
|
|
];
|
|
|
|
};
|
2024-07-08 00:58:14 +00:00
|
|
|
}).override extraBazelPackageAttrs
|