Package hudson.plugins.android_emulator
Class AndroidEmulatorContext
- java.lang.Object
-
- hudson.plugins.android_emulator.AndroidEmulatorContext
-
public class AndroidEmulatorContext extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
EMULATOR_COMMAND_TIMEOUT_MS
Interval during which an emulator command should complete.
-
Constructor Summary
Constructors Constructor Description AndroidEmulatorContext(AbstractBuild<?,?> build_, Launcher launcher_, BuildListener listener_, AndroidSdk sdk_)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
adbPort()
int
adbServerPort()
void
cleanUp()
int
getEmulatorCallbackPort()
Launcher.ProcStarter
getProcStarter(ArgumentListBuilder command)
Sets up a standardLauncher.ProcStarter
for the current adb environment, ready to execute the given command.Launcher.ProcStarter
getProcStarter(ArgumentListBuilder command, EnvVars env)
Sets up a standardLauncher.ProcStarter
for the current context.ArgumentListBuilder
getToolCommand(SdkCliCommand sdkCmd)
Generates a ready-to-use ArgumentListBuilder for one of the Android SDK tools, based on the current context.Launcher.ProcStarter
getToolProcStarter(SdkCliCommand sdkCmd)
Generates a ready-to-use ProcStarter for one of the Android SDK tools, based on the current context.Launcher.ProcStarter
getToolProcStarter(SdkCliCommand sdkCmd, EnvVars env)
Generates a ready-to-use ProcStarter for one of the Android SDK tools, based on the current context.Launcher
launcher()
BuildListener
listener()
PrintStream
logger()
Proc
process()
AndroidSdk
sdk()
boolean
sendCommand(String command)
Sends a user command to the running emulator via its telnet interface.
Execution will be cancelled if it takes longer thanEMULATOR_COMMAND_TIMEOUT_MS
.boolean
sendCommand(String command, int timeout)
Sends a user command to the running emulator via its telnet interface.
Execution will be cancelled if it takes longer than timeout ms.String
serial()
void
setProcess(Proc process)
int
userPort()
-
-
-
Field Detail
-
EMULATOR_COMMAND_TIMEOUT_MS
public static final int EMULATOR_COMMAND_TIMEOUT_MS
Interval during which an emulator command should complete.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AndroidEmulatorContext
public AndroidEmulatorContext(AbstractBuild<?,?> build_, Launcher launcher_, BuildListener listener_, AndroidSdk sdk_) throws InterruptedException, IOException
- Throws:
InterruptedException
IOException
-
-
Method Detail
-
cleanUp
public void cleanUp()
-
adbPort
public int adbPort()
-
userPort
public int userPort()
-
adbServerPort
public int adbServerPort()
-
getEmulatorCallbackPort
public int getEmulatorCallbackPort()
-
serial
public String serial()
-
listener
public BuildListener listener()
-
launcher
public Launcher launcher()
-
sdk
public AndroidSdk sdk()
-
logger
public PrintStream logger()
-
process
public Proc process()
-
setProcess
public void setProcess(Proc process)
-
getProcStarter
public Launcher.ProcStarter getProcStarter(ArgumentListBuilder command, EnvVars env) throws IOException, InterruptedException
Sets up a standardLauncher.ProcStarter
for the current context.- Parameters:
command
- What command to runenv
- Additional environment variables to set- Returns:
- A ready ProcStarter
- Throws:
IOException
InterruptedException
-
getProcStarter
public Launcher.ProcStarter getProcStarter(ArgumentListBuilder command) throws IOException, InterruptedException
Sets up a standardLauncher.ProcStarter
for the current adb environment, ready to execute the given command.- Parameters:
command
- What command to run- Returns:
- A ready ProcStarter
- Throws:
IOException
InterruptedException
-
getToolCommand
public ArgumentListBuilder getToolCommand(SdkCliCommand sdkCmd)
Generates a ready-to-use ArgumentListBuilder for one of the Android SDK tools, based on the current context.- Parameters:
sdkCmd
- The Android tool and any extra arguments for the command to run.- Returns:
- Arguments including the full path to the SDK and any extra Windows stuff required.
-
getToolProcStarter
public Launcher.ProcStarter getToolProcStarter(SdkCliCommand sdkCmd, EnvVars env) throws IOException, InterruptedException
Generates a ready-to-use ProcStarter for one of the Android SDK tools, based on the current context.- Parameters:
sdkCmd
- The Android tool and any extra arguments for the command to run.env
- Additional environment variables to set- Returns:
- A ready ProcStarter
- Throws:
IOException
InterruptedException
-
getToolProcStarter
public Launcher.ProcStarter getToolProcStarter(SdkCliCommand sdkCmd) throws IOException, InterruptedException
Generates a ready-to-use ProcStarter for one of the Android SDK tools, based on the current context.- Parameters:
sdkCmd
- The Android tool and any extra arguments for the command to run.- Returns:
- A ready ProcStarter
- Throws:
IOException
InterruptedException
-
sendCommand
public boolean sendCommand(String command)
Sends a user command to the running emulator via its telnet interface.
Execution will be cancelled if it takes longer thanEMULATOR_COMMAND_TIMEOUT_MS
.- Parameters:
command
- The command to execute on the emulator's telnet interface.- Returns:
- Whether sending the command succeeded.
-
sendCommand
public boolean sendCommand(String command, int timeout)
Sends a user command to the running emulator via its telnet interface.
Execution will be cancelled if it takes longer than timeout ms.- Parameters:
command
- The command to execute on the emulator's telnet interface.timeout
- The command's timeout, in ms.- Returns:
- Whether sending the command succeeded.
-
-