Search in sources :

Example 1 with MOEGlobalSettings

use of org.moe.idea.MOEGlobalSettings in project moe-ide-integration by multi-os-engine.

the class MOEMavenTask method addArguments.

protected void addArguments(StringBuilder goalBuilder) {
    List<String> args = new ArrayList<String>();
    MOEGlobalSettings globalSettings = MOEGlobalSettings.getInstance();
    String logLevel = globalSettings.getGradleLoggingLevel();
    if (logLevel != null && !logLevel.isEmpty()) {
        args.add("-D" + GRADLE_LOG_LEVEL_PROPERTY + logLevel);
    }
    String stacktraceLevel = globalSettings.getGradleStacktraceLevel();
    if (stacktraceLevel != null && !stacktraceLevel.isEmpty()) {
        args.add("-D" + GRADLE_STACKTRACE_LEVEL_PROPERTY + stacktraceLevel);
    }
    for (String arg : args) {
        goalBuilder.append(" " + arg);
    }
}
Also used : MOEGlobalSettings(org.moe.idea.MOEGlobalSettings)

Example 2 with MOEGlobalSettings

use of org.moe.idea.MOEGlobalSettings in project moe-ide-integration by multi-os-engine.

the class MOEGradleRunner method construct.

public GeneralCommandLine construct(boolean isDebug, boolean isLaunch) throws ExecutionException {
    final List<String> args = new ArrayList<String>();
    // Get Gradle
    Module module = runConfig.module();
    File workingDir = new File(ModuleUtils.getModulePath(module));
    GradleExec exec = new GradleExec(workingDir);
    args.add(exec.getExecPath());
    // Pass moe task
    if (runConfig.runJUnitTests()) {
        args.add("moeTest");
    } else {
        args.add("moeLaunch");
    }
    MOEGlobalSettings globalSettings = MOEGlobalSettings.getInstance();
    String logLevel = globalSettings.getGradleLoggingLevel();
    if (logLevel != null && !logLevel.isEmpty()) {
        args.add(logLevel);
    }
    String stacktraceLevel = globalSettings.getGradleStacktraceLevel();
    if (stacktraceLevel != null && !stacktraceLevel.isEmpty()) {
        args.add(stacktraceLevel);
    }
    final OptionsBuilder options = new OptionsBuilder();
    // Push mode
    if (isLaunch) {
        options.push("no-build");
        options.push("no-install-on-target");
    } else {
        options.push("no-launch");
        options.push("install-on-target");
    }
    // Push config
    options.push("config:" + runConfig.configuration());
    // Push debug
    if (isDebug) {
        if (runConfig.runOnSimulator()) {
            options.push("debug:" + runConfig.debugPort());
        } else {
            options.push("debug:" + runConfig.debugPort() + ":" + runConfig.debugRemotePort());
        }
    }
    List<String> vmArgs = runConfig.getVMArguments();
    if (vmArgs != null) {
        for (String arg : vmArgs) {
            if (arg != null && !arg.isEmpty()) {
                options.push("vmarg:" + arg);
            }
        }
    }
    Map<String, String> environmentVariables = runConfig.getEnvironmentVariables();
    if (environmentVariables != null) {
        for (Map.Entry<String, String> arg : environmentVariables.entrySet()) {
            options.push("env:" + arg.getKey() + "=" + arg.getValue());
        }
    }
    List<String> programArguments = runConfig.getProgramArguments();
    if (programArguments != null) {
        for (String arg : programArguments) {
            if (arg != null && !arg.isEmpty()) {
                options.push("arg:" + arg);
            }
        }
    }
    // Push test args
    if (runConfig.runJUnitTests()) {
        options.push("raw-test-output");
        String[] testArgs = runConfig.getTestArgs();
        if (testArgs != null) {
            for (String testArg : testArgs) {
                if (testArg != null && !testArg.isEmpty()) {
                    options.push("arg:" + testArg);
                }
            }
        }
    }
    // Pass option
    final String optionsString = options.toString();
    if (optionsString.length() > 0) {
        args.add(optionsString);
    }
    // Pass remote build settings
    if (runConfig.isRemoteBuildEnabled()) {
        args.add("-Pmoe.remotebuild.properties.ignore");
        Properties properties = RemoteSettings.getProperties(runConfig.getRemoteHost(), Integer.toString(runConfig.getRemotePort()), runConfig.getRemoteUser(), runConfig.getRemoteKnownhosts(), runConfig.getRemoteIdentity(), runConfig.getRemoteKeychainName(), runConfig.getRemoteKeychainPass(), Integer.toString(runConfig.getRemoteKeychainLocktimeout()), runConfig.getRemoteGradleRepositories());
        RemoteSettings.getArguments("-P", properties, args);
    }
    // Pass target device
    if (runConfig.runOnSimulator()) {
        args.add("-Pmoe.launcher.simulators=" + runConfig.simulatorUdid());
    } else {
        if (!StringUtil.isEmptyOrSpaces(runConfig.deviceUdid())) {
            args.add("-Pmoe.launcher.devices=" + runConfig.deviceUdid());
        }
    }
    return new GeneralCommandLine(args).withWorkDirectory(workingDir);
}
Also used : MOEGlobalSettings(org.moe.idea.MOEGlobalSettings) ArrayList(java.util.ArrayList) GradleExec(org.moe.common.exec.GradleExec) Properties(java.util.Properties) GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) Module(com.intellij.openapi.module.Module) File(java.io.File) Map(java.util.Map)

Example 3 with MOEGlobalSettings

use of org.moe.idea.MOEGlobalSettings in project moe-ide-integration by multi-os-engine.

the class MOEMavenBuildTask method addArguments.

@Override
protected void addArguments(StringBuilder goalBuilder) {
    List<String> args = new ArrayList<String>();
    args.add("-Dmoe.install.ontarget=true");
    MOEGlobalSettings globalSettings = MOEGlobalSettings.getInstance();
    String logLevel = globalSettings.getGradleLoggingLevel();
    if (logLevel != null && !logLevel.isEmpty()) {
        args.add("-D" + GRADLE_LOG_LEVEL_PROPERTY + logLevel);
    }
    String stacktraceLevel = globalSettings.getGradleStacktraceLevel();
    if (stacktraceLevel != null && !stacktraceLevel.isEmpty()) {
        args.add("-D" + GRADLE_STACKTRACE_LEVEL_PROPERTY + stacktraceLevel);
    }
    args.add("-D" + CONFIGURATION_MAVEN + moeRunConfig.configuration());
    boolean isRemoteBuildEnabled = moeRunConfig.isRemoteBuildEnabled();
    if (isRemoteBuildEnabled) {
        addRemoteMavenBuildArguments(args);
    }
    if (moeRunConfig.runOnSimulator()) {
        args.add("-D" + SIMULATOR_UDID + moeRunConfig.simulatorUdid());
    }
    for (String arg : args) {
        goalBuilder.append(" " + arg);
    }
}
Also used : MOEGlobalSettings(org.moe.idea.MOEGlobalSettings) ArrayList(java.util.ArrayList)

Aggregations

MOEGlobalSettings (org.moe.idea.MOEGlobalSettings)3 ArrayList (java.util.ArrayList)2 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 Module (com.intellij.openapi.module.Module)1 File (java.io.File)1 Map (java.util.Map)1 Properties (java.util.Properties)1 GradleExec (org.moe.common.exec.GradleExec)1