tvix/{store,build}: rebuild rules for protos are broken

#387
Opened by sterni at 2024-03-15T19·53+00

The build.rs files for //tvix/store and //tvix/build generate bogus cargo:rerun-if-changed directives that cause cargo to rebuild tvix every single time I do anything:

[tvix-castore 0.1.0] cargo:rerun-if-changed=tvix/castore/protos/castore.proto
[tvix-castore 0.1.0] cargo:rerun-if-changed=tvix/castore/protos/rpc_blobstore.proto
[tvix-castore 0.1.0] cargo:rerun-if-changed=tvix/castore/protos/rpc_directory.proto
[tvix-castore 0.1.0] cargo:rerun-if-changed=../..

[tvix-build 0.1.0] cargo:rerun-if-changed=tvix/build/protos/build.proto
[tvix-build 0.1.0] cargo:rerun-if-changed=tvix/build/protos/rpc_build.proto
[tvix-build 0.1.0] cargo:rerun-if-changed=../..
[tvix-store 0.1.0] cargo:rerun-if-changed=tvix/store/protos/pathinfo.proto
[tvix-store 0.1.0] cargo:rerun-if-changed=tvix/store/protos/rpc_pathinfo.proto
[tvix-store 0.1.0] cargo:rerun-if-changed=../..

  1. This seems to be over a problem relating to the relative location of the protos:

           Dirty tvix-store v0.1.0 (/home/lukas/src/depot/tvix/store): the file `store/tvix/store/protos/pathinfo.proto` is missing
           Dirty tvix-build v0.1.0 (/home/lukas/src/depot/tvix/build): the file `build/tvix/build/protos/build.proto` is missing
    

    sterni at 2024-03-15T19·58+00

  2. … though that doesn't really matter since cargo:rerun-if-changed=../.. would cause a rebuild always. If tonic would emit only correct paths, we would be golden…

    sterni at 2024-03-15T20·24+00

  3. https://cl.tvl.fyi/11157 proposes a workaround for this, which should be good enough.

    flokli at 2024-03-15T21·04+00

  4. At least for me, it seems to now stop compiling every time:

    ❯ cargo build
       Compiling tvix-castore v0.1.0 (/home/flokli/dev/nixos/code.tvl.fyi/tvix/castore)
       Compiling tvix-store v0.1.0 (/home/flokli/dev/nixos/code.tvl.fyi/tvix/store)
        Finished dev [unoptimized + debuginfo] target(s) in 14.92s
    ❯ cargo build
       Compiling tvix-castore v0.1.0 (/home/flokli/dev/nixos/code.tvl.fyi/tvix/castore)
       Compiling tvix-store v0.1.0 (/home/flokli/dev/nixos/code.tvl.fyi/tvix/store)
        Finished dev [unoptimized + debuginfo] target(s) in 6.28s
    ❯ cargo build
        Finished dev [unoptimized + debuginfo] target(s) in 0.15s
    

    flokli at 2024-03-15T21·06+00

  5. https://cl.tvl.fyi/11157 got merged, this can be closed.

    flokli at 2024-03-16T09·38+00

  6. flokli closed this issue at 2024-03-16T09·38+00