use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class ParametersListTest method paramsGroupSubGroups.
@Test
public void paramsGroupSubGroups() {
ParametersList params = new ParametersList();
ParamsGroup group1 = params.addParamsGroup("id1");
group1.addParameter("group1_param1");
group1.addParameter("group1_param2");
ParamsGroup group2 = params.addParamsGroup("id2");
group2.addParameter("group2_param1");
ParamsGroup group1_1 = group1.getParametersList().addParamsGroup("id1_1");
group1_1.addParameter("group1_1_param1");
ParamsGroup group1_2 = group1.getParametersList().addParamsGroup("id1_2");
group1_2.addParameter("group1_2_param1");
assertEquals(asList("group1_param1", "group1_param2", "group1_1_param1", "group1_2_param1", "group2_param1"), params.getList());
assertEquals(asList("group1_param1", "group1_param2", "group1_1_param1", "group1_2_param1", "group2_param1"), params.getList());
assertEquals("group1_param1 group1_param2 group1_1_param1 group1_2_param1 group2_param1", params.getParametersString().trim());
}
use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class ParametersListTest method properties.
@Test
public void properties() {
ParametersList params = new ParametersList();
params.addProperty("foo.foo", "\"bar bar\" bar");
assertEquals(1, params.getProperties().size());
assertEquals("\"bar bar\" bar", params.getProperties().get("foo.foo"));
}
use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class ParametersListTest method joiningParams.
@Test
public void joiningParams() {
String[] parameters = { "simpleParam", "param with spaces", "withQuote=\"", "param=\"complex quoted\"", "C:\\\"q\"", "C:\\w s\\" };
ParametersList parametersList = new ParametersList();
parametersList.addAll(parameters);
String joined = parametersList.getParametersString();
assertEquals("simpleParam \"param with spaces\" withQuote=\\\" \"param=\\\"complex quoted\\\"\" C:\\\\\"q\\\" \"C:\\w s\"\\", joined);
checkTokenizer(joined, parameters);
}
use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class ParametersListTest method paramsGroupEmpty.
@Test
public void paramsGroupEmpty() {
ParametersList params = new ParametersList();
assertEquals(0, params.getParamsGroupsCount());
assertTrue(params.getParamsGroups().isEmpty());
}
use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class AntCommandLineBuilder method setBuildFile.
public void setBuildFile(AbstractProperty.AbstractPropertyContainer container, File buildFile) throws CantRunException {
String jdkName = AntBuildFileImpl.CUSTOM_JDK_NAME.get(container);
Sdk jdk;
if (jdkName != null && jdkName.length() > 0) {
jdk = GlobalAntConfiguration.findJdk(jdkName);
} else {
jdkName = AntConfigurationImpl.DEFAULT_JDK_NAME.get(container);
if (jdkName == null || jdkName.length() == 0) {
throw new CantRunException(AntBundle.message("project.jdk.not.specified.error.message"));
}
jdk = GlobalAntConfiguration.findJdk(jdkName);
}
if (jdk == null) {
throw new CantRunException(AntBundle.message("jdk.with.name.not.configured.error.message", jdkName));
}
VirtualFile homeDirectory = jdk.getHomeDirectory();
if (homeDirectory == null) {
throw new CantRunException(AntBundle.message("jdk.with.name.bad.configured.error.message", jdkName));
}
myCommandLine.setJdk(jdk);
final ParametersList vmParametersList = myCommandLine.getVMParametersList();
vmParametersList.add("-Xmx" + AntBuildFileImpl.MAX_HEAP_SIZE.get(container) + "m");
vmParametersList.add("-Xss" + AntBuildFileImpl.MAX_STACK_SIZE.get(container) + "m");
final AntInstallation antInstallation = AntBuildFileImpl.ANT_INSTALLATION.get(container);
if (antInstallation == null) {
throw new CantRunException(AntBundle.message("ant.installation.not.configured.error.message"));
}
final String antHome = AntInstallation.HOME_DIR.get(antInstallation.getProperties());
vmParametersList.add("-Dant.home=" + antHome);
final String libraryDir = antHome + (antHome.endsWith("/") || antHome.endsWith(File.separator) ? "" : File.separator) + "lib";
vmParametersList.add("-Dant.library.dir=" + libraryDir);
String[] urls = jdk.getRootProvider().getUrls(OrderRootType.CLASSES);
final String jdkHome = homeDirectory.getPath().replace('/', File.separatorChar);
@NonNls final String pathToJre = jdkHome + File.separator + "jre" + File.separator;
for (String url : urls) {
final String path = PathUtil.toPresentableUrl(url);
if (!path.startsWith(pathToJre)) {
myCommandLine.getClassPath().add(path);
}
}
myCommandLine.getClassPath().addAllFiles(AntBuildFileImpl.ALL_CLASS_PATH.get(container));
myCommandLine.getClassPath().addAllFiles(AntBuildFileImpl.getUserHomeLibraries());
final SdkTypeId sdkType = jdk.getSdkType();
if (sdkType instanceof JavaSdkType) {
final String toolsJar = ((JavaSdkType) sdkType).getToolsPath(jdk);
if (toolsJar != null) {
myCommandLine.getClassPath().add(toolsJar);
}
}
PathUtilEx.addRtJar(myCommandLine.getClassPath());
myCommandLine.setMainClass(AntMain2.class.getName());
final ParametersList programParameters = myCommandLine.getProgramParametersList();
final String additionalParams = AntBuildFileImpl.ANT_COMMAND_LINE_PARAMETERS.get(container);
if (additionalParams != null) {
for (String param : ParametersList.parse(additionalParams)) {
if (param.startsWith("-J")) {
final String cutParam = param.substring("-J".length());
if (cutParam.length() > 0) {
vmParametersList.add(cutParam);
}
} else {
programParameters.add(param);
}
}
}
if (!(programParameters.getList().contains(LOGGER_PARAMETER))) {
programParameters.add(LOGGER_PARAMETER, IdeaAntLogger2.class.getName());
}
if (!programParameters.getList().contains(INPUT_HANDLER_PARAMETER)) {
programParameters.add(INPUT_HANDLER_PARAMETER, IdeaInputHandler.class.getName());
}
myProperties = AntBuildFileImpl.ANT_PROPERTIES.get(container);
myBuildFilePath = buildFile.getAbsolutePath();
myCommandLine.setWorkingDirectory(buildFile.getParent());
}
Aggregations