use of org.eclipse.xtext.build.BuildRequest in project xtext-core by eclipse.
the class IncrementalBuilderTest method testIndexOnly.
@Test
public void testIndexOnly() {
final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
it.setIndexOnly(true);
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("entity A {}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
URI _minus = this.operator_minus("src/MyFile.indextestlanguage", _builder.toString());
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus)));
final BuildRequest.IPostValidationCallback _function_1 = (URI $0, Iterable<Issue> $1) -> {
throw new IllegalStateException();
};
it.setAfterValidate(_function_1);
final Procedure2<URI, URI> _function_2 = (URI $0, URI $1) -> {
throw new IllegalStateException();
};
it.setAfterGenerateFile(_function_2);
};
final BuildRequest buildRequest = this.newBuildRequest(_function);
final IndexState result = this.build(buildRequest);
Assert.assertEquals(1, IterableExtensions.size(result.getResourceDescriptions().getAllResourceDescriptions()));
}
use of org.eclipse.xtext.build.BuildRequest in project xtext-core by eclipse.
the class IncrementalBuilderTest method testNoCleanupBuild.
@Test
public void testNoCleanupBuild() {
final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
final Procedure1<OutputConfiguration> _function_1 = (OutputConfiguration it_1) -> {
it_1.setCleanUpDerivedResources(false);
};
this.withOutputConfig(it, _function_1);
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("entity B {}");
_builder.newLine();
_builder.append("\t");
_builder.append("entity A { foo.B myReference }");
_builder.newLine();
_builder.append("}");
_builder.newLine();
URI _minus = this.operator_minus("src/MyFile.indextestlanguage", _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());
Assert.assertEquals(2, this.generated.size());
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt"));
final Procedure1<BuildRequest> _function_1 = (BuildRequest it) -> {
final Procedure1<OutputConfiguration> _function_2 = (OutputConfiguration it_1) -> {
it_1.setCleanUpDerivedResources(false);
};
this.withOutputConfig(it, _function_2);
URI _delete = this.delete(this.uri("src/A.indextestlanguage"));
it.setDeletedFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_delete)));
};
this.newBuildRequest(_function_1);
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
Assert.assertEquals(2, this.generated.size());
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt"));
}
use of org.eclipse.xtext.build.BuildRequest in project xtext-core by eclipse.
the class IncrementalBuilderTest method testGeneratedOnceBuild.
@Test
public void testGeneratedOnceBuild() {
final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
final Procedure1<OutputConfiguration> _function_1 = (OutputConfiguration it_1) -> {
it_1.setOverrideExistingResources(false);
};
this.withOutputConfig(it, _function_1);
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("entity B {}");
_builder.newLine();
_builder.append("\t");
_builder.append("entity A { foo.B myReference }");
_builder.newLine();
_builder.append("}");
_builder.newLine();
URI _minus = this.operator_minus("src/MyFile.indextestlanguage", _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());
Assert.assertEquals(2, this.generated.size());
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt"));
final Procedure1<BuildRequest> _function_1 = (BuildRequest it) -> {
final Procedure1<OutputConfiguration> _function_2 = (OutputConfiguration it_1) -> {
it_1.setOverrideExistingResources(false);
};
this.withOutputConfig(it, _function_2);
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("entity B {}");
_builder.newLine();
_builder.append("\t");
_builder.append("entity A { foo.B someReference }");
_builder.newLine();
_builder.append("}");
_builder.newLine();
URI _minus = this.operator_minus("src/MyFile.indextestlanguage", _builder.toString());
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus)));
final Procedure2<URI, URI> _function_3 = (URI $0, URI $1) -> {
Assert.fail();
};
it.setAfterGenerateFile(_function_3);
};
this.newBuildRequest(_function_1);
}
use of org.eclipse.xtext.build.BuildRequest in project xtext-core by eclipse.
the class IncrementalBuilderTest method testIncrementalBuild.
@Test
public void testIncrementalBuild() {
final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("entity A {foo.B reference}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
URI _minus = this.operator_minus("src/A.indextestlanguage", _builder.toString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("foo {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("entity B {foo.A reference}");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
URI _minus_1 = this.operator_minus("src/B.indextestlanguage", _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());
Assert.assertEquals(2, this.generated.size());
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt"));
final Procedure1<BuildRequest> _function_1 = (BuildRequest it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("entity A {foo.B reference}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
URI _minus = this.operator_minus("src/A.indextestlanguage", _builder.toString());
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus)));
};
this.build(this.newBuildRequest(_function_1));
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
Assert.assertEquals(1, this.generated.size());
Assert.assertFalse(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt"));
final Procedure1<BuildRequest> _function_2 = (BuildRequest it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("entity X { foo.B reference }");
_builder.newLine();
_builder.append("}");
_builder.newLine();
URI _minus = this.operator_minus("src/A.indextestlanguage", _builder.toString());
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus)));
};
this.build(this.newBuildRequest(_function_2));
Assert.assertEquals(this.issues.toString(), 1, this.issues.size());
Assert.assertEquals(1, this.generated.size());
Assert.assertFalse(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/X.txt"));
Assert.assertEquals(1, this.indexState.getFileMappings().getGenerated(this.uri("src/A.indextestlanguage")).size());
Assert.assertEquals(1, this.deleted.size());
Assert.assertTrue(this.containsSuffix(this.deleted, "src-gen/A.txt"));
final Procedure1<BuildRequest> _function_3 = (BuildRequest it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("entity A { foo.B reference }");
_builder.newLine();
_builder.append("}");
_builder.newLine();
URI _minus = this.operator_minus("src/A.indextestlanguage", _builder.toString());
it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus)));
};
this.build(this.newBuildRequest(_function_3));
Assert.assertTrue(this.issues.toString(), this.issues.isEmpty());
Assert.assertEquals(2, this.generated.size());
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/B.txt"));
Assert.assertTrue(this.containsSuffix(this.generated.values(), "src-gen/A.txt"));
Assert.assertTrue(this.containsSuffix(this.deleted, "src-gen/X.txt"));
final Procedure1<BuildRequest> _function_4 = (BuildRequest it) -> {
URI _delete = this.delete(this.uri("src/A.indextestlanguage"));
it.setDeletedFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_delete)));
};
this.build(this.newBuildRequest(_function_4));
Assert.assertEquals(this.issues.toString(), 1, this.issues.size());
Assert.assertEquals(0, this.generated.size());
Assert.assertEquals(1, this.deleted.size());
Assert.assertTrue(this.containsSuffix(this.deleted, "src-gen/A.txt"));
}
Aggregations