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

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

Issue 112843004: Add linter by default for polymer's pub-build, also cleans up the linter code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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
« no previous file with comments | « pkg/polymer/lib/builder.dart ('k') | pkg/polymer/lib/src/build/linter.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 var url = samePackage ? id.path 105 var url = samePackage ? id.path
106 : assetUrlFor(id, primaryId, transform.logger, allowAssetUrl: true); 106 : assetUrlFor(id, primaryId, transform.logger, allowAssetUrl: true);
107 return transform.readInputAsString(id).then((content) { 107 return transform.readInputAsString(id).then((content) {
108 return _parseHtml(content, url, transform.logger, 108 return _parseHtml(content, url, transform.logger,
109 checkDocType: samePackage && options.isHtmlEntryPoint(id)); 109 checkDocType: samePackage && options.isHtmlEntryPoint(id));
110 }); 110 });
111 } 111 }
112 112
113 Future<bool> assetExists(AssetId id, Transform transform) => 113 Future<bool> assetExists(AssetId id, Transform transform) =>
114 transform.getInput(id).then((_) => true).catchError((_) => false); 114 transform.getInput(id).then((_) => true).catchError((_) => false);
115
116 String toString() => 'polymer ($runtimeType)';
115 } 117 }
116 118
117 /** Create an [AssetId] for a [url] seen in the [source] asset. */ 119 /** Create an [AssetId] for a [url] seen in the [source] asset. */
118 // TODO(sigmund): delete once this is part of barback (dartbug.com/12610) 120 // TODO(sigmund): delete once this is part of barback (dartbug.com/12610)
119 AssetId resolve(AssetId source, String url, TransformLogger logger, Span span) { 121 AssetId resolve(AssetId source, String url, TransformLogger logger, Span span) {
120 if (url == null || url == '') return null; 122 if (url == null || url == '') return null;
121 var uri = Uri.parse(url); 123 var uri = Uri.parse(url);
122 var urlBuilder = path.url; 124 var urlBuilder = path.url;
123 if (uri.host != '' || uri.scheme != '' || urlBuilder.isAbsolute(url)) { 125 if (uri.host != '' || uri.scheme != '' || urlBuilder.isAbsolute(url)) {
124 logger.error('absolute paths not allowed: "$url"', span: span); 126 logger.error('absolute paths not allowed: "$url"', span: span);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 return builder.relative(builder.join('/', id.path), 199 return builder.relative(builder.join('/', id.path),
198 from: builder.join('/', builder.dirname(sourceId.path))); 200 from: builder.join('/', builder.dirname(sourceId.path)));
199 } 201 }
200 202
201 203
202 /** Convert system paths to asset paths (asset paths are posix style). */ 204 /** Convert system paths to asset paths (asset paths are posix style). */
203 String _systemToAssetPath(String assetPath) { 205 String _systemToAssetPath(String assetPath) {
204 if (path.Style.platform != path.Style.windows) return assetPath; 206 if (path.Style.platform != path.Style.windows) return assetPath;
205 return path.posix.joinAll(path.split(assetPath)); 207 return path.posix.joinAll(path.split(assetPath));
206 } 208 }
OLDNEW
« no previous file with comments | « pkg/polymer/lib/builder.dart ('k') | pkg/polymer/lib/src/build/linter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698