Jump to: navigation, search

JarProcessor Options/Examples

< JarProcessor Options
Revision as of 14:32, 25 April 2011 by David williams.us.ibm.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

I began my education to "pack.properties" with information provided by Kim Moir, in bug 178723#c9. But here's some additional information on how this turned into practice.


Orbit

In Orbit builds, we use the pack.properties file to exclude pre-built bundles from conditioning, though we still sign the pre-built bundles with "Eclipse certificate" under the assumption they have already been conditioned.

A typical example from an orbit build would look like the following (note the "pack.excludes" is one long line, even if not displayed that way):

pack200.default.args=-E4
pack.excludes=eclipse/plugins/com.ibm.icu_4.0.1.v20100112.jar,eclipse/plugins/com.ibm.icu_4.2.1.v20100412.jar,eclipse/plugins/com.ibm.icu_4.4.2.v20110208.jar,eclipse/plugins/com.ibm.icu.base_4.0.1.v20090822.jar,eclipse/plugins/com.ibm.icu.base_4.2.1.v20100412.jar,eclipse/plugins/com.ibm.icu.base_4.4.2.v20110208.jar,eclipse/plugins/com.ibm.icu.base.source_4.0.1.v20090822.jar,eclipse/plugins/com.ibm.icu.base.source_4.2.1.v20100412.jar,eclipse/plugins/com.ibm.icu.base.source_4.4.2.v20110208.jar,eclipse/plugins/com.ibm.icu.source_4.0.1.v20100112.jar,eclipse/plugins/com.ibm.icu.source_4.2.1.v20100412.jar,eclipse/plugins/com.ibm.icu.source_4.4.2.v20110208.jar,eclipse/plugins/org.sat4j.core_2.0.3.v20081021.jar,eclipse/plugins/org.sat4j.core_2.1.0.v20090520.jar,eclipse/plugins/org.sat4j.core_2.1.1.v20090825.jar,eclipse/plugins/org.sat4j.core_2.2.0.v20100429.jar,eclipse/plugins/org.sat4j.pb_2.0.3.v20081021.jar,eclipse/plugins/org.sat4j.pb_2.1.0.v20090520.jar,eclipse/plugins/org.sat4j.pb_2.1.1.v20090825.jar,eclipse/plugins/org.sat4j.pb_2.2.0.v20100429.jar

This is generated each build, by ant scripts, partially based on "hard coded" data and partially based on the specific jars that are found to be "pre-built" (likely a concept specific to Orbit).

Note that the entries in "pack.excludes" are prefixed by "eclipse/plugins/" since we build our zip-to-be signed with that directory structure.

To see the actual ant script, see the "updatePackProperties" task in

org.eclipse.orbit.releng.builder/scripts/build/buildutilities.xml
repository: /cvsroot/tools
module: org.eclipse.orbit/org.eclipse.orbit.releng.builder

Here's the task verbatim, at the time of this writing in case it suffices. Note, it is pretty much impossible that this task will work "as is" for anyone except the Orbit project, but might serve as an example on how to write your own task, specific for your build setup.

If you are just getting started, you might start with a more "hard coded" example, then make it more dynamic once that works.

   <target
       name="updatePackProperties">
       <copy
           todir="${buildDirectory}"
           overwrite="true"
           file="${builder.home}/rootfiles/pack.properties"/>
       <property
           name="packproperties"
           value="${buildDirectory}/updatePackProperties.txt"/>
       <delete
           file="${packproperties}"
           failonerror="false"
           quiet="true"/>
       <apply
           executable="ls"
           output="${packproperties}"
           dir="${buildDirectory}"
           relative="true"
           parallel="true"
           append="true">
           <arg
               value="-d"/>
           <fileset
               dir="${buildDirectory}"
               includes="plugins/com.ibm.icu*,plugins/com.jcraft.jsch*,plugins/org.sat4j*"/>
       </apply>


       <copy
           file="${packproperties}"
           tofile="${buildDirectory}/tempSave_updatePackProperties.txt"/>
       <replaceregexp
           flags="gm"
           file="${packproperties}"
           match="^.*plugins"
           replace="eclipse/plugins"/>
  
       <copy
           file="${packproperties}"
           tofile="${buildDirectory}/tempSave_updatePackProperties2.txt"/>
       <replaceregexp
           flags="g"
           file="${packproperties}"
           match="\n([^ ])"
           replace=",\1"/>
       <loadfile
           property="pack.properties"
           srcFile="${packproperties}"/>

       <replace
           file="${buildDirectory}/pack.properties"
           token="@excludejars@"
           value="${pack.properties}"/>
   </target>


