Author: [email protected]
Date: Mon Jan 12 12:13:17 2009
New Revision: 4429

Modified:
     
releases/1.6/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/SvnInfo.java

Log:
Sort & format.

Modified:  
releases/1.6/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/SvnInfo.java
==============================================================================
---  
releases/1.6/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/SvnInfo.java   
 
(original)
+++  
releases/1.6/build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/SvnInfo.java   
 
Mon Jan 12 12:13:17 2009
@@ -1,12 +1,12 @@
  /*
   * Copyright 2008 Google Inc.
- *
+ *
   * Licensed under the Apache License, Version 2.0 (the "License"); you may  
not
   * use this file except in compliance with the License. You may obtain a  
copy of
   * the License at
- *
+ *
   * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,  
WITHOUT
   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -25,27 +25,29 @@
  import java.util.regex.Matcher;
  import java.util.regex.Pattern;

-
  /**
   * A Svn interface task, because the initial solution of <exec> and
- * <propertyregex> is unhappy in ant 1.6.5, and while that's old, it's not
- * quite "too old" for us to care.
+ * <propertyregex> is unhappy in ant 1.6.5, and while that's old, it's not  
quite
+ * "too old" for us to care.
   */
  public class SvnInfo extends Task {

    // URL line from svn info output, selecting the very last term of the  
URL as
    // the branch specifier
    private static final String URL_REGEX  
= "\\s*URL:\\s*https?://.*/([^/]*)\\s*";
-
-
+
+  private String fileprop;
+
+  private String outprop;
+
+  private String workdir;
+
    public SvnInfo() {
      super();
    }

    @Override
    public void execute() throws BuildException {
-    String result;
-
      if (outprop == null) {
        throw new BuildException(
            "<svninfo> task requires an outputproperty attribute");
@@ -62,34 +64,37 @@
      String revision = getSvnVersion(workDirFile);
      getProject().setNewProperty(outprop, branch + "@" + revision);
      if (fileprop != null) {
-      getProject().setNewProperty(fileprop, branch + "-"
-          + revision.replaceAll(":", "-"));
+      getProject().setNewProperty(fileprop,
+          branch + "-" + revision.replaceAll(":", "-"));
      }
    }

    /**
-   * Establishes the property containing the SVN output string, bra...@rev.
-   * @param propname  Name of a property
+   * Establishes the directory used as the SVN workspace to fetch version
+   * information.
+   *
+   * @param srcdir workspace directory name
     */
-  public void setOutputProperty(String propname) {
-    outprop = propname;
+  public void setDirectory(String srcdir) {
+    workdir = srcdir;
    }

    /**
     * Establishes the property containing the SVN output string, bra...@rev.
-   * @param propname  Name of a property
+   *
+   * @param propname Name of a property
     */
    public void setOutputFileProperty(String propname) {
      fileprop = propname;
    }

    /**
-   * Establishes the directory used as the SVN workspace to fetch version
-   * information about
-   * @param srcdir  workspace directory name
+   * Establishes the property containing the SVN output string, bra...@rev.
+   *
+   * @param propname Name of a property
     */
-  public void setDirectory(String srcdir) {
-    workdir = srcdir;
+  public void setOutputProperty(String propname) {
+    outprop = propname;
    }

    private String getSvnBranch(File workdir) {
@@ -98,24 +103,24 @@
      LineNumberReader svnout = runCommand(workdir, "svn", "info");
      try {
        String line = svnout.readLine();
-
+
        Pattern urlRegex = Pattern.compile(URL_REGEX);
        while (line != null) {
          Matcher m = urlRegex.matcher(line);
-
+
          if (m.matches()) {
            branchName = m.group(1);
            if (branchName == null || "".equals(branchName)) {
-            throw new BuildException("svn info didn't get branch from URL  
line "
-                + line);
+            throw new BuildException(
+                "svn info didn't get branch from URL line " + line);
            }
            break;
          }
          line = svnout.readLine();
        }
      } catch (IOException e) {
-      throw new BuildException("<svninfo> cannot read svn info's output  
stream",
-          e);
+      throw new BuildException(
+          "<svninfo> cannot read svn info's output stream", e);
      }
      return branchName;
    }
@@ -127,8 +132,8 @@
      try {
        line = svnout.readLine();
      } catch (IOException e) {
-      throw new BuildException("<svninfo> cannot read svnversion's output  
stream",
-          e);
+      throw new BuildException(
+          "<svninfo> cannot read svnversion's output stream", e);
      }
      if (line == null || "".equals(line)) {
        throw new BuildException("svnversion didn't give any answer");
@@ -136,13 +141,13 @@
      return line;
    }

-  private LineNumberReader runCommand (File workdir, String... cmd) {
+  private LineNumberReader runCommand(File workdir, String... cmd) {
      String cmdString = "";
      for (String arg : cmd) {
        cmdString = cmdString + arg + " ";
      }
      cmdString = cmdString.substring(0, cmdString.length() - 1);
-
+
      ProcessBuilder svnPb = new ProcessBuilder(cmd);
      svnPb.directory(workdir);
      Process svnproc;
@@ -151,9 +156,9 @@
      } catch (IOException e) {
        throw new BuildException("cannot launch command " + cmdString, e);
      }
-
-    LineNumberReader svnerr =
-      new LineNumberReader(new  
InputStreamReader(svnproc.getErrorStream()));
+
+    LineNumberReader svnerr = new LineNumberReader(new InputStreamReader(
+        svnproc.getErrorStream()));
      try {
        String line = svnerr.readLine();
        String errorText = "";
@@ -162,20 +167,15 @@
            errorText = errorText + "  " + line + "\n";
            line = svnerr.readLine();
          }
-        throw new BuildException(cmdString + " returned error output:\n"
+        throw new BuildException(cmdString + " returned error output:\n"
              + errorText);
        }
      } catch (IOException e) {
-      throw new BuildException("cannot read error stream from " +  
cmdString,
-          e);
+      throw new BuildException("cannot read error stream from " +  
cmdString, e);
      }
-
-    LineNumberReader svnout =
-      new LineNumberReader(new  
InputStreamReader(svnproc.getInputStream()));
+
+    LineNumberReader svnout = new LineNumberReader(new InputStreamReader(
+        svnproc.getInputStream()));
      return svnout;
    }
-
-  private String fileprop;
-  private String outprop;
-  private String workdir;
  }

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to