| OLD | NEW |
| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 final int port; | 102 final int port; |
| 103 | 103 |
| 104 /// Host name or address for HTTP server when [serverMode] is on. | 104 /// Host name or address for HTTP server when [serverMode] is on. |
| 105 final String host; | 105 final String host; |
| 106 | 106 |
| 107 /// Location for runtime files, such as `dart_runtime.js`. By default this is | 107 /// Location for runtime files, such as `dart_runtime.js`. By default this is |
| 108 /// inferred to be under `lib/runtime/` in the location of the `dev_compiler` | 108 /// inferred to be under `lib/runtime/` in the location of the `dev_compiler` |
| 109 /// package (if we can infer where that is located). | 109 /// package (if we can infer where that is located). |
| 110 final String runtimeDir; | 110 final String runtimeDir; |
| 111 | 111 |
| 112 /// The files to compile. |
| 112 final List<String> inputs; | 113 final List<String> inputs; |
| 113 | 114 |
| 115 /// The base directory for [inputs]. Module imports will be generated relative |
| 116 /// to this directory. |
| 117 final String inputBaseDir; |
| 118 |
| 114 CompilerOptions({this.strongOptions: const StrongModeOptions(), | 119 CompilerOptions({this.strongOptions: const StrongModeOptions(), |
| 115 this.sourceOptions: const SourceResolverOptions(), | 120 this.sourceOptions: const SourceResolverOptions(), |
| 116 this.codegenOptions: const CodegenOptions(), this.checkSdk: false, | 121 this.codegenOptions: const CodegenOptions(), this.checkSdk: false, |
| 117 this.dumpInfo: false, this.dumpInfoFile, this.useColors: true, | 122 this.dumpInfo: false, this.dumpInfoFile, this.useColors: true, |
| 118 this.help: false, this.logLevel: Level.SEVERE, this.serverMode: false, | 123 this.help: false, this.logLevel: Level.SEVERE, this.serverMode: false, |
| 119 this.enableHashing: false, this.widget: true, this.host: 'localhost', | 124 this.enableHashing: false, this.widget: true, this.host: 'localhost', |
| 120 this.port: 8080, this.runtimeDir, this.inputs}); | 125 this.port: 8080, this.runtimeDir, this.inputs, this.inputBaseDir}); |
| 121 } | 126 } |
| 122 | 127 |
| 123 /// Parses options from the command-line | 128 /// Parses options from the command-line |
| 124 CompilerOptions parseOptions(List<String> argv) { | 129 CompilerOptions parseOptions(List<String> argv) { |
| 125 ArgResults args = argParser.parse(argv); | 130 ArgResults args = argParser.parse(argv); |
| 126 bool showUsage = args['help']; | 131 bool showUsage = args['help']; |
| 127 | 132 |
| 128 var serverMode = args['server']; | 133 var serverMode = args['server']; |
| 129 var enableHashing = args['hashing']; | 134 var enableHashing = args['hashing']; |
| 130 if (enableHashing == null) { | 135 if (enableHashing == null) { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 // The pub-cache directory is two levels up, but we verify that the layout | 306 // The pub-cache directory is two levels up, but we verify that the layout |
| 302 // looks correct. | 307 // looks correct. |
| 303 if (path.basename(dir) != 'dev_compiler') return null; | 308 if (path.basename(dir) != 'dev_compiler') return null; |
| 304 dir = path.dirname(dir); | 309 dir = path.dirname(dir); |
| 305 if (path.basename(dir) != 'global_packages') return null; | 310 if (path.basename(dir) != 'global_packages') return null; |
| 306 dir = path.dirname(dir); | 311 dir = path.dirname(dir); |
| 307 return path.join(dir, cacheDir, 'lib', 'runtime'); | 312 return path.join(dir, cacheDir, 'lib', 'runtime'); |
| 308 } | 313 } |
| 309 return null; | 314 return null; |
| 310 } | 315 } |
| OLD | NEW |