use of com.google.idea.blaze.base.run.BlazeCommandRunConfiguration in project intellij by bazelbuild.
the class HotSwapUtils method canHotSwap.
public static boolean canHotSwap(ExecutionEnvironment env) {
if (!isDebugging(env) || !enableHotSwapping.getValue()) {
return false;
}
BlazeCommandRunConfiguration configuration = getConfiguration(env);
BlazeCommandRunConfigurationCommonState handlerState = configuration.getHandlerStateIfType(BlazeCommandRunConfigurationCommonState.class);
Kind kind = configuration.getTargetKind();
return BlazeCommandName.RUN.equals(Preconditions.checkNotNull(handlerState).getCommandState().getCommand()) && kind != null && kind.isOneOf(SUPPORTED_BINARIES);
}
use of com.google.idea.blaze.base.run.BlazeCommandRunConfiguration in project intellij by bazelbuild.
the class BlazeHotSwapManager method findHotSwappableBlazeDebuggerSession.
@Nullable
static HotSwappableDebugSession findHotSwappableBlazeDebuggerSession(Project project) {
DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(project);
DebuggerSession session = debuggerManager.getContext().getDebuggerSession();
if (session == null || !session.isAttached()) {
return null;
}
JavaDebugProcess process = session.getProcess().getXdebugProcess();
if (process == null) {
return null;
}
ExecutionEnvironment env = ((XDebugSessionImpl) process.getSession()).getExecutionEnvironment();
if (env == null || ClassFileManifestBuilder.getManifest(env) == null) {
return null;
}
RunProfile runProfile = env.getRunProfile();
if (!(runProfile instanceof BlazeCommandRunConfiguration)) {
return null;
}
return new HotSwappableDebugSession(session, env, (BlazeCommandRunConfiguration) runProfile);
}
use of com.google.idea.blaze.base.run.BlazeCommandRunConfiguration in project intellij by bazelbuild.
the class BlazeAndroidTestProgramRunner method canRun.
@Override
public boolean canRun(String executorId, RunProfile profile) {
BlazeAndroidRunConfigurationHandler handler = BlazeAndroidRunConfigurationHandler.getHandlerFrom(profile);
if (!(handler instanceof BlazeAndroidTestRunConfigurationHandler)) {
return false;
}
if (!(profile instanceof BlazeCommandRunConfiguration)) {
return false;
}
BlazeCommandRunConfiguration configuration = (BlazeCommandRunConfiguration) profile;
// Debugging android_instrumentation_test doesn't work yet.
if (DefaultDebugExecutor.EXECUTOR_ID.equals(executorId)) {
return configuration.getTargetKind() != Kind.ANDROID_INSTRUMENTATION_TEST;
}
return DefaultRunExecutor.EXECUTOR_ID.equals(executorId);
}
use of com.google.idea.blaze.base.run.BlazeCommandRunConfiguration in project intellij by bazelbuild.
the class BlazeAndroidBinaryRunConfigurationHandler method doMigrate.
private int doMigrate(Project project) {
int count = 0;
for (RunConfiguration runConfig : RunManager.getInstance(project).getConfigurationsList(BlazeCommandRunConfigurationType.getInstance())) {
if (runConfig instanceof BlazeCommandRunConfiguration) {
RunConfigurationState state = ((BlazeCommandRunConfiguration) runConfig).getHandler().getState();
if (state instanceof BlazeAndroidBinaryRunConfigurationState) {
((BlazeAndroidBinaryRunConfigurationState) state).setLaunchMethod(AndroidBinaryLaunchMethod.MOBILE_INSTALL);
count++;
}
}
}
return count;
}
use of com.google.idea.blaze.base.run.BlazeCommandRunConfiguration in project intellij by bazelbuild.
the class RunConfigurationSerializerTest method testSetKeepInSyncWhenImporting.
@Test
public void testSetKeepInSyncWhenImporting() throws InvalidDataException {
configuration.setTarget(Label.create("//package:rule"));
configuration.setKeepInSync(false);
Element element = RunConfigurationSerializer.writeToXml(configuration);
assertThat(RunConfigurationSerializer.findExisting(getProject(), element)).isNotNull();
// remove configuration from project
clearRunManager();
RunConfigurationSerializer.loadFromXmlElementIgnoreExisting(getProject(), element);
RunConfiguration config = runManager.getAllConfigurations()[0];
assertThat(config).isInstanceOf(BlazeCommandRunConfiguration.class);
assertThat(((BlazeCommandRunConfiguration) config).getKeepInSync()).isTrue();
}
Aggregations