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