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

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

Issue 1148283010: Remove dart backend (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 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/codegen/html_codegen.dart ('k') | pubspec.yaml » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /// Set of flags and options passed to the compiler 5 /// Set of flags and options passed to the compiler
6 library dev_compiler.src.options; 6 library dev_compiler.src.options;
7 7
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:args/args.dart'; 10 import 'package:args/args.dart';
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 /// Whether to check the sdk libraries. 110 /// Whether to check the sdk libraries.
111 final bool checkSdk; 111 final bool checkSdk;
112 112
113 /// Whether to dump summary information on the console. 113 /// Whether to dump summary information on the console.
114 final bool dumpInfo; 114 final bool dumpInfo;
115 115
116 /// If not null, path to a file that will store a json representation of the 116 /// If not null, path to a file that will store a json representation of the
117 /// summary information (only used if [dumpInfo] is true). 117 /// summary information (only used if [dumpInfo] is true).
118 final String dumpInfoFile; 118 final String dumpInfoFile;
119 119
120 /// Directory where to dump the orignal but formatted Dart sources. This is
121 /// mainly used to make it easier to compare input and output files.
122 final String dumpSrcDir;
123
124 /// Whether to force compilation of code with static errors. 120 /// Whether to force compilation of code with static errors.
125 final bool forceCompile; 121 final bool forceCompile;
126 122
127 /// Whether to use a cheap formatter instead of dart_style.
128 // TODO(jmesserly): old comment said this might not be a semantically correct
129 // formatter. Why not?
130 final bool formatOutput;
131
132 /// Output directory for generated code. 123 /// Output directory for generated code.
133 final String outputDir; 124 final String outputDir;
134 125
135 /// Whether to emit Dart output (false means to emit JS output).
136 final bool outputDart;
137
138 /// Whether to use colors when interacting on the console. 126 /// Whether to use colors when interacting on the console.
139 final bool useColors; 127 final bool useColors;
140 128
141 /// Whether the user asked for help. 129 /// Whether the user asked for help.
142 final bool help; 130 final bool help;
143 131
144 /// Whether to use a mock-sdk during compilation. 132 /// Whether to use a mock-sdk during compilation.
145 final bool useMockSdk; 133 final bool useMockSdk;
146 134
147 /// Path to the dart-sdk. Null if `useMockSdk` is true or if the path couldn't 135 /// Path to the dart-sdk. Null if `useMockSdk` is true or if the path couldn't
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 221
234 /// Location for runtime files, such as `dart_runtime.js`. By default this is 222 /// Location for runtime files, such as `dart_runtime.js`. By default this is
235 /// inferred to be under `lib/runtime/` in the location of the `dev_compiler` 223 /// inferred to be under `lib/runtime/` in the location of the `dev_compiler`
236 /// package (if we can infer where that is located). 224 /// package (if we can infer where that is located).
237 final String runtimeDir; 225 final String runtimeDir;
238 226
239 /// Custom URI mappings, such as "dart:foo" -> "path/to/foo.dart" 227 /// Custom URI mappings, such as "dart:foo" -> "path/to/foo.dart"
240 final Map<String, String> customUrlMappings; 228 final Map<String, String> customUrlMappings;
241 229
242 CompilerOptions({this.allowConstCasts: true, this.checkSdk: false, 230 CompilerOptions({this.allowConstCasts: true, this.checkSdk: false,
243 this.dumpInfo: false, this.dumpInfoFile, this.dumpSrcDir, 231 this.dumpInfo: false, this.dumpInfoFile, this.forceCompile: false,
244 this.forceCompile: false, this.formatOutput: false,
245 this.ignoreTypes: false, 232 this.ignoreTypes: false,
246 this.wrapClosures: RulesOptions.wrapClosuresDefault, this.outputDir, 233 this.wrapClosures: RulesOptions.wrapClosuresDefault, this.outputDir,
247 this.outputDart: false, this.useColors: true, 234 this.useColors: true, this.covariantGenerics: true,
248 this.covariantGenerics: true, this.relaxedCasts: true, 235 this.relaxedCasts: true, this.useMultiPackage: false,
249 this.useMultiPackage: false, this.packageRoot: 'packages/', 236 this.packageRoot: 'packages/', this.packagePaths: const <String>[],
250 this.packagePaths: const <String>[], this.resources: const <String>[], 237 this.resources: const <String>[],
251 this.inferDownwards: RulesOptions.inferDownwardsDefault, 238 this.inferDownwards: RulesOptions.inferDownwardsDefault,
252 this.inferFromOverrides: ResolverOptions.inferFromOverridesDefault, 239 this.inferFromOverrides: ResolverOptions.inferFromOverridesDefault,
253 this.inferTransitively: ResolverOptions.inferTransitivelyDefault, 240 this.inferTransitively: ResolverOptions.inferTransitivelyDefault,
254 this.onlyInferConstsAndFinalFields: ResolverOptions.onlyInferConstAndFinal FieldsDefault, 241 this.onlyInferConstsAndFinalFields: ResolverOptions.onlyInferConstAndFinal FieldsDefault,
255 this.nonnullableTypes: TypeOptions.NONNULLABLE_TYPES, this.help: false, 242 this.nonnullableTypes: TypeOptions.NONNULLABLE_TYPES, this.help: false,
256 this.useMockSdk: false, this.dartSdkPath, this.logLevel: Level.SEVERE, 243 this.useMockSdk: false, this.dartSdkPath, this.logLevel: Level.SEVERE,
257 this.emitSourceMaps: true, this.entryPointFile: null, 244 this.emitSourceMaps: true, this.entryPointFile: null,
258 this.serverMode: false, this.useImplicitHtml: false, 245 this.serverMode: false, this.useImplicitHtml: false,
259 this.enableHashing: false, this.host: 'localhost', this.port: 8080, 246 this.enableHashing: false, this.host: 'localhost', this.port: 8080,
260 this.runtimeDir, this.customUrlMappings: const {}}); 247 this.runtimeDir, this.customUrlMappings: const {}});
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 customUrlMappings[splitMapping[0]] = splitMapping[1]; 291 customUrlMappings[splitMapping[0]] = splitMapping[1];
305 } 292 }
306 293
307 var entryPointFile = args.rest.length == 0 ? null : args.rest.first; 294 var entryPointFile = args.rest.length == 0 ? null : args.rest.first;
308 295
309 return new CompilerOptions( 296 return new CompilerOptions(
310 allowConstCasts: args['allow-const-casts'], 297 allowConstCasts: args['allow-const-casts'],
311 checkSdk: args['sdk-check'], 298 checkSdk: args['sdk-check'],
312 dumpInfo: dumpInfo, 299 dumpInfo: dumpInfo,
313 dumpInfoFile: args['dump-info-file'], 300 dumpInfoFile: args['dump-info-file'],
314 dumpSrcDir: args['dump-src-to'],
315 forceCompile: args['force-compile'] || serverMode, 301 forceCompile: args['force-compile'] || serverMode,
316 formatOutput: args['dart-gen-fmt'],
317 ignoreTypes: args['ignore-types'], 302 ignoreTypes: args['ignore-types'],
318 wrapClosures: args['wrap-closures'], 303 wrapClosures: args['wrap-closures'],
319 outputDart: args['dart-gen'],
320 outputDir: outputDir, 304 outputDir: outputDir,
321 covariantGenerics: args['covariant-generics'], 305 covariantGenerics: args['covariant-generics'],
322 relaxedCasts: args['relaxed-casts'], 306 relaxedCasts: args['relaxed-casts'],
323 useColors: useColors, 307 useColors: useColors,
324 customUrlMappings: customUrlMappings, 308 customUrlMappings: customUrlMappings,
325 useMultiPackage: args['use-multi-package'], 309 useMultiPackage: args['use-multi-package'],
326 packageRoot: args['package-root'], 310 packageRoot: args['package-root'],
327 packagePaths: args['package-paths'].split(','), 311 packagePaths: args['package-paths'].split(','),
328 resources: args['resources'] 312 resources: args['resources']
329 .split(',') 313 .split(',')
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 ..addFlag('infer-transitively', 364 ..addFlag('infer-transitively',
381 help: 'Infer consts/fields from definitions in other libraries', 365 help: 'Infer consts/fields from definitions in other libraries',
382 defaultsTo: ResolverOptions.inferTransitivelyDefault) 366 defaultsTo: ResolverOptions.inferTransitivelyDefault)
383 ..addFlag('infer-only-finals', 367 ..addFlag('infer-only-finals',
384 help: 'Do not infer non-const or non-final fields', 368 help: 'Do not infer non-const or non-final fields',
385 defaultsTo: ResolverOptions.onlyInferConstAndFinalFieldsDefault) 369 defaultsTo: ResolverOptions.onlyInferConstAndFinalFieldsDefault)
386 370
387 // input/output options 371 // input/output options
388 ..addOption('out', abbr: 'o', help: 'Output directory', defaultsTo: null) 372 ..addOption('out', abbr: 'o', help: 'Output directory', defaultsTo: null)
389 ..addOption('dart-sdk', help: 'Dart SDK Path', defaultsTo: null) 373 ..addOption('dart-sdk', help: 'Dart SDK Path', defaultsTo: null)
390 ..addFlag('dart-gen',
391 abbr: 'd', help: 'Generate dart output', defaultsTo: false)
392 ..addFlag('dart-gen-fmt',
393 help: 'Generate readable dart output', defaultsTo: true)
394 ..addOption('dump-src-to', help: 'Dump dart src code', defaultsTo: null) 374 ..addOption('dump-src-to', help: 'Dump dart src code', defaultsTo: null)
395 ..addOption('package-root', 375 ..addOption('package-root',
396 abbr: 'p', 376 abbr: 'p',
397 help: 'Package root to resolve "package:" imports', 377 help: 'Package root to resolve "package:" imports',
398 defaultsTo: 'packages/') 378 defaultsTo: 'packages/')
399 ..addOption('url-mapping', 379 ..addOption('url-mapping',
400 help: '--url-mapping=libraryUri,/path/to/library.dart uses library.dart\n' 380 help: '--url-mapping=libraryUri,/path/to/library.dart uses library.dart\n'
401 'as the source for an import of of "libraryUri".', 381 'as the source for an import of of "libraryUri".',
402 allowMultiple: true, 382 allowMultiple: true,
403 splitCommas: false) 383 splitCommas: false)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 // The pub-cache directory is two levels up, but we verify that the layout 459 // The pub-cache directory is two levels up, but we verify that the layout
480 // looks correct. 460 // looks correct.
481 if (path.basename(dir) != 'dev_compiler') return null; 461 if (path.basename(dir) != 'dev_compiler') return null;
482 dir = path.dirname(dir); 462 dir = path.dirname(dir);
483 if (path.basename(dir) != 'global_packages') return null; 463 if (path.basename(dir) != 'global_packages') return null;
484 dir = path.dirname(dir); 464 dir = path.dirname(dir);
485 return path.join(dir, cacheDir, 'lib', 'runtime'); 465 return path.join(dir, cacheDir, 'lib', 'runtime');
486 } 466 }
487 return null; 467 return null;
488 } 468 }
OLDNEW
« no previous file with comments | « lib/src/codegen/html_codegen.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698