Skip to content

feat: add mainBinaryName option#10977

Merged
lucasfernog merged 9 commits intodevfrom
feat/main-binary-name
Sep 15, 2024
Merged

feat: add mainBinaryName option#10977
lucasfernog merged 9 commits intodevfrom
feat/main-binary-name

Conversation

@amrbashir
Copy link
Member

No description provided.

@amrbashir amrbashir requested a review from a team as a code owner September 12, 2024 20:31
@github-actions
Copy link
Contributor

github-actions bot commented Sep 12, 2024

Package Changes Through 5047cbe

There are 5 changes which include tauri-bundler with premajor, tauri-cli with prerelease, tauri with prerelease, tauri-build with prerelease, tauri-utils with prerelease

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
tauri-utils 2.0.0-rc.10 2.0.0-rc.11
tauri-bundler 2.0.1-rc.10 3.0.0-rc.0
tauri-runtime 2.0.0-rc.10 2.0.0-rc.11
tauri-runtime-wry 2.0.0-rc.10 2.0.0-rc.11
tauri-codegen 2.0.0-rc.10 2.0.0-rc.11
tauri-macros 2.0.0-rc.9 2.0.0-rc.10
tauri-plugin 2.0.0-rc.10 2.0.0-rc.11
tauri-build 2.0.0-rc.10 2.0.0-rc.11
tauri 2.0.0-rc.11 2.0.0-rc.12
@tauri-apps/cli 2.0.0-rc.13 2.0.0-rc.14
tauri-cli 2.0.0-rc.12 2.0.0-rc.13

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

fn generate_changelog_file(settings: &Settings, data_dir: &Path) -> crate::Result<()> {
if let Some(changelog_src_path) = &settings.deb().changelog {
let mut src_file = File::open(changelog_src_path)?;
let bin_name = settings.main_binary_name();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's also document that the changelog path changed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for tauri v1, the path is unchanged, it is only a breaking change for those on v2. Added a change file nevertheless

/// `data_dir`.
fn copy_resource_files(settings: &Settings, data_dir: &Path) -> crate::Result<()> {
let resource_dir = data_dir.join("usr/lib").join(settings.main_binary_name());
let resource_dir = data_dir.join("usr/lib").join(settings.product_name());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and also document the resource path changed - this will cause new apps to duplicate the resources in the system

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I tested, at least .deb removes all bins and resources directory as well when installing a new version and then adds the new binaries and resources.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and also document the resource path changed

for tauri v1, the path is unchanged, it is only a breaking change for those on v2. Added a change file nevertheless

let path = entry?.path();
if let Some(name) = path.file_stem() {
let bin_exists = binaries.iter().any(|bin| {
bin.name() == name || path.ends_with(bin.src_path().unwrap_or(&"".to_string()))
Copy link
Member

@lucasfernog lucasfernog Sep 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this check is here to fix the following issue:

  • you have a src-tauri/src/bin/app.rs file (automatically discovered as a binary by Cargo)
  • you configure the binary manually in Cargo.toml (yeah it's silly, but it's possible and allows you to configure more stuff)
[[bin]]
name = "lucass"
path = "src/bin/app.rs"

then the Tauri CLI will try to load both app and lucass, while only lucass exists

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted

@lucasfernog
Copy link
Member

I also think our migration script should fill this value with the productName value, it'll prevent some issues if you do not ship the final v1 update before migrating to v2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants