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

Unified Diff: editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerMain.java

Issue 12438007: Updates to the new analyzer to help make the try bot happy. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerMain.java
===================================================================
--- editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerMain.java (revision 19891)
+++ editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerMain.java (working copy)
@@ -70,6 +70,12 @@
System.exit(1);
}
+ if (!options.getDartSdkPath().exists()) {
+ System.out.println(PROGRAM_NAME + ": invalid Dart SDK path: " + options.getDartSdkPath());
+ showUsage(options, System.out);
+ System.exit(1);
+ }
+
if (options.getSdkIndexLocation() != null) {
AnalyzerImpl analyzer = new AnalyzerImpl(options);
if (analyzer.createSdkIndex()) {
@@ -84,15 +90,9 @@
System.exit(0);
}
- String sourceFilePath = options.getSourceFile();
+ try {
+ final AnalyzerImpl analyzer = new AnalyzerImpl(options);
- if (sourceFilePath == null) {
- System.out.println(PROGRAM_NAME + ": no source files were specified.");
- showUsage(options, System.out);
- System.exit(1);
- }
-
- try {
if (options.shouldBatch()) {
BatchRunner.runAsBatch(args, new BatchRunnerInvocation() {
@Override
@@ -103,12 +103,20 @@
compilerOptions.setDartSdkPath(options.getDartSdkPath());
}
- return runAnalyzer(compilerOptions);
+ return runAnalyzer(analyzer, compilerOptions);
}
});
} else {
- ErrorSeverity result = runAnalyzer(options);
+ String sourceFilePath = options.getSourceFile();
+ if (sourceFilePath == null) {
+ System.out.println(PROGRAM_NAME + ": no source files were specified.");
+ showUsage(options, System.out);
+ System.exit(1);
+ }
+
+ ErrorSeverity result = runAnalyzer(analyzer, options);
+
if (result != ErrorSeverity.NONE) {
System.exit(result.ordinal());
}
@@ -131,10 +139,8 @@
* @param analyzerOptions parsed command line arguments
* @return {@code true} on success, {@code false} on failure.
*/
- protected static ErrorSeverity runAnalyzer(AnalyzerOptions options) throws IOException,
- AnalysisException {
- AnalyzerImpl analyzer = new AnalyzerImpl(options);
-
+ protected static ErrorSeverity runAnalyzer(AnalyzerImpl analyzer, AnalyzerOptions options)
+ throws IOException, AnalysisException {
File sourceFile = new File(options.getSourceFile());
if (!sourceFile.exists()) {

Powered by Google App Engine
This is Rietveld 408576698