| 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 /// Example that illustrates how to use the incremental compiler and trigger a | 5 /// Example that illustrates how to use the incremental compiler and trigger a |
| 6 /// hot-reload on the VM after recompiling the application. | 6 /// hot-reload on the VM after recompiling the application. |
| 7 /// | 7 /// |
| 8 /// This example resembles the `run` command in flutter-tools. It creates an | 8 /// This example resembles the `run` command in flutter-tools. It creates an |
| 9 /// interactive command-line program that waits for the user to tap a key to | 9 /// interactive command-line program that waits for the user to tap a key to |
| 10 /// trigger a recompile and reload. | 10 /// trigger a recompile and reload. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 /// | 39 /// |
| 40 /// * In terminal A, hit the "r" key to trigger a recompile and hot reload. | 40 /// * In terminal A, hit the "r" key to trigger a recompile and hot reload. |
| 41 /// | 41 /// |
| 42 /// * See the changed program in terminal B | 42 /// * See the changed program in terminal B |
| 43 library front_end.example.incremental_reload.run; | 43 library front_end.example.incremental_reload.run; |
| 44 | 44 |
| 45 import 'dart:io'; | 45 import 'dart:io'; |
| 46 import 'dart:async'; | 46 import 'dart:async'; |
| 47 import 'dart:convert' show ASCII; | 47 import 'dart:convert' show ASCII; |
| 48 | 48 |
| 49 import 'package:front_end/src/vm/reload.dart'; | 49 import '../../tool/vm/reload.dart'; |
| 50 | 50 |
| 51 import 'compiler_with_invalidation.dart'; | 51 import 'compiler_with_invalidation.dart'; |
| 52 | 52 |
| 53 VmReloader reloader = new VmReloader(); | 53 VmReloader reloader = new VmReloader(); |
| 54 AnsiTerminal terminal = new AnsiTerminal(); | 54 AnsiTerminal terminal = new AnsiTerminal(); |
| 55 | 55 |
| 56 main(List<String> args) async { | 56 main(List<String> args) async { |
| 57 if (args.length <= 1) { | 57 if (args.length <= 1) { |
| 58 print('usage: dart incremental_compile.dart input.dart out.dill'); | 58 print('usage: dart incremental_compile.dart input.dart out.dill'); |
| 59 exit(1); | 59 exit(1); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } on StdinException catch (error) { | 275 } on StdinException catch (error) { |
| 276 if (!_lineModeIgnorableErrors.contains(error.osError?.errorCode)) rethrow; | 276 if (!_lineModeIgnorableErrors.contains(error.osError?.errorCode)) rethrow; |
| 277 } | 277 } |
| 278 } | 278 } |
| 279 | 279 |
| 280 /// Return keystrokes from the console. | 280 /// Return keystrokes from the console. |
| 281 /// | 281 /// |
| 282 /// Useful when the console is in [singleCharMode]. | 282 /// Useful when the console is in [singleCharMode]. |
| 283 Stream<String> get onCharInput => stdin.transform(ASCII.decoder); | 283 Stream<String> get onCharInput => stdin.transform(ASCII.decoder); |
| 284 } | 284 } |
| OLD | NEW |