use of org.eclipse.xtext.generator.OutputConfiguration in project xtext-core by eclipse.
the class ResourceStorageFacade method getFileSystemAccess.
protected AbstractFileSystemAccess2 getFileSystemAccess(final StorageAwareResource resource) {
final AbstractFileSystemAccess2 fsa = this.fileSystemAccessProvider.get();
fsa.setContext(resource);
final Function1<OutputConfiguration, String> _function = (OutputConfiguration it) -> {
return it.getName();
};
fsa.setOutputConfigurations(IterableExtensions.<String, OutputConfiguration>toMap(this.outputConfigurationProvider.getOutputConfigurations(resource), _function));
return fsa;
}
use of org.eclipse.xtext.generator.OutputConfiguration 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.generator.OutputConfiguration 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.generator.OutputConfiguration in project xtext-core by eclipse.
the class URIBasedFileSystemAccessTest method before.
@Before
public void before() {
try {
final Path tmpPath = Paths.get(StandardSystemProperty.JAVA_IO_TMPDIR.value());
StringConcatenation _builder = new StringConcatenation();
_builder.append("tempFolder_");
UUID _randomUUID = UUID.randomUUID();
_builder.append(_randomUUID);
final Path output = Files.createTempDirectory(tmpPath, _builder.toString());
final Path resource = Files.createFile(output.resolve(URIBasedFileSystemAccessTest.EXISTING_RESOURCE_NAME));
resource.toFile().deleteOnExit();
output.toFile().deleteOnExit();
final OutputConfiguration config = IterableExtensions.<OutputConfiguration>head(this.configProvider.getOutputConfigurations());
config.setOutputDirectory(output.toString());
Pair<String, OutputConfiguration> _mappedTo = Pair.<String, OutputConfiguration>of(IFileSystemAccess.DEFAULT_OUTPUT, config);
this.fsa.setOutputConfigurations(Collections.<String, OutputConfiguration>unmodifiableMap(CollectionLiterals.<String, OutputConfiguration>newHashMap(_mappedTo)));
this.fsa.setConverter(this.uriConverter);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations