本文整理汇总了Java中com.jetbrains.php.config.commandLine.PhpCommandSettings类的典型用法代码示例。如果您正苦于以下问题:Java PhpCommandSettings类的具体用法?Java PhpCommandSettings怎么用?Java PhpCommandSettings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PhpCommandSettings类属于com.jetbrains.php.config.commandLine包,在下文中一共展示了PhpCommandSettings类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCommand
import com.jetbrains.php.config.commandLine.PhpCommandSettings; //导入依赖的package包/类
@NotNull
private PhpCommandSettings createCommand(Map<String, String> envParameters, List<String> arguments, boolean withDebuggerOptions) throws ExecutionException {
PhpInterpreter interpreter = PhpProjectConfigurationFacade.getInstance(getProject()).getInterpreter();
if (interpreter == null) {
throw new ExecutionException(TesterBundle.message("runConfiguration.errors.phpInterpreterNotSet"));
} else {
PhpCommandSettings command = PhpCommandSettingsBuilder.create(getProject(), interpreter, withDebuggerOptions);
command.setScript(getSettings().getTesterExecutable(), false);
command.importCommandLineSettings(getSettings().getPhpCommandLineSettings(), null);
command.addEnvs(envParameters);
// support for user setup
if (getSettings().getSetupScriptPath() != null) {
command.addEnv("INTELLIJ_NETTE_TESTER_USER_SETUP", getSettings().getSetupScriptPath());
}
TesterExecutionUtil.addCommandArguments(getProject(), command, getSettings(), arguments);
return command;
}
}
示例2: setTestGroup
import com.jetbrains.php.config.commandLine.PhpCommandSettings; //导入依赖的package包/类
static void setTestGroup(PhpCommandSettings command, int group, @Nullable String groupExra) {
String testGroup;
switch (group) {
case TEST_GROUP:
// Technically "group extra" has our group value. No need to pass an argument.
testGroup = groupExra;
groupExra = null;
break;
case TEST_MODULE:
testGroup = "--module";
break;
case TEST_DIRECTORY:
testGroup = "--directory";
break;
case TEST_CLASS:
testGroup = "--class";
break;
case TEST_ALL:
default:
testGroup = "--all";
break;
}
command.addArgument(StringUtil.notNullize(testGroup));
if (groupExra != null) {
command.addArgument(StringUtil.notNullize(groupExra));
}
}
示例3: createProcess
import com.jetbrains.php.config.commandLine.PhpCommandSettings; //导入依赖的package包/类
public static Process createProcess(PhpCommandSettings commandSettings, Project project) throws Exception
{
GeneralCommandLine generalCommandLine = commandSettings.createGeneralCommandLine();
RemoteSdkAdditionalData remoteSdkAdditionalData = (RemoteSdkAdditionalData)commandSettings.getAdditionalData();
if (remoteSdkAdditionalData == null) {
throw new Exception("Unable to fetch remote sdk-data!");
}
RemoteSdkCredentials remoteSdkCredentials = remoteSdkAdditionalData.getRemoteSdkCredentials(project, false);
SshRemoteSession session = RemoteSdkUtil.createRemoteSession(project, remoteSdkCredentials);
return RemoteSdkUtil.createRemoteProcess(session, generalCommandLine, false, false, true);
}
示例4: createCommandSettings
import com.jetbrains.php.config.commandLine.PhpCommandSettings; //导入依赖的package包/类
@Override
public PhpCommandSettings createCommandSettings() throws Exception
{
PhpCommandSettings commandSettings = super.createCommandSettings();
String selectedLanguage = Service.getInstance(project).getLanguage();
commandSettings.addArgument("--language=" + selectedLanguage);
return commandSettings;
}
示例5: createCommandSettings
import com.jetbrains.php.config.commandLine.PhpCommandSettings; //导入依赖的package包/类
protected PhpCommandSettings createCommandSettings() throws Exception
{
PhpCommandSettings commandSettings = PhpCommandSettingsBuilder.create(project, false);
commandSettings.setScript(getConsole());
commandSettings.addArgument(command);
commandSettings.addArgument("--no-ansi");
String environment = getEnvironment().trim();
if (environment.length() > 0) {
commandSettings.addArgument("--env=" + getEnvironment());
}
return commandSettings;
}
示例6: createProcess
import com.jetbrains.php.config.commandLine.PhpCommandSettings; //导入依赖的package包/类
protected void createProcess() throws Exception
{
PhpCommandSettings commandSettings = createCommandSettings();
if (commandSettings.isRemote()) {
process = RemoteCommand.createProcess(commandSettings, project);
indicator.setText(title);
}
else {
GeneralCommandLine generalCommandLine = commandSettings.createGeneralCommandLine();
process = generalCommandLine.createProcess();
}
}
示例7: addCommandArguments
import com.jetbrains.php.config.commandLine.PhpCommandSettings; //导入依赖的package包/类
public static void addCommandArguments(@NotNull Project project, @NotNull PhpCommandSettings command, TesterSettings settings, List<String> arguments) throws ExecutionException {
PhpInterpreter testEnvironmentInterpreter = settings.getPhpInterpreter(project);
if (testEnvironmentInterpreter != null && testEnvironmentInterpreter.getPathToPhpExecutable() != null) {
command.addArgument("-p");
command.addArgument(testEnvironmentInterpreter.getPathToPhpExecutable());
}
if (settings.getUseSystemPhpIni()) {
command.addArgument("-C");
} else if (!StringUtil.isEmpty(settings.getPhpIniPath())) {
command.addArgument("-c");
command.addArgument(settings.getPhpIniPath());
}
try {
Path tempDir = Paths.get(PathManager.getPluginsPath(), "intellij-nette-tester");
if (!Files.isDirectory(tempDir)) {
Files.createDirectory(tempDir);
}
Path setupScriptPath = Paths.get(tempDir.toString(), "setup.php");
InputStream setupResourceStream = TesterExecutionUtil.class.getClassLoader().getResourceAsStream("setup.php");
Files.copy(setupResourceStream, setupScriptPath, StandardCopyOption.REPLACE_EXISTING);
setupResourceStream.close();
command.addArgument("--setup");
command.addArgument(setupScriptPath.toString());
} catch (IOException e) {
throw new ExecutionException(e);
}
if (!StringUtil.isEmpty(settings.getTesterOptions())) {
String[] optionsArray = settings.getTesterOptions().split(" ");
command.addArguments(Arrays.asList(optionsArray));
}
for (PhpConfigurationOptionData configurationOption : settings.getPhpInterpreterOptions()) {
command.addArgument("-d");
command.addArgument(configurationOption.getName() + (!configurationOption.getValue().isEmpty() ? "=" + configurationOption.getValue() : ""));
}
command.addArguments(arguments);
command.addArgument(settings.getTestScope());
}
示例8: buildCommand
import com.jetbrains.php.config.commandLine.PhpCommandSettings; //导入依赖的package包/类
public void buildCommand(@NotNull Map<String, String> env, @NotNull PhpCommandSettings command) throws ExecutionException {
Project project = getProject();
DrupalRunConfiguration.Settings settings = this.getSettings();
DrupalDataService drupalDataService = DrupalDataService.getInstance(project);
String drupalRoot = drupalDataService.getDrupalPath();
boolean isDrupal8 = (drupalDataService.getVersion() == DrupalVersion.EIGHT);
// Discover the proper path to the run-tests.sh script.
try {
command.setScript(DrupalRunTestsExecutionUtil.getRunTestsPath(project), true);
} catch (DrupalVersionException dve) {
throw new ExecutionException(dve);
}
PhpInterpreter e = PhpProjectConfigurationFacade.getInstance(project).getInterpreter();
if (e == null || e.getPathToPhpExecutable() == null) {
throw new ExecutionException("Unable to find PHP executable");
}
command.addArgument("--php");
command.addArgument(e.getPathToPhpExecutable());
command.addArgument("--url");
command.addArgument(settings.getSimpletestUrl());
command.addArgument("--concurrency");
command.addArgument(Integer.toString(settings.getTestConcurrency()));
if (settings.hasColorOutput()) {
command.addArgument("--color");
}
if (settings.hasVerboseOutput()) {
command.addArgument("--verbose");
}
if (isDrupal8) {
if (settings.getSimpletestDb() != null) {
command.addArgument("--dburl");
command.addArgument(settings.getSimpletestDb());
}
if (settings.isUsingSqlite()) {
command.addArgument("--sqlite");
command.addArgument(settings.getSqliteDb());
}
if (settings.hasDieOnFail()) {
command.addArgument("--die-on-fail");
}
if (settings.hasRepeat()) {
command.addArgument("--repeat");
command.addArgument(Integer.toString(settings.getRepeatCount()));
}
String testTypes = settings.getTestTypes();
if (testTypes != null) {
command.addArgument("--types");
command.addArgument(testTypes);
}
}
// @todo This saves each test result individually. Can we parse this.
// command.addArgument("--xml ");
// command.addArgument("/tmp/drupal-tests");
DrupalRunTestsExecutionUtil.setTestGroup(command, settings.getTestGroup(), settings.getTestGroupExtra());
command.importCommandLineSettings(settings.getCommandLineSettings(), drupalRoot);
command.addEnvs(env);
}
示例9: doExecute
import com.jetbrains.php.config.commandLine.PhpCommandSettings; //导入依赖的package包/类
@Override
protected RunContentDescriptor doExecute(@NotNull DrupalRunConfiguration runConfiguration, @NotNull RunProfileState runProfileState, @NotNull ExecutionEnvironment env) throws ExecutionException {
final Project project = runConfiguration.getProject();
PhpProjectDebugConfiguration.State debugConfiguration = PhpProjectDebugConfiguration.getInstance(project).getState();
boolean breakAtFirstLine = (debugConfiguration != null) && debugConfiguration.isBreakAtFirstLine();
final PhpInterpreter interpreter = PhpProjectConfigurationFacade.getInstance(project).getInterpreter();
if(interpreter == null) {
throw new ExecutionException(PhpCommandSettingsBuilder.INTERPRETER_NOT_FOUND_ERROR);
}
final PhpDebugExtension debugExtension = PhpProjectConfigurationFacade.getInstance(runConfiguration.getProject()).getInterpreterDebugExtension();
if(debugExtension == null) {
throw new ExecutionException("Unknown debugger.");
} else {
final PhpDebugServer debugServer = debugExtension.startDebugServer(project);
final PhpDebugConnectionManager connectionsManager = debugExtension.createDebugConnectionManager();
final String sessionId = debugServer.registerSessionHandler(false, connectionsManager);
try {
final PhpCommandSettings commandSettings = PhpCommandSettingsBuilder.create(project, interpreter, true);
Map<String, String> commandLineEnv = debugExtension.getDebugEnv(project, breakAtFirstLine, sessionId);
runConfiguration.buildCommand(commandLineEnv, commandSettings);
final ProcessHandler processHandler = runConfiguration.createProcessHandler(project, commandSettings);
ProcessTerminatedListener.attach(processHandler, project);
XDebugSession debugSession = XDebuggerManager.getInstance(project).startSession(env, new XDebugProcessStarter() {
@NotNull
public XDebugProcess start(@NotNull XDebugSession session) {
PhpScriptDebugRunner.onSessionStart(session, debugServer, sessionId, connectionsManager, project, commandSettings, interpreter, processHandler);
PhpDebugDriver driver = debugExtension.getDebugDriver();
return PhpDebugProcessFactory.forPhpScript(project, session, sessionId, connectionsManager, driver, commandSettings.getPathProcessor());
}
});
debugSession.getConsoleView().attachToProcess(processHandler);
processHandler.startNotify();
return debugSession.getRunContentDescriptor();
} catch (ExecutionException var16) {
debugServer.unregisterSessionHandler(sessionId);
throw var16;
}
}
}