commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <pe...@apache.org>
Subject jarlib-* tasks
Date Thu, 04 Apr 2002 13:23:33 GMT
Hi,

Over last few days I have been working on extracting some tasks from another 
project I was working on. These tasks basically aimed at helping manage 
"Optional Packages" (previously known as "Extensions" and before that 
"Standard Extensions"). These are basically the standard library format for 
most of newer specifications (servlet, ejb etc).

Basically what these specifications demand is a certain set of attributes in 
a jars manifest. One example of attributes required for an extension would be

Extension-Name: org.realityforge.dve 
Specification-Version: 1.0 
Specification-Vendor: Peter Donald 

Which declares a basic extension. You can read more about these extension 
specifications at 

http://java.sun.com/j2se/1.3/docs/guide/extensions/versioning.html. 

or at

http://jakarta.apache.org/ant/myrmidon/librarys.html

under dependencies.

Anyhow I have got two basic tasks going in myrmidon that I will backport to 
ant1.x and these are; jarlib-display and jarlib-manifest

* jarlib-display: this task will basically display all the Extensions a task
  implements or depends upon. It also displays the Package Specification that 
  a library implements. Some examples of task in action would be

        <jarlib-display file="../../src/ant1compat/jar/ant.jar"/> 
        <jarlib-display> 
            <fileset dir="../../"> 
                <include name="src/ant1compat/jar/*.jar"/> 
                <include name="lib/*.jar"/> 
            </fileset> 
        </jarlib-display> 

  The first would display only the information  in single jar while second 
form would display information in all the jars. The information comes out 
looking somethin like
  
----------------------------------------------------------------------------------
File: 
/mnt/dos-e/projects/jakarta-ant/proposal/myrmidon/src/ant1compat/jar/ant.jar
----------------------------------------------------------------------------------
Extensions Supported By Library:
Extension-Name: org.apache.tools.ant
Specification-Version: 1.4.9
Specification-Vendor: Apache Software Foundation
Implementation-Version: 1.4.9
Implementation-Vendor: Apache Software Foundation

Specifications Supported By Library:
Sections:  org/apache/tools/ant
Specification-Title: Apache Ant
Specification-Version: 1.4.9
Specification-Vendor: Apache Software Foundation
Implementation-Title: org.apache.tools.ant
Implementation-Version: 1.4.9
Implementation-Vendor: Apache Software Foundation

* jarlib-manifest: this task aims to make it easier to generate manifest that 
contain all the correct dependency information. An example invocation of taks 
would be 

        <jarlib-manifest 
            destfile="../../generated-manifest.txt" 
            extension-name="org.realityforge.dve" 
            specification-version="1.0" 
            specification-vendor="Peter Donald" > 
            <attribute name="Main-class" 
                       value="org.realityforg.dve.WorldGen"/> 
            <depends dir="../../"> 
                <include name="src/ant1compat/jar/*.jar"/> 
            </depends> 
            <depends dir="../../"> 
                <include name="lib/*.jar"/> 
            </depends> 
        </jarlib-manifest> 

This would generate a manifest with the specified extension, an extra 
attribute "Main-class" in the main section and all the dependency info. A 
sample output may be

Manifest-Version: 1.0 
Created-By: Myrmidon @@VERSION@@ compiled on @@DATE@@ 
Extension-Name: org.realityforge.dve 
Specification-Version: 1.0 
Specification-Vendor: Peter Donald 
Main-class: org.realityforg.dve.WorldGen 
Extension-List: lib0 lib1 
lib0-Extension-Name: org.apache.tools.ant 
lib0-Specification-Version: 1.4.9 
lib0-Specification-Vendor: Apache Software Foundation 
lib1-Extension-Name: org.apache.tools.ant.taskdefs.optional 
lib1-Specification-Vendor: Apache Software Foundation 
lib1-Specification-Version: 1.4.9 

Notice that by default you don't include the "implementation" details in the 
dependencies generated (at least not by default). To turn on dependency on a 
specific implementation of a library you could specify the attribute 
includeImpl="true" and it would generate

Manifest-Version: 1.0 
Created-By: Myrmidon @@VERSION@@ compiled on @@DATE@@ 
Extension-Name: org.realityforge.dve 
Specification-Version: 1.0 
Specification-Vendor: Peter Donald 
Main-class: org.realityforg.dve.WorldGen 
Extension-List: lib0 lib1 
lib0-Extension-Name: org.apache.tools.ant 
lib0-Specification-Version: 1.4.9 
lib0-Specification-Vendor: Apache Software Foundation 
lib0-Implementation-Version: 1.4.9 
lib0-Implementation-Vendor: Apache Software Foundation 
lib1-Extension-Name: org.apache.tools.ant.taskdefs.optional 
lib1-Specification-Vendor: Apache Software Foundation 
lib1-Implementation-Vendor: Apache Software Foundation 
lib1-Implementation-Version: 1.4.9 
lib1-Specification-Version: 1.4.9 
 
You can also turn on exposure of the Implementation-URL attribute by setting 
the attribute includeURL="true" on the filesets. In the cases where the 
library itself does not contain the implementation-URL attribute you can add 
the baseURL=".." , the javadocs for this attribute are as follows

   /** 
     * String that is the base URL for the librarys 
     * when constructing the "Implementation-URL" 
     * attribute. For instance setting the base to 
     * "http://jakarta.apache.org/avalon/libs/" and then 
     * including the library "excalibur-cli-1.0.jar" in the 
     * fileset will result in the "Implementation-URL" attribute 
     * being set to 
"http://jakarta.apache.org/avalon/libs/excalibur-cli-1.0.jar" 
     * 
     * Note this is only used if the library does not define 
     * "Implementation-URL" itself. 
     * 
     * Note that this also implies includeURL=true 
     */ 


Anyways before I port it across to ant1.x is there any functionality 
requests? The primary reason for creating this is to make projects like 
commons and excalibur easier to manage. Basically they all have lots of 
little libraries and these tasks are the start of making the dependency 
tracking partially-automated.

Anyways before I go ahead and do all this - requests? complaints? suggestions?

-- 
Cheers,

Pete

*------------------------------------------------------*
| "Computers are useless. They can only give you       |
|            answers." - Pablo Picasso                 |
*------------------------------------------------------*

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


Mime
View raw message