Search in sources :

Example 6 with JUnitVersion

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;
}
Also used : JUnitVersion(org.eclipse.xtext.util.JUnitVersion)

Example 7 with JUnitVersion

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));
    }
}
Also used : Path(org.eclipse.core.runtime.Path) IClasspathAttribute(org.eclipse.jdt.core.IClasspathAttribute) SourceFolderDescriptor(org.eclipse.xtext.xtext.wizard.SourceFolderDescriptor) JUnitVersion(org.eclipse.xtext.util.JUnitVersion) IAccessRule(org.eclipse.jdt.core.IAccessRule)

Aggregations

JUnitVersion (org.eclipse.xtext.util.JUnitVersion)7 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)3 EClass (org.eclipse.emf.ecore.EClass)2 EClassifier (org.eclipse.emf.ecore.EClassifier)2 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)2 StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)2 AbstractRule (org.eclipse.xtext.AbstractRule)2 TypeReference (org.eclipse.xtext.xtext.generator.model.TypeReference)2 Charset (java.nio.charset.Charset)1 Path (org.eclipse.core.runtime.Path)1 IAccessRule (org.eclipse.jdt.core.IAccessRule)1 IClasspathAttribute (org.eclipse.jdt.core.IClasspathAttribute)1 XtextVersion (org.eclipse.xtext.util.XtextVersion)1 LanguageDescriptor (org.eclipse.xtext.xtext.wizard.LanguageDescriptor)1 SourceFolderDescriptor (org.eclipse.xtext.xtext.wizard.SourceFolderDescriptor)1