| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Command line tool to run the checker on a Dart program. | 5 /// Command line tool to run the checker on a Dart program. |
| 6 library dev_compiler.devc; | 6 library dev_compiler.devc; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 new File(outputFile).writeAsStringSync(output); | 129 new File(outputFile).writeAsStringSync(output); |
| 130 | 130 |
| 131 if (_options.outputDart) return; | 131 if (_options.outputDart) return; |
| 132 } | 132 } |
| 133 | 133 |
| 134 void _buildResourceFile(ResourceSourceNode node) { | 134 void _buildResourceFile(ResourceSourceNode node) { |
| 135 // ResourceSourceNodes files that just need to be copied over to the output | 135 // ResourceSourceNodes files that just need to be copied over to the output |
| 136 // location. These can be external dependencies or pieces of the | 136 // location. These can be external dependencies or pieces of the |
| 137 // dev_compiler runtime. | 137 // dev_compiler runtime. |
| 138 if (_options.outputDir == null || _options.outputDart) return; | 138 if (_options.outputDir == null || _options.outputDart) return; |
| 139 assert(node.uri.scheme == 'package'); | 139 var filepath = resourceOutputPath(node.uri); |
| 140 var filepath = path.join(_options.outputDir, resourceOutputPath(node.uri)); | 140 assert(filepath != null); |
| 141 filepath = path.join(_options.outputDir, filepath); |
| 141 var dir = path.dirname(filepath); | 142 var dir = path.dirname(filepath); |
| 142 new Directory(dir).createSync(recursive: true); | 143 new Directory(dir).createSync(recursive: true); |
| 143 var text = node.source.contents.data; | 144 var text = node.source.contents.data; |
| 144 new File(filepath).writeAsStringSync(text); | 145 new File(filepath).writeAsStringSync(text); |
| 145 if (_hashing) node.cachingHash = computeHash(text); | 146 if (_hashing) node.cachingHash = computeHash(text); |
| 146 } | 147 } |
| 147 | 148 |
| 148 bool _isEntry(DartSourceNode node) { | 149 bool _isEntry(DartSourceNode node) { |
| 149 if (_entryNode is DartSourceNode) return _entryNode == node; | 150 if (_entryNode is DartSourceNode) return _entryNode == node; |
| 150 return (_entryNode as HtmlSourceNode).scripts.contains(node); | 151 return (_entryNode as HtmlSourceNode).scripts.contains(node); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 // Note: the cache-control header should be enough, but this doesn't hurt | 304 // Note: the cache-control header should be enough, but this doesn't hurt |
| 304 // and can help renew the policy after it expires. | 305 // and can help renew the policy after it expires. |
| 305 headers['ETag'] = segments[1]; | 306 headers['ETag'] = segments[1]; |
| 306 } | 307 } |
| 307 return response.change(headers: headers); | 308 return response.change(headers: headers); |
| 308 }; | 309 }; |
| 309 } | 310 } |
| 310 | 311 |
| 311 final _log = new Logger('dev_compiler'); | 312 final _log = new Logger('dev_compiler'); |
| 312 final _earlyErrorResult = new CheckerResults(const [], null, true); | 313 final _earlyErrorResult = new CheckerResults(const [], null, true); |
| OLD | NEW |