-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
upgradeCode
config option (#11039)
* feat: add `upgradeCode` config option * fix build on other platforms * Update crates/tauri-bundler/src/bundle/settings.rs [skip ci] * move to subcommand, use same product name fallback as the bundler --------- Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
- Loading branch information
1 parent
3f1a8a4
commit f57a729
Showing
14 changed files
with
131 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"tauri-cli": "patch:feat" | ||
"@tauri-apps/cli": "patch:feat" | ||
--- | ||
|
||
Add `tauri inspect wix-upgrade-code` to print default Upgrade Code for your MSI installer derived from `productName`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"tauri-utils": "patch:feat" | ||
"tauri-bundler": "patch:feat" | ||
--- | ||
|
||
Add `upgradeCode` in `wix` configuration to set an upgrade code for your MSI installer. This is recommended to be set if you plan to change your `productName`. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-License-Identifier: MIT | ||
|
||
use anyhow::Result; | ||
use clap::{Parser, Subcommand}; | ||
|
||
use crate::interface::{AppInterface, AppSettings, Interface}; | ||
|
||
#[derive(Debug, Parser)] | ||
#[clap(about = "Manage or create permissions for your app or plugin")] | ||
pub struct Cli { | ||
#[clap(subcommand)] | ||
command: Commands, | ||
} | ||
|
||
#[derive(Subcommand, Debug)] | ||
enum Commands { | ||
/// Print the default Upgrade Code used by MSI installer derived from productName. | ||
WixUpgradeCode, | ||
} | ||
|
||
pub fn command(cli: Cli) -> Result<()> { | ||
match cli.command { | ||
Commands::WixUpgradeCode => wix_upgrade_code(), | ||
} | ||
} | ||
|
||
// NOTE: if this is ever changed, make sure to also update Wix upgrade code generation in tauri-bundler | ||
fn wix_upgrade_code() -> Result<()> { | ||
crate::helpers::app_paths::resolve(); | ||
|
||
let target = tauri_utils::platform::Target::Windows; | ||
let config = crate::helpers::config::get(target, None)?; | ||
|
||
let interface = AppInterface::new(config.lock().unwrap().as_ref().unwrap(), None)?; | ||
|
||
let product_name = interface.app_settings().get_package_settings().product_name; | ||
|
||
let upgrade_code = uuid::Uuid::new_v5( | ||
&uuid::Uuid::NAMESPACE_DNS, | ||
format!("{product_name}.exe.app.x64").as_bytes(), | ||
) | ||
.to_string(); | ||
|
||
log::info!("Default WiX Upgrade Code, derived from {product_name}: {upgrade_code}"); | ||
if let Some(code) = config.lock().unwrap().as_ref().and_then(|c| { | ||
c.bundle | ||
.windows | ||
.wix | ||
.as_ref() | ||
.and_then(|wix| wix.upgrade_code) | ||
}) { | ||
log::info!("Application Upgrade Code override: {code}"); | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters