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
-
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected 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
-
Constructor Details
-
AbstractBuilder
public AbstractBuilder()
-
-
Method Details
-
getAndroidSdk
protected static AndroidSdk getAndroidSdk(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws IOException, InterruptedExceptionGets 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
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
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, InterruptedExceptionWaits 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, InterruptedExceptionUninstalls 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, InterruptedExceptionUninstalls 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.
-