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

Unified Diff: sdk/lib/_internal/pub/lib/src/package_graph.dart

Issue 597773003: Have barback lazily load assets from static pub packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
Index: sdk/lib/_internal/pub/lib/src/package_graph.dart
diff --git a/sdk/lib/_internal/pub/lib/src/package_graph.dart b/sdk/lib/_internal/pub/lib/src/package_graph.dart
index f7914a8e5eb67f03169d9fea679ae9db5dd52249..a66872bb1474486797092fb24c9ef9358cf2f2ce 100644
--- a/sdk/lib/_internal/pub/lib/src/package_graph.dart
+++ b/sdk/lib/_internal/pub/lib/src/package_graph.dart
@@ -95,4 +95,22 @@ class PackageGraph {
return entrypoint.cache.sources[depId.source] is! CachedSource;
});
}
+
+ /// Returns whether [package] is static.
+ ///
+ /// A package is considered to be static if it's not transformed and it came
+ /// from a cached source. Static packages don't need to be fully processed by
+ /// barback.
+ ///
+ /// Note that a static package isn't the same as an immutable package (see
+ /// [isPackageMutable]).
+ bool isPackageStatic(String package) {
+ var id = lockFile.packages[package];
+ if (id == null) return false;
+
+ var source = entrypoint.cache.sources[id.source];
+ if (source is! CachedSource) return true;
+
+ return packages[package].pubspec.transformers.isEmpty;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698