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

Side by Side Diff: dart/sdk/lib/_internal/pub/lib/src/barback/transformer_cache.dart

Issue 651483004: Version 1.7.2 (Closed) Base URL: http://dart.googlecode.com/svn/branches/1.7/
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/pub/test/transformer/cache_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.barback.transformer_cache; 5 library pub.barback.transformer_cache;
6 6
7 import 'package:path/path.dart' as p; 7 import 'package:path/path.dart' as p;
8 8
9 import '../io.dart'; 9 import '../io.dart';
10 import '../log.dart' as log; 10 import '../log.dart' as log;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 /// This may modify the cache. 49 /// This may modify the cache.
50 TransformerCache.load(PackageGraph graph) 50 TransformerCache.load(PackageGraph graph)
51 : _graph = graph, 51 : _graph = graph,
52 _dir = graph.entrypoint.root.path(".pub/transformers") { 52 _dir = graph.entrypoint.root.path(".pub/transformers") {
53 _oldTransformers = _parseManifest(); 53 _oldTransformers = _parseManifest();
54 } 54 }
55 55
56 /// Clear the cache if it depends on any package in [changedPackages]. 56 /// Clear the cache if it depends on any package in [changedPackages].
57 void clearIfOutdated(Set<String> changedPackages) { 57 void clearIfOutdated(Set<String> changedPackages) {
58 var snapshotDependencies = unionAll(_oldTransformers.map((id) { 58 var snapshotDependencies = unionAll(_oldTransformers.map((id) {
59 // If the transformer cache contains transformers we don't know about,
60 // that's fine; we just won't load them.
61 if (!_graph.packages.containsKey(id.package)) return new Set();
62
59 return _graph.transitiveDependencies(id.package) 63 return _graph.transitiveDependencies(id.package)
60 .map((package) => package.name).toSet(); 64 .map((package) => package.name).toSet();
61 })); 65 }));
62 66
63 // If none of the snapshot's dependencies have changed, then we can reuse 67 // If none of the snapshot's dependencies have changed, then we can reuse
64 // it. 68 // it.
65 if (!overlaps(changedPackages, snapshotDependencies)) return; 69 if (!overlaps(changedPackages, snapshotDependencies)) return;
66 70
67 // Otherwise, delete it. 71 // Otherwise, delete it.
68 deleteEntry(_dir); 72 deleteEntry(_dir);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 return new Set(); 135 return new Set();
132 } 136 }
133 137
134 /// The second line of the manifest is a list of transformer ids used to 138 /// The second line of the manifest is a list of transformer ids used to
135 /// create the existing snapshot. 139 /// create the existing snapshot.
136 return manifest.single.split(",") 140 return manifest.single.split(",")
137 .map((id) => new TransformerId.parse(id, null)) 141 .map((id) => new TransformerId.parse(id, null))
138 .toSet(); 142 .toSet();
139 } 143 }
140 } 144 }
OLDNEW
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/pub/test/transformer/cache_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698