@@ -13,11 +13,10 @@ pub struct Manifest<'a> {
1313}
1414
1515impl < ' a > Manifest < ' a > {
16- pub fn parse ( s : & ' a str , mobile : bool ) -> Result < Self , anyhow:: Error > {
16+ pub fn parse ( s : & ' a str ) -> Result < Self , anyhow:: Error > {
1717 let mut manifest = Self :: default ( ) ;
1818
1919 let mut in_files_section = false ;
20- let mut in_mobile_section = false ;
2120
2221 for ( i, line) in s. split ( '\n' ) . enumerate ( ) {
2322 let line_number = i + 1 ;
@@ -31,13 +30,6 @@ impl<'a> Manifest<'a> {
3130
3231 if line == "[files]" {
3332 in_files_section = true ;
34- in_mobile_section = false ;
35- continue ;
36- }
37-
38- if line == "[mobile]" {
39- in_mobile_section = true ;
40- in_files_section = false ;
4133 continue ;
4234 }
4335
@@ -64,16 +56,12 @@ impl<'a> Manifest<'a> {
6456 bail ! ( "parsing manifest: value is empty in line {line_number}" ) ;
6557 }
6658
67- #[ allow( clippy:: nonminimal_bool) ]
68- let replace =
69- !in_files_section && ( !in_mobile_section || ( in_mobile_section && mobile) ) ;
70-
7159 match k {
72- "beforeDevCommand" if replace => manifest. before_dev_command = Some ( v) ,
73- "beforeBuildCommand" if replace => manifest. before_build_command = Some ( v) ,
74- "devPath" if replace => manifest. dev_path = Some ( v) ,
75- "distDir" if replace => manifest. dist_dir = Some ( v) ,
76- "withGlobalTauri" if replace => manifest. with_global_tauri = Some ( v. parse ( ) ?) ,
60+ "beforeDevCommand" => manifest. before_dev_command = Some ( v) ,
61+ "beforeBuildCommand" => manifest. before_build_command = Some ( v) ,
62+ "devPath" => manifest. dev_path = Some ( v) ,
63+ "distDir" => manifest. dist_dir = Some ( v) ,
64+ "withGlobalTauri" => manifest. with_global_tauri = Some ( v. parse ( ) ?) ,
7765 _ if in_files_section => {
7866 manifest. files . insert ( k, v) ;
7967 }
@@ -100,15 +88,12 @@ mod test {
10088 beforeBuildCommand = {% pkg_manager_run_command %} build # this comment should be stripped
10189 devPath = http://localhost:1420
10290
103- [mobile]
104- beforeBuildCommand = {% pkg_manager_run_command %} build mobile
105-
10691 [files]
10792 tauri.svg = src/assets/tauri.svg
10893 styles.css = src/styles.css
10994 "# ;
11095
111- assert_eq ! ( Manifest :: parse( manifest_file, false ) . unwrap( ) , {
96+ assert_eq ! ( Manifest :: parse( manifest_file) . unwrap( ) , {
11297 let mut files = HashMap :: new( ) ;
11398 files. insert( "tauri.svg" , "src/assets/tauri.svg" ) ;
11499 files. insert( "styles.css" , "src/styles.css" ) ;
@@ -122,21 +107,6 @@ mod test {
122107 files,
123108 }
124109 } ) ;
125-
126- assert_eq ! ( Manifest :: parse( manifest_file, true ) . unwrap( ) , {
127- let mut files = HashMap :: new( ) ;
128- files. insert( "tauri.svg" , "src/assets/tauri.svg" ) ;
129- files. insert( "styles.css" , "src/styles.css" ) ;
130-
131- Manifest {
132- before_dev_command: Some ( "npm start -- --port 1420" ) ,
133- before_build_command: Some ( "{% pkg_manager_run_command %} build mobile" ) ,
134- dev_path: Some ( "http://localhost:1420" ) ,
135- dist_dir: None ,
136- with_global_tauri: None ,
137- files,
138- }
139- } ) ;
140110 }
141111
142112 #[ test]
@@ -151,15 +121,12 @@ mod test {
151121 beforeBuildCommand =
152122 devPath = http://localhost:1420
153123
154- [mobile]
155- beforeBuildCommand = {% pkg_manager_run_command %} build mobile
156-
157124 [files]
158125 tauri.svg = src/assets/tauri.svg
159126 styles.css = src/styles.css
160127 "# ;
161128
162- Manifest :: parse ( manifest_file, false ) . unwrap ( ) ;
129+ Manifest :: parse ( manifest_file) . unwrap ( ) ;
163130 }
164131
165132 #[ test]
@@ -179,7 +146,7 @@ mod test {
179146 styles.css = src/styles.css
180147 "# ;
181148
182- assert_eq ! ( Manifest :: parse( manifest_file, false ) . unwrap( ) , {
149+ assert_eq ! ( Manifest :: parse( manifest_file) . unwrap( ) , {
183150 let mut files = HashMap :: new( ) ;
184151 files. insert( "tauri.svg" , "src/assets/tauri.svg" ) ;
185152 files. insert( "styles.css" , "src/styles.css" ) ;
0 commit comments