Re: [PATCH] Support

From: Jephte CLAIN (Jephte.Clai..niv-reunion.fr)
Date: Tue Apr 07 2009 - 07:30:47 EDT

  • Next message: Mike Schrag: "Re: Project Template Questions"

    Mike Schrag a écrit :
    >> I have a few woproject projects that have been broken by WOCompile's
    >> NewBuildPathHotness revision. Attached is a patch I'd love to see
    >> accepted into WOProject that fixes it again for me.
    > I hate looking in this code ... your patch didn't appear to do any evil,
    > so I committed it.

    The patch has been committed:

       String frameworkjar = includedFrameworkFolderName+\
         "/Resources/Java/"+frameworkName.toLowerCase()+".jar";
       File frameworkLocation = new File(getDir(), frameworkjar);
       frameworkPath.createPathElement().setLocation(frameworkLocation);

    and then someone changed the code again:

       String jarDirName = includedFrameworkFolderName + File.separator\
         + "Resources" + File.separator + "Java";
       File jarDir = new File(getDir(), jarDirName);
       if (jarDir.isDirectory()) {
         File[] jars = jarDir.listFiles(new FilenameFilter() {
           public boolean accept(File dir, String name) {
             return (name.endsWith(".jar") || name.endsWith(".zip")) && \
                    !name.equals("src.jar");
           }
         });
         for (File jar : jars)
           frameworkPath.setLocation(jar);
         }

    But neither of these changes make use of the facilities provided by
    ExternalFolderFramework (they actually duplicate poorly some of the
    logic of ExternalFolderFramework). In fact, one can write instead.

       ExternalFolderFramework framework = new ExternalFolderFramework(
         getFrameworkRoot(),
         new File(getDir(), includedFrameworkFolderName));
       frameworks.add(framework);

    Plus, it solves somes problems with strange corner cases. The patch is
    attached below.

    -- 
    cordialement,
    Jephté Clain
    Centre des Resources Informatiques
    Tél. 0262 93 86 31
    Fax. 0262 93 81 06
    

    Index: woproject-ant-tasks/src/java/org/objectstyle/woproject/ant/FrameworkSet.java =================================================================== --- woproject-ant-tasks/src/java/org/objectstyle/woproject/ant/FrameworkSet.java (révision 5713) +++ woproject-ant-tasks/src/java/org/objectstyle/woproject/ant/FrameworkSet.java (copie de travail) ..-56,7 +56,6 @@ package org.objectstyle.woproject.ant; import java.io.File; -import java.io.FilenameFilter; import java.io.IOException; import java.util.Hashtable; import java.util.LinkedList; ..-292,17 +291,8 @@ } } else { - String jarDirName = includedFrameworkFolderName + File.separator + "Resources" + File.separator + "Java"; - File jarDir = new File(getDir(), jarDirName); - if (jarDir.isDirectory()) { - File[] jars = jarDir.listFiles(new FilenameFilter() { - public boolean accept(File dir, String name) { - return (name.endsWith(".jar") || name.endsWith(".zip")) && !name.equals("src.jar"); - } - }); - for (File jar : jars) - frameworkPath.setLocation(jar); - } + ExternalFolderFramework framework = new ExternalFolderFramework(getFrameworkRoot(), new File(getDir(), includedFrameworkFolderName)); + frameworks.add(framework); } } else {



    This archive was generated by hypermail 2.0.0 : Tue Apr 07 2009 - 07:31:53 EDT