feat: bundle type detection at runtime via binary patching#13209
feat: bundle type detection at runtime via binary patching#13209lucasfernog merged 19 commits intotauri-apps:devfrom
Conversation
only patch if the updater is included fix linux warnings patch binary when updaer is configured
…lczyk/tauri into feature/binary_patch_bundle_types
crates/tauri-bundler/src/bundle.rs
Outdated
| // bundle was already built! e.g. DMG already built .app | ||
| if bundles.iter().any(|b| b.package_type == *package_type) { | ||
| continue; | ||
| } // REMOVE THIS? |
There was a problem hiding this comment.
Not sure about this. This only applies to DMG, right? We don't want to skip anything on linux or windows as the binary needs to be patched for each type anyway.
| .idea | ||
| debug.log | ||
| TODO.md | ||
| .aider* |
There was a problem hiding this comment.
Sorry for those weird patches. I think this is line end issue because I worked on both windows and linux. I only added '.aider*' here.
There was a problem hiding this comment.
You probably want to set autocrlf to true or input
git config --global core.autocrlf true/git config --global core.autocrlf input
https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#:~:text=with%20these%20issues.-,core.autocrlf,-If%20you%E2%80%99re%20programming
crates/tauri-bundler/src/error.rs
Outdated
| HashError, | ||
| /// Failed to parse binary | ||
| #[error("Binary parse error: `{0}`")] | ||
| BinaryParseError(String), |
There was a problem hiding this comment.
Same line end issue. New errors are here.
Package Changes Through 4ff1d8cThere are 4 changes which include @tauri-apps/api with patch, tauri-cli with patch, tauri-bundler with patch, tauri-utils with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
crates/tauri-bundler/src/bundle.rs
Outdated
| mod updater_bundle; | ||
| mod windows; | ||
|
|
||
| impl From<goblin::error::Error> for crate::error::Error { |
There was a problem hiding this comment.
this can be done inside crate::error::Error::BinaryParseError by leverating thiserror #[from] attribute
|
i think we should consider using https://github.com/denoland/sui it has an easy to use API |
Definitely looks simpler than goblin. Wish I knew about it before :) Should I just change the patching implementation? |
|
@lucasfernog I've pushed some of the suggested changes. I decided no to use sui as this would add dependency to the app, not just the builder. If there anything else missing here? |
|
Didn't look at it yet, but it seems like the ubuntu build is failing https://github.com/tauri-apps/tauri/actions/runs/16120739808/job/45485616619 |
|
@Legend-Master I've just checked and the tests I added to |
…auri-apps#13209)" This reverts commit 232265c.
|
@Legend-Master pushed the fix. Turns out my tests used ...Now I see this PR was closed already. Do I have to create a new PR with the fix? |
Yeah, that's how we usually do it |
|
@Legend-Master Submitted here: #13808 |
|
Hey, Looks like the patcher is modifying the binary after code signing. This is rendering the signing to be invalid. maybe move the signing to after binary is patched? |
|
@kittuov Hey, can you point me to the place were we sign the binary? I'm only familiar wit generating the signatures files for the bundles. |
It was signing the main executable on Windows (you sign both the binaries and the bundles on Windows instead of just the bundles on Linux, and we don't do binary patching on macOS yet), should be fixed in #13870 (we sign the binaries first before generating all the bundles, but now we need to sign them after the binary patching) Thanks for taking a look anyways 🙃 |
This is first PR to address tauri-apps/plugins-workspace#2277
Thanks to this the updater plugin will be able to determine which installer to download.
There is a breaking change here requiring updater plugin and tauri-cli to be compatible since we need __TAURI_BUNDLE_TYPE variable to be present in the binary. In case the variable is not found error is reported. Not sure if it's ok or if we need a better solution here.