use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class MavenRunnerParametersPanel method getData.
protected void getData(final MavenRunnerParameters data) {
workingDirComponent.getComponent().setText(data.getWorkingDirPath());
goalsComponent.getComponent().setText(ParametersList.join(data.getGoals()));
myResolveToWorkspaceCheckBox.setSelected(data.isResolveToWorkspace());
ParametersList parametersList = new ParametersList();
for (Map.Entry<String, Boolean> entry : data.getProfilesMap().entrySet()) {
String profileName = entry.getKey();
if (!entry.getValue()) {
profileName = '-' + profileName;
}
parametersList.add(profileName);
}
profilesComponent.getComponent().setText(parametersList.getParametersString());
}
use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class GriffonFramework method createJavaParameters.
@Override
public JavaParameters createJavaParameters(@NotNull Module module, boolean forCreation, boolean forTests, boolean classpathFromDependencies, @NotNull MvcCommand command) throws ExecutionException {
JavaParameters params = new JavaParameters();
Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
params.setJdk(sdk);
final VirtualFile sdkRoot = getSdkRoot(module);
if (sdkRoot == null) {
return params;
}
params.addEnv(getSdkHomePropertyName(), FileUtil.toSystemDependentName(sdkRoot.getPath()));
final VirtualFile lib = sdkRoot.findChild("lib");
if (lib != null) {
for (final VirtualFile child : lib.getChildren()) {
final String name = child.getName();
if (name.startsWith("groovy-all-") && name.endsWith(".jar")) {
params.getClassPath().add(child);
}
}
}
final VirtualFile dist = sdkRoot.findChild("dist");
if (dist != null) {
for (final VirtualFile child : dist.getChildren()) {
final String name = child.getName();
if (name.endsWith(".jar")) {
if (name.startsWith("griffon-cli-") || name.startsWith("griffon-rt-") || name.startsWith("griffon-resources-")) {
params.getClassPath().add(child);
}
}
}
}
/////////////////////////////////////////////////////////////
params.setMainClass("org.codehaus.griffon.cli.support.GriffonStarter");
final VirtualFile rootFile;
if (forCreation) {
VirtualFile[] roots = ModuleRootManager.getInstance(module).getContentRoots();
if (roots.length != 1) {
throw new ExecutionException("Failed to initialize griffon module: module " + module.getName() + " contains more than one root");
}
command.getArgs().add(0, roots[0].getName());
rootFile = roots[0].getParent();
} else {
rootFile = findAppRoot(module);
if (rootFile == null) {
throw new ExecutionException("Failed to run griffon command: module " + module.getName() + " is not a Griffon module");
}
}
String workDir = VfsUtilCore.virtualToIoFile(rootFile).getAbsolutePath();
params.getVMParametersList().addParametersString(command.getVmOptions());
if (!params.getVMParametersList().getParametersString().contains(XMX_JVM_PARAMETER)) {
params.getVMParametersList().add("-Xmx256M");
}
final String griffonHomePath = FileUtil.toSystemDependentName(sdkRoot.getPath());
params.getVMParametersList().add("-Dgriffon.home=" + griffonHomePath);
params.getVMParametersList().add("-Dbase.dir=" + workDir);
assert sdk != null;
params.getVMParametersList().add("-Dtools.jar=" + ((JavaSdkType) sdk.getSdkType()).getToolsPath(sdk));
final String confpath = griffonHomePath + GROOVY_STARTER_CONF;
params.getVMParametersList().add("-Dgroovy.starter.conf=" + confpath);
params.getVMParametersList().add("-Dgroovy.sanitized.stacktraces=\"groovy., org.codehaus.groovy., java., javax., sun., gjdk.groovy., gant., org.codehaus.gant.\"");
params.getProgramParametersList().add("--main");
params.getProgramParametersList().add("org.codehaus.griffon.cli.GriffonScriptRunner");
params.getProgramParametersList().add("--conf");
params.getProgramParametersList().add(confpath);
if (!forCreation && classpathFromDependencies) {
final String path = getApplicationClassPath(module).getPathsString();
if (StringUtil.isNotEmpty(path)) {
params.getProgramParametersList().add("--classpath");
params.getProgramParametersList().add(path);
}
}
params.setWorkingDirectory(workDir);
ParametersList paramList = new ParametersList();
command.addToParametersList(paramList);
params.getProgramParametersList().add(paramList.getParametersString());
params.setDefaultCharset(module.getProject());
return params;
}
use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class XsltCommandLineState method createJavaParameters.
protected SimpleJavaParameters createJavaParameters() throws ExecutionException {
final Sdk jdk = myXsltRunConfiguration.getEffectiveJDK();
if (jdk == null) {
throw CantRunException.noJdkConfigured();
}
final SimpleJavaParameters parameters = new SimpleJavaParameters();
parameters.setJdk(jdk);
if (myXsltRunConfiguration.getJdkChoice() == XsltRunConfiguration.JdkChoice.FROM_MODULE) {
final Module module = myXsltRunConfiguration.getEffectiveModule();
// OK to run as if just a JDK has been selected (a missing JDK would already have been complained about above)
if (module != null) {
OrderEnumerator.orderEntries(module).productionOnly().recursively().classes().collectPaths(parameters.getClassPath());
}
}
final ParametersList vmParameters = parameters.getVMParametersList();
vmParameters.addParametersString(myXsltRunConfiguration.myVmArguments);
if (isEmpty(myXsltRunConfiguration.getXsltFile())) {
throw new CantRunException("No XSLT file selected");
}
vmParameters.defineProperty("xslt.file", myXsltRunConfiguration.getXsltFile());
if (isEmpty(myXsltRunConfiguration.getXmlInputFile())) {
throw new CantRunException("No XML input file selected");
}
vmParameters.defineProperty("xslt.input", myXsltRunConfiguration.getXmlInputFile());
final XsltRunConfiguration.OutputType outputType = myXsltRunConfiguration.getOutputType();
if (outputType == XsltRunConfiguration.OutputType.CONSOLE) {
//noinspection deprecation
myPort = NetUtils.tryToFindAvailableSocketPort(myXsltRunConfiguration.myRunnerPort);
vmParameters.defineProperty("xslt.listen-port", String.valueOf(myPort));
}
if (myXsltRunConfiguration.isSaveToFile()) {
vmParameters.defineProperty("xslt.output", myXsltRunConfiguration.myOutputFile);
}
for (Pair<String, String> pair : myXsltRunConfiguration.getParameters()) {
final String name = pair.getFirst();
final String value = pair.getSecond();
if (isEmpty(name) || value == null)
continue;
vmParameters.defineProperty("xslt.param." + name, value);
}
vmParameters.defineProperty("xslt.smart-error-handling", String.valueOf(myXsltRunConfiguration.mySmartErrorHandling));
final PluginId pluginId = PluginManagerCore.getPluginByClassName(getClass().getName());
assert pluginId != null || System.getProperty("xslt.plugin.path") != null : "PluginId not found - development builds need to specify -Dxslt.plugin.path=../out/classes/production/xslt-rt";
final File pluginPath;
if (pluginId != null) {
final IdeaPluginDescriptor descriptor = PluginManager.getPlugin(pluginId);
assert descriptor != null;
pluginPath = descriptor.getPath();
} else {
// -Dxslt.plugin.path=C:\work\java\intellij/ultimate\out\classes\production\xslt-rt
pluginPath = new File(System.getProperty("xslt.plugin.path"));
}
LOG.debug("Plugin Path = " + pluginPath.getAbsolutePath());
final char c = File.separatorChar;
File rtClasspath = new File(pluginPath, "lib" + c + "rt" + c + "xslt-rt.jar");
// File rtClasspath = new File("C:/Demetra/plugins/xpath/lib/rt/xslt-rt.jar");
if (!rtClasspath.exists()) {
LOG.warn("Plugin's Runtime classes not found in " + rtClasspath.getAbsolutePath());
if (!(rtClasspath = new File(pluginPath, "classes")).exists()) {
if (ApplicationManagerEx.getApplicationEx().isInternal() && new File(pluginPath, "org").exists()) {
rtClasspath = pluginPath;
} else {
throw new CantRunException("Runtime classes not found");
}
}
parameters.getVMParametersList().prepend("-ea");
}
parameters.getClassPath().addTail(rtClasspath.getAbsolutePath());
parameters.setMainClass("org.intellij.plugins.xslt.run.rt.XSLTRunner");
if (isEmpty(myXsltRunConfiguration.myWorkingDirectory)) {
parameters.setWorkingDirectory(new File(myXsltRunConfiguration.getXsltFile()).getParentFile().getAbsolutePath());
} else {
parameters.setWorkingDirectory(expandPath(myXsltRunConfiguration.myWorkingDirectory, myXsltRunConfiguration.getEffectiveModule(), myXsltRunConfiguration.getProject()));
}
myExtensionData = new UserDataHolderBase();
final List<XsltRunnerExtension> extensions = XsltRunnerExtension.getExtensions(myXsltRunConfiguration, myIsDebugger);
for (XsltRunnerExtension extension : extensions) {
extension.patchParameters(parameters, myXsltRunConfiguration, myExtensionData);
}
parameters.setUseDynamicClasspath(JdkUtil.useDynamicClasspath(myXsltRunConfiguration.getProject()));
return parameters;
}
use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class BuildoutFacet method patchCommandLineForBuildout.
public void patchCommandLineForBuildout(GeneralCommandLine commandLine) {
Map<String, String> env = commandLine.getEnvironment();
ParametersList params = commandLine.getParametersList();
// alter execution script
ParamsGroup scriptParams = params.getParamsGroup(PythonCommandLineState.GROUP_SCRIPT);
assert scriptParams != null;
if (scriptParams.getParameters().size() > 0) {
// expect DjangoUtil.MANAGE_FILE
String normalScript = scriptParams.getParameters().get(0);
HelperPackage engulfer = PythonHelper.BUILDOUT_ENGULFER;
env.put("PYCHARM_ENGULF_SCRIPT", getConfiguration().getScriptName());
scriptParams.getParametersList().replaceOrPrepend(normalScript, engulfer.asParamString());
}
// add pycharm helpers to pythonpath so that fixGetpass is importable
PythonEnvUtil.addToPythonPath(env, PythonHelpersLocator.getHelpersRoot().getAbsolutePath());
/*
// set prependable paths
List<String> paths = facet.getAdditionalPythonPath();
if (paths != null) {
path_value = PyUtil.joinWith(File.pathSeparator, paths);
env.put("PYCHARM_PREPEND_SYSPATH", path_value);
}
*/
}
use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class MavenUtil method getPropertiesFromMavenOpts.
public static Map<String, String> getPropertiesFromMavenOpts() {
Map<String, String> res = ourPropertiesFromMvnOpts;
if (res == null) {
String mavenOpts = System.getenv("MAVEN_OPTS");
if (mavenOpts != null) {
ParametersList mavenOptsList = new ParametersList();
mavenOptsList.addParametersString(mavenOpts);
res = mavenOptsList.getProperties();
} else {
res = Collections.emptyMap();
}
ourPropertiesFromMvnOpts = res;
}
return res;
}
Aggregations