-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows the user to run `android install` and it will automatically install the apk to the currently connected device.
- Loading branch information
Showing
5 changed files
with
62 additions
and
2 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,30 @@ | ||
use std::path::PathBuf; | ||
|
||
use clap::{ArgAction, Parser}; | ||
|
||
#[derive(Parser, Debug)] | ||
pub struct Install { | ||
/// Should install release APK | ||
#[clap(short, long, default_value="false", action = ArgAction::SetTrue)] | ||
release: bool, | ||
} | ||
|
||
pub fn handle(args: Install) { | ||
let output_dir = PathBuf::from("app/build/outputs/apk"); | ||
|
||
let apk_path = match args.release { | ||
true => output_dir.join("release/app-release.apk"), | ||
false => output_dir.join("debug/app-debug.apk") | ||
}; | ||
|
||
let status = android_cli::invoke_adb_command(&[ | ||
"install", | ||
apk_path.to_str().unwrap() | ||
]) | ||
.unwrap(); | ||
|
||
match status.success() { | ||
true => println!("Successfully installed APK."), | ||
false => eprintln!("Failed to install APK"), | ||
}; | ||
} |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod create; | ||
pub mod build; | ||
pub mod install; |
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