use of com.intellij.execution.configurations.ParametersList in project intellij-plugins by JetBrains.
the class FelixRunner method setupParameters.
/**
* See <a href="http://felix.apache.org/site/apache-felix-framework-configuration-properties.html">Felix Configuration Properties</a>.
*/
@Override
protected void setupParameters(@NotNull JavaParameters parameters) {
ParametersList vmParameters = parameters.getVMParametersList();
// bundles and start levels
MultiMap<Integer, String> startBundles = new MultiMap<>();
List<String> installBundles = ContainerUtil.newSmartList();
for (SelectedBundle bundle : myBundles) {
String bundlePath = bundle.getBundlePath();
if (bundlePath == null)
continue;
boolean isFragment = CachingBundleInfoProvider.isFragmentBundle(bundlePath);
String bundleUrl = toFileUri(bundlePath);
if (bundle.isStartAfterInstallation() && !isFragment) {
int startLevel = getBundleStartLevel(bundle);
startBundles.putValue(startLevel, bundleUrl);
} else {
installBundles.add(bundleUrl);
}
}
for (Integer startLevel : startBundles.keySet()) {
vmParameters.addProperty("felix.auto.start." + startLevel, StringUtil.join(startBundles.get(startLevel), " "));
}
if (!installBundles.isEmpty()) {
vmParameters.addProperty("felix.auto.install.1", StringUtil.join(installBundles, " "));
}
int startLevel = getFrameworkStartLevel();
vmParameters.addProperty("org.osgi.framework.startlevel.beginning", String.valueOf(startLevel));
int defaultStartLevel = myRunConfiguration.getDefaultStartLevel();
vmParameters.addProperty("felix.startlevel.bundle", String.valueOf(defaultStartLevel));
// framework-specific options
vmParameters.addProperty("org.osgi.framework.storage.clean", "onFirstInit");
if (GenericRunProperties.isDebugMode(myAdditionalProperties)) {
vmParameters.addProperty("felix.log.level", "4");
}
parameters.setMainClass(MAIN_CLASS);
}
use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class ProcessProxyFactoryImpl method createCommandLineProxy.
@Override
public ProcessProxy createCommandLineProxy(JavaCommandLine javaCmdLine) throws ExecutionException {
JavaParameters javaParameters = javaCmdLine.getJavaParameters();
String mainClass = javaParameters.getMainClass();
if (ourMayUseLauncher && mainClass != null) {
String rtJarPath = JavaSdkUtil.getIdeaRtJarPath();
boolean runtimeJarFile = new File(rtJarPath).isFile() && FileUtil.isAncestor(PathManager.getHomePath(), rtJarPath, true);
if (runtimeJarFile || javaParameters.getModuleName() == null) {
try {
ProcessProxyImpl proxy = new ProcessProxyImpl(StringUtil.getShortName(mainClass));
String port = String.valueOf(proxy.getPortNumber());
String binPath = PathManager.getBinPath();
if (runtimeJarFile && JavaSdkUtil.isJdkAtLeast(javaParameters.getJdk(), JavaSdkVersion.JDK_1_5)) {
javaParameters.getVMParametersList().add("-javaagent:" + rtJarPath + '=' + port + ':' + binPath);
} else {
JavaSdkUtil.addRtJar(javaParameters.getClassPath());
ParametersList vmParametersList = javaParameters.getVMParametersList();
vmParametersList.defineProperty(AppMainV2.LAUNCHER_PORT_NUMBER, port);
vmParametersList.defineProperty(AppMainV2.LAUNCHER_BIN_PATH, binPath);
javaParameters.getProgramParametersList().prepend(mainClass);
javaParameters.setMainClass(AppMainV2.class.getName());
}
return proxy;
} catch (Exception e) {
Logger.getInstance(ProcessProxy.class).warn(e);
}
}
}
return null;
}
use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class JdkUtil method setupCommandLine.
private static void setupCommandLine(GeneralCommandLine commandLine, SimpleJavaParameters javaParameters) throws CantRunException {
final ParametersList vmParameters = javaParameters.getVMParametersList();
commandLine.withEnvironment(javaParameters.getEnv());
commandLine.withParentEnvironmentType(javaParameters.isPassParentEnvs() ? ParentEnvironmentType.CONSOLE : ParentEnvironmentType.NONE);
final Class commandLineWrapper;
boolean dynamicParameters = false;
if (javaParameters.isDynamicClasspath() && !explicitClassPath(vmParameters) && javaParameters.getModulePath().isEmpty() && (commandLineWrapper = getCommandLineWrapperClass()) != null) {
if (isClassPathJarEnabled(javaParameters, PathUtil.getJarPathForClass(ClassPath.class))) {
dynamicParameters = setClasspathJarParams(javaParameters, commandLine, vmParameters, commandLineWrapper);
} else {
dynamicParameters = setCommandLineWrapperParams(javaParameters, commandLine, vmParameters, commandLineWrapper);
}
} else {
appendParamsEncodingClasspath(javaParameters, commandLine, vmParameters);
}
final String mainClass = javaParameters.getMainClass();
final String moduleName = javaParameters.getModuleName();
final String jarPath = javaParameters.getJarPath();
if (moduleName != null && mainClass != null) {
commandLine.addParameter("-m");
commandLine.addParameter(moduleName + '/' + mainClass);
} else if (mainClass != null) {
commandLine.addParameter(mainClass);
} else if (jarPath != null) {
commandLine.addParameter("-jar");
commandLine.addParameter(jarPath);
} else {
throw new CantRunException(ExecutionBundle.message("main.class.is.not.specified.error.message"));
}
if (!dynamicParameters) {
commandLine.addParameters(javaParameters.getProgramParametersList().getList());
}
commandLine.withWorkDirectory(javaParameters.getWorkingDirectory());
}
use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class ParametersListTest method paramsGroupGroupParams.
@Test
public void paramsGroupGroupParams() {
ParametersList params = new ParametersList();
params.add("param1");
ParamsGroup group1 = params.addParamsGroup("id1");
group1.addParameter("group1_param1");
params.add("param2");
group1.addParameter("group1_param2");
ParamsGroup group2 = params.addParamsGroup("id2");
group2.addParameter("group2_param1");
params.add("param3");
assertEquals(asList("param1", "param2", "param3"), params.getParameters());
assertEquals(asList("param1", "param2", "param3", "group1_param1", "group1_param2", "group2_param1"), params.getList());
assertArrayEquals(new String[] { "param1", "param2", "param3", "group1_param1", "group1_param2", "group2_param1" }, params.getArray());
assertEquals("param1 param2 param3 group1_param1 group1_param2 group2_param1", params.getParametersString().trim());
ParametersList group1_params = group1.getParametersList();
assertEquals(asList("group1_param1", "group1_param2"), group1_params.getParameters());
assertEquals(asList("group1_param1", "group1_param2"), group1_params.getList());
assertArrayEquals(new String[] { "group1_param1", "group1_param2" }, group1_params.getArray());
assertEquals("group1_param1 group1_param2", group1_params.getParametersString().trim());
ParametersList group2_params = group2.getParametersList();
assertEquals(asList("group2_param1"), group2_params.getParameters());
assertEquals(asList("group2_param1"), group2_params.getList());
assertArrayEquals(new String[] { "group2_param1" }, group2_params.getArray());
assertEquals("group2_param1", group2_params.getParametersString().trim());
}
use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class ParametersListTest method paramsGroupAddAt.
@Test
public void paramsGroupAddAt() {
ParametersList params = new ParametersList();
ParamsGroup group1 = params.addParamsGroup("id1");
ParamsGroup group2 = params.addParamsGroup("id2");
ParamsGroup group12 = params.addParamsGroupAt(1, "id12");
ParamsGroup group01 = params.addParamsGroupAt(0, "id01");
assertEquals(asList(group01, group1, group12, group2), params.getParamsGroups());
}
Aggregations