ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28984] New: - Optional ccm tasks only run on windows, patch for linux compatibility
Date Fri, 14 May 2004 15:55:02 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28984>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28984

Optional ccm tasks only run on windows, patch for linux compatibility

           Summary: Optional ccm tasks only run on windows, patch for linux
                    compatibility
           Product: Ant
           Version: 1.6.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: staplin@digitalglobe.com


The arguments passed to the underlying ccm command are formatted such that they
only work with a Windows installation of ccm (ccm uses '/' on windows and '-' on
linux). 

The following 4 diffs (against ant 1.6.1 source) make the ccm tasks more
platform independent.

Continuus.java:

@@ -17,6 +17,8 @@
 
 package org.apache.tools.ant.taskdefs.optional.ccm;
 
+import java.io.File;
+
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
@@ -75,8 +77,8 @@
      */
     protected final String getCcmCommand() {
         String toReturn = ccmDir;
-        if (!toReturn.equals("") && !toReturn.endsWith("/")) {
-            toReturn += "/";
+        if (!toReturn.equals("") && !toReturn.endsWith(File.separator)) {
+            toReturn += File.separator;
         }
 
         toReturn += CCM_EXE;
@@ -128,5 +130,14 @@
      */
     public static final String COMMAND_DEFAULT_TASK = "default_task";
 
-
+    /**
+     * The system OS dependent character denoting a command line argument flag 
to ccm.
+     * For windows, this is '/', but others this is '-'
+     */
+    protected static final char ARGUMENT_FLAG_CHAR;
+    static {
+        String os = System.getProperty("os.name");
+        boolean windowsOs = os.indexOf("Windows") != -1;
+        ARGUMENT_FLAG_CHAR = windowsOs ? '/' : '-';




CCMCheck.java:

@@ -188,13 +188,13 @@
     }
 
     /**
-     * -comment flag -- comment to attach to the file
+     * comment flag -- comment to attach to the file
      */
-    public static final String FLAG_COMMENT = "/comment";
+    public static final String FLAG_COMMENT = ARGUMENT_FLAG_CHAR+"comment";
 
     /**
-     *  -task flag -- associate checkout task with task
+     *  task flag -- associate checkout task with task
      */
-    public static final String FLAG_TASK = "/task";
+    public static final String FLAG_TASK = ARGUMENT_FLAG_CHAR+"task";
 }




CCMCreateTask.java:

@@ -234,32 +234,32 @@
     /**
      * /comment -- comments associated to the task
      */
-    public static final String FLAG_COMMENT = "/synopsis";
+    public static final String FLAG_COMMENT = ARGUMENT_FLAG_CHAR+"synopsis";
 
     /**
-     *  /platform flag -- target platform
+     *  platform flag -- target platform
      */
-    public static final String FLAG_PLATFORM = "/plat";
+    public static final String FLAG_PLATFORM = ARGUMENT_FLAG_CHAR+"plat";
 
     /**
-     * /resolver flag
+     * resolver flag
      */
-    public static final String FLAG_RESOLVER = "/resolver";
+    public static final String FLAG_RESOLVER = ARGUMENT_FLAG_CHAR+"resolver";
 
     /**
-     * /release flag
+     * release flag
      */
-    public static final String FLAG_RELEASE = "/release";
+    public static final String FLAG_RELEASE = ARGUMENT_FLAG_CHAR+"release";
 
     /**
-     * /release flag
+     * release flag
      */
-    public static final String FLAG_SUBSYSTEM = "/subsystem";
+    public static final String FLAG_SUBSYSTEM = ARGUMENT_FLAG_CHAR+"subsystem";
 
     /**
-     *  -task flag -- associate checkout task with task
+     *  task flag -- associate checkout task with task
      */
-    public static final String FLAG_TASK = "/task";
+    public static final String FLAG_TASK = ARGUMENT_FLAG_CHAR+"task";
 
 
     // implementation of org.apache.tools.ant.taskdefs.ExecuteStreamHandler
interface



CCMReconfigure.java:

@@ -138,20 +138,20 @@
 
 
     /**
-     * /recurse --
+     * recurse --
      */
-    public static final String FLAG_RECURSE = "/recurse";
+    public static final String FLAG_RECURSE = ARGUMENT_FLAG_CHAR+"recurse";
 
     /**
-     * /recurse --
+     * recurse --
      */
-    public static final String FLAG_VERBOSE = "/verbose";
+    public static final String FLAG_VERBOSE = ARGUMENT_FLAG_CHAR+"verbose";
 
 
     /**
-     *  /project flag -- target project
+     *  project flag -- target project
      */
-    public static final String FLAG_PROJECT = "/project";
+    public static final String FLAG_PROJECT = ARGUMENT_FLAG_CHAR+"project";
 
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message