| 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 | 6 |
| 7 import 'package:barback/barback.dart'; | 7 import 'package:barback/barback.dart'; |
| 8 import 'package:path/path.dart' as path; | 8 import 'package:path/path.dart' as path; |
| 9 | 9 |
| 10 import '../barback/asset_environment.dart'; | 10 import '../barback/asset_environment.dart'; |
| 11 import '../exit_codes.dart' as exit_codes; | 11 import '../exit_codes.dart' as exit_codes; |
| 12 import '../io.dart'; | 12 import '../io.dart'; |
| 13 import '../log.dart' as log; | 13 import '../log.dart' as log; |
| 14 import '../source/hosted.dart'; |
| 14 import '../utils.dart'; | 15 import '../utils.dart'; |
| 15 import 'barback.dart'; | 16 import 'barback.dart'; |
| 16 | 17 |
| 17 final _arrow = getSpecial('\u2192', '=>'); | 18 final _arrow = getSpecial('\u2192', '=>'); |
| 18 | 19 |
| 19 /// Handles the `build` pub command. | 20 /// Handles the `build` pub command. |
| 20 class BuildCommand extends BarbackCommand { | 21 class BuildCommand extends BarbackCommand { |
| 21 String get name => "build"; | 22 String get name => "build"; |
| 22 String get description => "Apply transformers to build a package."; | 23 String get description => "Apply transformers to build a package."; |
| 23 String get invocation => "pub build [options] [directories...]"; | 24 String get invocation => "pub build [options] [directories...]"; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 ensureDir(path.dirname(destPath)); | 196 ensureDir(path.dirname(destPath)); |
| 196 return createFileFromStream(asset.read(), destPath); | 197 return createFileFromStream(asset.read(), destPath); |
| 197 } | 198 } |
| 198 | 199 |
| 199 /// If this package depends directly on the `browser` package, this ensures | 200 /// If this package depends directly on the `browser` package, this ensures |
| 200 /// that the JavaScript bootstrap files are copied into `packages/browser/` | 201 /// that the JavaScript bootstrap files are copied into `packages/browser/` |
| 201 /// directories next to each entrypoint in [entrypoints]. | 202 /// directories next to each entrypoint in [entrypoints]. |
| 202 Future _copyBrowserJsFiles(Iterable<AssetId> entrypoints, AssetSet assets) { | 203 Future _copyBrowserJsFiles(Iterable<AssetId> entrypoints, AssetSet assets) { |
| 203 // Must depend on the browser package. | 204 // Must depend on the browser package. |
| 204 if (!entrypoint.root.immediateDependencies.any( | 205 if (!entrypoint.root.immediateDependencies.any( |
| 205 (dep) => dep.name == 'browser' && dep.source == 'hosted')) { | 206 (dep) => dep.name == 'browser' && dep.source is HostedSource)) { |
| 206 return new Future.value(); | 207 return new Future.value(); |
| 207 } | 208 } |
| 208 | 209 |
| 209 // Get all of the subdirectories that contain Dart entrypoints. | 210 // Get all of the subdirectories that contain Dart entrypoints. |
| 210 var entrypointDirs = entrypoints | 211 var entrypointDirs = entrypoints |
| 211 // Convert the asset path to a native-separated one and get the | 212 // Convert the asset path to a native-separated one and get the |
| 212 // directory containing the entrypoint. | 213 // directory containing the entrypoint. |
| 213 .map((id) => path.dirname(path.fromUri(id.path))) | 214 .map((id) => path.dirname(path.fromUri(id.path))) |
| 214 // Don't copy files to the top levels of the build directories since | 215 // Don't copy files to the top levels of the build directories since |
| 215 // the normal lib asset copying will take care of that. | 216 // the normal lib asset copying will take care of that. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 "end": { | 258 "end": { |
| 258 "line": entry.span.end.line, | 259 "line": entry.span.end.line, |
| 259 "column": entry.span.end.column | 260 "column": entry.span.end.column |
| 260 }, | 261 }, |
| 261 }; | 262 }; |
| 262 } | 263 } |
| 263 | 264 |
| 264 return data; | 265 return data; |
| 265 } | 266 } |
| 266 } | 267 } |
| OLD | NEW |