Struct cargo_packager::config::Config
source · pub struct Config {Show 31 fields
pub product_name: String,
pub version: String,
pub binaries: Vec<Binary>,
pub identifier: Option<String>,
pub before_packaging_command: Option<HookCommand>,
pub before_each_package_command: Option<HookCommand>,
pub log_level: Option<LogLevel>,
pub formats: Option<Vec<PackageFormat>>,
pub out_dir: PathBuf,
pub binaries_dir: Option<PathBuf>,
pub target_triple: Option<String>,
pub description: Option<String>,
pub long_description: Option<String>,
pub homepage: Option<String>,
pub authors: Option<Vec<String>>,
pub publisher: Option<String>,
pub license_file: Option<PathBuf>,
pub copyright: Option<String>,
pub category: Option<AppCategory>,
pub icons: Option<Vec<String>>,
pub file_associations: Option<Vec<FileAssociation>>,
pub resources: Option<Vec<Resource>>,
pub external_binaries: Option<Vec<PathBuf>>,
pub windows: Option<WindowsConfig>,
pub macos: Option<MacOsConfig>,
pub deb: Option<DebianConfig>,
pub appimage: Option<AppImageConfig>,
pub pacman: Option<PacmanConfig>,
pub wix: Option<WixConfig>,
pub nsis: Option<NsisConfig>,
pub dmg: Option<DmgConfig>,
/* private fields */
}
Expand description
The packaging config.
Fields§
§product_name: String
The package’s product name, for example “My Awesome App”.
version: String
The package’s version.
binaries: Vec<Binary>
The binaries to package.
identifier: Option<String>
The application identifier in reverse domain name notation (e.g. com.packager.example
).
This string must be unique across applications since it is used in some system configurations.
This string must contain only alphanumeric characters (A–Z, a–z, and 0–9), hyphens (-),
and periods (.).
before_packaging_command: Option<HookCommand>
The command to run before starting to package an application.
This runs only once.
before_each_package_command: Option<HookCommand>
The command to run before packaging each format for an application.
This will run multiple times depending on the formats specifed.
log_level: Option<LogLevel>
The logging level.
formats: Option<Vec<PackageFormat>>
The packaging formats to create, if not present, PackageFormat::platform_default
is used.
out_dir: PathBuf
The directory where the generated packages will be placed.
If Config::binaries_dir
is not set, this is also where the Config::binaries
exist.
binaries_dir: Option<PathBuf>
The directory where the Config::binaries
exist.
Defaults to Config::out_dir
.
target_triple: Option<String>
The target triple we are packaging for. This mainly affects Config::external_binaries
.
Defaults to the current OS target triple.
description: Option<String>
The package’s description.
long_description: Option<String>
The app’s long description.
homepage: Option<String>
The package’s homepage.
The package’s authors.
publisher: Option<String>
The app’s publisher. Defaults to the second element in Config::identifier
string.
Currently maps to the Manufacturer property of the Windows Installer.
license_file: Option<PathBuf>
A path to the license file.
copyright: Option<String>
The app’s copyright.
category: Option<AppCategory>
The app’s category.
icons: Option<Vec<String>>
The app’s icon list. Supports glob patterns.
file_associations: Option<Vec<FileAssociation>>
The file associations
resources: Option<Vec<Resource>>
The app’s resources to package. This a list of either a glob pattern, path to a file, path to a directory
or an object of src
and target
paths. In the case of using an object,
the src
could be either a glob pattern, path to a file, path to a directory,
and the target
is a path inside the final resources folder in the installed package.
§Format-specific:
- PackageFormat::Nsis / PackageFormat::Wix: The resources are placed next to the executable in the root of the packager.
- PackageFormat::Deb: The resources are placed in
usr/lib
of the package.
external_binaries: Option<Vec<PathBuf>>
Paths to external binaries to add to the package.
The path specified should not include -<target-triple><.exe>
suffix,
it will be auto-added when by the packager when reading these paths,
so the actual binary name should have the target platform’s target triple appended,
as well as .exe
for Windows.
For example, if you’re packaging an external binary called sqlite3
, the packager expects
a binary named sqlite3-x86_64-unknown-linux-gnu
on linux,
and sqlite3-x86_64-pc-windows-gnu.exe
on windows.
If you are building a universal binary for MacOS, the packager expects
your external binary to also be universal, and named after the target triple,
e.g. sqlite3-universal-apple-darwin
. See
https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary
windows: Option<WindowsConfig>
Windows-specific configuration.
macos: Option<MacOsConfig>
MacOS-specific configuration.
deb: Option<DebianConfig>
Debian-specific configuration.
appimage: Option<AppImageConfig>
AppImage configuration.
pacman: Option<PacmanConfig>
Pacman configuration.
wix: Option<WixConfig>
WiX configuration.
nsis: Option<NsisConfig>
Nsis configuration.
dmg: Option<DmgConfig>
Dmg configuration.
Implementations§
source§impl Config
impl Config
sourcepub fn builder() -> ConfigBuilder
pub fn builder() -> ConfigBuilder
Creates a new ConfigBuilder
.
sourcepub fn windows(&self) -> Option<&WindowsConfig>
pub fn windows(&self) -> Option<&WindowsConfig>
Returns the windows specific configuration.
sourcepub fn macos(&self) -> Option<&MacOsConfig>
pub fn macos(&self) -> Option<&MacOsConfig>
Returns the macos specific configuration.
sourcepub fn nsis(&self) -> Option<&NsisConfig>
pub fn nsis(&self) -> Option<&NsisConfig>
Returns the nsis specific configuration.
sourcepub fn deb(&self) -> Option<&DebianConfig>
pub fn deb(&self) -> Option<&DebianConfig>
Returns the debian specific configuration.
sourcepub fn appimage(&self) -> Option<&AppImageConfig>
pub fn appimage(&self) -> Option<&AppImageConfig>
Returns the appimage specific configuration.
sourcepub fn pacman(&self) -> Option<&PacmanConfig>
pub fn pacman(&self) -> Option<&PacmanConfig>
Returns the pacman specific configuration.
sourcepub fn target_triple(&self) -> String
pub fn target_triple(&self) -> String
Returns the target triple of this config, if not set, fallsback to the current OS target triple.
sourcepub fn target_arch(&self) -> Result<&str>
pub fn target_arch(&self) -> Result<&str>
Returns the architecture for the package to be built (e.g. “arm”, “x86” or “x86_64”).
sourcepub fn binary_path(&self, binary: &Binary) -> PathBuf
pub fn binary_path(&self, binary: &Binary) -> PathBuf
Returns the path to the specified binary.
sourcepub fn identifier(&self) -> &str
pub fn identifier(&self) -> &str
Returns the package identifier. Defaults an empty string.
sourcepub fn publisher(&self) -> String
pub fn publisher(&self) -> String
Returns the package publisher.
Defaults to the second element in Config::identifier
.
sourcepub fn binaries_dir(&self) -> PathBuf
pub fn binaries_dir(&self) -> PathBuf
Returns the binaries dir. Defaults to Self::out_dir
if Self::binaries_dir
is not set.
sourcepub fn main_binary(&self) -> Result<&Binary>
pub fn main_binary(&self) -> Result<&Binary>
Returns the main binary.
sourcepub fn main_binary_name(&self) -> Result<String>
pub fn main_binary_name(&self) -> Result<String>
Returns the main binary name.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.