Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: pkg/analyzer/tool/summary/build_sdk_summary.dart

Issue 1668533002: Set an exit code when exiting build_sdk_summary in error. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import 'dart:io'; 1 import 'dart:io';
2 2
3 import 'package:analyzer/dart/element/element.dart'; 3 import 'package:analyzer/dart/element/element.dart';
4 import 'package:analyzer/src/generated/engine.dart'; 4 import 'package:analyzer/src/generated/engine.dart';
5 import 'package:analyzer/src/generated/java_io.dart'; 5 import 'package:analyzer/src/generated/java_io.dart';
6 import 'package:analyzer/src/generated/sdk.dart'; 6 import 'package:analyzer/src/generated/sdk.dart';
7 import 'package:analyzer/src/generated/sdk_io.dart'; 7 import 'package:analyzer/src/generated/sdk_io.dart';
8 import 'package:analyzer/src/generated/source.dart'; 8 import 'package:analyzer/src/generated/source.dart';
9 import 'package:analyzer/src/summary/format.dart'; 9 import 'package:analyzer/src/summary/format.dart';
10 import 'package:analyzer/src/summary/summarize_elements.dart'; 10 import 'package:analyzer/src/summary/summarize_elements.dart';
11 11
12 main(List<String> args) { 12 main(List<String> args) {
13 if (args.length < 1 || args.length > 2) { 13 if (args.length < 1 || args.length > 2) {
14 _printUsage(); 14 _printUsage();
15 return; 15 exit(1);
kevmoo 2016/02/03 19:22:07 consider setting exitCode = 1 and return. exit(n)
Paul Berry 2016/02/04 13:27:34 Done.
16 } 16 }
17 // 17 //
18 // Prepare output file path. 18 // Prepare output file path.
19 // 19 //
20 String outputFilePath = args[0]; 20 String outputFilePath = args[0];
21 if (FileSystemEntity.isDirectorySync(outputFilePath)) { 21 if (FileSystemEntity.isDirectorySync(outputFilePath)) {
22 print("'$outputFilePath' is a directory."); 22 print("'$outputFilePath' is a directory.");
23 _printUsage(); 23 _printUsage();
24 return; 24 exit(1);
25 } 25 }
26 // 26 //
27 // Prepare SDK path. 27 // Prepare SDK path.
28 // 28 //
29 String sdkPath; 29 String sdkPath;
30 if (args.length == 2) { 30 if (args.length == 2) {
31 sdkPath = args[1]; 31 sdkPath = args[1];
32 if (!FileSystemEntity.isDirectorySync('$sdkPath/lib')) { 32 if (!FileSystemEntity.isDirectorySync('$sdkPath/lib')) {
33 print("'$sdkPath/lib' does not exist."); 33 print("'$sdkPath/lib' does not exist.");
34 _printUsage(); 34 _printUsage();
35 return; 35 exit(1);
36 } 36 }
37 } else { 37 } else {
38 sdkPath = DirectoryBasedDartSdk.defaultSdkDirectory.getAbsolutePath(); 38 sdkPath = DirectoryBasedDartSdk.defaultSdkDirectory.getAbsolutePath();
39 } 39 }
40 // 40 //
41 // Prepare SDK. 41 // Prepare SDK.
42 // 42 //
43 DirectoryBasedDartSdk sdk = new DirectoryBasedDartSdk(new JavaFile(sdkPath)); 43 DirectoryBasedDartSdk sdk = new DirectoryBasedDartSdk(new JavaFile(sdkPath));
44 AnalysisContext context = sdk.context; 44 AnalysisContext context = sdk.context;
45 // 45 //
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 * The name of the SDK summary builder application. 78 * The name of the SDK summary builder application.
79 */ 79 */
80 const BINARY_NAME = "build_sdk_summary"; 80 const BINARY_NAME = "build_sdk_summary";
81 81
82 /** 82 /**
83 * Print information about how to use the SDK summary builder. 83 * Print information about how to use the SDK summary builder.
84 */ 84 */
85 void _printUsage() { 85 void _printUsage() {
86 print('Usage: $BINARY_NAME output_file_path [sdk_path]'); 86 print('Usage: $BINARY_NAME output_file_path [sdk_path]');
87 } 87 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698