33// SPDX-License-Identifier: MIT
44
55use anyhow:: Context ;
6- use tauri_bundler:: bundle:: { bundle_project, PackageType , SettingsBuilder } ;
6+ use tauri_bundler:: bundle:: { bundle_project, PackageType } ;
77
88use crate :: helpers:: {
99 app_paths:: { app_dir, tauri_dir} ,
@@ -16,8 +16,6 @@ use crate::helpers::{
1616
1717use std:: { env:: set_current_dir, fs:: rename, path:: PathBuf , process:: Command } ;
1818
19- mod rust;
20-
2119#[ derive( Default ) ]
2220pub struct Build {
2321 runner : Option < String > ,
@@ -124,10 +122,10 @@ impl Build {
124122 cargo_features. extend ( features) ;
125123 }
126124
127- rust:: build_project ( runner, & self . target , cargo_features, self . debug )
125+ crate :: interface :: rust:: build_project ( runner, & self . target , cargo_features, self . debug )
128126 . with_context ( || "failed to build app" ) ?;
129127
130- let app_settings = rust:: AppSettings :: new ( & config_) ?;
128+ let app_settings = crate :: interface :: rust:: AppSettings :: new ( & config_) ?;
131129
132130 let out_dir = app_settings
133131 . get_out_dir ( self . debug )
@@ -162,17 +160,8 @@ impl Build {
162160 } ;
163161 std:: fs:: write ( out_dir. join ( filename) , vcruntime_msm) ?;
164162 }
165- let mut settings_builder = SettingsBuilder :: new ( )
166- . package_settings ( app_settings. get_package_settings ( ) )
167- . bundle_settings ( app_settings. get_bundle_settings ( & config_, & manifest) ?)
168- . binaries ( app_settings. get_binaries ( & config_) ?)
169- . project_out_directory ( out_dir) ;
170-
171- if self . verbose {
172- settings_builder = settings_builder. verbose ( ) ;
173- }
174163
175- if let Some ( names) = self . bundles {
164+ let package_types = if let Some ( names) = self . bundles {
176165 let mut types = vec ! [ ] ;
177166 for name in names {
178167 if name == "none" {
@@ -190,8 +179,7 @@ impl Build {
190179 }
191180 }
192181 }
193-
194- settings_builder = settings_builder. package_types ( types) ;
182+ Some ( types)
195183 } else if let Some ( targets) = & config_. tauri . bundle . targets {
196184 let mut types = vec ! [ ] ;
197185 let targets = targets. to_vec ( ) ;
@@ -209,14 +197,26 @@ impl Build {
209197 }
210198 }
211199 }
212- settings_builder = settings_builder. package_types ( types) ;
200+ Some ( types)
201+ } else {
202+ None
213203 }
214- }
215-
216- // Bundle the project
217- let settings = settings_builder
218- . build ( )
219- . with_context ( || "failed to build bundler settings" ) ?;
204+ } else {
205+ None
206+ } ;
207+
208+ let settings = crate :: interface:: get_bundler_settings (
209+ app_settings,
210+ & manifest,
211+ & config_,
212+ & out_dir,
213+ self . verbose ,
214+ package_types,
215+ )
216+ . with_context ( || "failed to build bundler settings" ) ?;
217+
218+ settings. copy_resources ( & out_dir) ?;
219+ settings. copy_binaries ( & out_dir) ?;
220220
221221 let bundles = bundle_project ( settings) . with_context ( || "failed to bundle project" ) ?;
222222
0 commit comments