| 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 library pub.command.build; | 5 library pub.command.build; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:barback/barback.dart'; | 9 import 'package:barback/barback.dart'; |
| 10 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 Future onRun() { | 45 Future onRun() { |
| 46 if (!dirExists(source)) { | 46 if (!dirExists(source)) { |
| 47 throw new ApplicationException('There is no "$source" directory.'); | 47 throw new ApplicationException('There is no "$source" directory.'); |
| 48 } | 48 } |
| 49 | 49 |
| 50 cleanDir(target); | 50 cleanDir(target); |
| 51 | 51 |
| 52 var dart2jsTransformer; | 52 var dart2jsTransformer; |
| 53 var builtFiles = 0; | 53 var builtFiles = 0; |
| 54 | 54 |
| 55 return entrypoint.ensureLockFileIsUpToDate().then((_) { | 55 return entrypoint.loadPackageGraph().then((graph) { |
| 56 return entrypoint.loadPackageGraph(); | |
| 57 }).then((graph) { | |
| 58 dart2jsTransformer = new Dart2JSTransformer(graph, mode); | 56 dart2jsTransformer = new Dart2JSTransformer(graph, mode); |
| 59 var builtInTransformers = [ | 57 var builtInTransformers = [ |
| 60 dart2jsTransformer, | 58 dart2jsTransformer, |
| 61 new DartForwardingTransformer(mode) | 59 new DartForwardingTransformer(mode) |
| 62 ]; | 60 ]; |
| 63 | 61 |
| 64 // Since this server will only be hit by the transformer loader and isn't | 62 // Since this server will only be hit by the transformer loader and isn't |
| 65 // user-facing, just use an IPv4 address to avoid a weird bug on the | 63 // user-facing, just use an IPv4 address to avoid a weird bug on the |
| 66 // OS X buildbots. | 64 // OS X buildbots. |
| 67 // TODO(rnystrom): Allow specifying mode. | 65 // TODO(rnystrom): Allow specifying mode. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // TODO(nweiz): do something more principled when issue 6101 is fixed. | 145 // TODO(nweiz): do something more principled when issue 6101 is fixed. |
| 148 /// Ensures that the [name].js file is copied into [directory] in [target], | 146 /// Ensures that the [name].js file is copied into [directory] in [target], |
| 149 /// under `packages/browser/`. | 147 /// under `packages/browser/`. |
| 150 void _addBrowserJs(String directory, String name) { | 148 void _addBrowserJs(String directory, String name) { |
| 151 var jsPath = path.join( | 149 var jsPath = path.join( |
| 152 target, directory, 'packages', 'browser', '$name.js'); | 150 target, directory, 'packages', 'browser', '$name.js'); |
| 153 ensureDir(path.dirname(jsPath)); | 151 ensureDir(path.dirname(jsPath)); |
| 154 copyFile(path.join(entrypoint.packagesDir, 'browser', '$name.js'), jsPath); | 152 copyFile(path.join(entrypoint.packagesDir, 'browser', '$name.js'), jsPath); |
| 155 } | 153 } |
| 156 } | 154 } |
| OLD | NEW |