@@ -434,6 +434,8 @@ impl BundleBinary {
434434/// The Settings exposed by the module.
435435#[ derive( Clone , Debug ) ]
436436pub struct Settings {
437+ /// The log level.
438+ log_level : log:: Level ,
437439 /// the package settings.
438440 package : PackageSettings ,
439441 /// the package types we're bundling.
@@ -453,6 +455,7 @@ pub struct Settings {
453455/// A builder for [`Settings`].
454456#[ derive( Default ) ]
455457pub struct SettingsBuilder {
458+ log_level : Option < log:: Level > ,
456459 project_out_directory : Option < PathBuf > ,
457460 package_types : Option < Vec < PackageType > > ,
458461 package_settings : Option < PackageSettings > ,
@@ -511,6 +514,13 @@ impl SettingsBuilder {
511514 self
512515 }
513516
517+ /// Sets the log level for spawned commands. Defaults to [`log::Level::Error`].
518+ #[ must_use]
519+ pub fn log_level ( mut self , level : log:: Level ) -> Self {
520+ self . log_level . replace ( level) ;
521+ self
522+ }
523+
514524 /// Builds a Settings from the CLI args.
515525 ///
516526 /// Package settings will be read from Cargo.toml.
@@ -524,6 +534,7 @@ impl SettingsBuilder {
524534 } ;
525535
526536 Ok ( Settings {
537+ log_level : self . log_level . unwrap_or ( log:: Level :: Error ) ,
527538 package : self . package_settings . expect ( "package settings is required" ) ,
528539 package_types : self . package_types ,
529540 project_out_directory : self
@@ -544,6 +555,16 @@ impl SettingsBuilder {
544555}
545556
546557impl Settings {
558+ /// Sets the log level for spawned commands.
559+ pub fn set_log_level ( & mut self , level : log:: Level ) {
560+ self . log_level = level;
561+ }
562+
563+ /// Returns the log level for spawned commands.
564+ pub fn log_level ( & self ) -> log:: Level {
565+ self . log_level
566+ }
567+
547568 /// Returns the directory where the bundle should be placed.
548569 pub fn project_out_directory ( & self ) -> & Path {
549570 & self . project_out_directory
@@ -604,8 +625,14 @@ impl Settings {
604625 ///
605626 /// Fails if the host/target's native package type is not supported.
606627 pub fn package_types ( & self ) -> crate :: Result < Vec < PackageType > > {
607- let target_os = std:: env:: consts:: OS ;
608- let mut platform_types = match target_os {
628+ let target_os = self
629+ . target
630+ . split ( '-' )
631+ . nth ( 2 )
632+ . unwrap_or ( std:: env:: consts:: OS )
633+ . replace ( "darwin" , "macos" ) ;
634+
635+ let mut platform_types = match target_os. as_str ( ) {
609636 "macos" => vec ! [ PackageType :: MacOsBundle , PackageType :: Dmg ] ,
610637 "ios" => vec ! [ PackageType :: IosBundle ] ,
611638 "linux" => vec ! [ PackageType :: Deb , PackageType :: AppImage ] ,
0 commit comments