Search in sources :

Example 1 with XBuildRequest

use of org.eclipse.n4js.xtext.ide.server.build.XBuildRequest in project n4js by eclipse.

the class N4JSProjectBuilder method newBuildRequest.

@Override
protected XBuildRequest newBuildRequest(IBuildRequestFactory buildRequestFactory, Set<URI> changedFiles, Set<URI> deletedFiles, List<Delta> externalDeltas, CancelIndicator cancelIndicator) {
    XBuildRequest request = super.newBuildRequest(buildRequestFactory, changedFiles, deletedFiles, externalDeltas, cancelIndicator);
    ProjectDescription pd = getProjectConfig().getProjectDescription();
    if (N4JSLanguageUtils.isDtsGenerationActive(pd)) {
        request.addAfterBuildRequestListener(new DtsAfterBuildListener(getProjectConfig()));
    }
    request.addAfterBuildFileListener((uri) -> {
        Resource resource = getResource(uri);
        if (resource instanceof N4JSResource) {
            N4JSResource n4jsResource = (N4JSResource) resource;
            ASTFlowInfo flowInfo = n4jsResource.getASTMetaInfoCache().getFlowInfo();
            // release memory
            flowInfo.reset();
            n4jsResource.unloadAST();
        }
    });
    return request;
}
Also used : N4JSResource(org.eclipse.n4js.resource.N4JSResource) Resource(org.eclipse.emf.ecore.resource.Resource) N4JSResource(org.eclipse.n4js.resource.N4JSResource) ASTFlowInfo(org.eclipse.n4js.postprocessing.ASTFlowInfo) ProjectDescription(org.eclipse.n4js.packagejson.projectDescription.ProjectDescription) XBuildRequest(org.eclipse.n4js.xtext.ide.server.build.XBuildRequest)

Aggregations

Resource (org.eclipse.emf.ecore.resource.Resource)1 ProjectDescription (org.eclipse.n4js.packagejson.projectDescription.ProjectDescription)1 ASTFlowInfo (org.eclipse.n4js.postprocessing.ASTFlowInfo)1 N4JSResource (org.eclipse.n4js.resource.N4JSResource)1 XBuildRequest (org.eclipse.n4js.xtext.ide.server.build.XBuildRequest)1