@NotNull public GoExecutor withParameterString(@NotNull String parameterString) { myParameterList.addParametersString(parameterString); return this; }
@NotNull public GoExecutor withParameters(@NotNull String... parameters) { myParameterList.addAll(parameters); return this; }
public static void printBallerinaEnvVariables(@NotNull GeneralCommandLine commandLine, @NotNull ProcessHandler handler) { Map<String, String> environment = commandLine.getEnvironment(); // Todo - Add BALLERINA_REPOSITORY // handler.notifyTextAvailable("BALLERINA_REPOSITORY=" + StringUtil.nullize(environment.get // (BallerinaConstants.BALLERINA_REPOSITORY)) + '\n', ProcessOutputTypes.SYSTEM); }
@Override public boolean canExecuteTask(RunConfiguration configuration, GoCommandBeforeRunTask task) { if (configuration instanceof GoRunConfigurationBase) { Module module = ((GoRunConfigurationBase)configuration).getConfigurationModule().getModule(); GoSdkService sdkService = GoSdkService.getInstance(configuration.getProject()); if (sdkService.isGoModule(module)) { return StringUtil.isNotEmpty(sdkService.getSdkHomePath(module)) && StringUtil.isNotEmpty(task.getCommand()); } } return false; }
private static void checkPortValue(@Nullable String port, @NotNull String errorMessage) throws RuntimeConfigurationError { if (StringUtil.isNotEmpty(port)) { int intPort = StringUtil.parseInt(port, -1); if (intPort < 0 || intPort > Short.MAX_VALUE * 2) { throw new RuntimeConfigurationError(errorMessage); } } }
@NotNull public static com.intellij.execution.process.ProcessOutput execute(@NotNull GeneralCommandLine cmd, int timeout) throws ExecutionException { CapturingProcessHandler processHandler = new CapturingProcessHandler(cmd.createProcess()); return timeout < 0 ? processHandler.runProcess() : processHandler.runProcess(timeout); }
public GoTestRunConfiguration(@NotNull Project project, String name, @NotNull ConfigurationType configurationType) { super(name, new GoModuleBasedConfiguration(project), configurationType.getConfigurationFactories()[0]); }
@Nullable private VirtualFile findFile() { String url = myLocation.file; VirtualFile file = LocalFileSystem.getInstance().findFileByPath(url); if (file == null && SystemInfo.isWindows) { Project project = myProcess.getSession().getProject(); RunProfile profile = myProcess.getSession().getRunProfile(); Module module = profile instanceof ModuleBasedConfiguration ? ((ModuleBasedConfiguration)profile).getConfigurationModule().getModule() : null; String sdkHomePath = GoSdkService.getInstance(project).getSdkHomePath(module); if (sdkHomePath == null) return null; String newUrl = StringUtil.replaceIgnoreCase(url, "c:/go", sdkHomePath); return LocalFileSystem.getInstance().findFileByPath(newUrl); } return file; }
@Override public void configureBeforeRunTaskDefaults(Key<? extends BeforeRunTask> providerID, BeforeRunTask task) { super.configureBeforeRunTaskDefaults(providerID, task); if (providerID == CompileStepBeforeRun.ID) { task.setEnabled(false); } } }
@NotNull public BallerinaExecutor withParameterString(@NotNull String parameterString) { myParameterList.addParametersString(parameterString); return this; }
@Override public boolean configureTask(RunConfiguration configuration, GoCommandBeforeRunTask task) { Project project = configuration.getProject(); if (!(configuration instanceof GoRunConfigurationBase)) { showAddingTaskErrorMessage(project, "Go Command task supports only Go Run Configurations"); return false; } Module module = ((GoRunConfigurationBase)configuration).getConfigurationModule().getModule(); if (!GoSdkService.getInstance(project).isGoModule(module)) { showAddingTaskErrorMessage(project, "Go Command task supports only Go Modules"); return false; } GoCommandConfigureDialog dialog = new GoCommandConfigureDialog(project); if (dialog.showAndGet()) { task.setCommand(dialog.getCommand()); return true; } return false; }
protected void checkFileConfiguration() throws RuntimeConfigurationError { VirtualFile file = findFile(getFilePath()); if (file == null) { throw new RuntimeConfigurationError("Main file is not specified"); } PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(file); if (!(psiFile instanceof GoFile)) { throw new RuntimeConfigurationError("Main file is invalid"); } if (!GoRunUtil.isMainGoFile(psiFile)) { throw new RuntimeConfigurationError("Main file has non-main package or doesn't contain main function"); } }
public GoRunFileConfiguration(Project project, String name, @NotNull ConfigurationType configurationType) { super(name, new GoModuleBasedConfiguration(project), configurationType.getConfigurationFactories()[0]); }
@NotNull public BallerinaExecutor withParameters(@NotNull String... parameters) { myParameterList.addAll(parameters); return this; }
public static void printGoEnvVariables(@NotNull GeneralCommandLine commandLine, @NotNull ProcessHandler handler) { Map<String, String> environment = commandLine.getEnvironment(); handler.notifyTextAvailable("GOROOT=" + StringUtil.nullize(environment.get(GoConstants.GO_ROOT)) + '\n', ProcessOutputTypes.SYSTEM); handler.notifyTextAvailable("GOPATH=" + StringUtil.nullize(environment.get(GoConstants.GO_PATH)) + '\n', ProcessOutputTypes.SYSTEM); } }
@Override public void configureBeforeRunTaskDefaults(Key<? extends BeforeRunTask> providerID, BeforeRunTask task) { super.configureBeforeRunTaskDefaults(providerID, task); if (providerID == CompileStepBeforeRun.ID) { task.setEnabled(false); } } }
public GoAppEngineRunConfiguration(@NotNull Project project, String name, @NotNull ConfigurationType configurationType) { super(name, new GoModuleBasedConfiguration(project), configurationType.getConfigurationFactories()[0]); }
public GoApplicationConfiguration(Project project, String name, @NotNull ConfigurationType configurationType) { super(name, new GoModuleBasedConfiguration(project), configurationType.getConfigurationFactories()[0]); }
public BallerinaTestConfiguration(Project project, String name, @NotNull ConfigurationType configurationType) { super(name, new BallerinaModuleBasedConfiguration(project), configurationType.getConfigurationFactories()[0]); }
public BallerinaApplicationConfiguration(Project project, String name, @NotNull ConfigurationType configurationType) { super(name, new BallerinaModuleBasedConfiguration(project), configurationType.getConfigurationFactories()[0]); }