@@ -46,13 +46,11 @@ pub fn discover_proc_block_manifests(
46
46
Ok ( ProcBlocks {
47
47
packages,
48
48
target_dir : metadata. target_directory . into_std_path_buf ( ) ,
49
- workspace_root : workspace_root. to_path_buf ( ) ,
50
49
} )
51
50
}
52
51
53
52
#[ derive( Debug ) ]
54
53
pub struct ProcBlocks {
55
- workspace_root : PathBuf ,
56
54
packages : Vec < Package > ,
57
55
target_dir : PathBuf ,
58
56
}
@@ -70,48 +68,43 @@ impl ProcBlocks {
70
68
let cargo =
71
69
std:: env:: var ( "CARGO" ) . unwrap_or_else ( |_| "cargo" . to_string ( ) ) ;
72
70
73
- let mut cmd = Command :: new ( cargo) ;
74
- cmd. arg ( "build" )
75
- . arg ( "--manifest-path" )
76
- . arg ( & self . workspace_root )
77
- . arg ( "--workspace" )
78
- . arg ( "--target=wasm32-unknown-unknown" )
79
- . arg ( "--exclude=xtask" )
80
- . arg ( "--features=metadata" ) ;
81
-
82
- match mode {
83
- CompilationMode :: Release => {
84
- cmd. arg ( "--release" ) ;
85
- } ,
86
- CompilationMode :: Debug => { } ,
87
- }
71
+ let mut libs = Vec :: new ( ) ;
72
+
73
+ for package in & self . packages {
74
+ let mut cmd = Command :: new ( & cargo) ;
75
+ cmd. arg ( "rustc" )
76
+ . arg ( "--manifest-path" )
77
+ . arg ( & package. manifest_path )
78
+ . arg ( "--lib" )
79
+ . arg ( "--target=wasm32-unknown-unknown" )
80
+ . arg ( "--features=metadata" )
81
+ . arg ( "-Zunstable-options" )
82
+ . arg ( "--crate-type=cdylib" ) ;
83
+
84
+ match mode {
85
+ CompilationMode :: Release => {
86
+ cmd. arg ( "--release" ) ;
87
+ } ,
88
+ CompilationMode :: Debug => { } ,
89
+ }
88
90
89
- tracing:: debug!( command = ?cmd, "Running cargo build" ) ;
91
+ tracing:: debug!( command = ?cmd, "Running cargo build" ) ;
90
92
91
- let status = cmd. status ( ) . with_context ( || {
92
- format ! (
93
- "Unable to start \" {}\" " ,
94
- cmd. get_program( ) . to_string_lossy( )
95
- )
96
- } ) ?;
93
+ let status = cmd. status ( ) . with_context ( || {
94
+ format ! (
95
+ "Unable to start \" {}\" " ,
96
+ cmd. get_program( ) . to_string_lossy( )
97
+ )
98
+ } ) ?;
97
99
98
- tracing:: debug!( exit_code = ?status. code( ) , "Cargo build completed" ) ;
100
+ tracing:: debug!( exit_code = ?status. code( ) , "Cargo build completed" ) ;
99
101
100
- if !status. success ( ) {
101
- anyhow:: bail!( "Compilation failed" ) ;
102
- }
102
+ if !status. success ( ) {
103
+ anyhow:: bail!( "Compilation failed" ) ;
104
+ }
103
105
104
- let libs: Vec < _ > = self
105
- . packages
106
- . iter ( )
107
- . filter ( |pkg| pkg. features . contains_key ( "metadata" ) )
108
- . filter_map ( |pkg| {
109
- pkg. targets
110
- . iter ( )
111
- . find ( |t| t. kind . iter ( ) . any ( |k| k == "cdylib" ) )
112
- . map ( |t| & t. name )
113
- } )
114
- . collect ( ) ;
106
+ libs. push ( & package. name ) ;
107
+ }
115
108
116
109
tracing:: debug!( ?libs) ;
117
110
0 commit comments