enhance!(nsis): use !ifmacrodef for installer hooks (#10177)

This commit is contained in:
Tony 2024-07-03 10:48:22 +08:00 committed by GitHub
parent 55733aba9c
commit 11aa7743e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 31 additions and 34 deletions

View File

@ -0,0 +1,5 @@
---
"tauri-bundler": "patch:breaking"
---
Changed NSIS installer hooks from `!define` to `!macro`

View File

@ -2347,7 +2347,7 @@
]
},
"installerHooks": {
"description": "A path to a `.nsh` file that contains special NSIS macros to be hooked into the\n main installer.nsi script.\n\n Supported hooks are:\n - `NSIS_HOOK_PREINSTALL`: This hook runs before copying files, setting registry key values and creating shortcuts.\n - `NSIS_HOOK_POSTINSTALL`: This hook runs after the installer has finished copying all files, setting the registry keys and created shortcuts.\n - `NSIS_HOOK_PREUNINSTALL`: This hook runs before removing any files, registry keys and shortcuts.\n - `NSIS_HOOK_POSTUNINSTALL`: This hook runs after files, registry keys and shortcuts have been removed.\n\n\n ### Example\n\n ```nsh\n !define NSIS_HOOK_PREINSTALL \"NSIS_HOOK_PREINSTALL_\"\n !macro NSIS_HOOK_PREINSTALL_\n MessageBox MB_OK \"PreInstall\"\n !macroend\n\n !define NSIS_HOOK_POSTINSTALL \"NSIS_HOOK_POSTINSTALL_\"\n !macro NSIS_HOOK_POSTINSTALL_\n MessageBox MB_OK \"PostInstall\"\n !macroend\n\n !define NSIS_HOOK_PREUNINSTALL \"NSIS_HOOK_PREUNINSTALL_\"\n !macro NSIS_HOOK_PREUNINSTALL_\n MessageBox MB_OK \"PreUnInstall\"\n !macroend\n\n !define NSIS_HOOK_POSTUNINSTALL \"NSIS_HOOK_POSTUNINSTALL_\"\n !macro NSIS_HOOK_POSTUNINSTALL_\n MessageBox MB_OK \"PostUninstall\"\n !macroend\n\n ```",
"description": "A path to a `.nsh` file that contains special NSIS macros to be hooked into the\n main installer.nsi script.\n\n Supported hooks are:\n - `NSIS_HOOK_PREINSTALL`: This hook runs before copying files, setting registry key values and creating shortcuts.\n - `NSIS_HOOK_POSTINSTALL`: This hook runs after the installer has finished copying all files, setting the registry keys and created shortcuts.\n - `NSIS_HOOK_PREUNINSTALL`: This hook runs before removing any files, registry keys and shortcuts.\n - `NSIS_HOOK_POSTUNINSTALL`: This hook runs after files, registry keys and shortcuts have been removed.\n\n\n ### Example\n\n ```nsh\n !macro NSIS_HOOK_PREINSTALL\n MessageBox MB_OK \"PreInstall\"\n !macroend\n\n !macro NSIS_HOOK_POSTINSTALL\n MessageBox MB_OK \"PostInstall\"\n !macroend\n\n !macro NSIS_HOOK_PREUNINSTALL\n MessageBox MB_OK \"PreUnInstall\"\n !macroend\n\n !macro NSIS_HOOK_POSTUNINSTALL\n MessageBox MB_OK \"PostUninstall\"\n !macroend\n\n ```",
"type": [
"string",
"null"

View File

@ -802,23 +802,19 @@ pub struct NsisConfig {
/// ### Example
///
/// ```nsh
/// !define NSIS_HOOK_PREINSTALL "NSIS_HOOK_PREINSTALL_"
/// !macro NSIS_HOOK_PREINSTALL_
/// !macro NSIS_HOOK_PREINSTALL
/// MessageBox MB_OK "PreInstall"
/// !macroend
///
/// !define NSIS_HOOK_POSTINSTALL "NSIS_HOOK_POSTINSTALL_"
/// !macro NSIS_HOOK_POSTINSTALL_
/// !macro NSIS_HOOK_POSTINSTALL
/// MessageBox MB_OK "PostInstall"
/// !macroend
///
/// !define NSIS_HOOK_PREUNINSTALL "NSIS_HOOK_PREUNINSTALL_"
/// !macro NSIS_HOOK_PREUNINSTALL_
/// !macro NSIS_HOOK_PREUNINSTALL
/// MessageBox MB_OK "PreUnInstall"
/// !macroend
///
/// !define NSIS_HOOK_POSTUNINSTALL "NSIS_HOOK_POSTUNINSTALL_"
/// !macro NSIS_HOOK_POSTUNINSTALL_
/// !macro NSIS_HOOK_POSTUNINSTALL
/// MessageBox MB_OK "PostUninstall"
/// !macroend
///

View File

@ -3033,7 +3033,7 @@ checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"
[[package]]
name = "tauri"
version = "2.0.0-beta.22"
version = "2.0.0-beta.23"
dependencies = [
"anyhow",
"bytes",
@ -3083,7 +3083,7 @@ dependencies = [
[[package]]
name = "tauri-build"
version = "2.0.0-beta.17"
version = "2.0.0-beta.18"
dependencies = [
"anyhow",
"cargo_toml",
@ -3105,7 +3105,7 @@ dependencies = [
[[package]]
name = "tauri-codegen"
version = "2.0.0-beta.17"
version = "2.0.0-beta.18"
dependencies = [
"base64 0.22.1",
"brotli",
@ -3130,7 +3130,7 @@ dependencies = [
[[package]]
name = "tauri-macros"
version = "2.0.0-beta.17"
version = "2.0.0-beta.18"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@ -3142,7 +3142,7 @@ dependencies = [
[[package]]
name = "tauri-plugin"
version = "2.0.0-beta.17"
version = "2.0.0-beta.18"
dependencies = [
"anyhow",
"glob",
@ -3168,7 +3168,7 @@ dependencies = [
[[package]]
name = "tauri-runtime"
version = "2.0.0-beta.18"
version = "2.0.0-beta.19"
dependencies = [
"dpi",
"gtk",
@ -3185,7 +3185,7 @@ dependencies = [
[[package]]
name = "tauri-runtime-wry"
version = "2.0.0-beta.18"
version = "2.0.0-beta.19"
dependencies = [
"cocoa",
"gtk",
@ -3207,7 +3207,7 @@ dependencies = [
[[package]]
name = "tauri-utils"
version = "2.0.0-beta.17"
version = "2.0.0-beta.18"
dependencies = [
"aes-gcm",
"brotli",

View File

@ -440,23 +440,19 @@ pub struct NsisSettings {
/// ### Example
///
/// ```nsh
/// !define NSIS_HOOK_PREINSTALL "NSIS_HOOK_PREINSTALL_"
/// !macro NSIS_HOOK_PREINSTALL_
/// !macro NSIS_HOOK_PREINSTALL
/// MessageBox MB_OK "PreInstall"
/// !macroend
///
/// !define NSIS_HOOK_POSTINSTALL "NSIS_HOOK_POSTINSTALL_"
/// !macro NSIS_HOOK_POSTINSTALL_
/// !macro NSIS_HOOK_POSTINSTALL
/// MessageBox MB_OK "PostInstall"
/// !macroend
///
/// !define NSIS_HOOK_PREUNINSTALL "NSIS_HOOK_PREUNINSTALL_"
/// !macro NSIS_HOOK_PREUNINSTALL_
/// !macro NSIS_HOOK_PREUNINSTALL
/// MessageBox MB_OK "PreUnInstall"
/// !macroend
///
/// !define NSIS_HOOK_POSTUNINSTALL "NSIS_HOOK_POSTUNINSTALL_"
/// !macro NSIS_HOOK_POSTUNINSTALL_
/// !macro NSIS_HOOK_POSTUNINSTALL
/// MessageBox MB_OK "PostUninstall"
/// !macroend
/// ```

View File

@ -558,8 +558,8 @@ Section Install
!insertmacro CheckIfAppIsRunning
!ifdef NSIS_HOOK_PREINSTALL
!insertmacro "${NSIS_HOOK_PREINSTALL}"
!ifmacrodef NSIS_HOOK_PREINSTALL
!insertmacro NSIS_HOOK_PREINSTALL
!endif
; Copy main executable
@ -638,8 +638,8 @@ Section Install
Call CreateOrUpdateDesktopShortcut
${EndIf}
!ifdef NSIS_HOOK_POSTINSTALL
!insertmacro "${NSIS_HOOK_POSTINSTALL}"
!ifmacrodef NSIS_HOOK_POSTINSTALL
!insertmacro NSIS_HOOK_POSTINSTALL
!endif
; Auto close this page for passive mode
@ -685,8 +685,8 @@ Section Uninstall
!insertmacro CheckIfAppIsRunning
!ifdef NSIS_HOOK_PREUNINSTALL
!insertmacro "${NSIS_HOOK_PREUNINSTALL}"
!ifmacrodef NSIS_HOOK_PREUNINSTALL
!insertmacro NSIS_HOOK_PREUNINSTALL
!endif
; Delete the app directory and its content from disk
@ -776,8 +776,8 @@ Section Uninstall
RmDir /r "$LOCALAPPDATA\${BUNDLEID}"
${EndIf}
!ifdef NSIS_HOOK_POSTUNINSTALL
!insertmacro "${NSIS_HOOK_POSTUNINSTALL}"
!ifmacrodef NSIS_HOOK_POSTUNINSTALL
!insertmacro NSIS_HOOK_PREUNINSTALL
!endif
; Auto close if passive mode

View File

@ -2347,7 +2347,7 @@
]
},
"installerHooks": {
"description": "A path to a `.nsh` file that contains special NSIS macros to be hooked into the\n main installer.nsi script.\n\n Supported hooks are:\n - `NSIS_HOOK_PREINSTALL`: This hook runs before copying files, setting registry key values and creating shortcuts.\n - `NSIS_HOOK_POSTINSTALL`: This hook runs after the installer has finished copying all files, setting the registry keys and created shortcuts.\n - `NSIS_HOOK_PREUNINSTALL`: This hook runs before removing any files, registry keys and shortcuts.\n - `NSIS_HOOK_POSTUNINSTALL`: This hook runs after files, registry keys and shortcuts have been removed.\n\n\n ### Example\n\n ```nsh\n !define NSIS_HOOK_PREINSTALL \"NSIS_HOOK_PREINSTALL_\"\n !macro NSIS_HOOK_PREINSTALL_\n MessageBox MB_OK \"PreInstall\"\n !macroend\n\n !define NSIS_HOOK_POSTINSTALL \"NSIS_HOOK_POSTINSTALL_\"\n !macro NSIS_HOOK_POSTINSTALL_\n MessageBox MB_OK \"PostInstall\"\n !macroend\n\n !define NSIS_HOOK_PREUNINSTALL \"NSIS_HOOK_PREUNINSTALL_\"\n !macro NSIS_HOOK_PREUNINSTALL_\n MessageBox MB_OK \"PreUnInstall\"\n !macroend\n\n !define NSIS_HOOK_POSTUNINSTALL \"NSIS_HOOK_POSTUNINSTALL_\"\n !macro NSIS_HOOK_POSTUNINSTALL_\n MessageBox MB_OK \"PostUninstall\"\n !macroend\n\n ```",
"description": "A path to a `.nsh` file that contains special NSIS macros to be hooked into the\n main installer.nsi script.\n\n Supported hooks are:\n - `NSIS_HOOK_PREINSTALL`: This hook runs before copying files, setting registry key values and creating shortcuts.\n - `NSIS_HOOK_POSTINSTALL`: This hook runs after the installer has finished copying all files, setting the registry keys and created shortcuts.\n - `NSIS_HOOK_PREUNINSTALL`: This hook runs before removing any files, registry keys and shortcuts.\n - `NSIS_HOOK_POSTUNINSTALL`: This hook runs after files, registry keys and shortcuts have been removed.\n\n\n ### Example\n\n ```nsh\n !macro NSIS_HOOK_PREINSTALL\n MessageBox MB_OK \"PreInstall\"\n !macroend\n\n !macro NSIS_HOOK_POSTINSTALL\n MessageBox MB_OK \"PostInstall\"\n !macroend\n\n !macro NSIS_HOOK_PREUNINSTALL\n MessageBox MB_OK \"PreUnInstall\"\n !macroend\n\n !macro NSIS_HOOK_POSTUNINSTALL\n MessageBox MB_OK \"PostUninstall\"\n !macroend\n\n ```",
"type": [
"string",
"null"