use of org.moe.idea.runconfig.configuration.test.MOETestListener in project moe-ide-integration by multi-os-engine.
the class MOERunProfileState method createProcessHandler.
@NotNull
private OSProcessHandler createProcessHandler() throws ExecutionException {
if (runConfiguration.configuration() == null) {
throw new ExecutionException("Invalid build configuration for " + runConfiguration.getClass().getName());
} else if (runConfiguration.architecture() == null) {
throw new ExecutionException("Invalid architecture for " + runConfiguration.getClass().getName());
}
final MOEGradleRunner gradleRunner = new MOEGradleRunner(runConfiguration);
final boolean isDebug = runConfiguration.getActionType().equals("Debug");
final GeneralCommandLine commandLine = gradleRunner.construct(isDebug, true);
final OSProcessHandler handler = new MOEOSProcessHandler(commandLine);
handler.setShouldDestroyProcessRecursively(true);
final MOETestResultParser parser = new MOETestResultParser(new MOETestListener(this));
final boolean isTest = runConfiguration.runJUnitTests();
handler.addProcessListener(new ProcessListener() {
@Override
public void startNotified(ProcessEvent event) {
}
@Override
public void processTerminated(ProcessEvent event) {
}
@Override
public void processWillTerminate(ProcessEvent event, boolean willBeDestroyed) {
}
@Override
public void onTextAvailable(ProcessEvent event, Key outputType) {
String text = event.getText();
if (isTest) {
parser.addOutput(text);
}
if (text.contains("ApplicationVerificationFailed")) {
MOEToolWindow.getInstance(project).balloon(MessageType.ERROR, "Application installation failed. Please check log for details...");
MOEToolWindow.getInstance(project).log("Application installation failed. Please make sure you have correct bundle id in your Info.plist file.");
}
}
});
return handler;
}
Aggregations