ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service ComponentService.java
Date Wed, 01 May 2002 07:19:30 GMT
conor       02/05/01 00:19:30

  Modified:    proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib
                        AntLibManager.java
               proposal/mutant/src/java/antcore/org/apache/ant/antcore/config
                        AntConfig.java AntConfigHandler.java
               proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution
                        ComponentManager.java ExecutionManager.java
                        Frame.java
               proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system
                        LoadLib.java
               proposal/mutant/src/java/bootstrap/org/apache/ant/builder
                        Builder.java
               proposal/mutant/src/java/common/org/apache/ant/common/service
                        ComponentService.java
  Log:
  Fixes to the new config task stuff
  
  Revision  Changes    Path
  1.10      +11 -3     jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibManager.java
  
  Index: AntLibManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibManager.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -w -u -r1.9 -r1.10
  --- AntLibManager.java	30 Apr 2002 14:57:02 -0000	1.9
  +++ AntLibManager.java	1 May 2002 07:19:30 -0000	1.10
  @@ -166,9 +166,17 @@
               if (libraries.containsKey(libraryId)) {
                   AntLibrary currentVersion
                        = (AntLibrary) libraries.get(libraryId);
  +                // same location?
  +                AntLibrarySpec spec 
  +                    = (AntLibrarySpec) librarySpecs.get(libraryId); 
  +                URL specURL = spec.getLibraryURL();
  +                if (!specURL.equals(currentVersion.getDefinitionURL())) {
                   throw new ExecutionException("Ant Library \"" + libraryId
                        + "\" is already loaded from "
  -                     + currentVersion.getDefinitionURL());
  +                         + currentVersion.getDefinitionURL() 
  +                         + " new version found at " 
  +                         + specURL);
  +                }
               }
           }
   
  
  
  
  1.10      +0 -8      jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/config/AntConfig.java
  
  Index: AntConfig.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/config/AntConfig.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -w -u -r1.9 -r1.10
  --- AntConfig.java	30 Apr 2002 14:57:02 -0000	1.9
  +++ AntConfig.java	1 May 2002 07:19:30 -0000	1.10
  @@ -52,17 +52,9 @@
    * <http://www.apache.org/>.
    */
   package org.apache.ant.antcore.config;
  -import java.io.File;
  -import java.net.MalformedURLException;
  -import java.net.URL;
   import java.util.ArrayList;
  -import java.util.HashMap;
   import java.util.Iterator;
   import java.util.List;
  -import java.util.Map;
  -import org.apache.ant.common.util.ConfigException;
  -import org.apache.ant.common.util.PathTokenizer;
  -import org.apache.ant.init.InitUtils;
   import org.apache.ant.common.model.BuildElement;
   
   /**
  
  
  
  1.10      +0 -1      jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/config/AntConfigHandler.java
  
  Index: AntConfigHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/config/AntConfigHandler.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -w -u -r1.9 -r1.10
  --- AntConfigHandler.java	30 Apr 2002 14:57:02 -0000	1.9
  +++ AntConfigHandler.java	1 May 2002 07:19:30 -0000	1.10
  @@ -52,7 +52,6 @@
    * <http://www.apache.org/>.
    */
   package org.apache.ant.antcore.config;
  -import org.apache.ant.common.util.ConfigException;
   import org.apache.ant.antcore.xml.ElementHandler;
   import org.apache.ant.antcore.modelparser.BuildElementHandler;
   import org.xml.sax.Attributes;
  
  
  
  1.15      +8 -4      jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ComponentManager.java
  
  Index: ComponentManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ComponentManager.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -w -u -r1.14 -r1.15
  --- ComponentManager.java	30 Apr 2002 14:57:02 -0000	1.14
  +++ ComponentManager.java	1 May 2002 07:19:30 -0000	1.15
  @@ -111,7 +111,7 @@
        * These are AntLibraries which have been loaded into this component
        * manager
        */
  -    private Map antLibraries = new HashMap();
  +    private static Map antLibraries = new HashMap();
   
       /** dynamic libraries which have been defined */
       private Map dynamicLibraries;
  @@ -149,9 +149,12 @@
        * @param libLocation the file or URL of the library location
        * @param importAll if true all tasks are imported as the library is
        *      loaded
  +     * @param autoImport true if libraries in the Ant namespace should be
  +     *                   automatically imported.
        * @exception ExecutionException if the library cannot be loaded
        */
  -    public void loadLib(String libLocation, boolean importAll)
  +    public void loadLib(String libLocation, boolean importAll,
  +                        boolean autoImport)
            throws ExecutionException {
           try {
               Map librarySpecs = new HashMap();
  @@ -162,8 +165,9 @@
               Iterator i = librarySpecs.keySet().iterator();
               while (i.hasNext()) {
                   String libraryId = (String) i.next();
  -                if (importAll 
  -                    || libraryId.startsWith(Constants.ANT_LIB_PREFIX)) {
  +                boolean doAuto = autoImport 
  +                    && libraryId.startsWith(Constants.ANT_LIB_PREFIX);
  +                if (importAll || doAuto) {
                       importLibrary(libraryId);
                   }
               }
  
  
  
  1.17      +0 -4      jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionManager.java
  
  Index: ExecutionManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionManager.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -w -u -r1.16 -r1.17
  --- ExecutionManager.java	30 Apr 2002 14:57:02 -0000	1.16
  +++ ExecutionManager.java	1 May 2002 07:19:30 -0000	1.17
  @@ -52,13 +52,9 @@
    * <http://www.apache.org/>.
    */
   package org.apache.ant.antcore.execution;
  -import java.net.MalformedURLException;
  -import java.net.URL;
  -import java.util.HashMap;
   import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
  -import org.apache.ant.antcore.antlib.AntLibManager;
   import org.apache.ant.antcore.config.AntConfig;
   import org.apache.ant.common.event.BuildListener;
   import org.apache.ant.common.model.Project;
  
  
  
  1.22      +2 -4      jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Frame.java
  
  Index: Frame.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/Frame.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -w -u -r1.21 -r1.22
  --- Frame.java	30 Apr 2002 14:57:02 -0000	1.21
  +++ Frame.java	1 May 2002 07:19:30 -0000	1.22
  @@ -153,8 +153,6 @@
       /**
        * Create an Execution Frame for the given project
        *
  -     * @param standardLibs The libraries of tasks and types available to this
  -     *      frame
        * @param config the user config to use for this execution of Ant
        * @param initConfig Ant's initialisation config
        * @exception ExecutionException if a component of the library cannot be
  @@ -951,14 +949,14 @@
               // load system ant lib
               URL systemLibs 
                   = new URL(initConfig.getLibraryURL(), "syslibs/");
  -            componentManager.loadLib(systemLibs.toString(), true);
  +            componentManager.loadLib(systemLibs.toString(), true, true);
               
               // execute any config tasks
               executeTasks(config.getTasks());
       
               // now load other system libraries
               URL antLibs = new URL(initConfig.getLibraryURL(), "antlibs/");
  -            componentManager.loadLib(antLibs.toString(), false);                      
    
  +            componentManager.loadLib(antLibs.toString(), false, true);
               
               executeTasks(project.getTasks());
           } catch (MalformedURLException e) {
  
  
  
  1.4       +1 -1      jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/LoadLib.java
  
  Index: LoadLib.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/org/apache/ant/antlib/system/LoadLib.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -u -r1.3 -r1.4
  --- LoadLib.java	18 Mar 2002 02:44:26 -0000	1.3
  +++ LoadLib.java	1 May 2002 07:19:30 -0000	1.4
  @@ -151,7 +151,7 @@
           AntContext context = getAntContext();
           ComponentService componentService = (ComponentService)
               context.getCoreService(ComponentService.class);
  -        componentService.loadLib(url.toString(), importAll);
  +        componentService.loadLib(url.toString(), importAll, false);
       }
   
       /**
  
  
  
  1.19      +21 -22    jakarta-ant/proposal/mutant/src/java/bootstrap/org/apache/ant/builder/Builder.java
  
  Index: Builder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/bootstrap/org/apache/ant/builder/Builder.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -w -u -r1.18 -r1.19
  --- Builder.java	30 Apr 2002 14:57:02 -0000	1.18
  +++ Builder.java	1 May 2002 07:19:30 -0000	1.19
  @@ -53,7 +53,6 @@
    */
   package org.apache.ant.builder;
   import java.io.File;
  -import java.io.FilenameFilter;
   import java.util.ArrayList;
   
   import java.util.List;
  @@ -90,7 +89,7 @@
       /** the input root */
       private static final File INPUT_ROOT
            = new File(PACKAGE_ROOT, "input");
  -         
  +    /** the input root */
            
       /** the root forthe depend task's support classes */
       private static final File DEPEND_ROOT
  @@ -107,24 +106,25 @@
       }
   
       /**
  -     * Add all the java files fro, a given directory.
  +     * Add all the java files from a given directory.
        *
        * @param files the list to which the files are to be added.
        * @param dir the directory from which the Java files are added.
  +     * @param recurse true if subdirectories should be searched.
        */
  -    private void addJavaFiles(List files, File dir) {
  -        File[] javaFiles = dir.listFiles(new FilenameFilter() {
  -            public boolean accept(File dir, String name) {
  -                return name.endsWith(".java");
  -            }
  -        });
  +    private void addJavaFiles(List files, File dir, boolean recurse) {
  +        File[] javaFiles = dir.listFiles();
           
           if (javaFiles != null) {
               for (int i = 0; i < javaFiles.length; ++i) {
  +                if (javaFiles[i].isDirectory() && recurse) {
  +                    addJavaFiles(files, javaFiles[i], recurse);
  +                } else if (javaFiles[i].getName().endsWith(".java")) {
                   files.add(javaFiles[i]);
               }
           }
       }
  +    }
       
       /**
        * Get the Ant1 files currently required to build a bootstrap build.
  @@ -134,18 +134,17 @@
        */
       private File[] getAnt1Files() {
           List files = new ArrayList();
  -        addJavaFiles(files, TASKDEFS_ROOT);
  -        addJavaFiles(files, new File(TASKDEFS_ROOT, "compilers"));
  -        addJavaFiles(files, new File(TASKDEFS_ROOT, "condition"));
  -        addJavaFiles(files, DEPEND_ROOT);
  -        addJavaFiles(files, new File(DEPEND_ROOT, "constantpool"));
  -        addJavaFiles(files, TYPES_ROOT);
  -        addJavaFiles(files, FILTERS_ROOT);
  -        addJavaFiles(files, UTIL_ROOT);
  -        addJavaFiles(files, new File(UTIL_ROOT, "depend"));
  -        addJavaFiles(files, ZIP_ROOT);
  -        addJavaFiles(files, new File(UTIL_ROOT, "facade"));
  -        addJavaFiles(files, INPUT_ROOT);
  +        addJavaFiles(files, TASKDEFS_ROOT, false);
  +        addJavaFiles(files, new File(TASKDEFS_ROOT, "compilers"), true);
  +        addJavaFiles(files, new File(TASKDEFS_ROOT, "condition"), true);
  +        addJavaFiles(files, DEPEND_ROOT, true);
  +        addJavaFiles(files, TYPES_ROOT, true);
  +        addJavaFiles(files, FILTERS_ROOT, false);
  +        addJavaFiles(files, UTIL_ROOT, false);
  +        addJavaFiles(files, new File(UTIL_ROOT, "depend"), false);
  +        addJavaFiles(files, new File(UTIL_ROOT, "facade"), true);
  +        addJavaFiles(files, ZIP_ROOT, true);
  +        addJavaFiles(files, INPUT_ROOT, true);
   
           files.add(new File(PACKAGE_ROOT, "BuildException.java"));
           files.add(new File(PACKAGE_ROOT, "Location.java"));
  
  
  
  1.12      +3 -1      jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/ComponentService.java
  
  Index: ComponentService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/service/ComponentService.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -w -u -r1.11 -r1.12
  --- ComponentService.java	17 Apr 2002 15:51:07 -0000	1.11
  +++ ComponentService.java	1 May 2002 07:19:30 -0000	1.12
  @@ -77,10 +77,12 @@
        * @param libLocation the location of the library or the libraries
        * @param importAll true if all components of the loaded libraries
        *      should be imported
  +     * @param autoImport true if libraries in the Ant namespace should be
  +     *                   automatically imported.
        * @exception ExecutionException if the library or libraries cannot be
        *      imported.
        */
  -    void loadLib(String libLocation, boolean importAll)
  +    void loadLib(String libLocation, boolean importAll, boolean autoImport)
            throws ExecutionException;
   
       /**
  
  
  

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


Mime
View raw message