Class AbstractBuilder
- java.lang.Object
-
- hudson.tasks.BuildStepCompatibilityLayer
-
- hudson.tasks.Builder
-
- hudson.plugins.android_emulator.builder.AbstractBuilder
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<Builder>
,BuildStep
- Direct Known Subclasses:
AbstractSnapshotBuilder
,InstallBuilder
,MonkeyBuilder
,ProjectPrerequisitesInstaller
,UninstallBuilder
,UpdateProjectBuilder
public abstract class AbstractBuilder extends Builder
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherList
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
-
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
-
-
Constructor Summary
Constructors Constructor Description AbstractBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static AndroidSdk
getAndroidSdk(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener)
Gets an Android SDK instance, ready for use.protected static String
getDeviceIdentifier(AbstractBuild<?,?> build, BuildListener listener)
Gets the Android device identifier for this job, defaulting to the AVD started by this plugin.protected static int
getDeviceTelnetPort(AbstractBuild<?,?> build, BuildListener listener)
Gets the Android device identifier for this job, defaulting to the AVD started by this plugin.protected static boolean
uninstallApk(AbstractBuild<?,?> build, Launcher launcher, PrintStream logger, AndroidSdk androidSdk, String deviceIdentifier, FilePath apkPath)
Uninstalls the Android package corresponding to the given APK file from an Android device.protected static boolean
uninstallApk(AbstractBuild<?,?> build, Launcher launcher, PrintStream logger, AndroidSdk androidSdk, String deviceIdentifier, String packageId)
Uninstalls the given Android package ID from the given Android device.protected boolean
waitForCoreProcess(AbstractBuild<?,?> build, Launcher launcher, AndroidSdk androidSdk, String deviceIdentifier)
Waits for the "android.process.acore" process to start, as this is a prerequisite for using the package manager.-
Methods inherited from class hudson.tasks.Builder
all, getDescriptor, getRequiredMonitorService, prebuild
-
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectAction, getProjectActions, perform, perform, prebuild
-
-
-
-
Method Detail
-
getAndroidSdk
protected static AndroidSdk getAndroidSdk(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException
Gets an Android SDK instance, ready for use.- Parameters:
build
- The build for which we should retrieve the SDK instance.launcher
- The launcher for the remote node.listener
- The listener used to get the environment variables.- Returns:
- An Android SDK instance, or
null
if none could be found or installed. - Throws:
IOException
InterruptedException
-
getDeviceIdentifier
protected static String getDeviceIdentifier(AbstractBuild<?,?> build, BuildListener listener)
Gets the Android device identifier for this job, defaulting to the AVD started by this plugin.- Parameters:
build
- The build for which we should retrieve the SDK instance.listener
- The listener used to get the environment variables.- Returns:
- The device identifier (defaulting to the value of "
$ANDROID_AVD_DEVICE
").
-
getDeviceTelnetPort
protected static int getDeviceTelnetPort(AbstractBuild<?,?> build, BuildListener listener)
Gets the Android device identifier for this job, defaulting to the AVD started by this plugin.- Parameters:
build
- The build for which we should retrieve the SDK instance.listener
- The listener used to get the environment variables.- Returns:
- The device identifier (defaulting to the value of "
-s $ANDROID_AVD_DEVICE
").
-
waitForCoreProcess
protected boolean waitForCoreProcess(AbstractBuild<?,?> build, Launcher launcher, AndroidSdk androidSdk, String deviceIdentifier) throws IOException, InterruptedException
Waits for the "android.process.acore" process to start, as this is a prerequisite for using the package manager.- Parameters:
build
-launcher
-androidSdk
-deviceIdentifier
-- Returns:
true
if the process has started;false
if it did not start within a reasonable timeout.- Throws:
IOException
InterruptedException
-
uninstallApk
protected static boolean uninstallApk(AbstractBuild<?,?> build, Launcher launcher, PrintStream logger, AndroidSdk androidSdk, String deviceIdentifier, FilePath apkPath) throws IOException, InterruptedException
Uninstalls the Android package corresponding to the given APK file from an Android device.- Parameters:
build
- The build for which we should uninstall the package.launcher
- The launcher for the remote node.logger
- Where log output should be redirected to.androidSdk
- The Android SDK to use.deviceIdentifier
- The device from which the package should be removed.apkPath
- The path to the APK file.- Returns:
true
iff uninstallation completed successfully.- Throws:
IOException
- If execution failed.InterruptedException
- If execution failed.
-
uninstallApk
protected static boolean uninstallApk(AbstractBuild<?,?> build, Launcher launcher, PrintStream logger, AndroidSdk androidSdk, String deviceIdentifier, String packageId) throws IOException, InterruptedException
Uninstalls the given Android package ID from the given Android device.- Parameters:
build
- The build for which we should uninstall the package.launcher
- The launcher for the remote node.logger
- Where log output should be redirected to.androidSdk
- The Android SDK to use.deviceIdentifier
- The device from which the package should be removed.packageId
- The ID of the Android package to remove from the given device.- Returns:
true
iff uninstallation completed successfully.- Throws:
IOException
- If execution failed.InterruptedException
- If execution failed.
-
-