Esempio n. 1
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));
        }
Esempio n. 2
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));
        }
Esempio n. 3
0
        private async Task <SolutionChecksumObject> CreateSolutionChecksumObjectAsync(
            Solution solution, string kind, SnapshotBuilder snapshotBuilder, AssetBuilder assetBuilder, CancellationToken cancellationToken)
        {
            var info = await assetBuilder.BuildAsync(solution, cancellationToken).ConfigureAwait(false);

            var projects = await snapshotBuilder.BuildAsync(solution, solution.Projects, cancellationToken).ConfigureAwait(false);

            return(new SolutionChecksumObject(_serializer, info.Checksum, projects));
        }
Esempio n. 4
0
        private async Task <DocumentChecksumObject> CreateDocumentChecksumObjectAsync(TextDocumentState key, TextDocumentState documentState, string kind, CancellationToken cancellationToken)
        {
            var assetBuilder = new AssetBuilder(_checksumTree);
            var info         = await assetBuilder.BuildAsync(documentState, cancellationToken).ConfigureAwait(false);

            var sourceText = await key.GetTextAsync(cancellationToken).ConfigureAwait(false);

            var text = await assetBuilder.BuildAsync(key, sourceText, cancellationToken).ConfigureAwait(false);

            return(new DocumentChecksumObject(_serializer, info.Checksum, text.Checksum));
        }
Esempio n. 5
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));
        }
Esempio n. 6
0
        private ChecksumCollection CreateChecksumCollections(
            IReadOnlyList <AnalyzerReference> key, IEnumerable <AnalyzerReference> references, string kind, CancellationToken cancellationToken)
        {
            if (key.Count == 0)
            {
                return(GetEmptyChecksumCollection(kind));
            }

            var assetBuilder = new AssetBuilder(_checksumTree.GetOrCreateSubTreeNode(key));

            return(CreateChecksumCollections(references, kind, assetBuilder.Build, cancellationToken));
        }
Esempio n. 7
0
        private async Task <DocumentChecksumObject> CreateDocumentChecksumObjectAsync(
            TextDocument document, string kind, SnapshotBuilder snapshotBuilder, AssetBuilder assetBuilder, CancellationToken cancellationToken)
        {
            var info = await assetBuilder.BuildAsync(document, cancellationToken).ConfigureAwait(false);

            var state      = document.State;
            var sourceText = await state.GetTextAsync(cancellationToken).ConfigureAwait(false);

            var text = await assetBuilder.BuildAsync(state, sourceText, cancellationToken).ConfigureAwait(false);

            return(new DocumentChecksumObject(_serializer, info.Checksum, text.Checksum));
        }
Esempio n. 8
0
        private Task <ChecksumCollection> CreateChecksumCollectionsAsync(
            IReadOnlyList <MetadataReference> key, IEnumerable <MetadataReference> references, string kind, CancellationToken cancellationToken)
        {
            if (key.Count == 0)
            {
                return(GetEmptyChecksumCollectionTask(kind));
            }

            var assetBuilder = new AssetBuilder(_checksumTree.GetOrCreateSubTreeNode(key));

            return(CreateChecksumCollectionsAsync(references, kind, assetBuilder.BuildAsync, cancellationToken));
        }
Esempio n. 9
0
            public override async Task <TChecksumObject> GetOrCreateChecksumObjectWithChildrenAsync <TKey, TValue, TChecksumObject>(
                TKey key, TValue value, string kind,
                Func <TValue, string, SnapshotBuilder, AssetBuilder, CancellationToken, Task <TChecksumObject> > valueGetterAsync, CancellationToken cancellationToken)
            {
                return(await GetOrCreateChecksumObjectAsync(key, value, kind, (v, k, c) =>
                {
                    var snapshotBuilder = new SnapshotBuilder(GetOrCreateSubTreeNodeCache(key));
                    var assetBuilder = new AssetBuilder(this);

                    return valueGetterAsync(v, k, snapshotBuilder, assetBuilder, c);
                }, cancellationToken).ConfigureAwait(false));
            }
Esempio n. 10
0
        private async Task <ProjectChecksumObject> CreateProjectChecksumObjectAsync(
            Project project, string kind, SnapshotBuilder snapshotBuilder, AssetBuilder assetBuilder, CancellationToken cancellationToken)
        {
            var info = await assetBuilder.BuildAsync(project, cancellationToken).ConfigureAwait(false);

            var compilationOptions = await assetBuilder.BuildAsync(project, project.CompilationOptions, cancellationToken).ConfigureAwait(false);

            var parseOptions = await assetBuilder.BuildAsync(project, project.ParseOptions, cancellationToken).ConfigureAwait(false);

            var documents = await snapshotBuilder.BuildAsync(project, project.Documents, WellKnownChecksumObjects.Documents, cancellationToken).ConfigureAwait(false);

            var projectReferences = await snapshotBuilder.BuildAsync(project, project.ProjectReferences, cancellationToken).ConfigureAwait(false);

            var metadataReferences = await snapshotBuilder.BuildAsync(project, project.MetadataReferences, cancellationToken).ConfigureAwait(false);

            var analyzerReferences = await snapshotBuilder.BuildAsync(project, project.AnalyzerReferences, cancellationToken).ConfigureAwait(false);

            var additionalDocuments = await snapshotBuilder.BuildAsync(project, project.AdditionalDocuments, WellKnownChecksumObjects.TextDocuments, cancellationToken).ConfigureAwait(false);

            return(new ProjectChecksumObject(
                       _serializer, info.Checksum, compilationOptions.Checksum, parseOptions.Checksum,
                       documents, projectReferences, metadataReferences, analyzerReferences, additionalDocuments));
        }
Esempio n. 11
0
 private Task <ChecksumCollection> CreateChecksumCollectionsAsync(
     IEnumerable <AnalyzerReference> references, string kind, SnapshotBuilder snapshotBuilder, AssetBuilder assetBuilder, CancellationToken cancellationToken)
 {
     return(CreateChecksumCollectionsAsync(references, kind, assetBuilder.BuildAsync, cancellationToken));
 }
Esempio n. 12
0
 private Task <ChecksumCollection> CreateDocumentChecksumObjectAsync(
     IEnumerable <TextDocument> documents, string kind, SnapshotBuilder snapshotBuilder, AssetBuilder assetBuilder, CancellationToken cancellationToken)
 {
     return(CreateChecksumCollectionsAsync(documents, kind, snapshotBuilder.BuildAsync, cancellationToken));
 }
Esempio n. 13
0
 private Task <ChecksumCollection> CreateProjectChecksumCollectionAsync(
     IEnumerable <Project> projects, string kind, SnapshotBuilder snapshotBuilder, AssetBuilder assetBuilder, CancellationToken cancellationToken)
 {
     return(CreateChecksumCollectionsAsync(projects, kind, snapshotBuilder.BuildAsync, cancellationToken));
 }