org.eclipse.xtext.build.BuildRequest Java Examples

The following examples show how to use org.eclipse.xtext.build.BuildRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProjectManager.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Creates a new build request for this project.
 */
protected BuildRequest newBuildRequest(List<URI> changedFiles, List<URI> deletedFiles,
		List<IResourceDescription.Delta> externalDeltas, CancelIndicator cancelIndicator) {
	BuildRequest result = new BuildRequest();
	result.setBaseDir(baseDir);
	result.setState(
			new IndexState(indexState.getResourceDescriptions().copy(), indexState.getFileMappings().copy()));
	result.setResourceSet(createFreshResourceSet(result.getState().getResourceDescriptions()));
	result.setDirtyFiles(changedFiles);
	result.setDeletedFiles(deletedFiles);
	result.setExternalDeltas(externalDeltas);
	result.setAfterValidate((URI uri, Iterable<Issue> issues) -> {
		issueAcceptor.apply(uri, issues);
		return true;
	});
	result.setCancelIndicator(cancelIndicator);
	result.setIndexOnly(projectConfig.isIndexOnly());
	return result;
}
 
Example #2
Source File: XtendIncrementalBuilderPerformanceTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
public void doTestPerformance(final int max) {
  final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
    final Function1<Integer, URI> _function_1 = (Integer it_1) -> {
      return this.toFile((it_1).intValue(), max);
    };
    it.setDirtyFiles(IterableExtensions.<URI>toList(IterableExtensions.<Integer, URI>map(new IntegerRange(1, max), _function_1)));
  };
  final BuildRequest buildRequest = this.newBuildRequest(_function);
  final Stopwatch sw = Stopwatch.createStarted();
  this.build(buildRequest);
  StringConcatenation _builder = new StringConcatenation();
  _builder.append(max);
  _builder.append(" file took ");
  long _elapsed = sw.elapsed(TimeUnit.MILLISECONDS);
  _builder.append(_elapsed);
  _builder.append(" ms");
  InputOutput.<String>println(_builder.toString());
}
 
Example #3
Source File: IncrementalBuilderTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testSimpleFullBuild() {
  final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
    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"));
}
 
Example #4
Source File: AbstractIncrementalBuilderTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
protected BuildRequest newBuildRequest(Procedure1<? super BuildRequest> init) {
	BuildRequest result = new BuildRequest();
	ResourceDescriptionsData newIndex = indexState.getResourceDescriptions().copy();
	result.setBaseDir(uri(""));
	XtextResourceSet rs = resourceSetProvider.get();
	rs.getURIConverter().getURIHandlers().clear();
	rs.getURIConverter().getURIHandlers().add(inMemoryURIHandler);
	rs.setClasspathURIContext(AbstractIncrementalBuilderTest.class.getClassLoader());
	ProjectDescription projectDescription = new ProjectDescription();
	projectDescription.setName("test-project");
	projectDescription.attachToEmfObject(rs);
	ChunkedResourceDescriptions index = new ChunkedResourceDescriptions(Collections.emptyMap(), rs);
	index.setContainer(projectDescription.getName(), newIndex);
	result.setResourceSet(rs);
	result.setDirtyFiles(new ArrayList<>());
	result.setDeletedFiles(new ArrayList<>());
	result.setAfterValidate((uri, issues) -> {
		Iterables.addAll(this.issues, issues);
		return Iterables.isEmpty(issues);
	});
	result.setAfterDeleteFile(f -> deleted.add(f));
	result.setAfterGenerateFile((source, target) -> generated.put(source, target));
	result.setState(new IndexState(newIndex, indexState.getFileMappings().copy()));
	init.apply(result);
	return result;
}
 
Example #5
Source File: XtendIncrementalBuilderTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@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());
}
 
Example #6
Source File: ProjectManager.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Build this project.
 */
