ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/script ScriptDef.java
Date Fri, 15 Aug 2003 08:51:10 GMT
peterreilly    2003/08/15 01:51:10

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/script
                        ScriptDef.java
  Log:
  make scriptdef an antlibbable definition
  derive from DefBase and use the uri for the name
  this change also provides the classloader attributes
  and elements from DefBase to ScriptDef
  use the DefBase classloader
  
  Revision  Changes    Path
  1.6       +14 -3     ant/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java
  
  Index: ScriptDef.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/script/ScriptDef.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ScriptDef.java	20 Jul 2003 09:34:21 -0000	1.5
  +++ ScriptDef.java	15 Aug 2003 08:51:10 -0000	1.6
  @@ -53,10 +53,13 @@
    */
   package org.apache.tools.ant.taskdefs.optional.script;
   
  +import org.apache.tools.ant.AntTypeDefinition;
  +import org.apache.tools.ant.ComponentHelper;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.MagicNames;
  -import org.apache.tools.ant.Task;
   import org.apache.tools.ant.BuildException;
  +import org.apache.tools.ant.ProjectHelper;
  +import org.apache.tools.ant.taskdefs.DefBase;
   
   import java.util.Map;
   import java.util.HashMap;
  @@ -75,7 +78,7 @@
    * @author Conor MacNeill
    * @since Ant 1.6
    */
  -public class ScriptDef extends Task {
  +public class ScriptDef extends DefBase {
       /** Used to run the script */
       private ScriptRunner runner = new ScriptRunner();
   
  @@ -268,8 +271,13 @@
               }
           }
   
  +        name = ProjectHelper.genComponentName(getUri(), name);
           scriptRepository.put(name, this);
  -        project.addTaskDefinition(name, ScriptDefBase.class);
  +        AntTypeDefinition def = new AntTypeDefinition();
  +        def.setName(name);
  +        def.setClass(ScriptDefBase.class);
  +        ComponentHelper.getComponentHelper(
  +            getProject()).addDataTypeDefinition(def);
       }
   
       /**
  @@ -294,9 +302,12 @@
                   instance = getProject().createDataType(definition.type);
               }
           } else {
  +            /*
               // try the context classloader
               ClassLoader loader
                   = Thread.currentThread().getContextClassLoader();
  +            */
  +            ClassLoader loader = createLoader();
   
               Class instanceClass = null;
               try {
  
  
  

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


Mime
View raw message