Web Tools Platform

In the Web Tools project, we use a custom java task to update the pack.properties file. In that custom task, we take a quick peek at the "jars to be signed" and use some simple heuristics to see which are already signed, and exclude those. Those heuristics will not be correct for everyone, fairly specific to how we do builds in Eclipse Web Tools. Note that in webtools, if we find a jar already signed, we exclude it from both conditioning and signing.

pack200.default.args=-E4 pack.excludes=plugins/org.apache.commons.codec_1.3.0.v201101211617.jar,plugins/org.apache.xerces_2.9.0.v201101211617.jar,plugins/org.apache.commons.codec.source_1.3.0.v201101211617.jar,plugins/org.apache.wsil4j_1.0.0.v200901211807.jar,plugins/org.uddi4j_2.0.5.v200805270300.jar,plugins/org.apache.xml.serializer_2.7.1.v201005080400.jar,plugins/javax.xml.stream_1.0.1.v201004272200.jar,plugins/javax.xml.ws_2.1.0.v200902101523.jar,plugins/javax.xml_1.3.4.v201005080400.jar,plugins/javax.xml.rpc_1.1.0.v201005080400.jar,plugins/org.apache.commons.logging_1.0.4.v201101211617.jar,plugins/org.apache.log4j_1.2.15.v201012070815.jar,plugins/org.apache.xml.resolver_1.2.0.v201005080400.jar,plugins/javax.wsdl_1.6.2.v201012040545.jar,plugins/javax.wsdl_1.5.1.v201012040544.jar,plugins/javax.jws_2.0.0.v201005080400.jar,plugins/org.jdom_1.1.1.v201101151400.jar,plugins/javax.xml.soap_1.2.0.v201005080501.jar,plugins/org.apache.commons.logging.source_1.0.4.v201101211617.jar,plugins/javax.activation_1.1.0.v201005080500.jar,plugins/javax.xml.bind_2.1.9.v201005080401.jar,plugins/org.apache.commons.discovery_0.2.0.v201004190315.jar,plugins/org.apache.axis_1.4.0.v201005080400.jar,plugins/javax.mail_1.4.0.v201005080615.jar sign.excludes=plugins/org.apache.commons.codec_1.3.0.v201101211617.jar,plugins/org.apache.xerces_2.9.0.v201101211617.jar,plugins/org.apache.commons.codec.source_1.3.0.v201101211617.jar,plugins/org.apache.wsil4j_1.0.0.v200901211807.jar,plugins/org.uddi4j_2.0.5.v200805270300.jar,plugins/org.apache.xml.serializer_2.7.1.v201005080400.jar,plugins/javax.xml.stream_1.0.1.v201004272200.jar,plugins/javax.xml.ws_2.1.0.v200902101523.jar,plugins/javax.xml_1.3.4.v201005080400.jar,plugins/javax.xml.rpc_1.1.0.v201005080400.jar,plugins/org.apache.commons.logging_1.0.4.v201101211617.jar,plugins/org.apache.log4j_1.2.15.v201012070815.jar,plugins/org.apache.xml.resolver_1.2.0.v201005080400.jar,plugins/javax.wsdl_1.6.2.v201012040545.jar,plugins/javax.wsdl_1.5.1.v201012040544.jar,plugins/javax.jws_2.0.0.v201005080400.jar,plugins/org.jdom_1.1.1.v201101151400.jar,plugins/javax.xml.soap_1.2.0.v201005080501.jar,plugins/org.apache.commons.logging.source_1.0.4.v201101211617.jar,plugins/javax.activation_1.1.0.v201005080500.jar,plugins/javax.xml.bind_2.1.9.v201005080401.jar,plugins/org.apache.commons.discovery_0.2.0.v201004190315.jar,plugins/org.apache.axis_1.4.0.v201005080400.jar,plugins/javax.mail_1.4.0.v201005080615.jar

Note that the entries in the excludes statements are prefixed with (only) "plugins/" since that is the way we construct the zips-to-be-signed.

The custom ant task is defined in UpdatePackPropertiesFile.java in

org.eclipse.wtp.releng.tools
repository: /cvsroot/webtools
module: webtools.releng/plugins/org.eclipse.wtp.releng.tools

As is often the case, it is unlikely anyone could use custom task "as-is" (it was never meant to be general purpose) but perhaps could serve as an example for others to develop their own custom task.