mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-08-16 19:30:27 +03:00
feat(nsis): add an option to disable compression (#9932)
This commit is contained in:
parent
656a649744
commit
3ab170917e
5
.changes/bundler-compression-option.md
Normal file
5
.changes/bundler-compression-option.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"tauri-utils": patch:breaking
|
||||||
|
---
|
||||||
|
|
||||||
|
Changed `NsisSettings::compression` field from `Option<NsisCompression>` to just `NsisCompression`
|
6
.changes/nsis-no-compression.md
Normal file
6
.changes/nsis-no-compression.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"tauri-utils": patch:feat
|
||||||
|
"tauri-bundler": patch:feat
|
||||||
|
---
|
||||||
|
|
||||||
|
Add an option to disable NSIS compression `bundle > nsis > compression: "none"`
|
5
.changes/utils-compression-option.md
Normal file
5
.changes/utils-compression-option.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"tauri-utils": patch:breaking
|
||||||
|
---
|
||||||
|
|
||||||
|
Changed `NsisConfig::compression` field from `Option<NsisCompression>` to just `NsisCompression`
|
@ -2299,12 +2299,10 @@
|
|||||||
},
|
},
|
||||||
"compression": {
|
"compression": {
|
||||||
"description": "Set the compression algorithm used to compress files in the installer.\n\nSee <https://nsis.sourceforge.io/Reference/SetCompressor>",
|
"description": "Set the compression algorithm used to compress files in the installer.\n\nSee <https://nsis.sourceforge.io/Reference/SetCompressor>",
|
||||||
"anyOf": [
|
"default": "lzma",
|
||||||
|
"allOf": [
|
||||||
{
|
{
|
||||||
"$ref": "#/definitions/NsisCompression"
|
"$ref": "#/definitions/NsisCompression"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "null"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -2367,6 +2365,13 @@
|
|||||||
"enum": [
|
"enum": [
|
||||||
"lzma"
|
"lzma"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Disable compression",
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"none"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -691,6 +691,44 @@ pub enum NsisCompression {
|
|||||||
Bzip2,
|
Bzip2,
|
||||||
/// LZMA (default) is a new compression method that gives very good compression ratios. The decompression speed is high (10-20 MB/s on a 2 GHz CPU), the compression speed is lower. The memory size that will be used for decompression is the dictionary size plus a few KBs, the default is 8 MB.
|
/// LZMA (default) is a new compression method that gives very good compression ratios. The decompression speed is high (10-20 MB/s on a 2 GHz CPU), the compression speed is lower. The memory size that will be used for decompression is the dictionary size plus a few KBs, the default is 8 MB.
|
||||||
Lzma,
|
Lzma,
|
||||||
|
/// Disable compression
|
||||||
|
None,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for NsisCompression {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::Lzma
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Install Modes for the NSIS installer.
|
||||||
|
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||||
|
#[cfg_attr(feature = "schema", derive(JsonSchema))]
|
||||||
|
pub enum NSISInstallerMode {
|
||||||
|
/// Default mode for the installer.
|
||||||
|
///
|
||||||
|
/// Install the app by default in a directory that doesn't require Administrator access.
|
||||||
|
///
|
||||||
|
/// Installer metadata will be saved under the `HKCU` registry path.
|
||||||
|
CurrentUser,
|
||||||
|
/// Install the app by default in the `Program Files` folder directory requires Administrator
|
||||||
|
/// access for the installation.
|
||||||
|
///
|
||||||
|
/// Installer metadata will be saved under the `HKLM` registry path.
|
||||||
|
PerMachine,
|
||||||
|
/// Combines both modes and allows the user to choose at install time
|
||||||
|
/// whether to install for the current user or per machine. Note that this mode
|
||||||
|
/// will require Administrator access even if the user wants to install it for the current user only.
|
||||||
|
///
|
||||||
|
/// Installer metadata will be saved under the `HKLM` or `HKCU` registry path based on the user's choice.
|
||||||
|
Both,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for NSISInstallerMode {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::CurrentUser
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Configuration for the Installer bundle using NSIS.
|
/// Configuration for the Installer bundle using NSIS.
|
||||||
@ -736,7 +774,8 @@ pub struct NsisConfig {
|
|||||||
/// Set the compression algorithm used to compress files in the installer.
|
/// Set the compression algorithm used to compress files in the installer.
|
||||||
///
|
///
|
||||||
/// See <https://nsis.sourceforge.io/Reference/SetCompressor>
|
/// See <https://nsis.sourceforge.io/Reference/SetCompressor>
|
||||||
pub compression: Option<NsisCompression>,
|
#[serde(default)]
|
||||||
|
pub compression: NsisCompression,
|
||||||
/// A path to a `.nsh` file that contains special NSIS macros to be hooked into the
|
/// A path to a `.nsh` file that contains special NSIS macros to be hooked into the
|
||||||
/// main installer.nsi script.
|
/// main installer.nsi script.
|
||||||
///
|
///
|
||||||
@ -775,36 +814,6 @@ pub struct NsisConfig {
|
|||||||
pub installer_hooks: Option<PathBuf>,
|
pub installer_hooks: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Install Modes for the NSIS installer.
|
|
||||||
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
|
|
||||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
|
||||||
#[cfg_attr(feature = "schema", derive(JsonSchema))]
|
|
||||||
pub enum NSISInstallerMode {
|
|
||||||
/// Default mode for the installer.
|
|
||||||
///
|
|
||||||
/// Install the app by default in a directory that doesn't require Administrator access.
|
|
||||||
///
|
|
||||||
/// Installer metadata will be saved under the `HKCU` registry path.
|
|
||||||
CurrentUser,
|
|
||||||
/// Install the app by default in the `Program Files` folder directory requires Administrator
|
|
||||||
/// access for the installation.
|
|
||||||
///
|
|
||||||
/// Installer metadata will be saved under the `HKLM` registry path.
|
|
||||||
PerMachine,
|
|
||||||
/// Combines both modes and allows the user to choose at install time
|
|
||||||
/// whether to install for the current user or per machine. Note that this mode
|
|
||||||
/// will require Administrator access even if the user wants to install it for the current user only.
|
|
||||||
///
|
|
||||||
/// Installer metadata will be saved under the `HKLM` or `HKCU` registry path based on the user's choice.
|
|
||||||
Both,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for NSISInstallerMode {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::CurrentUser
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Install modes for the Webview2 runtime.
|
/// Install modes for the Webview2 runtime.
|
||||||
/// Note that for the updater bundle [`Self::DownloadBootstrapper`] is used.
|
/// Note that for the updater bundle [`Self::DownloadBootstrapper`] is used.
|
||||||
///
|
///
|
||||||
|
@ -416,7 +416,7 @@ pub struct NsisSettings {
|
|||||||
/// By default the OS language is selected, with a fallback to the first language in the `languages` array.
|
/// By default the OS language is selected, with a fallback to the first language in the `languages` array.
|
||||||
pub display_language_selector: bool,
|
pub display_language_selector: bool,
|
||||||
/// Set compression algorithm used to compress files in the installer.
|
/// Set compression algorithm used to compress files in the installer.
|
||||||
pub compression: Option<NsisCompression>,
|
pub compression: NsisCompression,
|
||||||
/// A path to a `.nsh` file that contains special NSIS macros to be hooked into the
|
/// A path to a `.nsh` file that contains special NSIS macros to be hooked into the
|
||||||
/// main installer.nsi script.
|
/// main installer.nsi script.
|
||||||
///
|
///
|
||||||
|
@ -247,10 +247,11 @@ fn build_nsis_app_installer(
|
|||||||
|
|
||||||
data.insert(
|
data.insert(
|
||||||
"compression",
|
"compression",
|
||||||
to_json(match &nsis.compression.unwrap_or(NsisCompression::Lzma) {
|
to_json(match &nsis.compression {
|
||||||
NsisCompression::Zlib => "zlib",
|
NsisCompression::Zlib => "zlib",
|
||||||
NsisCompression::Bzip2 => "bzip2",
|
NsisCompression::Bzip2 => "bzip2",
|
||||||
NsisCompression::Lzma => "lzma",
|
NsisCompression::Lzma => "lzma",
|
||||||
|
NsisCompression::None => "none",
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
Unicode true
|
Unicode true
|
||||||
ManifestDPIAware true
|
ManifestDPIAware true
|
||||||
; Set the compression algorithm. Default is LZMA.
|
|
||||||
!if "{{compression}}" == ""
|
!if "{{compression}}" == "none"
|
||||||
SetCompressor /SOLID lzma
|
SetCompress false
|
||||||
!else
|
!else
|
||||||
|
; Set the compression algorithm. Default is LZMA.
|
||||||
SetCompressor /SOLID "{{compression}}"
|
SetCompressor /SOLID "{{compression}}"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
@ -2299,12 +2299,10 @@
|
|||||||
},
|
},
|
||||||
"compression": {
|
"compression": {
|
||||||
"description": "Set the compression algorithm used to compress files in the installer.\n\nSee <https://nsis.sourceforge.io/Reference/SetCompressor>",
|
"description": "Set the compression algorithm used to compress files in the installer.\n\nSee <https://nsis.sourceforge.io/Reference/SetCompressor>",
|
||||||
"anyOf": [
|
"default": "lzma",
|
||||||
|
"allOf": [
|
||||||
{
|
{
|
||||||
"$ref": "#/definitions/NsisCompression"
|
"$ref": "#/definitions/NsisCompression"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "null"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -2367,6 +2365,13 @@
|
|||||||
"enum": [
|
"enum": [
|
||||||
"lzma"
|
"lzma"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Disable compression",
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"none"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user