stm32-rs icon indicating copy to clipboard operation
stm32-rs copied to clipboard

docs.rs only shows empty crates

Open jonas-schievink opened this issue 7 years ago • 21 comments

For example: https://docs.rs/stm32f4/0.1.0/stm32f4/

The features added in https://github.com/onur/docs.rs/pull/73 can be used to make docs.rs build the crates with all features enabled:

[package.metadata.docs.rs]
all-features = true

jonas-schievink avatar Apr 12 '18 23:04 jonas-schievink

Actually, scratch that. cargo doc --open --all-features takes 10 minutes and uses up to 12 GB of memory, so I doubt the docs.rs builder would like that. I'd still like to find some solution for hosted docs, though.

jonas-schievink avatar Apr 12 '18 23:04 jonas-schievink

I was trying to look for that feature to make docs.rs build all features and couldn't find it anywhere, so thanks! But I fear you're right and it won't enjoy the intense RAM usage.

At the moment I have a sort of halfway towards being docs thing at https://stm32.agg.io/rs but it's not really what you want. I think I might be able to build them locally and host somewhere, but it would be nice if they could be on docs.rs. Could always add a link in the crate READMEs though.

adamgreig avatar Apr 12 '18 23:04 adamgreig

I uploaded docs for just stm32f405 here to try it out, but it takes a lot of time to generate and upload and about 500MB per device. I think I can probably wrangle that for everything but it'l take a while and is a bit extreme. I'll look in to generating them on the server at least.

adamgreig avatar Apr 24 '18 23:04 adamgreig

Maybe you could (ab)use Travis CI to generate the doc ?

gbip avatar Jun 15 '18 18:06 gbip

Travis only provides like 2 GB of RAM

jonas-schievink avatar Jun 15 '18 18:06 jonas-schievink

Generating the doc for 1 micro-controller took roughly 1.5 Gb of Ram on my computer, so I guess it is still doable, don't you think ?

gbip avatar Jun 15 '18 18:06 gbip

Then you'd have to generate multiple documentation pages per crate since it's necessary to document all microcontrollers, which makes navigating the docs annoying and still doesn't make them show up on docs.rs

To solve this issue properly at least one of these thing probably needs to happen:

  • Improve rustdoc's performance and memory use significantly
  • Improve the code generated by svd2rust (primarily by generating less of it)
  • We just use single-microcontroller crates instead

jonas-schievink avatar Jun 15 '18 19:06 jonas-schievink

Maybe a dumb question, but: Have you actually tried to generate the docs on docs.rs? Or do you just think that the docs.rs builder is not capable enough? Because normal svd2rust crates like stm32f7x6 seem to work fine on docs.rs. (I know that this crate is different because it contains code for multiple different devices, but I think it's worth a try.)

phil-opp avatar Jul 02 '18 08:07 phil-opp

I haven't actually tried. We'd just need to set

[package.metadata.docs.rs]
all-features = true

in the Cargo.toml of one crate and see what happens. I'm planning on a 0.2.1 release either today or tomorrow so I'll set that on one crate and see what it does.

adamgreig avatar Jul 02 '18 09:07 adamgreig

Thanks!

phil-opp avatar Jul 02 '18 09:07 phil-opp

I added that to stm321, stm32f2, stm32f3 crates before releasing 0.2.1.

However, the cortex-m dependency fails to build docs at the moment, so that might trip up docs.rs irregardless.

adamgreig avatar Jul 02 '18 21:07 adamgreig

Mixed results: stm32f1 worked, stm32f2 did too, but stm32f3 got this error log indicating the process was SIGKILL'd.

I'm guessing the first two just about fit but the f3 didn't, which doesn't bode well for f4/f7 which are bigger, but maybe f0 would work.

adamgreig avatar Jul 03 '18 17:07 adamgreig

Thanks for testing! I think we should open an issue in the docs.rs repo for this, maybe there is a way to increase limits. For the meantime we could enable only a few device features instead of all features so that there's at least some kind of documentation.

phil-opp avatar Jul 05 '18 09:07 phil-opp

That's not a bad idea... perhaps pick one or two representative devices per family which are likely to be popular or similar to everything else.

adamgreig avatar Jul 05 '18 20:07 adamgreig

I've updated crates to all build at least one or two devices. We'll see if it works and if any fail I might need to reduce the number of devices they try to build even further. I'll leave this issue open for now as it's still not an entirely satisfactory solution...

adamgreig avatar Jul 11 '18 20:07 adamgreig

Awesome, thanks @adamgreig!

phil-opp avatar Jul 12 '18 08:07 phil-opp

Might I suggest changing the device choices to reflect availability of dev boards? For instance, in the stm32l4 series, the two main Nucleos are NUCLEO-L476RG and NUCLEO-L432KC, so it would make sense to build stm32l4x2 and stm32l4x6 instead of the current 4x1 and 4x5.

nickray avatar Nov 15 '18 08:11 nickray

I believe this issue has been resolved as of the 0.6.0 release.

jessebraham avatar Feb 10 '19 17:02 jessebraham

We still don't build all devices in the docs -- each family crate has a list of which devices to include which is meant to be a vaguely representative subset, but I think docs.rs will still fail to build the entire f4 crate for example.

adamgreig avatar Feb 12 '19 01:02 adamgreig

Gotcha, just checked a handful of random device crates so I guess I got unlucky, disregard :p

jessebraham avatar Feb 12 '19 01:02 jessebraham

Improve rustdoc's performance and memory use significantly

If someone can give a flamegraph or perf mem record, I'd be interested in improving rustdoc's performance. Or you could measure it some other way, the main ones I know about are -Z self-profile and -Z time-passes.

jyn514 avatar Nov 05 '20 04:11 jyn514