Fixes so apichecker works on Windows, by making the refJar path an ant "path" <arg> and splitting
on path.separator, not ":".  Also, arg parsing is changed to return an error status, so typos and
such stop the builds.

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@5721 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/build.xml b/build.xml
index 0724592..8fbc6c5 100755
--- a/build.xml
+++ b/build.xml
@@ -152,7 +152,7 @@
         <pathelement location="${gwt.tools.lib}/apache/ant-1.6.5.jar" />
       </classpath>
       <arg value="-refJar"/>
-      <arg value="${gwt.root}/tools/api-checker/reference/gwt-dev-modified.jar:${gwt.root}/tools/api-checker/reference/gwt-user-modified.jar"/>
+      <arg path="${gwt.root}/tools/api-checker/reference/gwt-dev-modified.jar:${gwt.root}/tools/api-checker/reference/gwt-user-modified.jar"/>
       <arg value="-configFile"/>
       <arg file="${gwt.build.out}/userApi.conf"/>
       <arg value="-logLevel"/>
diff --git a/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java b/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java
index fac9892..d1cc813 100644
--- a/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java
+++ b/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java
@@ -455,66 +455,70 @@
   public static void main(String args[]) {
     try {
       ApiCompatibilityChecker checker = new ApiCompatibilityChecker();
-      if (checker.processArgs(args)) {
-        ApiContainer newApi = null, existingApi = null;
+      if (!checker.processArgs(args)) {
+        // if we couldn't parse arguments, return non-zero so the build breaks
+        System.exit(1);
+      }
 
-        AbstractTreeLogger logger = new PrintWriterTreeLogger();
-        logger.setMaxDetail(checker.type);
-        logger.log(TreeLogger.INFO, "gwtDevJar = " + checker.gwtDevJar
-            + ", userJar = " + checker.gwtUserJar + ", refjars = "
-            + Arrays.toString(checker.refJars) + ", logLevel = " + checker.type
-            + ", printAllApi = " + checker.printAllApi, null);
+      ApiContainer newApi = null, existingApi = null;
 
-        Set<String> excludedPackages = checker.getSetOfExcludedPackages(checker.configProperties);
-        if (PROCESS_NEW_API) {
-          Set<CompilationUnit> units = new HashSet<CompilationUnit>();
-          units.addAll(new SourceFileCompilationUnits(
-              checker.configProperties.getProperty("dirRoot_new"),
-              checker.getConfigPropertyAsSet("sourceFiles_new"),
-              checker.getConfigPropertyAsSet("excludedFiles_new"), logger).getCompilationUnits());
-          units.addAll(checker.getGwtCompilationUnits(logger));
-          newApi = new ApiContainer(
-              checker.configProperties.getProperty("name_new"), units,
-              excludedPackages, logger);
-          if (checker.printAllApi) {
-            logger.log(TreeLogger.INFO, newApi.getApiAsString());
-          }
-        }
-        if (PROCESS_EXISTING_API) {
-          Set<CompilationUnit> units = new HashSet<CompilationUnit>();
-          if (checker.refJars == null) {
-            units.addAll(new SourceFileCompilationUnits(
-                checker.configProperties.getProperty("dirRoot_old"),
-                checker.getConfigPropertyAsSet("sourceFiles_old"),
-                checker.getConfigPropertyAsSet("excludedFiles_old"), logger).getCompilationUnits());
-          } else {
-            units.addAll(new JarFileCompilationUnits(checker.refJars,
-                checker.getConfigPropertyAsSet("sourceFiles_old"),
-                checker.getConfigPropertyAsSet("excludedFiles_old"), logger).getCompilationUnits());
-          }
-          units.addAll(checker.getGwtCompilationUnits(logger));
-          existingApi = new ApiContainer(
-              checker.configProperties.getProperty("name_old"), units,
-              excludedPackages, logger);
-          if (checker.printAllApi) {
-            logger.log(TreeLogger.INFO, existingApi.getApiAsString());
-          }
-        }
+      AbstractTreeLogger logger = new PrintWriterTreeLogger();
+      logger.setMaxDetail(checker.type);
+      logger.log(TreeLogger.INFO, "gwtDevJar = " + checker.gwtDevJar
+          + ", userJar = " + checker.gwtUserJar + ", refjars = "
+          + Arrays.toString(checker.refJars) + ", logLevel = " + checker.type
+          + ", printAllApi = " + checker.printAllApi, null);
 
-        if (PROCESS_NEW_API && PROCESS_EXISTING_API) {
-          Collection<ApiChange> apiDifferences = getApiDiff(newApi,
-              existingApi, checker.whiteList);
-          for (ApiChange apiChange : apiDifferences) {
-            System.out.println(apiChange);
-          }
-          if (apiDifferences.size() == 0) {
-            System.out.println("API compatibility check SUCCESSFUL");
-          } else {
-            System.out.println("API compatibility check FAILED");
-          }
-          System.exit(apiDifferences.size() == 0 ? 0 : 1);
+      Set<String> excludedPackages = checker.getSetOfExcludedPackages(checker.configProperties);
+      if (PROCESS_NEW_API) {
+        Set<CompilationUnit> units = new HashSet<CompilationUnit>();
+        units.addAll(new SourceFileCompilationUnits(
+            checker.configProperties.getProperty("dirRoot_new"),
+            checker.getConfigPropertyAsSet("sourceFiles_new"),
+            checker.getConfigPropertyAsSet("excludedFiles_new"), logger).getCompilationUnits());
+        units.addAll(checker.getGwtCompilationUnits(logger));
+        newApi = new ApiContainer(
+            checker.configProperties.getProperty("name_new"), units,
+            excludedPackages, logger);
+        if (checker.printAllApi) {
+          logger.log(TreeLogger.INFO, newApi.getApiAsString());
         }
       }
+      if (PROCESS_EXISTING_API) {
+        Set<CompilationUnit> units = new HashSet<CompilationUnit>();
+        if (checker.refJars == null) {
+          units.addAll(new SourceFileCompilationUnits(
+              checker.configProperties.getProperty("dirRoot_old"),
+              checker.getConfigPropertyAsSet("sourceFiles_old"),
+              checker.getConfigPropertyAsSet("excludedFiles_old"), logger).getCompilationUnits());
+        } else {
+          units.addAll(new JarFileCompilationUnits(checker.refJars,
+              checker.getConfigPropertyAsSet("sourceFiles_old"),
+              checker.getConfigPropertyAsSet("excludedFiles_old"), logger).getCompilationUnits());
+        }
+        units.addAll(checker.getGwtCompilationUnits(logger));
+        existingApi = new ApiContainer(
+            checker.configProperties.getProperty("name_old"), units,
+            excludedPackages, logger);
+        if (checker.printAllApi) {
+          logger.log(TreeLogger.INFO, existingApi.getApiAsString());
+        }
+      }
+
+      if (PROCESS_NEW_API && PROCESS_EXISTING_API) {
+        Collection<ApiChange> apiDifferences = getApiDiff(newApi,
+            existingApi, checker.whiteList);
+        for (ApiChange apiChange : apiDifferences) {
+          System.out.println(apiChange);
+        }
+        if (apiDifferences.size() == 0) {
+          System.out.println("API compatibility check SUCCESSFUL");
+        } else {
+          System.out.println("API compatibility check FAILED");
+        }
+        System.exit(apiDifferences.size() == 0 ? 0 : 1);
+      }
+
     } catch (Throwable t) {
       // intercepting all exceptions in main, because I have to exit with -1 so
       // that the build breaks.
@@ -658,7 +662,7 @@
 
       @Override
       public boolean setString(String str) {
-        String refJarStrings[] = str.split(":");
+        String refJarStrings[] = str.split(System.getProperty("path.separator"));
         refJars = new JarFile[refJarStrings.length];
         int count = 0;
         for (String refJarString : refJarStrings) {