Chromium Code Reviews| 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 /** | 5 /** |
| 6 * Definitions used to run the polymer linter and deploy tools without using | 6 * Definitions used to run the polymer linter and deploy tools without using |
| 7 * pub serve or pub deploy. | 7 * pub serve or pub deploy. |
| 8 */ | 8 */ |
| 9 library polymer.src.barback_runner; | 9 library polymer.src.barback_runner; |
| 10 | 10 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 var currentPackage = options.currentPackage; | 232 var currentPackage = options.currentPackage; |
| 233 for (var asset in assets) { | 233 for (var asset in assets) { |
| 234 var id = asset.id; | 234 var id = asset.id; |
| 235 if (id.package != currentPackage) continue; | 235 if (id.package != currentPackage) continue; |
| 236 var firstDir = _firstDir(id.path); | 236 var firstDir = _firstDir(id.path); |
| 237 if (firstDir == null) continue; | 237 if (firstDir == null) continue; |
| 238 | 238 |
| 239 if (firstDir == 'web' || (options.transformTests && firstDir == 'test')) { | 239 if (firstDir == 'web' || (options.transformTests && firstDir == 'test')) { |
| 240 var dir = path.join(options.outDir, path.dirname(id.path)); | 240 var dir = path.join(options.outDir, path.dirname(id.path)); |
| 241 var linkPath = path.join(dir, 'packages'); | 241 var linkPath = path.join(dir, 'packages'); |
| 242 var targetPath = path.relative(outPackages, from: dir); | |
| 243 _deleteIfPresent(linkPath); | 242 _deleteIfPresent(linkPath); |
| 243 var targetPath = Platform.operatingSystem == 'windows' | |
|
Jennifer Messerly
2013/09/12 19:32:00
is this a pathos bug or a dart:io bug?
(we should
Jennifer Messerly
2013/09/12 19:38:08
suggestion: remove the == 'windows' check and make
| |
| 244 ? path.normalize(path.absolute(outPackages)) | |
| 245 : path.normalize(path.relative(outPackages, from: dir)); | |
| 244 new Link(linkPath).createSync(targetPath); | 246 new Link(linkPath).createSync(targetPath); |
| 245 } | 247 } |
| 246 } | 248 } |
| 247 } | 249 } |
| 248 | 250 |
| 249 /** | 251 /** |
| 250 * Emits a 'packages' directory directly under `out/packages` with the contents | 252 * Emits a 'packages' directory directly under `out/packages` with the contents |
| 251 * of every file that was not transformed by barback. | 253 * of every file that was not transformed by barback. |
| 252 */ | 254 */ |
| 253 Future _emitPackagesDir(BarbackOptions options) { | 255 Future _emitPackagesDir(BarbackOptions options) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 317 return writer.addStream(new File(inpath).openRead()) | 319 return writer.addStream(new File(inpath).openRead()) |
| 318 .then((_) => writer.close()); | 320 .then((_) => writer.close()); |
| 319 } | 321 } |
| 320 | 322 |
| 321 /** Write contents of an [asset] into a file at [filepath]. */ | 323 /** Write contents of an [asset] into a file at [filepath]. */ |
| 322 Future _writeAsset(String filepath, Asset asset) { | 324 Future _writeAsset(String filepath, Asset asset) { |
| 323 _ensureDir(path.dirname(filepath)); | 325 _ensureDir(path.dirname(filepath)); |
| 324 var writer = new File(filepath).openWrite(); | 326 var writer = new File(filepath).openWrite(); |
| 325 return writer.addStream(asset.read()).then((_) => writer.close()); | 327 return writer.addStream(asset.read()).then((_) => writer.close()); |
| 326 } | 328 } |
| OLD | NEW |