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

Side by Side Diff: lib/src/compiler/compiler.dart

Issue 2176763002: fix #606, allow specifying the summary file extension (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: fix Created 4 years, 5 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
« no previous file with comments | « lib/src/compiler/command.dart ('k') | test/worker/worker_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:collection' show HashSet; 5 import 'dart:collection' show HashSet;
6 import 'package:args/args.dart' show ArgParser, ArgResults; 6 import 'package:args/args.dart' show ArgParser, ArgResults;
7 import 'package:args/src/usage_exception.dart' show UsageException; 7 import 'package:args/src/usage_exception.dart' show UsageException;
8 import 'package:analyzer/analyzer.dart' 8 import 'package:analyzer/analyzer.dart'
9 show 9 show
10 AnalysisError, 10 AnalysisError,
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 /// If [sourceMap] is emitted, this will emit a `sourceMappingUrl` comment 152 /// If [sourceMap] is emitted, this will emit a `sourceMappingUrl` comment
153 /// into the output JavaScript module. 153 /// into the output JavaScript module.
154 final bool sourceMapComment; 154 final bool sourceMapComment;
155 155
156 /// Whether to emit a summary file containing API signatures. 156 /// Whether to emit a summary file containing API signatures.
157 /// 157 ///
158 /// This is required for a modular build process. 158 /// This is required for a modular build process.
159 final bool summarizeApi; 159 final bool summarizeApi;
160 160
161 /// The file extension for summaries.
162 final String summaryExtension;
163
161 /// Whether to preserve metdata only accessible via mirrors 164 /// Whether to preserve metdata only accessible via mirrors
162 final bool emitMetadata; 165 final bool emitMetadata;
163 166
164 /// Whether to force compilation of code with static errors. 167 /// Whether to force compilation of code with static errors.
165 final bool unsafeForceCompile; 168 final bool unsafeForceCompile;
166 169
167 /// Whether to emit Closure Compiler-friendly code. 170 /// Whether to emit Closure Compiler-friendly code.
168 final bool closure; 171 final bool closure;
169 172
170 /// Hoist the types at instance creation sites 173 /// Hoist the types at instance creation sites
(...skipping 27 matching lines...) Expand all
198 final bool destructureNamedParams; 201 final bool destructureNamedParams;
199 202
200 /// Which module format to support. 203 /// Which module format to support.
201 /// Currently 'es6' and 'legacy' are supported. 204 /// Currently 'es6' and 'legacy' are supported.
202 final ModuleFormat moduleFormat; 205 final ModuleFormat moduleFormat;
203 206
204 const CompilerOptions( 207 const CompilerOptions(
205 {this.sourceMap: true, 208 {this.sourceMap: true,
206 this.sourceMapComment: true, 209 this.sourceMapComment: true,
207 this.summarizeApi: true, 210 this.summarizeApi: true,
211 this.summaryExtension: 'sum',
208 this.unsafeForceCompile: false, 212 this.unsafeForceCompile: false,
209 this.emitMetadata: false, 213 this.emitMetadata: false,
210 this.closure: false, 214 this.closure: false,
211 this.destructureNamedParams: false, 215 this.destructureNamedParams: false,
212 this.moduleFormat: ModuleFormat.legacy, 216 this.moduleFormat: ModuleFormat.legacy,
213 this.hoistInstanceCreation: true, 217 this.hoistInstanceCreation: true,
214 this.hoistSignatureTypes: false, 218 this.hoistSignatureTypes: false,
215 this.nameTypeTests: true, 219 this.nameTypeTests: true,
216 this.hoistTypeTests: true, 220 this.hoistTypeTests: true,
217 this.useAngular2Whitelist: false}); 221 this.useAngular2Whitelist: false});
218 222
219 CompilerOptions.fromArguments(ArgResults args) 223 CompilerOptions.fromArguments(ArgResults args)
220 : sourceMap = args['source-map'], 224 : sourceMap = args['source-map'],
221 sourceMapComment = args['source-map-comment'], 225 sourceMapComment = args['source-map-comment'],
222 summarizeApi = args['summarize'], 226 summarizeApi = args['summarize'],
227 summaryExtension = args['summary-extension'],
223 unsafeForceCompile = args['unsafe-force-compile'], 228 unsafeForceCompile = args['unsafe-force-compile'],
224 emitMetadata = args['emit-metadata'], 229 emitMetadata = args['emit-metadata'],
225 closure = args['closure-experimental'], 230 closure = args['closure-experimental'],
226 destructureNamedParams = args['destructure-named-params'], 231 destructureNamedParams = args['destructure-named-params'],
227 moduleFormat = parseModuleFormat(args['modules']), 232 moduleFormat = parseModuleFormat(args['modules']),
228 hoistInstanceCreation = args['hoist-instance-creation'], 233 hoistInstanceCreation = args['hoist-instance-creation'],
229 hoistSignatureTypes = args['hoist-signature-types'], 234 hoistSignatureTypes = args['hoist-signature-types'],
230 nameTypeTests = args['name-type-tests'], 235 nameTypeTests = args['name-type-tests'],
231 hoistTypeTests = args['hoist-type-tests'], 236 hoistTypeTests = args['hoist-type-tests'],
232 useAngular2Whitelist = args['unsafe-angular2-whitelist']; 237 useAngular2Whitelist = args['unsafe-angular2-whitelist'];
233 238
234 static ArgParser addArguments(ArgParser parser) => parser 239 static ArgParser addArguments(ArgParser parser) => parser
235 ..addFlag('summarize', help: 'emit an API summary file', defaultsTo: true) 240 ..addFlag('summarize', help: 'emit an API summary file', defaultsTo: true)
241 ..addOption('summary-extension',
242 help: 'file extension for Dart summary files', defaultsTo: 'sum')
236 ..addFlag('source-map', help: 'emit source mapping', defaultsTo: true) 243 ..addFlag('source-map', help: 'emit source mapping', defaultsTo: true)
237 ..addFlag('source-map-comment', 244 ..addFlag('source-map-comment',
238 help: 'adds a sourceMappingURL comment to the end of the JS,\n' 245 help: 'adds a sourceMappingURL comment to the end of the JS,\n'
239 'disable if using X-SourceMap header', 246 'disable if using X-SourceMap header',
240 defaultsTo: true) 247 defaultsTo: true)
241 ..addOption('modules', 248 ..addOption('modules',
242 help: 'module pattern to emit', 249 help: 'module pattern to emit',
243 allowed: ['es6', 'legacy', 'node'], 250 allowed: ['es6', 'legacy', 'node'],
244 allowedHelp: { 251 allowedHelp: {
245 'es6': 'es6 modules', 252 'es6': 'es6 modules',
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 357 }
351 } 358 }
352 359
353 /// (Public for tests) the error code used when a part is missing. 360 /// (Public for tests) the error code used when a part is missing.
354 final missingPartErrorCode = const CompileTimeErrorCode( 361 final missingPartErrorCode = const CompileTimeErrorCode(
355 'MISSING_PART', 'The part was not supplied as an input to the compiler.'); 362 'MISSING_PART', 'The part was not supplied as an input to the compiler.');
356 363
357 /// (Public for tests) the error code used when a part is unused. 364 /// (Public for tests) the error code used when a part is unused.
358 final unusedPartWarningCode = const StaticWarningCode( 365 final unusedPartWarningCode = const StaticWarningCode(
359 'UNUSED_PART', 'The part was not used by any libraries being compiled.'); 366 'UNUSED_PART', 'The part was not used by any libraries being compiled.');
OLDNEW
« no previous file with comments | « lib/src/compiler/command.dart ('k') | test/worker/worker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698