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

Unified Diff: mojo/public/dart/third_party/barback/lib/src/package_provider.dart

Issue 1346773002: Stop running pub get at gclient sync time and fix build bugs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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: mojo/public/dart/third_party/barback/lib/src/package_provider.dart
diff --git a/mojo/public/dart/third_party/barback/lib/src/package_provider.dart b/mojo/public/dart/third_party/barback/lib/src/package_provider.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ce6ee23355e7f5882a88d3d515b2a61057772665
--- /dev/null
+++ b/mojo/public/dart/third_party/barback/lib/src/package_provider.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library barback.package_provider;
+
+import 'dart:async';
+
+import 'asset/asset.dart';
+import 'asset/asset_id.dart';
+
+/// API for locating and accessing packages on disk.
+///
+/// Implemented by pub and provided to barback so that it isn't coupled
+/// directly to pub.
+abstract class PackageProvider {
+ /// The names of all packages that can be provided by this provider.
+ ///
+ /// This is equal to the transitive closure of the entrypoint package
+ /// dependencies.
+ Iterable<String> get packages;
+
+ /// Loads an asset from disk.
+ ///
+ /// This should be re-entrant; it may be called multiple times with the same
+ /// id before the previously returned future has completed.
+ ///
+ /// If no asset with [id] exists, the provider should throw an
+ /// [AssetNotFoundException].
+ Future<Asset> getAsset(AssetId id);
+}
+
+/// A PackageProvider for which some packages are known to be static—that is,
+/// the package has no transformers and its assets won't ever change.
+///
+/// For static packages, rather than telling barback up-front which assets that
+/// package contains via [Barback.updateSources], barback will lazily query the
+/// provider for an asset when it's needed. This is much more efficient.
+abstract class StaticPackageProvider implements PackageProvider {
+ /// The names of all static packages provided by this provider.
+ ///
+ /// This must be disjoint from [packages].
+ Iterable<String> get staticPackages;
+
+ /// Returns all ids of assets in [package].
+ ///
+ /// This is used for [Barback.getAllAssets].
+ Stream<AssetId> getAllAssetIds(String package);
+}
« no previous file with comments | « mojo/public/dart/third_party/barback/lib/src/log.dart ('k') | mojo/public/dart/third_party/barback/lib/src/serialize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698