Skip to content

Commit

Permalink
Pass a bunch more Android-specific params through the install command
Browse files Browse the repository at this point in the history
Summary:
Added some more Android-specific params for compatibility with `buck1`. These are again just passed straight through to the installer.

I didn't add all of them, because some of them are incredibly rarely used (if ever) and they do fill up e.g. the help text so it's nicer not to bother with them.

Reviewed By: krallin

Differential Revision: D46686158

fbshipit-source-id: 876047fa19ce9f70706efcb1f06cc1a31e5a1828
  • Loading branch information
Ian Childs authored and facebook-github-bot committed Jun 15, 2023
1 parent dce49b2 commit 1e5fb5b
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions app/buck2_client/src/commands/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,56 @@ struct AndroidInstallOptions {
help = "Run an Android activity. Here for compatibility with buck1 - it is automatically forwarded to the installer"
)]
run: bool,

#[clap(
short,
long,
help = "Use this option to use emulators only on Android. Here for compatibility with buck1 - it is automatically forwarded to the installer"
)]
emulator: bool,

#[clap(
short,
long,
help = "Use this option to use real devices only on Android. Here for compatibility with buck1 - it is automatically forwarded to the installer"
)]
device: bool,

#[clap(
short,
long,
alias = "udid",
help = "Use Android device or emulator with specific serial or UDID number. Here for compatibility with buck1 - it is automatically forwarded to the installer"
)]
serial: Option<String>,

#[clap(
short = 'x',
long,
help = "Use all connected Android devices and/or emulators (multi-install mode). Here for compatibility with buck1 - it is automatically forwarded to the installer"
)]
all_devices: bool,

#[clap(
short,
long,
help = "Android activity to launch e.g. com.facebook/.LoginActivity. Implies -r. Here for compatibility with buck1 - it is automatically forwarded to the installer"
)]
activity: Option<String>,

#[clap(
short,
long,
help = "Android Intent URI to launch e.g. fb://profile. Implies -r. Here for compatibility with buck1 - it is automatically forwarded to the installer"
)]
intent_uri: Option<String>,

#[clap(
short,
long,
help = "Have the launched Android process wait for the debugger. Here for compatibility with buck1 - it is automatically forwarded to the installer"
)]
wait_for_debugger: bool,
}

#[async_trait]
Expand All @@ -77,6 +127,30 @@ impl StreamingCommand for InstallCommand {
if self.android_install_opts.run {
extra_run_args.push("-r".to_owned());
}
if self.android_install_opts.emulator {
extra_run_args.push("-e".to_owned());
}
if self.android_install_opts.device {
extra_run_args.push("-d".to_owned());
}
if let Some(serial) = self.android_install_opts.serial {
extra_run_args.push("-s".to_owned());
extra_run_args.push(serial);
}
if self.android_install_opts.all_devices {
extra_run_args.push("-x".to_owned());
}
if let Some(activity) = self.android_install_opts.activity {
extra_run_args.push("-a".to_owned());
extra_run_args.push(activity);
}
if let Some(intent_uri) = self.android_install_opts.intent_uri {
extra_run_args.push("-i".to_owned());
extra_run_args.push(intent_uri);
}
if self.android_install_opts.wait_for_debugger {
extra_run_args.push("-w".to_owned());
}

let context = ctx.client_context(
&self.common_opts.config_opts,
Expand Down

0 comments on commit 1e5fb5b

Please sign in to comment.