use of org.eclipse.xtext.build.BuildRequest in project xtext-xtend by eclipse.
the class XtendIncrementalBuilderTest method testIssue52.
/**
* tests https://github.com/eclipse/xtext-core/issues/52
*/
@Test
public void testIssue52() {
final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package a");
_builder.newLine();
_builder.newLine();
_builder.append("import b.B");
_builder.newLine();
_builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
_builder.newLine();
_builder.newLine();
_builder.append("class A {");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("@Accessors String version");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("new (String x, B b) {");
_builder.newLine();
_builder.append("\t\t");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("new() {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("@Accessors");
_builder.newLine();
_builder.append("class A1 {");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("var String a");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("}");
_builder.newLine();
URI _minus = this.operator_minus("src/a/A.xtend", _builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("package b");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("import a.A");
_builder_1.newLine();
_builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("class B {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("@Accessors String version");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def doSth() {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("val a = new A");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("a.toString");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def doSomethingElse(String a) {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("a.length + 1");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
URI _minus_1 = this.operator_minus("src/b/B.xtend", _builder_1.toString());
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus, _minus_1)));
};
this.build(this.newBuildRequest(_function));
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
final Procedure1<BuildRequest> _function_1 = (BuildRequest it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package a");
_builder.newLine();
_builder.newLine();
_builder.append("import b.B");
_builder.newLine();
_builder.append("import org.eclipse.xtend.lib.annotations.Accessors");
_builder.newLine();
_builder.newLine();
_builder.append("class A {");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("@Accessors String version");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("new (String x, B b) {");
_builder.newLine();
_builder.append("\t\t");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("new() {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("@Accessors");
_builder.newLine();
_builder.append("class A1 {");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("var String a");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("}");
_builder.newLine();
URI _minus = this.operator_minus("src/a/A.xtend", _builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("package b");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("import a.A");
_builder_1.newLine();
_builder_1.append("import org.eclipse.xtend.lib.annotations.Accessors");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("class B {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("@Accessors String version");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def doSth() {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("val a = new A");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("a.toString");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def doSomethingElse(String a) {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("a.length + 1");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
URI _minus_1 = this.operator_minus("src/b/B.xtend", _builder_1.toString());
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus, _minus_1)));
};
this.build(this.newBuildRequest(_function_1));
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
}
use of org.eclipse.xtext.build.BuildRequest in project xtext-xtend by eclipse.
the class XtendIncrementalBuilderTest method testPackageInfo.
@Test
public void testPackageInfo() {
final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package foo;");
_builder.newLine();
URI _minus = this.operator_minus("src/foo/package-info.java", _builder.toString());
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus)));
};
final BuildRequest buildRequest = this.newBuildRequest(_function);
this.build(buildRequest);
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
}
use of org.eclipse.xtext.build.BuildRequest in project xtext-xtend by eclipse.
the class XtendIncrementalBuilderTest method testSimpleMixedBuild_02.
@Test
public void testSimpleMixedBuild_02() {
final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class A {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void doStuff(mypack.MyClass obj) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("val A x = obj.a");
_builder.newLine();
_builder.append("\t\t");
_builder.append("println(\"Juhu \"+x)");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
URI _minus = this.operator_minus("src/MyFile.xtend", _builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("package mypack;");
_builder_1.newLine();
_builder_1.append("class MyClass {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("public A a;");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
URI _minus_1 = this.operator_minus("src/mypack/MyClass.java", _builder_1.toString());
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus, _minus_1)));
};
final BuildRequest buildRequest = this.newBuildRequest(_function);
this.build(buildRequest);
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
Assert.assertEquals(2, this.generated.size());
Assert.assertTrue(this.containsSuffix(this.generated.values(), "xtend-gen/A.java"));
}
use of org.eclipse.xtext.build.BuildRequest in project xtext-xtend by eclipse.
the class XtendIncrementalBuilderTest method testGrammarAccessproblem.
@Test
public void testGrammarAccessproblem() {
final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package mypack;");
_builder.newLine();
_builder.append("public class FakeIssue60GrammarAccess {");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("private final GreetingElements pGreeting;");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("public FakeIssue60GrammarAccess() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("this.pGreeting = new GreetingElements();");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("public class GreetingElements {");
_builder.newLine();
_builder.append("\t\t");
_builder.newLine();
_builder.append("\t\t");
_builder.append("public String getHelloKeyword_0() { return null; }");
_builder.newLine();
_builder.append("\t\t");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("public GreetingElements getGreetingAccess() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return pGreeting;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
URI _minus = this.operator_minus("src/mypack/FakeIssue60GrammarAccess.java", _builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("package mypack");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("import mypack.FakeIssue60GrammarAccess$GreetingElements");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("class Demo {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("extension mypack.FakeIssue60GrammarAccess");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("GreetingElements elements");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def void format() {");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("greetingAccess.helloKeyword_0");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("println(elements)");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
URI _minus_1 = this.operator_minus("src/mypack/Demo.xtend", _builder_1.toString());
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus, _minus_1)));
};
final BuildRequest buildRequest = this.newBuildRequest(_function);
this.build(buildRequest);
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
Assert.assertEquals(2, this.generated.size());
}
use of org.eclipse.xtext.build.BuildRequest in project xtext-xtend by eclipse.
the class XtendIncrementalBuilderTest method testSimpleMixedBuild_03.
@Test
public void testSimpleMixedBuild_03() {
final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class A extends mypack.MyClass {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void doStuff(A obj) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("val A x = obj.a");
_builder.newLine();
_builder.append("\t\t");
_builder.append("val mypack.MyClass x2 = obj.myClass");
_builder.newLine();
_builder.append("\t\t");
_builder.append("println(\"Juhu \"+x+\' - \'+x2.a)");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
URI _minus = this.operator_minus("src/MyFile.xtend", _builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("package mypack;");
_builder_1.newLine();
_builder_1.append("public class MyClass extends Third {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("public A a;");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
URI _minus_1 = this.operator_minus("src/mypack/MyClass.java", _builder_1.toString());
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append("package mypack");
_builder_2.newLine();
_builder_2.append("class Third {");
_builder_2.newLine();
_builder_2.append("\t");
_builder_2.append("public MyClass myClass");
_builder_2.newLine();
_builder_2.append("}");
_builder_2.newLine();
URI _minus_2 = this.operator_minus("src/mypack/Third.xtend", _builder_2.toString());
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus, _minus_1, _minus_2)));
};
final BuildRequest buildRequest = this.newBuildRequest(_function);
this.build(buildRequest);
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
Assert.assertEquals(4, this.generated.size());
Assert.assertTrue(this.containsSuffix(this.generated.values(), "xtend-gen/A.java"));
Assert.assertTrue(this.containsSuffix(this.generated.values(), "xtend-gen/.A.java._trace"));
Assert.assertTrue(this.containsSuffix(this.generated.values(), "xtend-gen/mypack/Third.java"));
Assert.assertTrue(this.containsSuffix(this.generated.values(), "xtend-gen/mypack/.Third.java._trace"));
}
Aggregations