ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyril Sagan <cys...@unx.sas.com>
Subject <manifest>: add arbitrary set of properties?
Date Thu, 26 Jan 2006 21:36:24 GMT

In our current java build process, we'd like to be able to allow users
to add arbitrary items to the jar manifest.

But, 1) we won't know the attribute names, and 2) some builds will
have these "extra" manifest, some won't.

In the ideal solution, the build.xml would look something like this:
    <jar ... >
        <manifest>
            <attribute name="Specification-Vendor" value="ABC Vendor" />
            <attribute name="Implementation-Vendor" value="ABC Vendor" />
            <attribute name="Implementation-Vendor-Id" value="com.abc"/>
            <!-- for each property named manifest.* add here -->
        </manifest>
    </jar>
    

... and the user would be able to invoke ant like this:
    $ ant -Dmanifest.Foo=bar -Dmanifest.Color=green

The build.xml should find every property with the "manifest." prefix,
then add to the manifest.  The resulting manifest would then look like
this:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.6.5
    Created-By: 1.4.2_08-b03 (Sun Microsystems Inc.)
    Specification-Vendor: ABC Vendor
    Implementation-Vendor: ABC Vendor
    Implementation-Vendor-Id: com.abc
    Foo: Bar
    Color: Green

The only thing I can think of is to use a property set like this:
    <propertyset id="manifest-properties">
        <propertyref prefix="manifest.">
    </propertyset>

... and extend Manifest.java to take a propertyref id.

Does anyone have any better ideas/suggestions??  Thanks.

--Cyril

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message