Hi all,
  Here are the complete diffs to build on a mac so far.  I think I have all
the indent issues worked out.  This is all modified to use the
platform-specific packaging I mentioned earlier today (i.e. it should
compile fine on other platforms without the Macbinary library).  The diffs
are attached as text files.  I've also attached the completely new files
tar'd and gzipped.

  This also includes the simple UI.  The UI is cross-platform, except that
there is currently no non-Mac entrypoint.  It would be very simple to add
one.  You just create a new BuildFame for your build file.  The build file
is passed in the constructor.

  Oh, and you'll need http://www.amug.org/~glguerin/sw/index.html#macbinary
to compile the Mac stuff.

  Have fun,

\x/ill           :-}

Attachment: newFiles.tar.gz.uu
Description: Binary data

Index: build.xml
===================================================================
RCS file: /home/cvspublic/jakarta-ant/build.xml,v
retrieving revision 1.10
diff -r1.10 build.xml
7c7
< <project name="Ant" default="main" basedir=".">
---
> <project name="Ant" default="main">
25a26
>     <property name="macclasspath"
value="${classpath}:lib/MacBinaryToolkitClasses.zip"/>
40c41
<   <!-- Compiles the source code                                           
-->
---
>   <!-- Compiles the base source code                                      
-->
42c43
<   <target name="compile" depends="prepare">
---
>   <target name="compileBase" depends="prepare">
45a47
>            excludes="**/platform/**"
49d50
<            optimize="on"
53a55,85
>   <!-- Platform specific compiles                                         
-->
>   <!-- ===================================================================
-->
>   <target name="mac" depends="compileBase" if="mrj.version">
>     <mkdir dir="${build.classes}"/>
>     <javac srcdir="${src.dir}"
>            destdir="${build.classes}"
>            includes="**/platform/mac/**"
>            classpath="${macclasspath}"
>            debug="on"
>            deprecation="on"
>     />
>   </target>
> 
>   <target name="unix" depends="compileBase">
>     <mkdir dir="${build.classes}"/>
>     <javac srcdir="${src.dir}"
>            destdir="${build.classes}"
>            includes="**/platform/unix/**"
>            classpath="${classpath}"
>            debug="on"
>            deprecation="on"
>     />
>   </target>
> 
>   <!-- ===================================================================
-->
>   <!-- Compiles all relevant source                                       
-->
>   <!-- ===================================================================
-->
>   <target name="compile" depends="compileBase,mac,unix">
>   </target>
> 
>   <!-- ===================================================================
-->
59d90
<          includes="org/**"
64a96,117
>   <!-- Creates the executable files                                       
-->
>   <!-- ===================================================================
-->
>   <target name="executables" depends="jar,macExecutable"> <!--
unixExecutable -->
>   </target>
> 
>   <target name="macExecutable" depends="jar,mac" if="mrj.version">
>      <Macbinary source="src/etc/mac.rsrc.bin"/>
>      <MakeExecutable output="${bin.dir}/macANT"
main="org.apache.tools.ant.platform.mac.Main"
>         system="mac" classpathbase="$$APPLICATION/.."
>       classpath="${lib.dir}/${name}.jar:${macclasspath}" gcmax="48M"
>       properties="ant.home" mergeresourcefile="src/etc/dAnt.rsrc"
>      />
>   </target>
> 
>   <target name="unixExecutable" depends="jar">
>      <MakeExecutable output="${bin.dir}/ant"
main="org.apache.tools.ant.Main"
>         system="unix" classpath="${lib.dir}/${name}.jar:${classpath}"
>         gcmax="48M" properties="ant.home"
>      />
>   </target>
> 
>   <!-- ===================================================================
-->
67c120
<   <target name="main" depends="jar">
---
>   <target name="main" depends="executables">
Index: ./src/main/org/apache/tools/ant/BuildException.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/BuildException.jav
a,v
retrieving revision 1.2
diff -r1.2 BuildException.java
60a61
>  * @author William Uther
66c67
<     private Exception cause;
---
>     private Throwable cause;
73c74
<       super();
---
>         super();
82c83
<       super(msg);
---
>         super(msg);
92,94c93,95
<     public BuildException(String msg, Exception cause) {
<       super(msg);
<       this.cause = cause;
---
>     public BuildException(String msg, Throwable cause) {
>         super(makeStringFromThrowable(cause, msg));
>         this.cause = cause;
102,104c103,136
<     public BuildException(Exception cause) {
<       super();
<       this.cause = cause;
---
>     public BuildException(Throwable cause) {
>         super(makeStringFromThrowable(cause, null));
>         this.cause = cause;
>     }
> 
>     protected static final String
makeStringFromThrowable(java.lang.Throwable t, String msg) {
>         if (t == null) {
>             if (msg == null)
>                 return "Null passed as Exception";
>             else
>                 return msg + ": null";
>         } else if (t instanceof BuildException) {
>             if (msg == null)
>                 return "Rethrowing: " + t.getMessage();
>             else
>                 return "Rethrowing (" + msg + "): " + t.getMessage();
>         } else {
>             java.io.CharArrayWriter myStream = new
java.io.CharArrayWriter();
>             java.io.PrintWriter pStream = new
java.io.PrintWriter(myStream);
> 
>             t.printStackTrace(pStream);
>             pStream.close();
>         
>             if (msg == null) {
>                 return "Exception: " + t.getClass().getName() + "\n" +
>                     "Message: " + t.getMessage() + "\n" +
>                     "at: " + myStream.toString() + "\n";
>             } else {
>                 return "Exception: " + t.getClass().getName() + "\n" +
>                     "Label: " + msg + "\n" +
>                     "Message: " + t.getMessage() + "\n" +
>                     "at: " + myStream.toString() + "\n";
>             }
>         }
Index: ./src/main/org/apache/tools/ant/taskdefs/Chmod.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Chmod.jav
a,v
retrieving revision 1.1
diff -r1.1 Chmod.java
82,89c82,90
<       try {
<           // XXX if OS=unix
<           if (System.getProperty("path.separator").equals(":"))
<               Runtime.getRuntime().exec("chmod " + mod + " " + srcFile );
<       } catch (IOException ioe) {
<           // ignore, but warn
<           System.out.println("Error chmod" + ioe.toString() );
<       }
---
>         try {
>             // XXX if OS=unix
>             if (System.getProperty("path.separator").equals(":") && 
>                     !System.getProperty("os.name").startsWith("Mac"))
>                 Runtime.getRuntime().exec("chmod " + mod + " " + srcFile
);
>         } catch (IOException ioe) {
>             // ignore, but warn
>             System.out.println("Error chmod" + ioe.toString() );
>         }
Index: ./src/main/org/apache/tools/ant/taskdefs/defaults.properties
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/defaults.
properties,v
retrieving revision 1.7
diff -r1.7 defaults.properties
28a29,30
> MakeExecutable=org.apache.tools.ant.taskdefs.MakeExecutable
> Macbinary=org.apache.tools.ant.taskdefs.Macbinary
Index: ./src/main/org/apache/tools/ant/taskdefs/Delete.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Delete.ja
va,v
retrieving revision 1.1
diff -r1.1 Delete.java
78c78,82
<             f.delete();
---
>             if (f.isDirectory()) {
>                 project.log("Directory: " + f.getAbsolutePath() + " cannot
be removed with delete.  Use Deltree instead.");
>             } else {
>                 f.delete();
>             }
Index: ./src/main/org/apache/tools/ant/taskdefs/Deltree.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Deltree.j
ava,v
retrieving revision 1.1
diff -r1.1 Deltree.java
98a99,100
>         // XXX - Warning getCanonicalPath() is platform dependant
>         // JavaSoft needs to introduce an isSymLink() method in
java.io.File.
100c102,110
<         if (dir.getCanonicalPath().equals(dir.getAbsolutePath())) {
---
>         String canonical = dir.getCanonicalPath();
>         String absolute = dir.getAbsolutePath();
>         
>         if (canonical.endsWith(dir.separator) &&
!absolute.endsWith(dir.separator))
>             absolute = absolute + dir.separator;
>         else if (!canonical.endsWith(dir.separator) &&
absolute.endsWith(dir.separator))
>             canonical = canonical + dir.separator;
>         
>         if (canonical.equals(absolute)) {
Index: ./src/main/org/apache/tools/ant/taskdefs/Javac.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.jav
a,v
retrieving revision 1.6
diff -r1.6 Javac.java
251c251,252
<      * support files to be copied.
---
>      * support files to be copied.  The results are returned in the
>      * class variables compileList and filecopyList.
254a256,258
>         compileList.removeAllElements();
>         filecopyList.clear();
>       
Index: ./src/main/org/apache/tools/ant/Project.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
retrieving revision 1.9
diff -r1.9 Project.java
353a354,360
>     /**
>      * Return an enumeration over the current targets.
>      */
>     public Enumeration getTargetNames() {
>         return targets.keys();
>     }
> 
559,560c566,567
<                 BufferedReader in = new BufferedReader(new
FileReader(sourceFile));
<                 BufferedWriter out = new BufferedWriter(new
FileWriter(destFile));
---
>                 BufferedReader in = null;
>                 BufferedWriter out = null;
562,572c569,575
<                 int length;
<                 String newline = null;
<                 String line = in.readLine();
<                 while (line != null) {
<                     if (line.length() == 0) {
<                         out.newLine();
<                     } else {
<                         newline = replace(line, filters);
<                         out.write(newline);
<                         out.newLine();
<                     }
---
>                 try {
>                     int length;
>                     String line;
>                     String newline = null;
> 
>                     in = new BufferedReader(new FileReader(sourceFile));
>                     out = new BufferedWriter(new FileWriter(destFile));
573a577,591
>                     while (line != null) {
>                         if (line.length() == 0) {
>                             out.newLine();
>                         } else {
>                             newline = replace(line, filters);
>                             out.write(newline);
>                             out.newLine();
>                         }
>                         line = in.readLine();
>                     }
>                 } finally {
>                     if (out != null)
>                         out.close();
>                     if (in != null)
>                         in.close();
575,577d592
< 
<                 out.close();
<                 in.close();
579,587c594,595
<                 FileInputStream in = new FileInputStream(sourceFile);
<                 FileOutputStream out = new FileOutputStream(destFile);
< 
<                 byte[] buffer = new byte[8 * 1024];
<                 int count = 0;
<                 do {
<                     out.write(buffer, 0, count);
<                     count = in.read(buffer, 0, buffer.length);
<                 } while (count != -1);
---
>                 FileInputStream in = null;
>                 FileOutputStream out = null;
589,590c597,635
<                 in.close();
<                 out.close();
---
>                 try {
>                     in = new FileInputStream(sourceFile);
>                     out = new FileOutputStream(destFile);
>                     
>                     byte[] buffer = new byte[8 * 1024];
>                     int count = 0;
>                     do {
>                         out.write(buffer, 0, count);
>                         count = in.read(buffer, 0, buffer.length);
>                     } while (count != -1);
>                 } finally {
>                     if (in != null)
>                         in.close();
>                     if (out != null)
>                         out.close();
>                 }
>             }
>             
>             // Macs have meta info.  Copy it if we're on a Mac.
>             try {
>                 argRunnable CopyMetaInfo = (argRunnable)Class.
>                        
forName("org.apache.tools.ant.platform.mac.CopyMetaInfo").
>                         newInstance();
>                 CopyMetaInfo.run(new Object[] {sourceFile, destFile});
>             } catch (ClassNotFoundException e) {
>                 // ignore class not found exceptions
>             } catch (IllegalAccessException e) {
>                 throw new BuildException(e);
>             } catch (InstantiationException e) {
>                 throw new BuildException(e);
>             } catch (java.lang.reflect.InvocationTargetException e) {
>                 Throwable t = e.getTargetException();
>                 if (t instanceof IOException) {
>                     throw (IOException)t;
>                 } else if (t instanceof RuntimeException) {
>                     throw (RuntimeException)t;
>                 } else {
>                     throw new BuildException(t);
>                 }

Reply via email to