2023-10-17 12:53:57 +02:00
|
|
|
{ depot, pkgs, ... }:
|
|
|
|
|
2023-10-17 22:00:00 +02:00
|
|
|
let
|
|
|
|
regenerate = pkgs.writeShellScriptBin "regenerate" ''
|
|
|
|
(cd $(git rev-parse --show-toplevel)/tvix/castore-go && rm *.pb.go && cp ${depot.tvix.castore.protos.go-bindings}/*.pb.go . && chmod +w *.pb.go)
|
|
|
|
'';
|
|
|
|
in
|
2023-10-17 12:53:57 +02:00
|
|
|
(pkgs.buildGoModule {
|
|
|
|
name = "castore-go";
|
|
|
|
src = depot.third_party.gitignoreSource ./.;
|
|
|
|
vendorHash = "sha256-ZNtSSW+oCxMsBtURSrea9/GyUHDagtGefM+Ii+VkgCA=";
|
|
|
|
}).overrideAttrs (_: {
|
|
|
|
meta.ci.extraSteps = {
|
|
|
|
check = {
|
|
|
|
label = ":water_buffalo: ensure generated protobuf files match";
|
|
|
|
needsOutput = true;
|
|
|
|
command = pkgs.writeShellScript "pb-go-check" ''
|
2023-10-17 22:00:00 +02:00
|
|
|
${regenerate}
|
2023-10-17 12:53:57 +02:00
|
|
|
if [[ -n "$(git status --porcelain -unormal)" ]]; then
|
|
|
|
echo "-----------------------------"
|
2023-10-17 22:00:00 +02:00
|
|
|
echo ".pb.go files need to be updated, mg run //tvix/castore-go/regenerate"
|
2023-10-17 12:53:57 +02:00
|
|
|
echo "-----------------------------"
|
|
|
|
git status -unormal
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
alwaysRun = true;
|
|
|
|
};
|
|
|
|
};
|
2023-10-17 22:00:00 +02:00
|
|
|
passthru.regenerate = regenerate;
|
2023-10-17 12:53:57 +02:00
|
|
|
})
|