-
Notifications
You must be signed in to change notification settings - Fork 246
Make installer a library with capturable stdout #691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
untitaker
wants to merge
3
commits into
main
Choose a base branch
from
installer-library
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+535
−395
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| /target | ||
| /book | ||
| .DS_Store | ||
| installer-gui/src-tauri/gen/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,52 +1,3 @@ | ||
| use std::env::consts::EXE_SUFFIX; | ||
| use std::path::PathBuf; | ||
|
|
||
| fn main() { | ||
| println!("cargo::rerun-if-env-changed=INSTALLER_PATH"); | ||
| println!("cargo::rerun-if-env-changed=SKIP_INSTALLER_COPY"); | ||
|
|
||
| let destination = get_installer_destination(); | ||
| if std::env::var_os("SKIP_INSTALLER_COPY").is_none() { | ||
| let cli_installer = | ||
| std::env::var_os("INSTALLER_PATH").map_or_else(default_installer_path, PathBuf::from); | ||
| if !cli_installer.exists() { | ||
| println!( | ||
| "cargo::error=CLI installer binary not present at {}", | ||
| cli_installer.display() | ||
| ); | ||
| std::process::exit(0); | ||
| } | ||
| std::fs::copy(&cli_installer, &destination).unwrap(); | ||
| println!("cargo::rerun-if-changed={}", cli_installer.display()); | ||
| println!("cargo::rerun-if-changed={}", destination.display()); | ||
| } else if !destination.exists() { | ||
| // if SKIP_INSTALLER_COPY is set, make sure something exists at destination so the build succeeds | ||
| std::fs::write(&destination, []).unwrap(); | ||
| } | ||
|
|
||
| tauri_build::build() | ||
| } | ||
|
|
||
| fn default_installer_path() -> PathBuf { | ||
| // the approach used here was taken from https://github.com/rust-lang/cargo/issues/9661#issuecomment-1722358176 | ||
| let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap()); | ||
| let profile = std::env::var("PROFILE").unwrap(); | ||
| let profile_dir = out_dir | ||
| .ancestors() | ||
| .find(|&path| path.ends_with(&profile)) | ||
| .unwrap(); | ||
|
|
||
| profile_dir.join(format!("installer{EXE_SUFFIX}")) | ||
| } | ||
|
|
||
| fn get_installer_destination() -> PathBuf { | ||
| // tauri expects included binaries to have the target triple appended to the file name like | ||
| // this. see https://tauri.app/develop/sidecar/ | ||
| let target_triple = std::env::var("TARGET").unwrap(); | ||
| [ | ||
| "binaries", | ||
| &format!("installer-cli-{target_triple}{EXE_SUFFIX}"), | ||
| ] | ||
| .iter() | ||
| .collect() | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were running into problems on Android?
e: We spoke OOB: yes we were.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. fwiw i have not added any CI for android because I am building the installer in another project. trying to keep the changes here relatively light. I've not really dug into the build failures for
adb_clientbut all the USB installers are not really useful on Android anyway.