@@ -5,10 +5,14 @@ use std::path::{Path, PathBuf};
5
5
const BOOTLOADER_VERSION : & str = env ! ( "CARGO_PKG_VERSION" ) ;
6
6
7
7
fn main ( ) {
8
+ #[ cfg( not( feature = "uefi" ) ) ]
9
+ async fn uefi_main ( ) { }
10
+ #[ cfg( not( feature = "bios" ) ) ]
11
+ async fn bios_main ( ) { }
12
+
8
13
block_on ( ( uefi_main ( ) , bios_main ( ) ) . join ( ) ) ;
9
14
}
10
15
11
- #[ cfg( not( docsrs_dummy_build) ) ]
12
16
#[ cfg( feature = "bios" ) ]
13
17
async fn bios_main ( ) {
14
18
let out_dir = PathBuf :: from ( std:: env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
@@ -17,6 +21,7 @@ async fn bios_main() {
17
21
// BIOS crates don't have enough dependencies to utilize all cores on modern
18
22
// CPUs. So by running the build commands in parallel, we increase the number
19
23
// of utilized cores.)
24
+ #[ cfg( not( docsrs_dummy_build) ) ]
20
25
let ( bios_boot_sector_path, bios_stage_2_path, bios_stage_3_path, bios_stage_4_path) = (
21
26
build_bios_boot_sector ( & out_dir) ,
22
27
build_bios_stage_2 ( & out_dir) ,
@@ -25,6 +30,14 @@ async fn bios_main() {
25
30
)
26
31
. join ( )
27
32
. await ;
33
+ // dummy implementations because docsrs builds have no network access
34
+ #[ cfg( docsrs_dummy_build) ]
35
+ let ( bios_boot_sector_path, bios_stage_2_path, bios_stage_3_path, bios_stage_4_path) = (
36
+ PathBuf :: new ( ) ,
37
+ PathBuf :: new ( ) ,
38
+ PathBuf :: new ( ) ,
39
+ PathBuf :: new ( ) ,
40
+ ) ;
28
41
println ! (
29
42
"cargo:rustc-env=BIOS_BOOT_SECTOR_PATH={}" ,
30
43
bios_boot_sector_path. display( )
@@ -43,11 +56,16 @@ async fn bios_main() {
43
56
) ;
44
57
}
45
58
46
- #[ cfg( not( docsrs_dummy_build) ) ]
47
59
#[ cfg( feature = "uefi" ) ]
48
60
async fn uefi_main ( ) {
49
61
let out_dir = PathBuf :: from ( std:: env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
62
+
63
+ #[ cfg( not( docsrs_dummy_build) ) ]
50
64
let uefi_path = build_uefi_bootloader ( & out_dir) . await ;
65
+ // dummy implementation because docsrs builds have no network access
66
+ #[ cfg( docsrs_dummy_build) ]
67
+ let uefi_path = PathBuf :: new ( ) ;
68
+
51
69
println ! (
52
70
"cargo:rustc-env=UEFI_BOOTLOADER_PATH={}" ,
53
71
uefi_path. display( )
@@ -295,9 +313,3 @@ async fn convert_elf_to_bin(elf_path: PathBuf) -> PathBuf {
295
313
}
296
314
flat_binary_path
297
315
}
298
-
299
- // dummy implementations because docsrs builds have no network access
300
- #[ cfg( any( not( feature = "bios" ) , docsrs_dummy_build) ) ]
301
- async fn bios_main ( ) { }
302
- #[ cfg( any( not( feature = "uefi" ) , docsrs_dummy_build) ) ]
303
- async fn uefi_main ( ) { }
0 commit comments