use of com.intellij.execution.configurations.JavaParameters in project intellij-community by JetBrains.
the class GroovyScriptRunner method getClassPathFromRootModel.
@Nullable
public static PathsList getClassPathFromRootModel(Module module, boolean isTests, JavaParameters params, boolean allowDuplication, PathsList pathList) throws CantRunException {
if (module == null) {
return null;
}
pathList.add(".");
final JavaParameters tmp = new JavaParameters();
tmp.configureByModule(module, isTests ? JavaParameters.CLASSES_AND_TESTS : JavaParameters.CLASSES_ONLY);
if (tmp.getClassPath().getVirtualFiles().isEmpty()) {
return null;
}
Set<VirtualFile> core = new HashSet<>(params.getClassPath().getVirtualFiles());
for (VirtualFile virtualFile : tmp.getClassPath().getVirtualFiles()) {
if (allowDuplication || !core.contains(virtualFile)) {
pathList.add(virtualFile);
}
}
return pathList;
}
use of com.intellij.execution.configurations.JavaParameters in project intellij-community by JetBrains.
the class GroovyShellRunnerImpl method createProcess.
@Override
protected Process createProcess() throws ExecutionException {
JavaParameters javaParameters = myShellRunner.createJavaParameters(myModule);
javaParameters.setUseDynamicClasspath(true);
myCommandLine = javaParameters.toCommandLine();
return myCommandLine.createProcess();
}
use of com.intellij.execution.configurations.JavaParameters in project intellij-community by JetBrains.
the class TestNGRunnableState method createJavaParameters.
@Override
protected JavaParameters createJavaParameters() throws ExecutionException {
final JavaParameters javaParameters = super.createJavaParameters();
javaParameters.setMainClass("org.testng.RemoteTestNGStarter");
try {
port = NetUtils.findAvailableSocketPort();
} catch (IOException e) {
throw new ExecutionException("Unable to bind to port " + port, e);
}
final TestData data = getConfiguration().getPersistantData();
if (data.getOutputDirectory() != null && !data.getOutputDirectory().isEmpty()) {
javaParameters.getProgramParametersList().add(CommandLineArgs.OUTPUT_DIRECTORY, data.getOutputDirectory());
}
javaParameters.getProgramParametersList().add(CommandLineArgs.USE_DEFAULT_LISTENERS, String.valueOf(data.USE_DEFAULT_REPORTERS));
@NonNls final StringBuilder buf = new StringBuilder();
if (data.TEST_LISTENERS != null && !data.TEST_LISTENERS.isEmpty()) {
buf.append(StringUtil.join(data.TEST_LISTENERS, ";"));
}
collectListeners(javaParameters, buf, IDEATestNGListener.EP_NAME, ";");
if (buf.length() > 0)
javaParameters.getProgramParametersList().add(CommandLineArgs.LISTENER, buf.toString());
createServerSocket(javaParameters);
createTempFiles(javaParameters);
return javaParameters;
}
use of com.intellij.execution.configurations.JavaParameters in project intellij-community by JetBrains.
the class TestMethods method createJavaParameters.
@Override
protected JavaParameters createJavaParameters() throws ExecutionException {
final JavaParameters javaParameters = super.createDefaultJavaParameters();
final JUnitConfiguration.Data data = getConfiguration().getPersistentData();
final RunConfigurationModule configurationModule = getConfiguration().getConfigurationModule();
final Project project = configurationModule.getProject();
final Module module = configurationModule.getModule();
final GlobalSearchScope searchScope = module != null ? module.getModuleRuntimeScope(true) : GlobalSearchScope.allScope(project);
addClassesListToJavaParameters(myFailedTests, testInfo -> testInfo != null ? getTestPresentation(testInfo, project, searchScope) : null, data.getPackageName(), true, javaParameters);
return javaParameters;
}
use of com.intellij.execution.configurations.JavaParameters in project intellij-community by JetBrains.
the class TestObject method createJavaParameters.
@Override
protected JavaParameters createJavaParameters() throws ExecutionException {
JavaParameters javaParameters = super.createJavaParameters();
javaParameters.setMainClass(JUnitConfiguration.JUNIT_START_CLASS);
javaParameters.getProgramParametersList().add(JUnitStarter.IDE_VERSION + JUnitStarter.VERSION);
final StringBuilder buf = new StringBuilder();
collectListeners(javaParameters, buf, IDEAJUnitListener.EP_NAME, "\n");
if (buf.length() > 0) {
try {
myListenersFile = FileUtil.createTempFile("junit_listeners_", "", true);
javaParameters.getProgramParametersList().add("@@" + myListenersFile.getPath());
FileUtil.writeToFile(myListenersFile, buf.toString().getBytes(CharsetToolkit.UTF8_CHARSET));
} catch (IOException e) {
LOG.error(e);
}
}
final Project project = getConfiguration().getProject();
final SourceScope sourceScope = getSourceScope();
if (isJUnit5(getConfiguration().getConfigurationModule().getModule(), sourceScope, project)) {
javaParameters.getProgramParametersList().add(JUnitStarter.JUNIT5_PARAMETER);
javaParameters.getClassPath().add(PathUtil.getJarPathForClass(JUnit5IdeaTestRunner.class));
final PathsList classPath = javaParameters.getClassPath();
classPath.add(PathUtil.getJarPathForClass(TestExecutionListener.class));
classPath.add(PathUtil.getJarPathForClass(JupiterTestEngine.class));
classPath.add(PathUtil.getJarPathForClass(JUnitException.class));
classPath.add(PathUtil.getJarPathForClass(TestEngine.class));
classPath.add(PathUtil.getJarPathForClass(JUnitPlatform.class));
try {
JUnitUtil.getTestCaseClass(sourceScope);
classPath.add(PathUtil.getJarPathForClass(VintageTestEngine.class));
} catch (JUnitUtil.NoJUnitException ignore) {
}
}
return javaParameters;
}
Aggregations