File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,10 @@ pub struct Common {
1919 /// The location of the WIT document(s).
2020 ///
2121 /// This may be specified more than once, for example:
22- /// `-d ./wit/deps -d ./wit/app`
22+ /// `-d ./wit/deps -d ./wit/app`.
23+ ///
24+ /// These paths can be either directories containing `*.wit` files, `*.wit`
25+ /// files themselves, or `*.wasm` files which are wasm-encoded WIT packages.
2326 #[ arg( long, short = 'd' ) ]
2427 pub wit_path : Vec < PathBuf > ,
2528
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ use std::{
33 path:: { Path , PathBuf } ,
44 process:: Command ,
55} ;
6- use wit_parser:: { Resolve , UnresolvedPackageGroup , WorldId } ;
6+ use wit_parser:: { PackageId , Resolve , WorldId } ;
77
88/// Ensure that the Go version is compatible with the embedded Wasm tooling.
99fn check_go_version ( go_path : & PathBuf ) -> Result < ( ) > {
@@ -191,19 +191,12 @@ fn parse_wit(
191191 }
192192 }
193193
194- let mut last_pkg = None ;
194+ let mut main_packages : Vec < PackageId > = vec ! [ ] ;
195195 for path in paths. iter ( ) . map ( AsRef :: as_ref) {
196- let pkg = if path. is_dir ( ) {
197- resolve. push_dir ( path) ?. 0
198- } else {
199- let pkg = UnresolvedPackageGroup :: parse_file ( path) ?;
200- resolve. push_group ( pkg) ?
201- } ;
202- last_pkg = Some ( pkg) ;
196+ let ( pkg, _files) = resolve. push_path ( path) ?;
197+ main_packages. push ( pkg) ;
203198 }
204199
205- let pkg = last_pkg. unwrap ( ) ; // The paths should not be empty
206- let world = resolve. select_world ( & [ pkg] , world) ?;
207-
200+ let world = resolve. select_world ( & main_packages, world) ?;
208201 Ok ( ( resolve, world) )
209202}
You can’t perform that action at this time.
0 commit comments