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

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/barback/pub_package_provider.dart

Issue 557563002: Store the async-await compiled pub code directly in the repo. (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_generated/lib/src/barback/pub_package_provider.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/pub_package_provider.dart b/sdk/lib/_internal/pub_generated/lib/src/barback/pub_package_provider.dart
similarity index 53%
copy from sdk/lib/_internal/pub/lib/src/barback/pub_package_provider.dart
copy to sdk/lib/_internal/pub_generated/lib/src/barback/pub_package_provider.dart
index 36ec86594aac6f6093217fd7971613e8156d15dd..52250d472f6a26aeaff4aeb1c84e175a77c331dc 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/pub_package_provider.dart
+++ b/sdk/lib/_internal/pub_generated/lib/src/barback/pub_package_provider.dart
@@ -1,71 +1,43 @@
-// 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 pub.pub_package_provider;
-
import 'dart:async';
-
import 'package:barback/barback.dart';
import 'package:path/path.dart' as path;
-
import '../io.dart';
import '../package_graph.dart';
import '../preprocess.dart';
import '../sdk.dart' as sdk;
import '../utils.dart';
-
-/// An implementation of barback's [PackageProvider] interface so that barback
-/// can find assets within pub packages.
class PubPackageProvider implements PackageProvider {
final PackageGraph _graph;
final List<String> packages;
-
PubPackageProvider(PackageGraph graph, [Iterable<String> packages])
: _graph = graph,
- packages = [r"$pub", r"$sdk"]
- ..addAll(packages == null ? graph.packages.keys : packages);
-
+ packages = [
+ r"$pub",
+ r"$sdk"]..addAll(packages == null ? graph.packages.keys : packages);
Future<Asset> getAsset(AssetId id) {
- // "$pub" is a psuedo-package that allows pub's transformer-loading
- // infrastructure to share code with pub proper.
if (id.package == r'$pub') {
var components = path.url.split(id.path);
assert(components.isNotEmpty);
assert(components.first == 'lib');
components[0] = 'dart';
var file = assetPath(path.joinAll(components));
-
- // Barback may not be in the package graph if there are no user-defined
- // transformers being used at all. The "$pub" sources are still provided,
- // but will never be loaded.
if (!_graph.packages.containsKey("barback")) {
return new Future.value(new Asset.fromPath(id, file));
}
-
- var versions = mapMap(_graph.packages,
- value: (_, package) => package.version);
+ var versions =
+ mapMap(_graph.packages, value: (_, package) => package.version);
var contents = readTextFile(file);
contents = preprocess(contents, versions, path.toUri(file));
return new Future.value(new Asset.fromString(id, contents));
}
-
- // "$sdk" is a pseudo-package that provides access to the Dart library
- // sources in the SDK. The dart2js transformer uses this to locate the Dart
- // sources for "dart:" libraries.
if (id.package == r'$sdk') {
- // The asset path contains two "lib" entries. The first represent's pub's
- // concept that all public assets are in "lib". The second comes from the
- // organization of the SDK itself. Strip off the first. Leave the second
- // since dart2js adds it and expects it to be there.
var parts = path.split(path.fromUri(id.path));
assert(parts.isNotEmpty && parts[0] == 'lib');
parts = parts.skip(1);
-
var file = path.join(sdk.rootDirectory, path.joinAll(parts));
return new Future.value(new Asset.fromPath(id, file));
}
-
var nativePath = path.fromUri(id.path);
var file = path.join(_graph.packages[id.package].dir, nativePath);
return new Future.value(new Asset.fromPath(id, file));

Powered by Google App Engine
This is Rietveld 408576698