@@ -184,6 +184,10 @@ enum Xtasks {
184
184
/// This will open the generated docs in the default browser
185
185
#[ clap( long, short) ]
186
186
open : bool ,
187
+
188
+ /// Skip building rust docs
189
+ #[ clap( long, short) ]
190
+ no_rust_docs : bool ,
187
191
} ,
188
192
/// Build the main workspace, and then run all tests
189
193
Test ,
@@ -196,7 +200,7 @@ impl Xtasks {
196
200
match self {
197
201
Xtasks :: Build => Self :: build ( features) ,
198
202
Xtasks :: Check => Self :: check ( features) ,
199
- Xtasks :: Docs { open } => Self :: docs ( open) ,
203
+ Xtasks :: Docs { open, no_rust_docs } => Self :: docs ( open, no_rust_docs ) ,
200
204
Xtasks :: Test => Self :: test ( features) ,
201
205
Xtasks :: CiCheck => Self :: cicd ( ) ,
202
206
Xtasks :: Init => Self :: init ( ) ,
@@ -334,54 +338,58 @@ impl Xtasks {
334
338
Ok ( ( ) )
335
339
}
336
340
337
- fn docs ( open : bool ) -> Result < ( ) > {
341
+ fn docs ( open : bool , no_rust_docs : bool ) -> Result < ( ) > {
338
342
// find [package.metadata."docs.rs"] key in Cargo.toml
339
- let metadata = Self :: cargo_metadata ( ) ?;
343
+ if !no_rust_docs {
344
+ info ! ( "Building rust docs" ) ;
345
+ let metadata = Self :: cargo_metadata ( ) ?;
346
+
347
+ let package = metadata
348
+ . packages
349
+ . iter ( )
350
+ . find ( |p| p. name == "bevy_mod_scripting" )
351
+ . expect ( "Could not find bevy_mod_scripting package in metadata" ) ;
352
+
353
+ info ! ( "Building with root package: {}" , package. name) ;
354
+
355
+ let docs_rs = package
356
+ . metadata
357
+ . get ( "docs.rs" )
358
+ . expect ( "no docs.rs metadata" ) ;
359
+
360
+ let features = docs_rs
361
+ . as_object ( )
362
+ . expect ( "docs.rs metadata is not an object" )
363
+ . get ( "features" )
364
+ . expect ( "no 'features' in docs.rs metadata" ) ;
365
+
366
+ info ! ( "Using docs.rs metadata: {:?}" , docs_rs) ;
367
+ let string_list = features
368
+ . as_array ( )
369
+ . expect ( "docs.rs metadata is not an array" )
370
+ . iter ( )
371
+ . map ( |v| v. as_str ( ) . expect ( "docs.rs metadata is not a string" ) )
372
+ . map ( |s| Feature :: from_str ( s) . expect ( "invalid feature" ) )
373
+ . collect :: < Vec < _ > > ( ) ;
340
374
341
- let package = metadata
342
- . packages
343
- . iter ( )
344
- . find ( |p| p. name == "bevy_mod_scripting" )
345
- . expect ( "Could not find bevy_mod_scripting package in metadata" ) ;
346
-
347
- info ! ( "Building with root package: {}" , package. name) ;
348
-
349
- let docs_rs = package
350
- . metadata
351
- . get ( "docs.rs" )
352
- . expect ( "no docs.rs metadata" ) ;
353
-
354
- let features = docs_rs
355
- . as_object ( )
356
- . expect ( "docs.rs metadata is not an object" )
357
- . get ( "features" )
358
- . expect ( "no 'features' in docs.rs metadata" ) ;
359
-
360
- info ! ( "Using docs.rs metadata: {:?}" , docs_rs) ;
361
- let string_list = features
362
- . as_array ( )
363
- . expect ( "docs.rs metadata is not an array" )
364
- . iter ( )
365
- . map ( |v| v. as_str ( ) . expect ( "docs.rs metadata is not a string" ) )
366
- . map ( |s| Feature :: from_str ( s) . expect ( "invalid feature" ) )
367
- . collect :: < Vec < _ > > ( ) ;
368
-
369
- let features = Features ( string_list) ;
370
-
371
- let mut args = Vec :: default ( ) ;
372
- args. push ( "--all" ) ;
373
- if open {
374
- args. push ( "--open" ) ;
375
+ let features = Features ( string_list) ;
376
+
377
+ let mut args = Vec :: default ( ) ;
378
+ args. push ( "--all" ) ;
379
+ if open {
380
+ args. push ( "--open" ) ;
381
+ }
382
+ Self :: run_workspace_command (
383
+ "doc" ,
384
+ "Failed to build crates.io docs" ,
385
+ features. clone ( ) ,
386
+ args,
387
+ None ,
388
+ ) ?;
375
389
}
376
- Self :: run_workspace_command (
377
- "doc" ,
378
- "Failed to build crates.io docs" ,
379
- features. clone ( ) ,
380
- args,
381
- None ,
382
- ) ?;
383
390
384
391
// build mdbook
392
+ info ! ( "Building mdbook docs" ) ;
385
393
let args = if open { vec ! [ "build" ] } else { vec ! [ "serve" ] } ;
386
394
387
395
Self :: run_system_command (
@@ -507,7 +515,7 @@ impl Xtasks {
507
515
Self :: check ( all_features. clone ( ) ) ?;
508
516
509
517
// run docs
510
- Self :: docs ( false ) ?;
518
+ Self :: docs ( false , false ) ?;
511
519
512
520
// run tests
513
521
Self :: test ( all_features) ?;
0 commit comments