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

Side by Side Diff: pkg/polymer/lib/src/build/common.dart

Issue 50073007: fix barback and polymer build warnings (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 /** Common methods used by transfomers. */ 5 /** Common methods used by transfomers. */
6 library polymer.src.build.common; 6 library polymer.src.build.common;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 9
10 import 'package:barback/barback.dart'; 10 import 'package:barback/barback.dart';
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 transform.getInput(id).then((_) => true).catchError((_) => false); 108 transform.getInput(id).then((_) => true).catchError((_) => false);
109 } 109 }
110 110
111 /** Create an [AssetId] for a [url] seen in the [source] asset. */ 111 /** Create an [AssetId] for a [url] seen in the [source] asset. */
112 // TODO(sigmund): delete once this is part of barback (dartbug.com/12610) 112 // TODO(sigmund): delete once this is part of barback (dartbug.com/12610)
113 AssetId resolve(AssetId source, String url, TransformLogger logger, Span span) { 113 AssetId resolve(AssetId source, String url, TransformLogger logger, Span span) {
114 if (url == null || url == '') return null; 114 if (url == null || url == '') return null;
115 var uri = Uri.parse(url); 115 var uri = Uri.parse(url);
116 var urlBuilder = path.url; 116 var urlBuilder = path.url;
117 if (uri.host != '' || uri.scheme != '' || urlBuilder.isAbsolute(url)) { 117 if (uri.host != '' || uri.scheme != '' || urlBuilder.isAbsolute(url)) {
118 logger.error('absolute paths not allowed: "$url"', span); 118 logger.error('absolute paths not allowed: "$url"', span: span);
119 return null; 119 return null;
120 } 120 }
121 121
122 var package; 122 var package;
123 var targetPath; 123 var targetPath;
124 var segments = urlBuilder.split(url); 124 var segments = urlBuilder.split(url);
125 if (segments[0] == 'packages') { 125 if (segments[0] == 'packages') {
126 if (segments.length < 3) { 126 if (segments.length < 3) {
127 logger.error("incomplete packages/ path. It should have at least 3 " 127 logger.error("incomplete packages/ path. It should have at least 3 "
128 "segments packages/name/path-from-name's-lib-dir", span); 128 "segments packages/name/path-from-name's-lib-dir", span: span);
129 return null; 129 return null;
130 } 130 }
131 package = segments[1]; 131 package = segments[1];
132 targetPath = urlBuilder.join('lib', 132 targetPath = urlBuilder.join('lib',
133 urlBuilder.joinAll(segments.sublist(2))); 133 urlBuilder.joinAll(segments.sublist(2)));
134 } else if (segments[0] == 'assets') { 134 } else if (segments[0] == 'assets') {
135 if (segments.length < 3) { 135 if (segments.length < 3) {
136 logger.error("incomplete assets/ path. It should have at least 3 " 136 logger.error("incomplete assets/ path. It should have at least 3 "
137 "segments assets/name/path-from-name's-asset-dir", span); 137 "segments assets/name/path-from-name's-asset-dir", span: span);
138 } 138 }
139 package = segments[1]; 139 package = segments[1];
140 targetPath = urlBuilder.join('asset', 140 targetPath = urlBuilder.join('asset',
141 urlBuilder.joinAll(segments.sublist(2))); 141 urlBuilder.joinAll(segments.sublist(2)));
142 } else { 142 } else {
143 package = source.package; 143 package = source.package;
144 targetPath = urlBuilder.normalize( 144 targetPath = urlBuilder.normalize(
145 urlBuilder.join(urlBuilder.dirname(source.path), url)); 145 urlBuilder.join(urlBuilder.dirname(source.path), url));
146 } 146 }
147 return new AssetId(package, targetPath); 147 return new AssetId(package, targetPath);
(...skipping 30 matching lines...) Expand all
178 return builder.relative(builder.join('/', id.path), 178 return builder.relative(builder.join('/', id.path),
179 from: builder.join('/', builder.dirname(sourceId.path))); 179 from: builder.join('/', builder.dirname(sourceId.path)));
180 } 180 }
181 181
182 182
183 /** Convert system paths to asset paths (asset paths are posix style). */ 183 /** Convert system paths to asset paths (asset paths are posix style). */
184 String _systemToAssetPath(String assetPath) { 184 String _systemToAssetPath(String assetPath) {
185 if (path.Style.platform != path.Style.windows) return assetPath; 185 if (path.Style.platform != path.Style.windows) return assetPath;
186 return path.posix.joinAll(path.split(assetPath)); 186 return path.posix.joinAll(path.split(assetPath));
187 } 187 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698