use of org.eclipse.xtext.util.JUnitVersion in project xtext-core by eclipse.
the class TestProjectDescriptor method getExternalDependencies.
@Override
public Set<ExternalDependency> getExternalDependencies() {
final LinkedHashSet<ExternalDependency> deps = CollectionLiterals.<ExternalDependency>newLinkedHashSet();
Set<ExternalDependency> _externalDependencies = super.getExternalDependencies();
Iterables.<ExternalDependency>addAll(deps, _externalDependencies);
JUnitVersion _junitVersion = this.getConfig().getJunitVersion();
boolean _equals = Objects.equal(_junitVersion, JUnitVersion.JUNIT_4);
if (_equals) {
ExternalDependency _externalDependency = new ExternalDependency();
final Procedure1<ExternalDependency> _function = (ExternalDependency it) -> {
ExternalDependency.P2Coordinates _p2 = it.getP2();
_p2.setBundleId("org.junit");
ExternalDependency.P2Coordinates _p2_1 = it.getP2();
_p2_1.setVersion("4.12.0");
ExternalDependency.MavenCoordinates _maven = it.getMaven();
_maven.setGroupId("junit");
ExternalDependency.MavenCoordinates _maven_1 = it.getMaven();
_maven_1.setArtifactId("junit");
ExternalDependency.MavenCoordinates _maven_2 = it.getMaven();
_maven_2.setScope(Scope.TESTCOMPILE);
};
ExternalDependency _doubleArrow = ObjectExtensions.<ExternalDependency>operator_doubleArrow(_externalDependency, _function);
deps.add(_doubleArrow);
}
JUnitVersion _junitVersion_1 = this.getConfig().getJunitVersion();
boolean _equals_1 = Objects.equal(_junitVersion_1, JUnitVersion.JUNIT_5);
if (_equals_1) {
ExternalDependency _externalDependency_1 = new ExternalDependency();
final Procedure1<ExternalDependency> _function_1 = (ExternalDependency it) -> {
ExternalDependency.P2Coordinates _p2 = it.getP2();
_p2.setBundleId("org.junit.jupiter.api");
ExternalDependency.P2Coordinates _p2_1 = it.getP2();
_p2_1.setVersion("[5.1.0,6.0.0)");
ExternalDependency.MavenCoordinates _maven = it.getMaven();
_maven.setGroupId("org.junit.jupiter");
ExternalDependency.MavenCoordinates _maven_1 = it.getMaven();
_maven_1.setArtifactId("junit-jupiter-api");
ExternalDependency.MavenCoordinates _maven_2 = it.getMaven();
_maven_2.setScope(Scope.TESTCOMPILE);
};
ExternalDependency _doubleArrow_1 = ObjectExtensions.<ExternalDependency>operator_doubleArrow(_externalDependency_1, _function_1);
deps.add(_doubleArrow_1);
ExternalDependency _externalDependency_2 = new ExternalDependency();
final Procedure1<ExternalDependency> _function_2 = (ExternalDependency it) -> {
ExternalDependency.MavenCoordinates _maven = it.getMaven();
_maven.setGroupId("org.junit.jupiter");
ExternalDependency.MavenCoordinates _maven_1 = it.getMaven();
_maven_1.setArtifactId("junit-jupiter-engine");
ExternalDependency.MavenCoordinates _maven_2 = it.getMaven();
_maven_2.setScope(Scope.TESTRUNTIME);
};
ExternalDependency _doubleArrow_2 = ObjectExtensions.<ExternalDependency>operator_doubleArrow(_externalDependency_2, _function_2);
deps.add(_doubleArrow_2);
}
return deps;
}
use of org.eclipse.xtext.util.JUnitVersion in project xtext-eclipse by eclipse.
the class XtextProjectCreator method configureJavaProject.
private void configureJavaProject(ProjectDescriptor descriptor, JavaProjectFactory factory) {
configurePlainProject(descriptor, factory);
factory.addProjectNatures(XtextProjectHelper.NATURE_ID);
factory.addBuilderIds(XtextProjectHelper.BUILDER_ID);
factory.addProjectNatures(JavaCore.NATURE_ID);
factory.addBuilderIds(JavaCore.BUILDER_ID);
for (SourceFolderDescriptor sourceFolder : descriptor.getSourceFolders()) {
String output = sourceFolder.isTest() ? (needsM2eIntegration(descriptor) ? "target/test-classes" : "test-bin") : null;
factory.addSourceFolder(sourceFolder.getPath(), output, sourceFolder.isTest());
}
factory.setJreContainerEntry(JREContainerProvider.getJREContainerEntry(descriptor.getBree()));
if (needsM2eIntegration(descriptor)) {
factory.setDefaultOutput("target/classes");
if (!descriptor.isEclipsePluginProject()) {
factory.addClasspathEntries(JavaCore.newContainerEntry(new Path("org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER")));
}
}
if (needsBuildshipIntegration(descriptor) && !descriptor.isEclipsePluginProject()) {
factory.addClasspathEntries(JavaCore.newContainerEntry(new Path("org.eclipse.buildship.core.gradleclasspathcontainer")));
}
if (requiresJUnitLibContainer(descriptor)) {
JUnitVersion junitVersion = descriptor.getConfig().getJunitVersion();
factory.addClasspathEntries(JavaCore.newContainerEntry(new Path("org.eclipse.jdt.junit.JUNIT_CONTAINER").append(Integer.toString(junitVersion.getVersion())), new IAccessRule[0], new IClasspathAttribute[] { JavaCore.newClasspathAttribute("test", "true") }, false));
}
}
Aggregations