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 276 matching lines...) Loading... |
287 // Must depend on the browser package. | 287 // Must depend on the browser package. |
288 if (!entrypoint.root.immediateDependencies.any( | 288 if (!entrypoint.root.immediateDependencies.any( |
289 (dep) => dep.name == 'browser' && dep.source == 'hosted')) { | 289 (dep) => dep.name == 'browser' && dep.source == 'hosted')) { |
290 return 0; | 290 return 0; |
291 } | 291 } |
292 | 292 |
293 // Get all of the subdirectories that contain Dart entrypoints. | 293 // Get all of the subdirectories that contain Dart entrypoints. |
294 var entrypointDirs = entrypoints | 294 var entrypointDirs = entrypoints |
295 // Convert the asset path to a native-separated one and get the | 295 // Convert the asset path to a native-separated one and get the |
296 // directory containing the entrypoint. | 296 // directory containing the entrypoint. |
297 .map((id) => path.dirname(path.joinAll(path.url.split(id.path)))) | 297 .map((id) => path.dirname(path.fromUri(id.path))) |
298 // Don't copy files to the top levels of the build directories since | 298 // Don't copy files to the top levels of the build directories since |
299 // the normal lib asset copying will take care of that. | 299 // the normal lib asset copying will take care of that. |
300 .where((dir) => dir.contains(path.separator)) | 300 .where((dir) => dir.contains(path.separator)) |
301 .toSet(); | 301 .toSet(); |
302 | 302 |
303 for (var dir in entrypointDirs) { | 303 for (var dir in entrypointDirs) { |
304 // TODO(nweiz): we should put browser JS files next to any HTML file | 304 // TODO(nweiz): we should put browser JS files next to any HTML file |
305 // rather than any entrypoint. An HTML file could import an entrypoint | 305 // rather than any entrypoint. An HTML file could import an entrypoint |
306 // that's not adjacent. | 306 // that's not adjacent. |
307 _addBrowserJs(dir, "dart"); | 307 _addBrowserJs(dir, "dart"); |
(...skipping 45 matching lines...) Loading... |
353 "end": { | 353 "end": { |
354 "line": entry.span.end.line, | 354 "line": entry.span.end.line, |
355 "column": entry.span.end.column | 355 "column": entry.span.end.column |
356 }, | 356 }, |
357 }; | 357 }; |
358 } | 358 } |
359 | 359 |
360 return data; | 360 return data; |
361 } | 361 } |
362 } | 362 } |
OLD | NEW |