OLD | NEW |
---|---|
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 // We need to use the 'io' prefix here, otherwise io.exitCode will shadow | 6 // We need to use the 'io' prefix here, otherwise io.exitCode will shadow |
7 // CommandOutput.exitCode in subclasses of CommandOutput. | 7 // CommandOutput.exitCode in subclasses of CommandOutput. |
8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
9 | 9 |
10 import 'command_output.dart'; | 10 import 'command_output.dart'; |
(...skipping 22 matching lines...) Expand all Loading... | |
33 static Command browserHtmlTest( | 33 static Command browserHtmlTest( |
34 String url, Configuration configuration, List<String> expectedMessages, | 34 String url, Configuration configuration, List<String> expectedMessages, |
35 {bool retry}) { | 35 {bool retry}) { |
36 return new BrowserHtmlTestCommand._( | 36 return new BrowserHtmlTestCommand._( |
37 url, configuration, expectedMessages, retry); | 37 url, configuration, expectedMessages, retry); |
38 } | 38 } |
39 | 39 |
40 static Command compilation( | 40 static Command compilation( |
41 String displayName, | 41 String displayName, |
42 String outputFile, | 42 String outputFile, |
43 bool neverSkipCompilation, | |
44 List<Uri> bootstrapDependencies, | 43 List<Uri> bootstrapDependencies, |
45 String executable, | 44 String executable, |
46 List<String> arguments, | 45 List<String> arguments, |
47 Map<String, String> environment) { | 46 Map<String, String> environment, |
48 return new CompilationCommand._( | 47 {bool alwaysCompile: false}) { |
49 displayName, | 48 return new CompilationCommand._(displayName, outputFile, alwaysCompile, |
50 outputFile, | 49 bootstrapDependencies, executable, arguments, environment); |
51 neverSkipCompilation, | |
52 bootstrapDependencies, | |
53 executable, | |
54 arguments, | |
55 environment); | |
56 } | 50 } |
57 | 51 |
58 static Command kernelCompilation( | 52 static Command kernelCompilation( |
59 String outputFile, | 53 String outputFile, |
60 bool neverSkipCompilation, | 54 bool neverSkipCompilation, |
61 List<Uri> bootstrapDependencies, | 55 List<Uri> bootstrapDependencies, |
62 String executable, | 56 String executable, |
63 List<String> arguments, | 57 List<String> arguments, |
64 Map<String, String> environment) { | 58 Map<String, String> environment) { |
65 return new KernelCompilationCommand._(outputFile, neverSkipCompilation, | 59 return new KernelCompilationCommand._(outputFile, neverSkipCompilation, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 Future<bool> get outputIsUpToDate => new Future.value(false); | 211 Future<bool> get outputIsUpToDate => new Future.value(false); |
218 | 212 |
219 /// Arguments that are passed to the process when starting batch mode. | 213 /// Arguments that are passed to the process when starting batch mode. |
220 /// | 214 /// |
221 /// In non-batch mode, they should be passed before [arguments]. | 215 /// In non-batch mode, they should be passed before [arguments]. |
222 List<String> get batchArguments => const []; | 216 List<String> get batchArguments => const []; |
223 } | 217 } |
224 | 218 |
225 class CompilationCommand extends ProcessCommand { | 219 class CompilationCommand extends ProcessCommand { |
226 final String _outputFile; | 220 final String _outputFile; |
227 final bool _neverSkipCompilation; | 221 |
222 /// If true, then the compilation is run even if the input files are older | |
223 /// than the output file. | |
224 final bool _alwaysCompile; | |
228 final List<Uri> _bootstrapDependencies; | 225 final List<Uri> _bootstrapDependencies; |
229 | 226 |
230 CompilationCommand._( | 227 CompilationCommand._( |
231 String displayName, | 228 String displayName, |
232 this._outputFile, | 229 this._outputFile, |
233 this._neverSkipCompilation, | 230 this._alwaysCompile, |
234 this._bootstrapDependencies, | 231 this._bootstrapDependencies, |
235 String executable, | 232 String executable, |
236 List<String> arguments, | 233 List<String> arguments, |
237 Map<String, String> environmentOverrides) | 234 Map<String, String> environmentOverrides) |
238 : super._(displayName, executable, arguments, environmentOverrides); | 235 : super._(displayName, executable, arguments, environmentOverrides); |
239 | 236 |
240 Future<bool> get outputIsUpToDate { | 237 Future<bool> get outputIsUpToDate { |
Bill Hesse
2017/06/21 16:33:20
Surely this is better written using keyword async?
Bob Nystrom
2017/06/21 20:18:28
It is a little out of scope, but what the heck. Ac
| |
241 if (_neverSkipCompilation) return new Future.value(false); | 238 if (_alwaysCompile) return new Future.value(false); |
242 | 239 |
243 Future<List<Uri>> readDepsFile(String path) { | 240 Future<List<Uri>> readDepsFile(String path) { |
244 var file = new io.File(new Path(path).toNativePath()); | 241 var file = new io.File(new Path(path).toNativePath()); |
245 if (!file.existsSync()) { | 242 if (!file.existsSync()) { |
246 return new Future.value(null); | 243 return new Future.value(null); |
247 } | 244 } |
248 return file.readAsLines().then((List<String> lines) { | 245 return file.readAsLines().then((List<String> lines) { |
249 var dependencies = new List<Uri>(); | 246 var dependencies = new List<Uri>(); |
250 for (var line in lines) { | 247 for (var line in lines) { |
251 line = line.trim(); | 248 line = line.trim(); |
(...skipping 22 matching lines...) Expand all Loading... | |
274 return true; | 271 return true; |
275 } | 272 } |
276 } | 273 } |
277 return false; | 274 return false; |
278 }); | 275 }); |
279 } | 276 } |
280 | 277 |
281 void _buildHashCode(HashCodeBuilder builder) { | 278 void _buildHashCode(HashCodeBuilder builder) { |
282 super._buildHashCode(builder); | 279 super._buildHashCode(builder); |
283 builder.addJson(_outputFile); | 280 builder.addJson(_outputFile); |
284 builder.addJson(_neverSkipCompilation); | 281 builder.addJson(_alwaysCompile); |
285 builder.addJson(_bootstrapDependencies); | 282 builder.addJson(_bootstrapDependencies); |
286 } | 283 } |
287 | 284 |
288 bool _equal(CompilationCommand other) => | 285 bool _equal(CompilationCommand other) => |
289 super._equal(other) && | 286 super._equal(other) && |
290 _outputFile == other._outputFile && | 287 _outputFile == other._outputFile && |
291 _neverSkipCompilation == other._neverSkipCompilation && | 288 _alwaysCompile == other._alwaysCompile && |
292 deepJsonCompare(_bootstrapDependencies, other._bootstrapDependencies); | 289 deepJsonCompare(_bootstrapDependencies, other._bootstrapDependencies); |
293 } | 290 } |
294 | 291 |
295 class KernelCompilationCommand extends CompilationCommand { | 292 class KernelCompilationCommand extends CompilationCommand { |
296 KernelCompilationCommand._( | 293 KernelCompilationCommand._( |
297 String outputFile, | 294 String outputFile, |
298 bool neverSkipCompilation, | 295 bool neverSkipCompilation, |
299 List<Uri> bootstrapDependencies, | 296 List<Uri> bootstrapDependencies, |
300 String executable, | 297 String executable, |
301 List<String> arguments, | 298 List<String> arguments, |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
600 | 597 |
601 void _buildHashCode(HashCodeBuilder builder) { | 598 void _buildHashCode(HashCodeBuilder builder) { |
602 super._buildHashCode(builder); | 599 super._buildHashCode(builder); |
603 builder.addJson(_link); | 600 builder.addJson(_link); |
604 builder.addJson(_target); | 601 builder.addJson(_target); |
605 } | 602 } |
606 | 603 |
607 bool _equal(MakeSymlinkCommand other) => | 604 bool _equal(MakeSymlinkCommand other) => |
608 super._equal(other) && _link == other._link && _target == other._target; | 605 super._equal(other) && _link == other._link && _target == other._target; |
609 } | 606 } |
OLD | NEW |