public IncrementalBuilder.Result build( final BuildRequest request, final Function1<? super URI, ? extends IResourceServiceProvider> languages, final IResourceClusteringPolicy clusteringPolicy) { try { final XtextResourceSet resourceSet = request.getResourceSet(); IndexState _state = request.getState(); ResourceDescriptionsData _resourceDescriptions = _state.getResourceDescriptions(); ResourceDescriptionsData _copy = _resourceDescriptions.copy(); IndexState _state_1 = request.getState(); Source2GeneratedMapping _fileMappings = _state_1.getFileMappings(); Source2GeneratedMapping _copy_1 = _fileMappings.copy(); final IndexState oldState = new IndexState(_copy, _copy_1); CancelIndicator _cancelIndicator = request.getCancelIndicator(); final BuildContext context = new BuildContext(languages, resourceSet, oldState, clusteringPolicy, _cancelIndicator); final IncrementalBuilder.InternalStatefulIncrementalBuilder builder = this.provider.get(); builder.context = context; builder.request = request; try { return builder.launch(); } catch (final Throwable _t) { if (_t instanceof Throwable) { final Throwable t = (Throwable) _t; this._operationCanceledManager.propagateIfCancelException(t); throw t; } else { throw Exceptions.sneakyThrow(_t); } } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
public IncrementalBuilder.Result launch() { IndexState _state = this.request.getState(); final Source2GeneratedMapping newSource2GeneratedMapping = _state.getFileMappings(); List<URI> _deletedFiles = this.request.getDeletedFiles(); final Procedure1<URI> _function = new Procedure1<URI>() { @Override public void apply(final URI source) { Set<URI> _deleteSource = newSource2GeneratedMapping.deleteSource(source); final Procedure1<URI> _function = new Procedure1<URI>() { @Override public void apply(final URI generated) { try { boolean _isInfoEnabled = IncrementalBuilder.InternalStatefulIncrementalBuilder.LOG .isInfoEnabled(); if (_isInfoEnabled) { IncrementalBuilder.InternalStatefulIncrementalBuilder.LOG.info( ("Deleting " + generated)); } final IResourceServiceProvider serviceProvider = InternalStatefulIncrementalBuilder.this.context .getResourceServiceProvider(source); IContextualOutputConfigurationProvider2 _get = serviceProvider.<IContextualOutputConfigurationProvider2>get( IContextualOutputConfigurationProvider2.class); XtextResourceSet _resourceSet = InternalStatefulIncrementalBuilder.this.request.getResourceSet(); final Set<OutputConfiguration> configs = _get.getOutputConfigurations(_resourceSet); final String configName = newSource2GeneratedMapping.getOutputConfigName(generated); final Function1<OutputConfiguration, Boolean> _function = new Function1<OutputConfiguration, Boolean>() { @Override public Boolean apply(final OutputConfiguration it) { String _name = it.getName(); return Boolean.valueOf(Objects.equal(_name, configName)); } }; final OutputConfiguration config = IterableExtensions.<OutputConfiguration>findFirst(configs, _function); if (((!Objects.equal(config, null)) && config.isCleanUpDerivedResources())) { XtextResourceSet _resourceSet_1 = InternalStatefulIncrementalBuilder.this.context.getResourceSet(); URIConverter _uRIConverter = _resourceSet_1.getURIConverter(); Map<Object, Object> _emptyMap = CollectionLiterals.<Object, Object>emptyMap(); _uRIConverter.delete(generated, _emptyMap); Procedure1<? super URI> _afterDeleteFile = InternalStatefulIncrementalBuilder.this.request.getAfterDeleteFile(); _afterDeleteFile.apply(generated); } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } } }; IterableExtensions.<URI>forEach(_deleteSource, _function); } }; IterableExtensions.<URI>forEach(_deletedFiles, _function); final Indexer.IndexResult result = this.indexer.computeAndIndexAffected(this.request, this.context); CancelIndicator _cancelIndicator = this.request.getCancelIndicator(); this._operationCanceledManager.checkCanceled(_cancelIndicator); final ArrayList<IResourceDescription.Delta> resolvedDeltas = CollectionLiterals.<IResourceDescription.Delta>newArrayList(); List<IResourceDescription.Delta> _resourceDeltas = result.getResourceDeltas(); final Function1<IResourceDescription.Delta, Boolean> _function_1 = new Function1<IResourceDescription.Delta, Boolean>() { @Override public Boolean apply(final IResourceDescription.Delta it) { IResourceDescription _new = it.getNew(); return Boolean.valueOf(Objects.equal(_new, null)); } }; Iterable<IResourceDescription.Delta> _filter = IterableExtensions.<IResourceDescription.Delta>filter(_resourceDeltas, _function_1); Iterables.<IResourceDescription.Delta>addAll(resolvedDeltas, _filter); List<IResourceDescription.Delta> _resourceDeltas_1 = result.getResourceDeltas(); final Function1<IResourceDescription.Delta, Boolean> _function_2 = new Function1<IResourceDescription.Delta, Boolean>() { @Override public Boolean apply(final IResourceDescription.Delta it) { IResourceDescription _new = it.getNew(); return Boolean.valueOf((!Objects.equal(_new, null))); } }; Iterable<IResourceDescription.Delta> _filter_1 = IterableExtensions.<IResourceDescription.Delta>filter(_resourceDeltas_1, _function_2); final Function1<IResourceDescription.Delta, URI> _function_3 = new Function1<IResourceDescription.Delta, URI>() { @Override public URI apply(final IResourceDescription.Delta it) { return it.getUri(); } }; Iterable<URI> _map = IterableExtensions.<IResourceDescription.Delta, URI>map(_filter_1, _function_3); final Function1<Resource, IResourceDescription.Delta> _function_4 = new Function1<Resource, IResourceDescription.Delta>() { @Override public IResourceDescription.Delta apply(final Resource resource) { CancelIndicator _cancelIndicator = InternalStatefulIncrementalBuilder.this.request.getCancelIndicator(); InternalStatefulIncrementalBuilder.this._operationCanceledManager.checkCanceled( _cancelIndicator); resource.getContents(); EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl); CancelIndicator _cancelIndicator_1 = InternalStatefulIncrementalBuilder.this.request.getCancelIndicator(); InternalStatefulIncrementalBuilder.this._operationCanceledManager.checkCanceled( _cancelIndicator_1); URI _uRI = resource.getURI(); final IResourceServiceProvider serviceProvider = InternalStatefulIncrementalBuilder.this.context.getResourceServiceProvider(_uRI); final IResourceDescription.Manager manager = serviceProvider.getResourceDescriptionManager(); final IResourceDescription description = manager.getResourceDescription(resource); final SerializableResourceDescription copiedDescription = SerializableResourceDescription.createCopy(description); ResourceDescriptionsData _newIndex = result.getNewIndex(); URI _uRI_1 = resource.getURI(); _newIndex.addDescription(_uRI_1, copiedDescription); CancelIndicator _cancelIndicator_2 = InternalStatefulIncrementalBuilder.this.request.getCancelIndicator(); InternalStatefulIncrementalBuilder.this._operationCanceledManager.checkCanceled( _cancelIndicator_2); if ((((!InternalStatefulIncrementalBuilder.this.request.isIndexOnly()) && InternalStatefulIncrementalBuilder.this.validate(resource)) && serviceProvider .<IShouldGenerate>get(IShouldGenerate.class) .shouldGenerate(resource, CancelIndicator.NullImpl))) { CancelIndicator _cancelIndicator_3 = InternalStatefulIncrementalBuilder.this.request.getCancelIndicator(); InternalStatefulIncrementalBuilder.this._operationCanceledManager.checkCanceled( _cancelIndicator_3); InternalStatefulIncrementalBuilder.this.generate( resource, InternalStatefulIncrementalBuilder.this.request, newSource2GeneratedMapping); } IndexState _oldState = InternalStatefulIncrementalBuilder.this.context.getOldState(); ResourceDescriptionsData _resourceDescriptions = _oldState.getResourceDescriptions(); URI _uRI_2 = resource.getURI(); final IResourceDescription old = _resourceDescriptions.getResourceDescription(_uRI_2); return manager.createDelta(old, copiedDescription); } }; Iterable<IResourceDescription.Delta> _executeClustered = this.context.<IResourceDescription.Delta>executeClustered(_map, _function_4); Iterables.<IResourceDescription.Delta>addAll(resolvedDeltas, _executeClustered); IndexState _state_1 = this.request.getState(); return new IncrementalBuilder.Result(_state_1, resolvedDeltas); }