Search in sources :

Example 6 with RunResult

use of org.jetbrains.kotlin.android.tests.run.RunResult in project kotlin by JetBrains.

the class GradleRunner method build.

public void build() {
    System.out.println("Building gradle project...");
    RunResult result = RunUtils.execute(generateCommandLine("build"));
    OutputUtils.checkResult(result);
}
Also used : RunResult(org.jetbrains.kotlin.android.tests.run.RunResult)

Example 7 with RunResult

use of org.jetbrains.kotlin.android.tests.run.RunResult in project kotlin by JetBrains.

the class Emulator method stopRedundantEmulators.

private void stopRedundantEmulators(PathManager pathManager) {
    GeneralCommandLine commandLineForListOfDevices = createAdbCommand();
    commandLineForListOfDevices.addParameter("devices");
    RunResult runResult = RunUtils.execute(commandLineForListOfDevices);
    OutputUtils.checkResult(runResult);
    Matcher matcher = EMULATOR_PATTERN.matcher(runResult.getOutput());
    boolean isDdmsStopped = false;
    while (matcher.find()) {
        System.out.println("Stopping redundant emulator...");
        GeneralCommandLine commandLineForStoppingEmulators = new GeneralCommandLine();
        if (SystemInfo.isWindows) {
            commandLineForStoppingEmulators.setExePath("taskkill");
            commandLineForStoppingEmulators.addParameter("/F");
            commandLineForStoppingEmulators.addParameter("/IM");
            commandLineForStoppingEmulators.addParameter("emulator-arm.exe");
            OutputUtils.checkResult(RunUtils.execute(commandLineForStoppingEmulators));
            break;
        } else {
            if (!isDdmsStopped && SystemInfo.isUnix) {
                stopEmulator();
                stopDdmsProcess();
                isDdmsStopped = true;
            }
            commandLineForStoppingEmulators.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/adb");
            commandLineForStoppingEmulators.addParameter("-s");
            commandLineForStoppingEmulators.addParameter(matcher.group());
            commandLineForStoppingEmulators.addParameter("emu");
            commandLineForStoppingEmulators.addParameter("kill");
            OutputUtils.checkResult(RunUtils.execute(commandLineForStoppingEmulators));
        }
    }
    OutputUtils.checkResult(RunUtils.execute(commandLineForListOfDevices));
}
Also used : Matcher(java.util.regex.Matcher) GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) RunResult(org.jetbrains.kotlin.android.tests.run.RunResult)

Example 8 with RunResult

use of org.jetbrains.kotlin.android.tests.run.RunResult in project kotlin by JetBrains.

the class Emulator method runTestsViaAdb.

public String runTestsViaAdb() {
    System.out.println("Running tests via adb...");
    GeneralCommandLine adbCommand = createAdbCommand();
    //adb shell am instrument -w -r org.jetbrains.kotlin.android.tests/android.test.InstrumentationTestRunner
    adbCommand.addParameters("shell", "am", "instrument", "-w", "-r", "org.jetbrains.kotlin.android.tests/android.test.InstrumentationTestRunner");
    RunResult execute = RunUtils.execute(adbCommand);
    return execute.getOutput();
}
Also used : GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) RunResult(org.jetbrains.kotlin.android.tests.run.RunResult)

Example 9 with RunResult

use of org.jetbrains.kotlin.android.tests.run.RunResult in project kotlin by JetBrains.

the class GradleRunner method clean.

public void clean() {
    System.out.println("Building gradle project...");
    RunResult result = RunUtils.execute(generateCommandLine("clean"));
    OutputUtils.checkResult(result);
}
Also used : RunResult(org.jetbrains.kotlin.android.tests.run.RunResult)

Example 10 with RunResult

use of org.jetbrains.kotlin.android.tests.run.RunResult in project kotlin by JetBrains.

the class AntRunner method compileSources.

public void compileSources() {
    System.out.println("Compiling sources...");
    RunResult result = RunUtils.execute(generateCommandLine("debug"));
    OutputUtils.checkResult(result);
}
Also used : RunResult(org.jetbrains.kotlin.android.tests.run.RunResult)

Aggregations

RunResult (org.jetbrains.kotlin.android.tests.run.RunResult)13 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)5 Matcher (java.util.regex.Matcher)1