Search in sources :

Example 1 with EclipseResourceFileSystemAccess2

use of org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2 in project xtext-eclipse by eclipse.

the class EclipseResourceFileSystemAccess2Test method setUp.

@Before
public void setUp() throws Exception {
    project = IResourcesSetupUtil.createProject("test");
    Injector injector = TestsActivator.getInstance().getInjector(TestsActivator.ORG_ECLIPSE_XTEXT_BUILDER_TESTS_BUILDERTESTLANGUAGE);
    fsa = injector.getInstance(EclipseResourceFileSystemAccess2.class);
    fsa.setProject(project);
    fsa.setOutputPath("src-gen");
    fsa.getOutputConfigurations().get(IFileSystemAccess.DEFAULT_OUTPUT).setCreateOutputDirectory(true);
    fsa.setMonitor(new NullProgressMonitor());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) EclipseResourceFileSystemAccess2(org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2) Injector(com.google.inject.Injector) Before(org.junit.Before)

Example 2 with EclipseResourceFileSystemAccess2

use of org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2 in project n4js by eclipse.

the class N4JSBuilderParticipant method prepareBuild.

/**
 * Intentionally package visible producer for the {@link IBuildParticipantInstruction}.
 *
 * @param project
 *            the currently build project
 * @param buildType
 *            the current build type
 * @return a StatefulBuilderParticipant. Never <code>null</code>.
 */
IBuildParticipantInstruction prepareBuild(IProject project, IXtextBuilderParticipant.BuildType buildType) throws CoreException {
    if (!isEnabled(project)) {
        return IBuildParticipantInstruction.NOOP;
    }
    EclipseResourceFileSystemAccess2 access = fileSystemAccessProvider.get();
    access.setProject(project);
    final Map<String, OutputConfiguration> outputConfigurations = getOutputConfigurations(project);
    refreshOutputFolders(project, outputConfigurations, null);
    access.setOutputConfigurations(outputConfigurations);
    if (buildType == BuildType.CLEAN || buildType == BuildType.RECOVERY) {
        IBuildParticipantInstruction clean = new CleanInstruction(project, outputConfigurations, getDerivedResourceMarkers());
        if (buildType == BuildType.RECOVERY) {
            clean.finish(Collections.<Delta>emptyList(), null);
        } else {
            return clean;
        }
    }
    Map<OutputConfiguration, Iterable<IMarker>> generatorMarkers = getGeneratorMarkers(project, outputConfigurations.values());
    BuildInstruction buildInstruction = new BuildInstruction(project, outputConfigurations, getDerivedResourceMarkers(), access, generatorMarkers, storage2UriMapper, compositeGenerator, injector);
    return buildInstruction;
}
Also used : IBuildParticipantInstruction(org.eclipse.n4js.ui.building.instructions.IBuildParticipantInstruction) EclipseResourceFileSystemAccess2(org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2) OutputConfiguration(org.eclipse.xtext.generator.OutputConfiguration) BuildInstruction(org.eclipse.n4js.ui.building.instructions.BuildInstruction) CleanInstruction(org.eclipse.n4js.ui.building.instructions.CleanInstruction)

Aggregations

EclipseResourceFileSystemAccess2 (org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2)2 Injector (com.google.inject.Injector)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 BuildInstruction (org.eclipse.n4js.ui.building.instructions.BuildInstruction)1 CleanInstruction (org.eclipse.n4js.ui.building.instructions.CleanInstruction)1 IBuildParticipantInstruction (org.eclipse.n4js.ui.building.instructions.IBuildParticipantInstruction)1 OutputConfiguration (org.eclipse.xtext.generator.OutputConfiguration)1 Before (org.junit.Before)1