Copy dependencies into Flatpak for 'offline' building

I am finding it hard to continue working/experimenting on Flatpak with Rust as each build takes ~20 mins. To speed it up I have imported my .cargo directory into the flatpak build. Below is what I'm adding to my Flatpak manifest to move the dependencies in. If all dependencies are already cached then share=network does not need to be added to the build-args.

modules:
_ - name: example
__ sources:
___ - type: dir
____ path: /home/dean/.cargo
____ dest: cargo
__ build-options:
____ env:
______ CARGO_HOME: /run/build/example/cargo

Is there a way to make this technique better?
Is there a way to easily intergrate cargo vendor to only pull in the required dependencies?
Is there a way to move the compiled dependencies in so each build becomes faster?

My full Flatpak manifest
* I don't know how to add tabs/spaces to blockquotes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.