diff --git a/base/src/com/google/idea/blaze/base/run/confighandler/BlazeCommandGenericRunConfigurationRunner.java b/base/src/com/google/idea/blaze/base/run/confighandler/BlazeCommandGenericRunConfigurationRunner.java index 8bad234575b..ef2e5b61b4c 100644 --- a/base/src/com/google/idea/blaze/base/run/confighandler/BlazeCommandGenericRunConfigurationRunner.java +++ b/base/src/com/google/idea/blaze/base/run/confighandler/BlazeCommandGenericRunConfigurationRunner.java @@ -63,6 +63,7 @@ import com.intellij.execution.ExecutionResult; import com.intellij.execution.Executor; import com.intellij.execution.configurations.CommandLineState; +import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.configurations.RunProfileState; import com.intellij.execution.filters.Filter; import com.intellij.execution.filters.TextConsoleBuilderImpl; @@ -193,7 +194,7 @@ private ProcessHandler getScopedProcessHandler( throws ExecutionException { return new ScopedBlazeProcessHandler( project, - blazeCommand, + new GeneralCommandLine(blazeCommand.toList()), workspaceRoot, new ScopedBlazeProcessHandler.ScopedProcessHandlerDelegate() { @Override diff --git a/base/src/com/google/idea/blaze/base/run/processhandler/ScopedBlazeProcessHandler.java b/base/src/com/google/idea/blaze/base/run/processhandler/ScopedBlazeProcessHandler.java index df42017af86..4525cb3c4e8 100644 --- a/base/src/com/google/idea/blaze/base/run/processhandler/ScopedBlazeProcessHandler.java +++ b/base/src/com/google/idea/blaze/base/run/processhandler/ScopedBlazeProcessHandler.java @@ -63,24 +63,16 @@ public interface ScopedProcessHandlerDelegate { /** * Construct a process handler and a context to be used for the life of the process. * - * @param blazeCommand the blaze command to run + * @param command the blaze command to run * @param workspaceRoot workspace root * @param scopedProcessHandlerDelegate delegate methods that will be run with the process's * context. * @throws ExecutionException */ - public ScopedBlazeProcessHandler( - Project project, - BlazeCommand blazeCommand, - WorkspaceRoot workspaceRoot, - ScopedProcessHandlerDelegate scopedProcessHandlerDelegate) - throws ExecutionException { - this(project, blazeCommand.toList(), workspaceRoot, scopedProcessHandlerDelegate); - } public ScopedBlazeProcessHandler( Project project, - List command, + GeneralCommandLine command, WorkspaceRoot workspaceRoot, ScopedProcessHandlerDelegate scopedProcessHandlerDelegate) throws ExecutionException { @@ -132,7 +124,7 @@ public void processWillTerminate(ProcessEvent event, boolean willBeDestroyed) { } private static class CommandLineWithRemappedPath extends GeneralCommandLine { - CommandLineWithRemappedPath(List command) { + CommandLineWithRemappedPath(GeneralCommandLine command) { super(command); } diff --git a/base/src/com/google/idea/blaze/base/run/state/EnvironmentVariablesState.java b/base/src/com/google/idea/blaze/base/run/state/EnvironmentVariablesState.java index b15e90d1258..57113572286 100644 --- a/base/src/com/google/idea/blaze/base/run/state/EnvironmentVariablesState.java +++ b/base/src/com/google/idea/blaze/base/run/state/EnvironmentVariablesState.java @@ -61,7 +61,7 @@ private static class Editor implements RunConfigurationStateEditor { private final EnvironmentVariablesComponent component = new EnvironmentVariablesComponent(); private Editor() { - component.setText("&Environment variables (only set when debugging)"); + component.setText("&Environment variables"); } @Override diff --git a/clwb/src/com/google/idea/blaze/clwb/run/BlazeCidrLauncher.java b/clwb/src/com/google/idea/blaze/clwb/run/BlazeCidrLauncher.java index b4da2bc712b..5902f58a7de 100644 --- a/clwb/src/com/google/idea/blaze/clwb/run/BlazeCidrLauncher.java +++ b/clwb/src/com/google/idea/blaze/clwb/run/BlazeCidrLauncher.java @@ -182,9 +182,16 @@ private ProcessHandler createProcess(CommandLineState state, List extraB WorkspaceRoot workspaceRoot = WorkspaceRoot.fromProject(project); final BlazeCommand command = commandBuilder.build(); + final GeneralCommandLine commandLine = new GeneralCommandLine(command.toList()); + + EnvironmentVariablesData envState = handlerState.getEnvVarsState().getData(); + commandLine.withParentEnvironmentType( + envState.isPassParentEnvs() ? ParentEnvironmentType.SYSTEM : ParentEnvironmentType.NONE); + commandLine.getEnvironment().putAll(envState.getEnvs()); + return new ScopedBlazeProcessHandler( project, - command, + commandLine, workspaceRoot, new ScopedBlazeProcessHandler.ScopedProcessHandlerDelegate() { @Override @@ -234,11 +241,6 @@ public CidrDebugProcess createDebugProcess(CommandLineState state, XDebugSession commandLine.addParameters(handlerState.getExeFlagsState().getFlagsForExternalProcesses()); commandLine.addParameters(handlerState.getTestArgs()); - EnvironmentVariablesData envState = handlerState.getEnvVarsState().getData(); - commandLine.withParentEnvironmentType( - envState.isPassParentEnvs() ? ParentEnvironmentType.SYSTEM : ParentEnvironmentType.NONE); - commandLine.getEnvironment().putAll(envState.getEnvs()); - if (CppBlazeRules.RuleTypes.CC_TEST.getKind().equals(configuration.getTargetKind())) { convertBlazeTestFilterToExecutableFlag().ifPresent(commandLine::addParameters); } diff --git a/java/src/com/google/idea/blaze/java/run/BlazeJavaRunProfileState.java b/java/src/com/google/idea/blaze/java/run/BlazeJavaRunProfileState.java index def6fb505a6..373b911584d 100644 --- a/java/src/com/google/idea/blaze/java/run/BlazeJavaRunProfileState.java +++ b/java/src/com/google/idea/blaze/java/run/BlazeJavaRunProfileState.java @@ -56,6 +56,7 @@ import com.intellij.execution.ExecutionException; import com.intellij.execution.ExecutionResult; import com.intellij.execution.Executor; +import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.filters.TextConsoleBuilderImpl; import com.intellij.execution.process.ProcessHandler; import com.intellij.execution.process.ProcessListener; @@ -281,7 +282,7 @@ private ProcessHandler getScopedProcessHandler( throws ExecutionException { return new ScopedBlazeProcessHandler( project, - command, + new GeneralCommandLine(command), workspaceRoot, new ScopedBlazeProcessHandler.ScopedProcessHandlerDelegate() { @Override