File tree Expand file tree Collapse file tree 4 files changed +18
-11
lines changed Expand file tree Collapse file tree 4 files changed +18
-11
lines changed Original file line number Diff line number Diff line change 1- #![ allow( dead_code) ]
2-
31fn build_glue_for_game_activity ( ) {
42 for f in [
53 "GameActivity.h" ,
@@ -46,6 +44,16 @@ fn build_glue_for_game_activity() {
4644}
4745
4846fn main ( ) {
49- #[ cfg( feature = "game-activity" ) ]
50- build_glue_for_game_activity ( ) ;
47+ // Avoid re-running build script if nothing changed.
48+ println ! ( "cargo:rerun-if-changed=build.rs" ) ;
49+
50+ if cfg ! ( feature = "game-activity" ) {
51+ build_glue_for_game_activity ( ) ;
52+ }
53+
54+ // Whether this is used directly in or as a dependency on docs.rs.
55+ println ! ( "cargo:rustc-check-cfg=cfg(used_on_docsrs)" ) ;
56+ if std:: env:: var ( "DOCS_RS" ) . is_ok ( ) {
57+ println ! ( "cargo:rustc-cfg=used_on_docsrs" ) ;
58+ }
5159}
Original file line number Diff line number Diff line change 1- #![ cfg( feature = "game-activity" ) ]
2-
31use std:: collections:: HashMap ;
42use std:: marker:: PhantomData ;
53use std:: ops:: Deref ;
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ compile_error!(
140140) ;
141141#[ cfg( all(
142142 not( any( feature = "game-activity" , feature = "native-activity" ) ) ,
143- not( doc)
143+ not( any ( doc, used_on_docsrs ) ) ,
144144) ) ]
145145compile_error ! (
146146 r#"Either "game-activity" or "native-activity" must be enabled as features
@@ -159,8 +159,11 @@ You may need to add a `[patch]` into your Cargo.toml to ensure a specific versio
159159android-activity is used across all of your application's crates."#
160160) ;
161161
162- #[ cfg_attr( any( feature = "native-activity" , doc) , path = "native_activity/mod.rs" ) ]
163- #[ cfg_attr( any( feature = "game-activity" , doc) , path = "game_activity/mod.rs" ) ]
162+ #[ cfg_attr(
163+ any( feature = "native-activity" , doc, used_on_docsrs) ,
164+ path = "native_activity/mod.rs"
165+ ) ]
166+ #[ cfg_attr( feature = "game-activity" , path = "game_activity/mod.rs" ) ]
164167pub ( crate ) mod activity_impl;
165168
166169pub mod error;
Original file line number Diff line number Diff line change 1- #![ cfg( any( feature = "native-activity" , doc) ) ]
2-
31use std:: collections:: HashMap ;
42use std:: marker:: PhantomData ;
53use std:: panic:: AssertUnwindSafe ;
You can’t perform that action at this time.
0 commit comments