OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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:async'; | 5 import 'dart:async'; |
6 import 'dart:math' as math; | 6 import 'dart:math' as math; |
7 | 7 |
8 import 'package:barback/barback.dart'; | 8 import 'package:barback/barback.dart'; |
9 | 9 |
10 import '../barback/asset_environment.dart'; | 10 import '../barback/asset_environment.dart'; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 Future onRunTransformerCommand() async { | 81 Future onRunTransformerCommand() async { |
82 var port = parseInt(argResults['port'], 'port'); | 82 var port = parseInt(argResults['port'], 'port'); |
83 var adminPort = argResults['admin-port'] == null ? null : | 83 var adminPort = argResults['admin-port'] == null ? null : |
84 parseInt(argResults['admin-port'], 'admin port'); | 84 parseInt(argResults['admin-port'], 'admin port'); |
85 | 85 |
86 var watcherType = argResults['force-poll'] ? | 86 var watcherType = argResults['force-poll'] ? |
87 WatcherType.POLLING : WatcherType.AUTO; | 87 WatcherType.POLLING : WatcherType.AUTO; |
88 | 88 |
89 var environmentConstants = new Map.fromIterable(argResults["define"], | 89 var environmentConstants = new Map<String, String>.fromIterable( |
| 90 argResults["define"], |
90 key: (pair) => pair.split("=").first, | 91 key: (pair) => pair.split("=").first, |
91 value: (pair) => pair.split("=").last); | 92 value: (pair) => pair.split("=").last); |
92 | 93 |
93 var environment = await AssetEnvironment.create(entrypoint, mode, | 94 var environment = await AssetEnvironment.create(entrypoint, mode, |
94 watcherType: watcherType, hostname: hostname, basePort: port, | 95 watcherType: watcherType, hostname: hostname, basePort: port, |
95 useDart2JS: useDart2JS, environmentConstants: environmentConstants); | 96 useDart2JS: useDart2JS, environmentConstants: environmentConstants); |
96 var directoryLength = sourceDirectories.map((dir) => dir.length) | 97 var directoryLength = sourceDirectories.map((dir) => dir.length) |
97 .reduce(math.max); | 98 .reduce(math.max); |
98 | 99 |
99 if (adminPort != null) { | 100 if (adminPort != null) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 "${padRight(server.rootDirectory, directoryLength)} " | 179 "${padRight(server.rootDirectory, directoryLength)} " |
179 "on ${log.bold('http://$hostname:${server.port}')}"); | 180 "on ${log.bold('http://$hostname:${server.port}')}"); |
180 } | 181 } |
181 | 182 |
182 /// Reports [error] and exits the server. | 183 /// Reports [error] and exits the server. |
183 void _fatalError(error, [stackTrace]) { | 184 void _fatalError(error, [stackTrace]) { |
184 if (_completer.isCompleted) return; | 185 if (_completer.isCompleted) return; |
185 _completer.completeError(error, stackTrace); | 186 _completer.completeError(error, stackTrace); |
186 } | 187 } |
187 } | 188 } |
OLD | NEW |