Search in sources :

Example 1 with AndroidBinaryLaunchMethod

use of com.google.idea.blaze.android.run.binary.BlazeAndroidBinaryLaunchMethodsProvider.AndroidBinaryLaunchMethod in project intellij by bazelbuild.

the class BlazeAndroidBinaryProgramRunner method canRun.

@Override
public boolean canRun(String executorId, RunProfile profile) {
    BlazeAndroidRunConfigurationHandler handler = BlazeAndroidRunConfigurationHandler.getHandlerFrom(profile);
    if (!(handler instanceof BlazeAndroidBinaryRunConfigurationHandler)) {
        return false;
    }
    // In practice, the stock runner will probably handle all non-incremental-install configs.
    if (DefaultDebugExecutor.EXECUTOR_ID.equals(executorId) || DefaultRunExecutor.EXECUTOR_ID.equals(executorId)) {
        return true;
    }
    // Otherwise, the configuration must be a Blaze incremental install configuration running with
    // an incremental install executor.
    AndroidBinaryLaunchMethod launchMethod = ((BlazeAndroidBinaryRunConfigurationHandler) handler).getState().getLaunchMethod();
    return (AndroidBinaryLaunchMethod.MOBILE_INSTALL.equals(launchMethod) || AndroidBinaryLaunchMethod.MOBILE_INSTALL_V2.equals(launchMethod)) && (IncrementalInstallDebugExecutor.EXECUTOR_ID.equals(executorId) || IncrementalInstallRunExecutor.EXECUTOR_ID.equals(executorId));
}
Also used : BlazeAndroidRunConfigurationHandler(com.google.idea.blaze.android.run.BlazeAndroidRunConfigurationHandler) AndroidBinaryLaunchMethod(com.google.idea.blaze.android.run.binary.BlazeAndroidBinaryLaunchMethodsProvider.AndroidBinaryLaunchMethod)

Aggregations

BlazeAndroidRunConfigurationHandler (com.google.idea.blaze.android.run.BlazeAndroidRunConfigurationHandler)1 AndroidBinaryLaunchMethod (com.google.idea.blaze.android.run.binary.BlazeAndroidBinaryLaunchMethodsProvider.AndroidBinaryLaunchMethod)1