So, I have a project that uses a build.rs
file to do some custom build steps, involving bindgen
to generate bindings for a "native" library that I need. This all works fine, locally.
Now, when I publish the project on crates.io, the problem arises that docs.rs tries to build the documentation for my project, but that always fails, because the custom build steps in my build.rs
will fail in the environment where docs.rs is executing the build process
The required "native" library is missing in the docs.rs build anvironemnt.
Even if I somehow was able to detect, inside of my build.rs
, that we are running on docs.rs (BTW: how would I do that, if it is possible at all?), then it wouldn't really solve the problem. Sure, I could simply skip all the bindgen
stuff in my build.rs
, iff we are running on docs.rs, but then the rest of the project wouldn't work (i.e. fail to compile) due to the missing bindings!
What is the "standard" way of dealing with this situation?
Note: I already have a working CI pipeline, implemented via GitHub Actions, that performs the build process and also generates the docs just fine. That is possible, because GitHub Actions allows me to set up an environment where the required dependencies are available.
Is there a way to just completely disable the involvement of docs.rs for my project?
(Sure, I could just ignore that it is failing, but I don't like that idea )
Thank you!