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

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/barback_server.dart

Issue 228863003: Warn when serving an asset from "asset". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo. Created 6 years, 8 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 | sdk/lib/_internal/pub/test/serve/warns_on_serve_from_asset_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/barback/barback_server.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/barback_server.dart b/sdk/lib/_internal/pub/lib/src/barback/barback_server.dart
index 611d62ff1931fc51a014003636d0b910dc222f19..954658b600eb797c3360b84674d77538fd9b4ca5 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/barback_server.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/barback_server.dart
@@ -117,6 +117,25 @@ class BarbackServer extends BaseServer<BarbackServerResult> {
return;
}
+ // TODO(rnystrom): Remove this when #16647 is fixed.
+ // The "assets" path is deprecated so warn if the user is relying on it.
+ // We do this here in pub serve so we only warn if they in fact actually
+ // use an asset from a package's "asset" directory.
+ if (id.path.startsWith("asset/")) {
+ var message = 'Warning: Support for the "asset" directory is deprecated '
+ 'and will be removed soon.\n';
+
+ var fixed = id.path.replaceAll(new RegExp(r"^asset/"), "lib/");
+ if (id.package == environment.rootPackage.name) {
+ message += 'Please move "${id.path}" to "$fixed".';
+ } else {
+ message += 'Please ask the maintainer of "${id.package}" to move '
+ '"${id.path}" to "$fixed".';
+ }
+
+ log.warning(log.yellow(message));
+ }
+
logRequest(request, "Loading $id");
environment.barback.getAssetById(id).then((result) {
logRequest(request, "getAssetById($id) returned");
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/serve/warns_on_serve_from_asset_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698