pejrich
Rustler - Any way to remove build artifacts automatically? 78mb exec vs 1.5gb build artifacts
I’m using rustler to wrap a Rust library. Specifically charabia. It’s a language tokenization library, and as such has to use a lot of dictionary data during building, which leads to large target directories. If my understanding of Rust is correct, the contents of build and deps are only relevant during building, and libmyapp_native or libmyapp_native.dylib are the only things that are needed during runtime. If this is the case, I’m curious if there’s a way to have Rustler automatically delete the deps and build directory after the executable has been built.
Here is what the sizes look like in my _build directory for the app’s native directory:
0B .cargo-lock
0B examples
0B incremental
4.0K libmyapp_native.d
3.7M .fingerprint
78M libmyapp_native.dylib
471M deps
1.1G build
From my understanding, this is the important part, not the stuff below it(at least once building is done).
78M libmyapp_native.dylib
First Post!
ziinc
You can try doing your own compilation step where you use cargo clean to clean the intermediate build files.
Rustler has a skip_compilation? option so you can do the compilation separately.








