feat: introduce Gerrit 3.11
Gerrit-version specific plugin hashes were introduced. Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
This commit is contained in:
parent
c011f670b3
commit
a4cc1ee06d
62
default.nix
62
default.nix
|
@ -5,22 +5,68 @@
|
|||
, pkgs ? import nixpkgs { }
|
||||
, lib ? pkgs.lib
|
||||
}:
|
||||
|
||||
let
|
||||
depsHashes = {
|
||||
"3_10" = {
|
||||
"oauth" = "sha256-LnfVTPvGDpLqAQ1QfAwFv0FA0aCg6H1WUgxVjjYTLoY=";
|
||||
"metric-reporter-prometheus" = "sha256-95JXlLwyxgMPk9z/weZWCdxAabasv6hHVdPPIfFq5ks=";
|
||||
};
|
||||
"3_11" = {
|
||||
"oauth" = "sha256-Xx607OSqlRMr8mlkVhfXiqM9hWcJqx4dmpf+cm10uSA=";
|
||||
"metric-reporter-prometheus" = "sha256-CzhpAN9Jh9E6GV+/UzVnNn56bOld8evdWcpkr/eFtag=";
|
||||
};
|
||||
};
|
||||
mkPluginSet = { self, depsHashes, buildGerritBazelPlugin }: {
|
||||
code-owners = self.callPackage ./plugins/code-owners {
|
||||
inherit buildGerritBazelPlugin;
|
||||
};
|
||||
oauth = self.callPackage ./plugins/oauth {
|
||||
inherit buildGerritBazelPlugin;
|
||||
depsHash = depsHashes.oauth;
|
||||
};
|
||||
metrics-reporter-prometheus = self.callPackage ./plugins/metrics-reporter-prometheus {
|
||||
inherit buildGerritBazelPlugin;
|
||||
depsHash = depsHashes.metric-reporter-prometheus;
|
||||
};
|
||||
};
|
||||
in
|
||||
lib.makeScope pkgs.newScope (self: {
|
||||
buildBazelPackageNG = self.callPackage ./buildBazelPackageNG { };
|
||||
gerrit = self.callPackage ./gerrit { };
|
||||
inherit (self.callPackage ./gerrit { }) gerrit_3_10 gerrit_3_11;
|
||||
|
||||
buildGerritBazelPlugin = self.callPackage ./plugins/builder.nix { };
|
||||
plugins = {
|
||||
code-owners = self.callPackage ./plugins/code-owners { };
|
||||
oauth = self.callPackage ./plugins/oauth { };
|
||||
metrics-reporter-prometheus = self.callPackage ./plugins/metrics-reporter-prometheus { };
|
||||
buildGerrit310BazelPlugin = self.callPackage ./plugins/builder.nix {
|
||||
gerrit = self.gerrit_3_10;
|
||||
};
|
||||
buildGerrit311BazelPlugin = self.callPackage ./plugins/builder.nix {
|
||||
gerrit = self.gerrit_3_11;
|
||||
};
|
||||
|
||||
ci = pkgs.linkFarm "gerrit-ci" [
|
||||
plugins_3_10 = mkPluginSet {
|
||||
inherit self;
|
||||
depsHashes = depsHashes."3_10";
|
||||
buildGerritBazelPlugin = self.buildGerrit310BazelPlugin;
|
||||
};
|
||||
plugins_3_11 = mkPluginSet {
|
||||
inherit self;
|
||||
depsHashes = depsHashes."3_11";
|
||||
buildGerritBazelPlugin = self.buildGerrit311BazelPlugin;
|
||||
};
|
||||
|
||||
buildGerritBazelPlugin = self.buildGerrit310BazelPlugin;
|
||||
gerrit = self.gerrit_3_10;
|
||||
plugins = self.plugins_3_10;
|
||||
|
||||
ci = pkgs.linkFarm "gerrit-${self.gerrit.version}-ci" [
|
||||
{ name = "gerrit"; path = self.gerrit; }
|
||||
{ name = "code-owners.jar"; path = self.plugins.code-owners; }
|
||||
{ name = "oauth.jar"; path = self.plugins.oauth; }
|
||||
{ name = "metrics-reporter-prometheus.jar"; path = self.plugins.metrics-reporter-prometheus; }
|
||||
];
|
||||
|
||||
ci-next = pkgs.linkFarm "gerrit-${self.gerrit_3_11.version}-ci" [
|
||||
{ name = "gerrit"; path = self.gerrit_3_11; }
|
||||
{ name = "code-owners.jar"; path = self.plugins_3_11.code-owners; }
|
||||
{ name = "oauth.jar"; path = self.plugins_3_11.oauth; }
|
||||
{ name = "metrics-reporter-prometheus.jar"; path = self.plugins_3_11.metrics-reporter-prometheus; }
|
||||
];
|
||||
})
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
pkgSet = import ./default.nix { pkgs = nixpkgs.legacyPackages."${system}"; };
|
||||
in {
|
||||
default = pkgSet.gerrit;
|
||||
inherit (pkgSet) gerrit;
|
||||
inherit (pkgSet) gerrit gerrit_3_11;
|
||||
inherit (pkgSet.plugins) oauth code-owners metrics-reporter-prometheus;
|
||||
inherit (pkgSet) plugins_3_11;
|
||||
});
|
||||
|
||||
devShells = forAllSystems (system: {
|
||||
|
|
123
gerrit/3_10.nix
Normal file
123
gerrit/3_10.nix
Normal file
|
@ -0,0 +1,123 @@
|
|||
# SPDX-FileCopyrightText: 2024 The nix-gerrit Authors <git@lukegb.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
{ buildBazelPackageNG
|
||||
, lib
|
||||
, fetchgit
|
||||
, bazel_7
|
||||
, python3
|
||||
, openjdk21_headless
|
||||
, curl
|
||||
, unzip
|
||||
, extraBazelPackageAttrs ? {}
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (buildBazelPackageNG) bazelRulesJavaHook bazelRulesNodeJS5Hook;
|
||||
in
|
||||
(buildBazelPackageNG rec {
|
||||
pname = "gerrit";
|
||||
version = "3.10.3";
|
||||
|
||||
bazel = bazel_7;
|
||||
|
||||
src = (fetchgit {
|
||||
url = "https://gerrit.googlesource.com/gerrit";
|
||||
rev = "v${version}";
|
||||
fetchSubmodules = true;
|
||||
deepClone = true;
|
||||
hash = "sha256-yp0LsqauIF8k/aCFFR2uYkeBNmp0E3lqpRSDm82dC3E=";
|
||||
}).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
|
||||
'';
|
||||
});
|
||||
depsHash = "sha256-Pq04IfyYnEYDbvnv3P8SDp3ONPYS8r3dipV5wwRaudM=";
|
||||
|
||||
patches = [
|
||||
./0001-Syntax-highlight-nix.patch
|
||||
./0002-Syntax-highlight-rules.pl.patch
|
||||
./0003-Add-titles-to-CLs-over-HTTP.patch
|
||||
|
||||
./gerrit-cl-431977-bump-sshd.patch
|
||||
./gerrit-cl-431977-part-2-bump-bouncycastle.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
bazelRulesJavaHook
|
||||
bazelRulesNodeJS5Hook
|
||||
|
||||
curl
|
||||
openjdk21_headless
|
||||
python3
|
||||
unzip
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
bazelFlagsArray+=(
|
||||
'--javacopt="-XepDisableAllChecks"'
|
||||
)
|
||||
'';
|
||||
|
||||
prePatch = ''
|
||||
rm .bazelversion
|
||||
|
||||
ln -sf ${./bazelrc} user.bazelrc
|
||||
|
||||
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"'
|
||||
|
||||
patchShebangs Documentation/replace_macros.py
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
sed -Ei 's,^(STABLE_BUILD_GERRIT_LABEL.*)$,\1-dirty-nix,' .version
|
||||
'';
|
||||
|
||||
preBuild = ''
|
||||
export GERRIT_CACHE_HOME=$NIXBAZEL_CACHE_ROOT/gerrit-cache
|
||||
'';
|
||||
|
||||
extraCacheInstall = ''
|
||||
cp -R $GERRIT_CACHE_HOME $out/gerrit-cache
|
||||
'';
|
||||
|
||||
extraBuildSetup = ''
|
||||
ln -sf $deps/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;
|
||||
};
|
||||
|
||||
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"
|
||||
];
|
||||
};
|
||||
}).override extraBazelPackageAttrs
|
119
gerrit/3_11.nix
Normal file
119
gerrit/3_11.nix
Normal file
|
@ -0,0 +1,119 @@
|
|||
# SPDX-FileCopyrightText: 2024 The nix-gerrit Authors <git@lukegb.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
{ buildBazelPackageNG
|
||||
, lib
|
||||
, fetchgit
|
||||
, bazel_7
|
||||
, python3
|
||||
, openjdk21_headless
|
||||
, curl
|
||||
, unzip
|
||||
, extraBazelPackageAttrs ? {}
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (buildBazelPackageNG) bazelRulesJavaHook bazelRulesNodeJS5Hook;
|
||||
in
|
||||
(buildBazelPackageNG rec {
|
||||
pname = "gerrit";
|
||||
version = "3.11.0";
|
||||
|
||||
bazel = bazel_7;
|
||||
|
||||
src = (fetchgit {
|
||||
url = "https://gerrit.googlesource.com/gerrit";
|
||||
rev = "v${version}";
|
||||
fetchSubmodules = true;
|
||||
deepClone = true;
|
||||
hash = "sha256-lnoVx0x3ssa4q/+nVtUSHQJP3NzsEyk8SFhwqgdvEbY=";
|
||||
}).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
|
||||
'';
|
||||
});
|
||||
depsHash = "sha256-AXWtkFOmx4IylWnPC1vdkoAbpKBQ46Nf7zLB9V1ieb0=";
|
||||
|
||||
patches = [
|
||||
./0002-Syntax-highlight-rules.pl.patch
|
||||
./0003-Add-titles-to-CLs-over-HTTP.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
bazelRulesJavaHook
|
||||
bazelRulesNodeJS5Hook
|
||||
|
||||
curl
|
||||
openjdk21_headless
|
||||
python3
|
||||
unzip
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
bazelFlagsArray+=(
|
||||
'--javacopt="-XepDisableAllChecks"'
|
||||
)
|
||||
'';
|
||||
|
||||
prePatch = ''
|
||||
rm .bazelversion
|
||||
|
||||
ln -sf ${./bazelrc} user.bazelrc
|
||||
|
||||
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"'
|
||||
|
||||
patchShebangs Documentation/replace_macros.py
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
sed -Ei 's,^(STABLE_BUILD_GERRIT_LABEL.*)$,\1-dirty-nix,' .version
|
||||
'';
|
||||
|
||||
preBuild = ''
|
||||
export GERRIT_CACHE_HOME=$NIXBAZEL_CACHE_ROOT/gerrit-cache
|
||||
'';
|
||||
|
||||
extraCacheInstall = ''
|
||||
cp -R $GERRIT_CACHE_HOME $out/gerrit-cache
|
||||
'';
|
||||
|
||||
extraBuildSetup = ''
|
||||
ln -sf $deps/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;
|
||||
};
|
||||
|
||||
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"
|
||||
];
|
||||
};
|
||||
}).override extraBazelPackageAttrs
|
|
@ -1,123 +1,8 @@
|
|||
# SPDX-FileCopyrightText: 2024 The nix-gerrit Authors <git@lukegb.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
{ buildBazelPackageNG
|
||||
, lib
|
||||
, fetchgit
|
||||
, bazel_7
|
||||
, python3
|
||||
, openjdk21_headless
|
||||
, curl
|
||||
, unzip
|
||||
, extraBazelPackageAttrs ? {}
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (buildBazelPackageNG) bazelRulesJavaHook bazelRulesNodeJS5Hook;
|
||||
in
|
||||
(buildBazelPackageNG rec {
|
||||
pname = "gerrit";
|
||||
version = "3.10.3";
|
||||
|
||||
bazel = bazel_7;
|
||||
|
||||
src = (fetchgit {
|
||||
url = "https://gerrit.googlesource.com/gerrit";
|
||||
rev = "v${version}";
|
||||
fetchSubmodules = true;
|
||||
deepClone = true;
|
||||
hash = "sha256-yp0LsqauIF8k/aCFFR2uYkeBNmp0E3lqpRSDm82dC3E=";
|
||||
}).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
|
||||
'';
|
||||
});
|
||||
depsHash = "sha256-Pq04IfyYnEYDbvnv3P8SDp3ONPYS8r3dipV5wwRaudM=";
|
||||
|
||||
patches = [
|
||||
./0001-Syntax-highlight-nix.patch
|
||||
./0002-Syntax-highlight-rules.pl.patch
|
||||
./0003-Add-titles-to-CLs-over-HTTP.patch
|
||||
|
||||
./gerrit-cl-431977-bump-sshd.patch
|
||||
./gerrit-cl-431977-part-2-bump-bouncycastle.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
bazelRulesJavaHook
|
||||
bazelRulesNodeJS5Hook
|
||||
|
||||
curl
|
||||
openjdk21_headless
|
||||
python3
|
||||
unzip
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
bazelFlagsArray+=(
|
||||
'--javacopt="-XepDisableAllChecks"'
|
||||
)
|
||||
'';
|
||||
|
||||
prePatch = ''
|
||||
rm .bazelversion
|
||||
|
||||
ln -sf ${./bazelrc} user.bazelrc
|
||||
|
||||
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"'
|
||||
|
||||
patchShebangs Documentation/replace_macros.py
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
sed -Ei 's,^(STABLE_BUILD_GERRIT_LABEL.*)$,\1-dirty-nix,' .version
|
||||
'';
|
||||
|
||||
preBuild = ''
|
||||
export GERRIT_CACHE_HOME=$NIXBAZEL_CACHE_ROOT/gerrit-cache
|
||||
'';
|
||||
|
||||
extraCacheInstall = ''
|
||||
cp -R $GERRIT_CACHE_HOME $out/gerrit-cache
|
||||
'';
|
||||
|
||||
extraBuildSetup = ''
|
||||
ln -sf $deps/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;
|
||||
};
|
||||
|
||||
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"
|
||||
];
|
||||
};
|
||||
}).override extraBazelPackageAttrs
|
||||
{ callPackage }:
|
||||
{
|
||||
gerrit_3_10 = callPackage ./3_10.nix { };
|
||||
gerrit_3_11 = callPackage ./3_11.nix { };
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# SPDX-FileCopyrightText: 2024 The nix-gerrit Authors <git@lukegb.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
{ buildGerritBazelPlugin, fetchgit }:
|
||||
{ buildGerritBazelPlugin, fetchgit, depsHash }:
|
||||
|
||||
buildGerritBazelPlugin rec {
|
||||
name = "metrics-reporter-prometheus";
|
||||
|
@ -11,7 +11,7 @@ buildGerritBazelPlugin rec {
|
|||
rev = "f2ee1de665281596ae300144243fcf94bf6f1f7d";
|
||||
hash = "sha256-iUFzSXKIKBdZBZMpZiejkEEXXI20wTJQRYkufc/YjOM=";
|
||||
};
|
||||
depsHash = "sha256-95JXlLwyxgMPk9z/weZWCdxAabasv6hHVdPPIfFq5ks=";
|
||||
inherit depsHash;
|
||||
postOverlayPlugin = ''
|
||||
cp "${src}/external_plugin_deps.bzl" "$out/plugins/external_plugin_deps.bzl"
|
||||
'';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# SPDX-FileCopyrightText: 2024 The nix-gerrit Authors <git@lukegb.com>
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
{ buildGerritBazelPlugin, fetchgit, lib }:
|
||||
{ buildGerritBazelPlugin, fetchgit, depsHash }:
|
||||
|
||||
buildGerritBazelPlugin rec {
|
||||
name = "oauth";
|
||||
|
@ -11,7 +11,7 @@ buildGerritBazelPlugin rec {
|
|||
rev = "98231604d60788bb43490f1a301d792817ac8008";
|
||||
hash = "sha256-AuVO1Yys8BYqGHZI/adszCUg0JM2v4Td4fe26LdOPLM=";
|
||||
};
|
||||
depsHash = "sha256-LnfVTPvGDpLqAQ1QfAwFv0FA0aCg6H1WUgxVjjYTLoY=";
|
||||
inherit depsHash;
|
||||
postOverlayPlugin = ''
|
||||
cp "${src}/external_plugin_deps.bzl" "$out/plugins/external_plugin_deps.bzl"
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue