use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class AntCommandLineBuilder method getCommandLine.
public JavaParameters getCommandLine() {
if (myDone)
return myCommandLine;
ParametersList programParameters = myCommandLine.getProgramParametersList();
for (final String property : myExpandedProperties) {
if (property != null) {
programParameters.add(property);
}
}
programParameters.add("-buildfile", myBuildFilePath);
for (final String target : myTargets) {
if (target != null) {
programParameters.add(target);
}
}
myDone = true;
return myCommandLine;
}
use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.
the class JUnitDevKitPatcher method patchJavaParameters.
@Override
public void patchJavaParameters(@Nullable Module module, JavaParameters javaParameters) {
Sdk jdk = javaParameters.getJdk();
if (jdk == null)
return;
ParametersList vm = javaParameters.getVMParametersList();
if (module != null && PsiUtil.isIdeaProject(module.getProject()) && !vm.hasProperty(SYSTEM_CL_PROPERTY) && !JavaSdk.getInstance().isOfVersionOrHigher(jdk, JavaSdkVersion.JDK_1_9)) {
JavaPsiFacade facade = JavaPsiFacade.getInstance(module.getProject());
String qualifiedName = UrlClassLoader.class.getName();
PsiClass loader = ReadAction.compute(() -> facade.findClass(qualifiedName, GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module)));
if (loader != null) {
vm.addProperty(SYSTEM_CL_PROPERTY, qualifiedName);
}
}
jdk = IdeaJdk.findIdeaJdk(jdk);
if (jdk == null)
return;
String libPath = jdk.getHomePath() + File.separator + "lib";
vm.add("-Xbootclasspath/a:" + libPath + File.separator + "boot.jar");
if (!vm.hasProperty("idea.load.plugins.id") && module != null && PluginModuleType.isOfType(module)) {
String id = DescriptorUtil.getPluginId(module);
if (id != null) {
vm.defineProperty("idea.load.plugins.id", id);
}
}
File sandboxHome = getSandboxPath(jdk);
if (sandboxHome != null) {
if (!vm.hasProperty("idea.home.path")) {
File homeDir = new File(sandboxHome, "test");
FileUtil.createDirectory(homeDir);
String buildNumber = IdeaJdk.getBuildNumber(jdk.getHomePath());
if (buildNumber != null) {
try {
FileUtil.writeToFile(new File(homeDir, "build.txt"), buildNumber);
} catch (IOException e) {
LOG.warn("failed to create build.txt in " + homeDir + ": " + e.getMessage(), e);
}
} else {
LOG.warn("Cannot determine build number for " + jdk.getHomePath());
}
vm.defineProperty("idea.home.path", homeDir.getAbsolutePath());
}
if (!vm.hasProperty("idea.plugins.path")) {
vm.defineProperty("idea.plugins.path", new File(sandboxHome, "plugins").getAbsolutePath());
}
}
javaParameters.getClassPath().addFirst(libPath + File.separator + "idea.jar");
javaParameters.getClassPath().addFirst(libPath + File.separator + "resources.jar");
javaParameters.getClassPath().addFirst(((JavaSdkType) jdk.getSdkType()).getToolsPath(jdk));
}
use of com.intellij.execution.configurations.ParametersList in project intellij-plugins by JetBrains.
the class Flexmojos4GenerateConfigTask method runGeneratorServer.
private void runGeneratorServer(MavenProjectsManager mavenProjectsManager, Project project) throws IOException, ExecutionException, MavenProcessCanceledException {
final SimpleJavaParameters params = new SimpleJavaParameters();
params.setJdk(new SimpleJavaSdkType().createJdk("tmp", SystemProperties.getJavaHome()));
final MavenGeneralSettings mavenGeneralSettings = mavenProjectsManager.getGeneralSettings();
final ParametersList programParametersList = params.getProgramParametersList();
programParametersList.add(getSettingsFilePath(mavenGeneralSettings.getEffectiveGlobalSettingsIoFile()));
programParametersList.add(getSettingsFilePath(mavenGeneralSettings.getEffectiveUserSettingsIoFile()));
programParametersList.add(mavenGeneralSettings.getEffectiveLocalRepository().getAbsolutePath());
programParametersList.add(mavenGeneralSettings.isWorkOffline() ? "t" : "f");
//noinspection ConstantConditions
programParametersList.add(project.getBaseDir().getPath() + "/.idea/flexmojos");
configureMavenClassPath(mavenGeneralSettings, params.getClassPath());
final File userVmP = new File(SystemProperties.getUserHome(), "fcg-vmp");
if (userVmP.exists()) {
params.getVMParametersList().addParametersString(FileUtil.loadFile(userVmP));
}
params.setMainClass("com.intellij.flex.maven.GeneratorServer");
final GeneralCommandLine commandLine = params.toCommandLine();
commandLine.setRedirectErrorStream(true);
LOG.info("Generate Flex Configs Task:" + commandLine.getCommandLineString());
indicator.checkCanceled();
process = commandLine.createProcess();
ApplicationManager.getApplication().executeOnPooledThread(new OutputReader(project));
//noinspection IOResourceOpenedButNotSafelyClosed
out = new DataOutputStream(new BufferedOutputStream(process.getOutputStream()));
writeExplicitProfiles(mavenProjectsManager.getExplicitProfiles().getEnabledProfiles());
writeWorkspaceMap(myTree.getProjects());
out.writeUTF(FlexCommonUtils.getPathToBundledJar("flexmojos-idea-configurator.jar"));
out.writeUTF(getIdeaConfiguratorClassName());
}
use of com.intellij.execution.configurations.ParametersList in project intellij-plugins by JetBrains.
the class KnopflerfishRunner method setupParameters.
/**
* See <a href="http://www.knopflerfish.org/releases/current/docs/running.html">Running Knopflerfish</a>.
*/
@Override
protected void setupParameters(@NotNull JavaParameters parameters) {
ParametersList vmParameters = parameters.getVMParametersList();
ParametersList programParameters = parameters.getProgramParametersList();
// framework-specific options
vmParameters.addProperty("org.knopflerfish.framework.debug.errors", "true");
if (GenericRunProperties.isDebugMode(myAdditionalProperties)) {
// todo: more detailed settings in the dialog (?)
vmParameters.addProperty("org.knopflerfish.verbosity", "10");
vmParameters.addProperty("org.knopflerfish.framework.debug.startlevel", "true");
vmParameters.addProperty("org.knopflerfish.framework.debug.classloader", "true");
}
parameters.setMainClass(MAIN_CLASS);
programParameters.add("-init");
programParameters.add("-launch");
// 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);
if (bundle.isStartAfterInstallation() && !isFragment) {
int startLevel = getBundleStartLevel(bundle);
startBundles.putValue(startLevel, bundlePath);
} else {
installBundles.add(bundlePath);
}
}
if (!installBundles.isEmpty()) {
int defaultStartLevel = myRunConfiguration.getDefaultStartLevel();
programParameters.addAll("-initlevel", String.valueOf(defaultStartLevel));
for (String bundle : installBundles) {
programParameters.addAll("-install", bundle);
}
}
for (Integer startLevel : startBundles.keySet()) {
programParameters.addAll("-initlevel", String.valueOf(startLevel));
for (String bundle : startBundles.get(startLevel)) {
programParameters.addAll("-install", bundle);
}
}
int frameworkStartLevel = getFrameworkStartLevel();
programParameters.addAll("-startlevel", String.valueOf(frameworkStartLevel));
for (Integer startLevel : startBundles.keySet()) {
for (String bundle : startBundles.get(startLevel)) {
programParameters.addAll("-start", bundle);
}
}
}
use of com.intellij.execution.configurations.ParametersList in project intellij-plugins by JetBrains.
the class ConciergeRunner method setupParameters.
/**
* See <a href="http://concierge.sourceforge.net/properties.html">Concierge Startup 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("osgi.auto.start." + startLevel, StringUtil.join(startBundles.get(startLevel), " "));
}
if (!installBundles.isEmpty()) {
vmParameters.addProperty("osgi.auto.install", StringUtil.join(installBundles, " "));
}
int startLevel = getFrameworkStartLevel();
vmParameters.addProperty("osgi.startlevel.framework", String.valueOf(startLevel));
int defaultStartLevel = myRunConfiguration.getDefaultStartLevel();
vmParameters.addProperty("osgi.startlevel.bundle", String.valueOf(defaultStartLevel));
// framework-specific options
vmParameters.addProperty("osgi.init", "true");
if (GenericRunProperties.isDebugMode(myAdditionalProperties)) {
vmParameters.addProperty("ch.ethz.iks.concierge.debug", "true");
}
parameters.setMainClass(MAIN_CLASS);
}
Aggregations