public IncrementalBuilder.Result doBuild(List<URI> dirtyFiles, List<URI> deletedFiles,
		List<IResourceDescription.Delta> externalDeltas, CancelIndicator cancelIndicator) {
	BuildRequest request = newBuildRequest(dirtyFiles, deletedFiles, externalDeltas, cancelIndicator);
	IncrementalBuilder.Result result = incrementalBuilder.build(request,
			languagesRegistry::getResourceServiceProvider);
	indexState = result.getIndexState();
	resourceSet = request.getResourceSet();
	indexProvider.get().put(projectDescription.getName(), indexState.getResourceDescriptions());
	return result;
}
 
Example #7
Source File: IncrementalBuilderTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test(expected = OperationCanceledException.class)
public void testCancellation() {
  final IncrementalBuilderTest.CancelOnFirstModel cancelOnFirstModel = new IncrementalBuilderTest.CancelOnFirstModel();
  final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("foo {");
    _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());
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("foo {");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("entity B {}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    URI _minus_1 = this.operator_minus(
      "src/MyFile2.indextestlanguage", _builder_1.toString());
    it.setDirtyFiles(Collections.<URI>unmodifiableList(CollectionLiterals.<URI>newArrayList(_minus, _minus_1)));
    it.setCancelIndicator(cancelOnFirstModel);
    it.setAfterValidate(cancelOnFirstModel);
  };
  final BuildRequest buildRequest = this.newBuildRequest(_function);
  this.build(buildRequest);
}
 
Example #8
Source File: AbstractIncrementalBuilderTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected void withOutputConfig(BuildRequest it, Procedure1<? super OutputConfiguration> init) {
	OutputConfiguration config = Iterables.getFirst(configurationProvider.getOutputConfigurations(), null);
	init.apply(config);
	Map<String, Set<OutputConfiguration>> outputConfigurationsPerLanguage = new HashMap<>();
	outputConfigurationsPerLanguage.put(languageName, Sets.newHashSet(config));
	OutputConfigurationAdapter adapter = new OutputConfigurationAdapter(outputConfigurationsPerLanguage);
	it.getResourceSet().eAdapters().add(adapter);
}
 
Example #9
Source File: ReusedTypeProviderTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void setUp() throws Exception {
	super.setUp();
	if (ReusedTypeProviderTest.typeProvider == null) {
		String pathToSources = "/org/eclipse/xtext/common/types/testSetups";
		List<String> files = ReusedTypeProviderTest.readResource(pathToSources + "/files.list");
		ResourceDescriptionsData part = new ResourceDescriptionsData(Collections.emptySet());
		XtextResourceSet resourceSet = resourceSetProvider.get();
		ProjectDescription projectDesc = new ProjectDescription();
		projectDesc.setName("my-test-project");
		projectDesc.attachToEmfObject(resourceSet);
		ChunkedResourceDescriptions index = new ChunkedResourceDescriptions(Collections.emptyMap(), resourceSet);
		index.setContainer(projectDesc.getName(), part);
		resourceSet.setClasspathURIContext(ReusedTypeProviderTest.class.getClassLoader());

		typeProviderFactory.createTypeProvider(resourceSet);
		BuildRequest buildRequest = new BuildRequest();
		for (String file : files) {
			if (file != null) {
				String fullPath = pathToSources + "/" + file;
				URL url = ReusedTypeProviderTest.class.getResource(fullPath);
				buildRequest.getDirtyFiles().add(URI.createURI(url.toExternalForm()));
			}
		}
		buildRequest.setResourceSet(resourceSet);
		buildRequest.setState(new IndexState(part, new Source2GeneratedMapping()));
		builder.build(buildRequest, (URI it) -> {
			return resourceServiceProviderRegistry.getResourceServiceProvider(it);
		});
		ReusedTypeProviderTest.typeProvider = typeProviderFactory.findTypeProvider(resourceSet);
	}
}
 
