Пример #1
0
        private async Task <ProjectChecksumObject> CreateProjectChecksumObjectAsync(ProjectState key, ProjectState projectState, string kind, CancellationToken cancellationToken)
        {
            var assetBuilder = new AssetBuilder(_checksumTree);
            var info         = assetBuilder.Build(projectState, cancellationToken);

            var subTreeNode        = _checksumTree.GetOrCreateSubTreeNode(key);
            var subSnapshotBuilder = new ChecksumTreeBuilder(subTreeNode);

            var documents = await subSnapshotBuilder.BuildAsync(projectState.DocumentStates, projectState.DocumentIds.Select(id => projectState.DocumentStates[id]), WellKnownChecksumObjects.Documents, cancellationToken).ConfigureAwait(false);

            var projectReferences   = subSnapshotBuilder.Build(projectState.ProjectReferences, projectState.ProjectReferences, cancellationToken);
            var metadataReferences  = subSnapshotBuilder.Build(projectState.MetadataReferences, projectState.MetadataReferences, cancellationToken);
            var analyzerReferences  = subSnapshotBuilder.Build(projectState.AnalyzerReferences, projectState.AnalyzerReferences, cancellationToken);
            var additionalDocuments = await subSnapshotBuilder.BuildAsync(projectState.AdditionalDocumentStates, projectState.AdditionalDocumentIds.Select(id => projectState.AdditionalDocumentStates[id]), WellKnownChecksumObjects.TextDocuments, cancellationToken).ConfigureAwait(false);

            var subAssetBuilder = new AssetBuilder(subTreeNode);

            // set Asset.Null if this particular project doesn't support compiler options.
            // this one is really bit wierd since project state has both compilation/parse options but only has support compilation.
            // for now, we use support compilation for both options
            var compilationOptions = projectState.SupportsCompilation ? subAssetBuilder.Build(projectState, projectState.CompilationOptions, cancellationToken) : Asset.Null;
            var parseOptions       = projectState.SupportsCompilation ? subAssetBuilder.Build(projectState, projectState.ParseOptions, cancellationToken) : Asset.Null;

            return(new ProjectChecksumObject(
                       _serializer, info.Checksum, compilationOptions.Checksum, parseOptions.Checksum,
                       documents, projectReferences, metadataReferences, analyzerReferences, additionalDocuments));
        }
Пример #2
0
        private async Task <ProjectChecksumObject> CreateProjectChecksumObjectAsync(ProjectState key, ProjectState projectState, string kind, CancellationToken cancellationToken)
        {
            var assetBuilder = new AssetBuilder(_checksumTree);
            var info         = await assetBuilder.BuildAsync(projectState, cancellationToken).ConfigureAwait(false);

            var subTreeNode        = _checksumTree.GetOrCreateSubTreeNode(key);
            var subSnapshotBuilder = new ChecksumTreeBuilder(subTreeNode);

            var documents = await subSnapshotBuilder.BuildAsync(projectState.DocumentStates, projectState.DocumentIds.Select(id => projectState.DocumentStates[id]), WellKnownChecksumObjects.Documents, cancellationToken).ConfigureAwait(false);

            var projectReferences = await subSnapshotBuilder.BuildAsync(projectState.ProjectReferences, projectState.ProjectReferences, cancellationToken).ConfigureAwait(false);

            var metadataReferences = await subSnapshotBuilder.BuildAsync(projectState.MetadataReferences, projectState.MetadataReferences, cancellationToken).ConfigureAwait(false);

            var analyzerReferences = await subSnapshotBuilder.BuildAsync(projectState.AnalyzerReferences, projectState.AnalyzerReferences, cancellationToken).ConfigureAwait(false);

            var additionalDocuments = await subSnapshotBuilder.BuildAsync(projectState.AdditionalDocumentStates, projectState.AdditionalDocumentIds.Select(id => projectState.AdditionalDocumentStates[id]), WellKnownChecksumObjects.TextDocuments, cancellationToken).ConfigureAwait(false);

            var subAssetBuilder    = new AssetBuilder(subTreeNode);
            var compilationOptions = await subAssetBuilder.BuildAsync(projectState, projectState.CompilationOptions, cancellationToken).ConfigureAwait(false);

            var parseOptions = await subAssetBuilder.BuildAsync(projectState, projectState.ParseOptions, cancellationToken).ConfigureAwait(false);

            return(new ProjectChecksumObject(
                       _serializer, info.Checksum, compilationOptions.Checksum, parseOptions.Checksum,
                       documents, projectReferences, metadataReferences, analyzerReferences, additionalDocuments));
        }
Пример #3
0
        private async Task <SolutionChecksumObject> CreateSolutionChecksumObjectAsync(SolutionState key, SolutionState solutionState, string kind, CancellationToken cancellationToken)
        {
            var assetBuilder = new AssetBuilder(_checksumTree);
            var info         = assetBuilder.Build(solutionState, cancellationToken);

            var subTreeNode        = _checksumTree.GetOrCreateSubTreeNode(key);
            var subSnapshotBuilder = new ChecksumTreeBuilder(subTreeNode);

            var projects = await subSnapshotBuilder.BuildAsync(solutionState.ProjectStates, solutionState.ProjectIds.Select(id => solutionState.ProjectStates[id]), cancellationToken).ConfigureAwait(false);

            return(new SolutionChecksumObject(_serializer, info.Checksum, projects));
        }
Пример #4
0
        private Task <ChecksumCollection> CreateProjectChecksumCollectionAsync(
            ImmutableDictionary <ProjectId, ProjectState> key, IEnumerable <ProjectState> projectStates, string kind, CancellationToken cancellationToken)
        {
            if (key.Count == 0)
            {
                return(GetEmptyChecksumCollectionTask(kind));
            }

            var snapshotBuilder = new ChecksumTreeBuilder(_checksumTree.GetOrCreateSubTreeNode(key));

            return(CreateChecksumCollectionsAsync(projectStates, kind, snapshotBuilder.BuildAsync, cancellationToken));
        }
Пример #5
0
            public async Task<ChecksumScope> CreateChecksumAsync(Solution solution, CancellationToken cancellationToken)
            {
                using (Logger.LogBlock(FunctionId.SolutionChecksumServiceFactory_CreateChecksumAsync, cancellationToken))
                {
                    var rootTreeNode = _treeCollection.CreateRootTreeNode(solution.State);

                    var builder = new ChecksumTreeBuilder(rootTreeNode);
                    var snapshot = new ChecksumScope(_treeCollection, rootTreeNode, await builder.BuildAsync(solution.State, cancellationToken).ConfigureAwait(false));

                    return snapshot;
                }
            }
Пример #6
0
        private Task <ChecksumCollection> CreateDocumentChecksumObjectAsync <TState>(
            ImmutableDictionary <DocumentId, TState> key, IEnumerable <TextDocumentState> documentStates, string kind, CancellationToken cancellationToken)
            where TState : TextDocumentState
        {
            if (key.Count == 0)
            {
                return(GetEmptyChecksumCollectionTask(kind));
            }

            var snapshotBuilder = new ChecksumTreeBuilder(_checksumTree.GetOrCreateSubTreeNode(key));

            return(CreateChecksumCollectionsAsync(documentStates, kind, snapshotBuilder.BuildAsync, cancellationToken));
        }