rust-lang / docs.rs

crates.io documentation generator
https://docs.rs
MIT License
979 stars 195 forks source link

Docrs issue with build scripts that require local folders #2625

Open gwbres opened 1 day ago

gwbres commented 1 day ago

Crate name

anise

Build failure link

https://docs.rs/crate/anise/0.4.4/builds

Additional details

Hello,

we're facing issues in the anise library: https://github.com/nyx-space/anise/issues/302 because the Docrs auto documentation happens in a docker environment, and it's unable to obtain the local folder that should be shipped with our library. Error logs: https://docs.rs/crate/anise/0.4.4/builds

The local folder is created by Build.rs. Its content is to be embedded with rust_embed. The Docrs job happens in a read only environment and when it is brought up, it seems the ../data folder does not exist and causes are build script to fail.

Can you guys help out:

syphar commented 18 hours ago

@gwbres the filesystem is intentionally read-only.

The only directory you can write to is the cargo out-dir, so be found in the OUT_DIR environment variable.

See also https://docs.rs/about/builds#read-only-directories

On that link you can also find the ways to do conditional compilation for docs.rs if you want that.

we added ../data to include in Cargo.toml, to our understanding, this describes what is hosted in crates I/O by publication, so it should exist

you can check if it really exists by downloading the packaged release:

https://crates.io/api/v1/crates/anise/0.4.4/download

( the file is .crate but is actually .tar.gz )