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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 var filename = path.basename(node.uri.path); | 132 var filename = path.basename(node.uri.path); |
133 String outputFile = path.join(outputDir, filename); | 133 String outputFile = path.join(outputDir, filename); |
134 new File(outputFile).writeAsStringSync(output); | 134 new File(outputFile).writeAsStringSync(output); |
135 } | 135 } |
136 | 136 |
137 void _buildResourceFile(ResourceSourceNode node) { | 137 void _buildResourceFile(ResourceSourceNode node) { |
138 // ResourceSourceNodes files that just need to be copied over to the output | 138 // ResourceSourceNodes files that just need to be copied over to the output |
139 // location. These can be external dependencies or pieces of the | 139 // location. These can be external dependencies or pieces of the |
140 // dev_compiler runtime. | 140 // dev_compiler runtime. |
141 if (outputDir == null) return; | 141 if (outputDir == null) return; |
142 var filepath = resourceOutputPath(node.uri, _entryNode.uri); | 142 var filepath = |
| 143 resourceOutputPath(node.uri, _entryNode.uri, options.runtimeDir); |
143 assert(filepath != null); | 144 assert(filepath != null); |
144 filepath = path.join(outputDir, filepath); | 145 filepath = path.join(outputDir, filepath); |
145 var dir = path.dirname(filepath); | 146 var dir = path.dirname(filepath); |
146 new Directory(dir).createSync(recursive: true); | 147 new Directory(dir).createSync(recursive: true); |
147 new File.fromUri(node.source.uri).copySync(filepath); | 148 new File.fromUri(node.source.uri).copySync(filepath); |
148 if (_hashing) node.cachingHash = computeHashFromFile(filepath); | 149 if (_hashing) node.cachingHash = computeHashFromFile(filepath); |
149 } | 150 } |
150 | 151 |
151 bool _isEntry(DartSourceNode node) { | 152 bool _isEntry(DartSourceNode node) { |
152 if (_entryNode is DartSourceNode) return _entryNode == node; | 153 if (_entryNode is DartSourceNode) return _entryNode == node; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // Note: the cache-control header should be enough, but this doesn't hurt | 330 // Note: the cache-control header should be enough, but this doesn't hurt |
330 // and can help renew the policy after it expires. | 331 // and can help renew the policy after it expires. |
331 headers['ETag'] = hash; | 332 headers['ETag'] = hash; |
332 } | 333 } |
333 return response.change(headers: headers); | 334 return response.change(headers: headers); |
334 }; | 335 }; |
335 } | 336 } |
336 | 337 |
337 final _log = new Logger('dev_compiler'); | 338 final _log = new Logger('dev_compiler'); |
338 final _earlyErrorResult = new CheckerResults(const [], null, true); | 339 final _earlyErrorResult = new CheckerResults(const [], null, true); |
OLD | NEW |