Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: pkg/analyzer_cli/lib/src/build_mode.dart

Issue 1826353002: Add a fallback mode for building summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer_cli.src.build_mode; 5 library analyzer_cli.src.build_mode;
6 6
7 import 'dart:core' hide Resource; 7 import 'dart:core' hide Resource;
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 9
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 if (!analysisResult.hasMoreWork) { 79 if (!analysisResult.hasMoreWork) {
80 break; 80 break;
81 } 81 }
82 } 82 }
83 } 83 }
84 84
85 // Write summary. 85 // Write summary.
86 if (options.buildSummaryOutput != null) { 86 if (options.buildSummaryOutput != null) {
87 PackageBundleAssembler assembler = new PackageBundleAssembler(); 87 PackageBundleAssembler assembler = new PackageBundleAssembler();
88 for (Source source in explicitSources) { 88 for (Source source in explicitSources) {
89 if (context.computeKindOf(source) != SourceKind.LIBRARY) { 89 if (context.computeKindOf(source) == SourceKind.LIBRARY) {
90 continue; 90 if (options.buildSummaryFallback) {
91 assembler.addFallbackLibrary(source);
92 } else {
93 LibraryElement libraryElement = context.computeLibraryElement(source );
94 assembler.serializeLibraryElement(libraryElement);
95 }
91 } 96 }
92 LibraryElement libraryElement = context.computeLibraryElement(source); 97 if (options.buildSummaryFallback) {
93 assembler.serializeLibraryElement(libraryElement); 98 assembler.addFallbackUnit(source);
99 }
94 } 100 }
95 // Write the whole package bundle. 101 // Write the whole package bundle.
96 PackageBundleBuilder sdkBundle = assembler.assemble(); 102 PackageBundleBuilder sdkBundle = assembler.assemble();
97 if (options.buildSummaryExcludeInformative) { 103 if (options.buildSummaryExcludeInformative) {
98 sdkBundle.flushInformative(); 104 sdkBundle.flushInformative();
99 sdkBundle.unlinkedUnitHashes = null; 105 sdkBundle.unlinkedUnitHashes = null;
100 } 106 }
101 io.File file = new io.File(options.buildSummaryOutput); 107 io.File file = new io.File(options.buildSummaryOutput);
102 file.writeAsBytesSync(sdkBundle.toBuffer(), mode: io.FileMode.WRITE_ONLY); 108 file.writeAsBytesSync(sdkBundle.toBuffer(), mode: io.FileMode.WRITE_ONLY);
103 } 109 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 'Illegal input file (must be "\$uri|\$path"): $sourceFile'); 209 'Illegal input file (must be "\$uri|\$path"): $sourceFile');
204 return null; 210 return null;
205 } 211 }
206 Uri uri = Uri.parse(sourceFile.substring(0, pipeIndex)); 212 Uri uri = Uri.parse(sourceFile.substring(0, pipeIndex));
207 String path = sourceFile.substring(pipeIndex + 1); 213 String path = sourceFile.substring(pipeIndex + 1);
208 uriToFileMap[uri] = new JavaFile(path); 214 uriToFileMap[uri] = new JavaFile(path);
209 } 215 }
210 return uriToFileMap; 216 return uriToFileMap;
211 } 217 }
212 } 218 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/in_summary_source_test.dart ('k') | pkg/analyzer_cli/lib/src/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698