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
  • Constructor Details

    • AbstractBuilder

      public AbstractBuilder()
  • Method Details

    • 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.