Example #10
Source File: XtendIncrementalBuilderTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testSimpleFullBuild() {
  final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class A {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("public String a");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("public B someB");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _builder.append("class B {");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    URI _minus = this.operator_minus(
      "src/MyFile.xtend", _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(4, this.generated.size());
  Assert.assertTrue(this.containsSuffix(this.generated.values(), "xtend-gen/B.java"));
  Assert.assertTrue(this.containsSuffix(this.generated.values(), "xtend-gen/A.java"));
  Assert.assertTrue(this.containsSuffix(this.generated.values(), "xtend-gen/.B.java._trace"));
  Assert.assertTrue(this.containsSuffix(this.generated.values(), "xtend-gen/.A.java._trace"));
}
 
Example #11
Source File: XtendIncrementalBuilderTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testSimpleMixedBuild04() {
  final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import b.B");
    _builder.newLine();
    _builder.append("class A {");
    _builder.newLine();
    _builder.append("   ");
    _builder.append("def foo() {");
    _builder.newLine();
    _builder.append("      ");
    _builder.append("B.foo");
    _builder.newLine();
    _builder.append("   ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    URI _minus = this.operator_minus(
      "src/A.xtend", _builder.toString());
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("package b;");
    _builder_1.newLine();
    _builder_1.append("public class B {");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("public static String foo;");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    URI _minus_1 = this.operator_minus("src/b/B.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"));
}
 
Example #12
Source File: XtendIncrementalBuilderTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testSimpleMixedBuild() {
  final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class A {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("public mypack.MyClass someField");
    _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 String 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"));
}
 
Example #13
Source File: AbstractIncrementalBuilderTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected void withOutputConfig(final BuildRequest it, final Procedure1<? super OutputConfiguration> init) {
  final OutputConfiguration config = IterableExtensions.<OutputConfiguration>head(this.configurationProvider.getOutputConfigurations());
  init.apply(config);
  Pair<String, Set<OutputConfiguration>> _mappedTo = Pair.<String, Set<OutputConfiguration>>of(this.languageName, Collections.<OutputConfiguration>unmodifiableSet(CollectionLiterals.<OutputConfiguration>newHashSet(config)));
  final OutputConfigurationAdapter adapter = new OutputConfigurationAdapter(Collections.<String, Set<OutputConfiguration>>unmodifiableMap(CollectionLiterals.<String, Set<OutputConfiguration>>newHashMap(_mappedTo)));
  EList<Adapter> _eAdapters = it.getResourceSet().eAdapters();
  _eAdapters.add(adapter);
}
 
Example #14
Source File: AbstractIncrementalBuilderTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected IndexState build(final BuildRequest buildRequest) {
  this.clean();
  final Function1<URI, IResourceServiceProvider> _function = (URI it) -> {
    return this.getLanguages().getResourceServiceProvider(it);
  };
  this.indexState = this.incrementalBuilder.build(buildRequest, _function).getIndexState();
  return this.indexState;
}
 
Example #15
Source File: XtendIncrementalBuilderTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@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());
}
 
Example #16
Source File: XtendIncrementalBuilderTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testInnerClassEnumProblem() {
  final Procedure1<BuildRequest> _function = (BuildRequest it) -> {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package mypack;");
    _builder.newLine();
    _builder.append("public class EnumTest {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("public enum AB {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("A,");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("B");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _builder.newLine();
    URI _minus = this.operator_minus(
      "src/mypack/EnumTest.java", _builder.toString());
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("package mypack");
    _builder_1.newLine();
    _builder_1.append("class Demo {");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("def void format() {");
    _builder_1.newLine();
    _builder_1.append("\t\t");
    _builder_1.append("var EnumTest.AB x = EnumTest.AB.A");
    _builder_1.newLine();
    _builder_1.append("\t\t");
    _builder_1.append("println(x)");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("}");
    _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());
}
 
Example #17
Source File: AbstractIncrementalBuilderTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
protected IndexState build(BuildRequest buildRequest) {
	clean();
	indexState = incrementalBuilder.build(buildRequest, it -> getLanguages().getResourceServiceProvider(it))
			.getIndexState();
	return indexState;
}
 
Example #18
Source File: XtendIncrementalBuilderTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@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"));
}
 
Example #19
Source File: XtendIncrementalBuilderTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@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"));
}