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 library task_dependency_graph.check_test; | 5 library task_dependency_graph.check_test; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
| 9 import 'package:analyzer/src/codegen/tools.dart'; |
9 import 'package:path/path.dart'; | 10 import 'package:path/path.dart'; |
10 | 11 |
11 import 'generate.dart'; | 12 import 'generate.dart'; |
12 | 13 |
13 /** | 14 /** |
14 * Check that the target file has been code generated. If it hasn't tell the | 15 * Check that the target file has been code generated. If it hasn't tell the |
15 * user to run generate.dart. | 16 * user to run generate.dart. |
16 */ | 17 */ |
17 main() { | 18 main() { |
18 String script = Platform.script.toFilePath(windows: Platform.isWindows); | 19 String script = Platform.script.toFilePath(windows: Platform.isWindows); |
19 String pkgPath = normalize(join(dirname(script), '..', '..')); | 20 String pkgPath = normalize(join(dirname(script), '..', '..')); |
20 if (!target.check(pkgPath)) { | 21 GeneratedContent.checkAll(pkgPath, 'tool/task_dependency_graph/generate.dart', |
21 print( | 22 <GeneratedContent>[target]); |
22 '${target.output(pkgPath).absolute} does not have expected contents.'); | |
23 print('Please regenerate using:'); | |
24 String executable = Platform.executable; | |
25 String packageRoot = ''; | |
26 if (Platform.packageRoot.isNotEmpty) { | |
27 packageRoot = ' --package-root=${Platform.packageRoot}'; | |
28 } | |
29 String generateScript = join(dirname(script), 'generate.dart'); | |
30 print(' $executable$packageRoot $generateScript'); | |
31 exit(1); | |
32 } else { | |
33 print('Generated file is up to date.'); | |
34 } | |
35 } | 23 } |
OLD | NEW |