rust-mobile / android-activity

Glue for building Rust applications on Android with NativeActivity or GameActivity
238 stars 46 forks source link

Allow downstream libraries' documentation to work without feature flags #117

Open madsmtm opened 1 year ago

madsmtm commented 1 year ago

Running cargo doc --target=aarch64-linux-android in winit fails to build because we haven't selected an activity.

It would be nice if that wasn't the case, e.g. the library compiled in #[cfg(doc)] successfully without selecting an activity.

(I think this is also why currently, winit doesn't display any platform-specific documentation for Android on docs.rs).

MarijnS95 commented 1 year ago

There is already a --cfg docsrs to steer some of this when we build this maybe it might help:

https://github.com/rust-mobile/android-activity/blob/main/android-activity/Cargo.toml#L62C27-L62C33


However:

Running cargo doc --target=aarch64-linux-android in winit fails to build because we haven't selected an activity.

That is strange though because there's already a && not(doc) there, to not panic if no activity is selected (but I guess it doesn't compile thereafter regardless, and we need to select a default?):

https://github.com/rust-mobile/android-activity/blob/865cc6a780bdf0e5d3e987744acaf26e4f003b1e/android-activity/src/lib.rs#L79-L84