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/src/main/org/apache/tools/ant/taskdefs/optional/ejb GenericDeploymentTool.java
Date Thu, 30 May 2002 15:20:31 GMT
conor       02/05/30 08:20:31

  Modified:    .        Tag: ANT_15_BRANCH WHATSNEW
               src/main/org/apache/tools/ant/taskdefs/optional/ejb Tag:
                        ANT_15_BRANCH GenericDeploymentTool.java
  Log:
  Fix up naming of manifest files to be included in jars
  Make sure the manifest is considered when checking if jar is up to date
  
  PR:	7538
  Reported by:	gilbode@yahoo.com (Mike Gilbode)
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.263.2.26 +13 -8     jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.263.2.25
  retrieving revision 1.263.2.26
  diff -u -w -u -r1.263.2.25 -r1.263.2.26
  --- WHATSNEW	30 May 2002 13:22:48 -0000	1.263.2.25
  +++ WHATSNEW	30 May 2002 15:20:31 -0000	1.263.2.26
  @@ -92,6 +92,16 @@
   
   * BeanShell is now supported in the <script> task.
   
  +* <ejbjar> under Weblogic attempts to use the ejbc20 compiler for 2.0 beans
  +  based on the deployment descriptor's DTD reference. Under weblogic 7.00 Beta
  +  this ejbc class has been deprecated. To avoid the deprecation warning use
  +  ejbcclass="weblogic.ejbc".
  +
  +* <ejbjar> will add a manifest to the generated jar based on the naming
  +  convention in use. This overrides the manifest specified in the
  +  <ejbjar> attribute
  +
  +
   Changes from Ant 1.4.1 to 1.5beta1
   ==================================
   
  @@ -218,11 +228,6 @@
     defines which classes are added. The addition of classes now uses
     the Jakarta-BCEL library rather than reflection, meaning bean classes are
     no longer loaded into Ant's JVM.
  -
  -* <ejbjar> under Weblogic attempts to use the ejbc20 compiler for 2.0 beans
  -  based on the deployment descriptor's DTD reference. Under weblogic 7.00 Beta
  -  this ejbc class has been deprecated. To avoid the deprecation warning use
  -  ejbcclass="weblogic.ejbc".
   
   * <available> has a new attribute named ignoreSystemClasses.
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.37.2.1  +51 -27    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java
  
  Index: GenericDeploymentTool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java,v
  retrieving revision 1.37
  retrieving revision 1.37.2.1
  diff -u -w -u -r1.37 -r1.37.2.1
  --- GenericDeploymentTool.java	14 Apr 2002 11:16:18 -0000	1.37
  +++ GenericDeploymentTool.java	30 May 2002 15:20:31 -0000	1.37.2.1
  @@ -97,6 +97,9 @@
       /** The standard META-INF directory in jar files */
       protected static final String META_DIR  = "META-INF/";
   
  +    /** The standard MANIFEST file */
  +    protected static final String MANIFEST  = META_DIR + "MANIFEST.MF";
  +
       /** Name for EJB Deployment descriptor within EJB jars */
       protected static final String EJB_DD    = "ejb-jar.xml";
   
  @@ -429,6 +432,13 @@
   
               String ddPrefix = getVendorDDPrefix(baseName, descriptorFileName);
   
  +            File manifestFile = getManifestFile(ddPrefix);
  +            if (manifestFile != null) {
  +                ejbFiles.put(MANIFEST, manifestFile);
  +            }
  +
  +
  +
               // First the regular deployment descriptor
               ejbFiles.put(META_DIR + EJB_DD,
                            new File(config.descriptorDir, descriptorFileName));
  @@ -698,14 +708,6 @@
           if (jarFile.exists()) {
               long lastBuild = jarFile.lastModified();
   
  -            if (config.manifest != null && config.manifest.exists() &&
  -                config.manifest.lastModified() > lastBuild) {
  -                log("Build needed because manifest " + config.manifest + " is out of date",
  -                    Project.MSG_VERBOSE);
  -                return true;
  -            }
  -
  -
               Iterator fileIter = ejbFiles.values().iterator();
   
               // Loop through the files seeing if any has been touched
  @@ -736,6 +738,30 @@
       }
   
       /**
  +     * Get the manifets file to use for building the generic jar.
  +     *
  +     * If the file does not exist the global manifest from the config is used
  +     * otherwise the default Ant manifest will be used.
  +     *
  +     * @param prefix the prefix where to llook for the manifest file based on
  +     *        the naming convention.
  +     *
  +     * @return the manifest file or null if the manifest file does not exist
  +     */
  +    protected File getManifestFile(String prefix) {
  +        File manifestFile
  +            = new File(getConfig().descriptorDir, prefix + "manifest.mf");
  +        if (manifestFile.exists()) {
  +            return manifestFile;
  +        }
  +
  +        if (config.manifest != null) {
  +            return config.manifest;
  +        }
  +        return null;
  +    }
  +
  +    /**
        * Method used to encapsulate the writing of the JAR file. Iterates over the
        * filenames/java.io.Files in the Hashtable stored on the instance variable
        * ejbFiles.
  @@ -762,15 +788,9 @@
               InputStream in = null;
               Manifest manifest = null;
               try {
  -                File manifestFile = new File(getConfig().descriptorDir, baseName + "-manifest.mf");
  -                if (manifestFile.exists()) {
  +                File manifestFile = (File) files.get(MANIFEST);
  +                if (manifestFile != null && manifestFile.exists()) {
                       in = new FileInputStream(manifestFile);
  -                } else if (config.manifest != null) {
  -                    in = new FileInputStream(config.manifest);
  -                    if (in == null) {
  -                        throw new BuildException("Could not find manifest file: " + config.manifest,
  -                                                  getLocation());
  -                    }
                   } else {
                       String defaultManifest = "/org/apache/tools/ant/defaultManifest.mf";
                       in = this.getClass().getResourceAsStream(defaultManifest);
  @@ -797,6 +817,10 @@
               // Loop through all the class files found and add them to the jar
               for (Iterator entryIterator = files.keySet().iterator(); entryIterator.hasNext();)
{
                   String entryName = (String) entryIterator.next();
  +                if (entryName.equals(MANIFEST)) {
  +                    continue;
  +                }
  +
                   File entryFile = (File) files.get(entryName);
   
                   log("adding file '" + entryName + "'",
  
  
  

--
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