ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 11756] New: - jar/zip isUpToDate returns true if files are not in the zip. It should return false.
Date Thu, 15 Aug 2002 23:57:37 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11756>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11756

jar/zip isUpToDate returns true if files are not in the zip.  It should return false.

           Summary: jar/zip isUpToDate returns true if files are not in the
                    zip.  It should return false.
           Product: Ant
           Version: 1.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Core tasks
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: scott@alodar.com


See discussion at:

http://marc.theaimsgroup.com/?l=ant-user&m=102813021322034&w=2

My goal:

Create a jar that may have resources from an optional "resources" directory.  If that 
directory does not exist, do nothing.

One way to approach this is to use the update="true" attribute of the jar task.

Currently, the 1.5 release code believes that the jar is up to date if it has a later date
than 
the files in the resources directory, even if they are not in the jar.  This is counterintuitive

to me.

One workaround is to touch the jar to be earlier if the files exist, but then the jar is rebuilt

whenever resources exist.  This is bad for build times, especially if a jar depended on by

other steps has resources.

Example using touch:

  <target name="jar-files" description="Jar files">
    <available file="${jar.resources}" type="dir" property="jar.resources.exists" />
    <jar
      jarfile="${jar.dist}/${jar.baseName}.jar"
      compress="${jar.compress}" >
      <fileset dir="${compile.classes}"/>
    </jar>
  </target>

  <target name="jar-resources" if="jar.resources.exists" description="Add resources to

jar">
    <!-- icky hack, as jar only checks file timestamps in 1.5.  If they check internal

timestamps as 1.4 did, this can be removed. -->
    <touch file="${jar.dist}/${jar.baseName}.jar" datetime="01/01/2000 2:02 pm"/>
    <jar
      jarfile="${jar.dist}/${jar.baseName}.jar"
      compress="${jar.compress}"
      update="true">
      <zipfileset dir="${jar.resources}" />
    </jar>
  </target>

What I would prefer:

  <target name="jar-files" description="Jar files">
    <available file="${jar.resources}" type="dir" property="jar.resources.exists" />
    <jar
      jarfile="${jar.dist}/${jar.baseName}.jar"
      compress="${jar.compress}" >
      <fileset dir="${compile.classes}"/>
    </jar>
  </target>

  <target name="jar-resources" if="jar.resources.exists" description="Add resources to

jar">
    <jar
      jarfile="${jar.dist}/${jar.baseName}.jar"
      compress="${jar.compress}"
      update="true">
      <zipfileset dir="${jar.resources}" />
    </jar>
  </target>

If files in the "resources" directory are newer than their counterpart in the jar, or if they
do 
not exist is the jar, a rebuild should be triggered.

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