Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(825)

Unified Diff: pkg/polymer/lib/src/build/runner.dart

Issue 26071003: Switch to copy files synchronously (address the too-many-open-files bug) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/src/build/runner.dart
diff --git a/pkg/polymer/lib/src/build/runner.dart b/pkg/polymer/lib/src/build/runner.dart
index 3596e923b440365a16655b2b2b44b4803fc339fc..ca05ae809f4cbb097fbd09878a7ca689509ae7f3 100644
--- a/pkg/polymer/lib/src/build/runner.dart
+++ b/pkg/polymer/lib/src/build/runner.dart
@@ -197,8 +197,8 @@ Future _emitAllFiles(Barback barback, BarbackOptions options) {
// Delete existing output folder before we generate anything
var dir = new Directory(options.outDir);
if (dir.existsSync()) dir.deleteSync(recursive: true);
- return _emitPackagesDir(options)
- .then((_) => _emitTransformedFiles(assets, options))
+ _emitPackagesDir(options);
+ return _emitTransformedFiles(assets, options)
.then((_) => _addPackagesSymlinks(assets, options))
.then((_) => assets);
});
@@ -265,22 +265,20 @@ Future _addPackagesSymlinks(AssetSet assets, BarbackOptions options) {
* Emits a 'packages' directory directly under `out/packages` with the contents
* of every file that was not transformed by barback.
*/
-Future _emitPackagesDir(BarbackOptions options) {
- if (options.transformPolymerDependencies) return new Future.value(null);
+void _emitPackagesDir(BarbackOptions options) {
+ if (options.transformPolymerDependencies) return;
var outPackages = path.join(options.outDir, 'packages');
_ensureDir(outPackages);
// Copy all the files we didn't process
- var futures = [];
var dirs = options.packageDirs;
for (var package in _polymerPackageDependencies) {
for (var relpath in _listPackageDir(package, 'lib', options)) {
var inpath = path.join(dirs[package], relpath);
var outpath = path.join(outPackages, package, relpath.substring(4));
- futures.add(_copyFile(inpath, outpath));
kevmoo-old 2013/10/05 04:23:12 Could this be the problem? We're adding a bunch of
Jennifer Messerly 2013/10/05 05:23:26 Sure, but then you're running them all serially. H
Søren Gjesse 2013/10/07 06:40:27 With async primitives you have the ability to easi
+ _copyFileSync(inpath, outpath);
}
}
- return Future.wait(futures);
}
/** Ensure [dirpath] exists. */
@@ -299,11 +297,9 @@ String _firstDir(String url) {
}
/** Copy a file from [inpath] to [outpath]. */
-Future _copyFile(String inpath, String outpath) {
+void _copyFileSync(String inpath, String outpath) {
_ensureDir(path.dirname(outpath));
- var writer = new File(outpath).openWrite();
- return writer.addStream(new File(inpath).openRead())
- .then((_) => writer.close());
+ new File(outpath).writeAsBytesSync(new File(inpath).readAsBytesSync());
}
/** Write contents of an [asset] into a file at [filepath]. */
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698