Search in sources :

Example 1 with MOEGradleRunner

use of org.moe.idea.compiler.MOEGradleRunner 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;
}
Also used : ProcessEvent(com.intellij.execution.process.ProcessEvent) ProcessListener(com.intellij.execution.process.ProcessListener) MOEGradleRunner(org.moe.idea.compiler.MOEGradleRunner) MOETestResultParser(org.moe.common.junit.MOETestResultParser) MOEOSProcessHandler(org.moe.idea.execution.process.MOEOSProcessHandler) MOETestListener(org.moe.idea.runconfig.configuration.test.MOETestListener) OSProcessHandler(com.intellij.execution.process.OSProcessHandler) MOEOSProcessHandler(org.moe.idea.execution.process.MOEOSProcessHandler) GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) ExecutionException(com.intellij.execution.ExecutionException) Key(com.intellij.openapi.util.Key) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ExecutionException (com.intellij.execution.ExecutionException)1 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 OSProcessHandler (com.intellij.execution.process.OSProcessHandler)1 ProcessEvent (com.intellij.execution.process.ProcessEvent)1 ProcessListener (com.intellij.execution.process.ProcessListener)1 Key (com.intellij.openapi.util.Key)1 NotNull (org.jetbrains.annotations.NotNull)1 MOETestResultParser (org.moe.common.junit.MOETestResultParser)1 MOEGradleRunner (org.moe.idea.compiler.MOEGradleRunner)1 MOEOSProcessHandler (org.moe.idea.execution.process.MOEOSProcessHandler)1 MOETestListener (org.moe.idea.runconfig.configuration.test.MOETestListener)1