| 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 library pub.barback.asset_environment; | 5 library pub.barback.asset_environment; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:barback/barback.dart'; | 10 import 'package:barback/barback.dart'; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 static Future<AssetEnvironment> create(Entrypoint entrypoint, | 67 static Future<AssetEnvironment> create(Entrypoint entrypoint, |
| 68 BarbackMode mode, {WatcherType watcherType, String hostname, int basePort, | 68 BarbackMode mode, {WatcherType watcherType, String hostname, int basePort, |
| 69 Iterable<String> packages, Iterable<AssetId> entrypoints, | 69 Iterable<String> packages, Iterable<AssetId> entrypoints, |
| 70 Map<String, String> environmentConstants, bool useDart2JS: true}) { | 70 Map<String, String> environmentConstants, bool useDart2JS: true}) { |
| 71 if (watcherType == null) watcherType = WatcherType.NONE; | 71 if (watcherType == null) watcherType = WatcherType.NONE; |
| 72 if (hostname == null) hostname = "localhost"; | 72 if (hostname == null) hostname = "localhost"; |
| 73 if (basePort == null) basePort = 0; | 73 if (basePort == null) basePort = 0; |
| 74 if (environmentConstants == null) environmentConstants = {}; | 74 if (environmentConstants == null) environmentConstants = {}; |
| 75 | 75 |
| 76 return log.progress("Loading asset environment", () async { | 76 return log.progress("Loading asset environment", () async { |
| 77 var graph = await entrypoint.loadPackageGraph(); | 77 var graph = _adjustPackageGraph(entrypoint.packageGraph, mode, packages); |
| 78 graph = _adjustPackageGraph(graph, mode, packages); | |
| 79 var barback = new Barback(new PubPackageProvider(graph)); | 78 var barback = new Barback(new PubPackageProvider(graph)); |
| 80 barback.log.listen(_log); | 79 barback.log.listen(_log); |
| 81 | 80 |
| 82 var environment = new AssetEnvironment._(graph, barback, mode, | 81 var environment = new AssetEnvironment._(graph, barback, mode, |
| 83 watcherType, hostname, basePort, environmentConstants); | 82 watcherType, hostname, basePort, environmentConstants); |
| 84 | 83 |
| 85 await environment._load(entrypoints: entrypoints, useDart2JS: useDart2JS); | 84 await environment._load(entrypoints: entrypoints, useDart2JS: useDart2JS); |
| 86 return environment; | 85 return environment; |
| 87 }, fine: true); | 86 }, fine: true); |
| 88 } | 87 } |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 String toString() => "polling"; | 789 String toString() => "polling"; |
| 791 } | 790 } |
| 792 | 791 |
| 793 class _NoneWatcherType implements WatcherType { | 792 class _NoneWatcherType implements WatcherType { |
| 794 const _NoneWatcherType(); | 793 const _NoneWatcherType(); |
| 795 | 794 |
| 796 DirectoryWatcher create(String directory) => null; | 795 DirectoryWatcher create(String directory) => null; |
| 797 | 796 |
| 798 String toString() => "none"; | 797 String toString() => "none"; |
| 799 } | 798 } |
| OLD | NEW |