chore(tvix): move regenerate scripts to passthru
This keeps things isolated a bit more. Change-Id: I437f2f63ee1567c0cbc02298514ad4d89f1dce85 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9790 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: Connor Brewster <cbrewster@hey.com> Tested-by: BuildkiteCI
This commit is contained in:
parent
c4ea205387
commit
45d8a78a8b
3 changed files with 16 additions and 14 deletions
|
@ -1,5 +1,10 @@
|
|||
{ depot, pkgs, ... }:
|
||||
|
||||
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
|
||||
(pkgs.buildGoModule {
|
||||
name = "castore-go";
|
||||
src = depot.third_party.gitignoreSource ./.;
|
||||
|
@ -10,10 +15,10 @@
|
|||
label = ":water_buffalo: ensure generated protobuf files match";
|
||||
needsOutput = true;
|
||||
command = pkgs.writeShellScript "pb-go-check" ''
|
||||
${depot.tvix.castore-go-generate}
|
||||
${regenerate}
|
||||
if [[ -n "$(git status --porcelain -unormal)" ]]; then
|
||||
echo "-----------------------------"
|
||||
echo ".pb.go files need to be updated, run //tvix:castore-go-generate"
|
||||
echo ".pb.go files need to be updated, mg run //tvix/castore-go/regenerate"
|
||||
echo "-----------------------------"
|
||||
git status -unormal
|
||||
exit 1
|
||||
|
@ -22,4 +27,5 @@
|
|||
alwaysRun = true;
|
||||
};
|
||||
};
|
||||
passthru.regenerate = regenerate;
|
||||
})
|
||||
|
|
|
@ -106,16 +106,6 @@ in
|
|||
# workspace too.
|
||||
shell = (import ./shell.nix { inherit pkgs; });
|
||||
|
||||
# Update `.pb.go` files in tvix/castore-go with the generated ones.
|
||||
castore-go-generate = pkgs.writeShellScriptBin "castore-go-protogen" ''
|
||||
(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)
|
||||
'';
|
||||
|
||||
# Update `.pb.go` files in tvix/store-go with the generated ones.
|
||||
store-go-generate = pkgs.writeShellScriptBin "store-go-protogen" ''
|
||||
(cd $(git rev-parse --show-toplevel)/tvix/store-go && rm *.pb.go && cp ${depot.tvix.store.protos.go-bindings}/*.pb.go . && chmod +w *.pb.go)
|
||||
'';
|
||||
|
||||
# Build the Rust documentation for publishing on docs.tvix.dev.
|
||||
rust-docs = pkgs.stdenv.mkDerivation {
|
||||
inherit cargoDeps;
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
{ depot, pkgs, ... }:
|
||||
|
||||
let
|
||||
regenerate = pkgs.writeShellScriptBin "regenerate" ''
|
||||
(cd $(git rev-parse --show-toplevel)/tvix/store-go && rm *.pb.go && cp ${depot.tvix.store.protos.go-bindings}/*.pb.go . && chmod +w *.pb.go)
|
||||
'';
|
||||
in
|
||||
(pkgs.buildGoModule {
|
||||
name = "store-go";
|
||||
src = depot.third_party.gitignoreSource ./.;
|
||||
|
@ -10,10 +15,10 @@
|
|||
label = ":water_buffalo: ensure generated protobuf files match";
|
||||
needsOutput = true;
|
||||
command = pkgs.writeShellScript "pb-go-check" ''
|
||||
${depot.tvix.store-go-generate}
|
||||
${regenerate}
|
||||
if [[ -n "$(git status --porcelain -unormal)" ]]; then
|
||||
echo "-----------------------------"
|
||||
echo ".pb.go files need to be updated, run //tvix:store-go-generate"
|
||||
echo ".pb.go files need to be updated, mg run //tvix/store-go/generate"
|
||||
echo "-----------------------------"
|
||||
git status -unormal
|
||||
exit 1
|
||||
|
@ -22,4 +27,5 @@
|
|||
alwaysRun = true;
|
||||
};
|
||||
};
|
||||
passthru.regenerate = regenerate;
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue