ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Campbell" <CCAMPB...@novell.com>
Subject Re: [PATCH] AntStructure - separate core tasks from optional tasksin a dtd
Date Thu, 25 Oct 2001 15:50:32 GMT
Here's the file diffs of AntStructure.  Sorry I forgot to send it with the patch.
 
Craig
 
 
Index: ./src/main/org/apache/tools/ant/taskdefs/AntStructure.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/AntStructure.java,v
retrieving revision 1.14
diff -r1.14 AntStructure.java
87c87,89
<     private File output;
---
>     private File core;
>     private File optional;
>     private boolean merge = false;
92,93c94,103
<     public void setOutput(File output) {
<         this.output = output;
---
>     public void setCore(File core) {
>         this.core = core;
>     }
> 
>     public void setOptional(File optional)  {
>         this.optional = optional;
>     }
> 
>     public void setMerge(boolean merge) {
>         this.merge = merge;
98c108
<         if (output == null) {
---
>         if (core == null) {
101c111,144
<         
---
> 
>         if (optional == null)    {
>             /*
>              * If optional is not specified create a seperate file
>              */
>             optional = new File(core.getParentFile() + File.separator +
>                 "optional_" + core.getName());
>         }
> 
>         Enumeration tasks = project.getTaskDefinitions().keys();
>         Hashtable coreTasks = new Hashtable();
>         Hashtable optionalTasks = new Hashtable();
>         while (tasks.hasMoreElements()) {
>             String taskName = (String) tasks.nextElement();
>             Class taskClass = (Class)project.getTaskDefinitions().get(taskName);
>             if(merge)  {
>                 coreTasks.put(taskName, taskClass);
>             }
>             else    {
>                 if(taskClass.getPackage().equals(this.getClass().getPackage()))
>                     coreTasks.put(taskName, taskClass);
>                 else
>                     optionalTasks.put(taskName, taskClass);
>             }
>         }
> 
> 
>         createDTD(core, coreTasks);
> 
>         if(!merge)
>             createDTD(optional, optionalTasks);
>     }
> 
>     private void createDTD(File output, Hashtable tasks) throws BuildException {
105c148,149
<                 out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(output),
"UTF8"));
---
>                 out = new PrintWriter(new OutputStreamWriter(
>                         new FileOutputStream(output), "UTF8"));
115,116c159,160
<             
<             printHead(out, project.getTaskDefinitions().keys(), 
---
> 
>             printHead(out, tasks.keys(),
118a163
> 
124c169
<                 printElementDecl(out, typeName, 
---
>                 printElementDecl(out, typeName,
127,133d171
<             
<             Enumeration tasks = project.getTaskDefinitions().keys();
<             while (tasks.hasMoreElements()) {
<                 String taskName = (String) tasks.nextElement();
<                 printElementDecl(out, taskName, 
<                                  (Class) project.getTaskDefinitions().get(taskName));
<             }
135c173
<             printTail(out);
---
>             printElements(out, tasks.keys());
137,138c175,178
<         } catch (IOException ioe) {
<             throw new BuildException("Error writing "+output.getAbsolutePath(),
---
>             printTail(out);
>         }
>         catch(IOException ioe)  {
>             throw new BuildException("Error writing " + output.getAbsolutePath(),
147c187
<     private void printHead(PrintWriter out, Enumeration tasks, 
---
>     private void printHead(PrintWriter out, Enumeration tasks,
177c217
<         
---
> 
206c246,256
<     private void printElementDecl(PrintWriter out, String name, Class element) 
---
>     private void printElements(PrintWriter out, Enumeration tasks) throws BuildException
{
> 
>         while (tasks.hasMoreElements()) {
>             String taskName = (String)tasks.nextElement();
> 
>             Class taskClass = (Class)project.getTaskDefinitions().get(taskName);
>             printElementDecl(out, taskName, taskClass);
>         }
>     }
> 
>     private void printElementDecl(PrintWriter out, String name, Class element)
274c324
<         
---
> 
279c329
<             
---
> 
282c332
<             if (type.equals(java.lang.Boolean.class) || 
---
>             if (type.equals(java.lang.Boolean.class) ||
285c335
<             } else if (org.apache.tools.ant.types.Reference.class.isAssignableFrom(type))
{ 
---
>             } else if (org.apache.tools.ant.types.Reference.class.isAssignableFrom(type))
{
289c339
<                     EnumeratedAttribute ea = 
---
>                     EnumeratedAttribute ea =
329c379
<     
---
> 


Mime
View raw message