use of com.jetbrains.cidr.cpp.execution.CLionRunParameters in project intellij by bazelbuild.
the class BlazeCidrLauncher method createDebugProcess.
@Override
public CidrDebugProcess createDebugProcess(CommandLineState state, XDebugSession session) throws ExecutionException {
TargetExpression target = configuration.getTarget();
if (target == null) {
throw new ExecutionException("Cannot parse run configuration target.");
}
if (runner.executableToDebug == null) {
throw new ExecutionException("No debug binary found.");
}
WorkspaceRoot workspaceRoot = WorkspaceRoot.fromProject(project);
GeneralCommandLine commandLine = new GeneralCommandLine(runner.executableToDebug.getPath());
File workingDir = workspaceRoot.directory();
commandLine.setWorkDirectory(workingDir);
commandLine.addParameters(handlerState.getExeFlagsState().getExpandedFlags());
EnvironmentVariablesData envState = handlerState.getEnvVarsState().getData();
commandLine.withParentEnvironmentType(envState.isPassParentEnvs() ? ParentEnvironmentType.SYSTEM : ParentEnvironmentType.NONE);
commandLine.getEnvironment().putAll(envState.getEnvs());
if (Kind.CC_TEST.equals(configuration.getTargetKind())) {
convertBlazeTestFilterToExecutableFlag().ifPresent(commandLine::addParameters);
}
TrivialInstaller installer = new TrivialInstaller(commandLine);
ImmutableList<String> startupCommands = getGdbStartupCommands(workingDir);
CLionRunParameters parameters = new CLionRunParameters(new BlazeGDBDriverConfiguration(project, startupCommands, workspaceRoot), installer);
state.setConsoleBuilder(createConsoleBuilder(null));
state.addConsoleFilters(getConsoleFilters().toArray(new Filter[0]));
return new CidrLocalDebugProcess(parameters, session, state.getConsoleBuilder());
}
Aggregations