[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] Re: Way to automatically build for update site? [Solution!]

nobody@xxxxxxxxxxx wrote:
Original Message <<<<<<<<<<<<<<<<<<


On 7/21/2004, 11:05:36 AM, Mark Melvin <mark.melvin@xxxxxxxxxxxxxx> wrote regarding Re: Way to automatically build for update site?:


Doubt number #1 will pan out since I have to have
 javacSource=1.4
 javacTarget=1.4
in build.properties for compile stage to succeed.  ( And if it does work
then why the hell does this whole 'PDE Build' thing exist? )

And of course #2 seems a little hokey.  That is I am assuming that my
'pde build' + copying will be equivalent to the 'build all' action
that is presented in the site manifest editor.



Right.  This generates a one-liner that basically calls an ANT task
called "pde.exportFeatures" on each feature.  We should be able to just
infuse this into our customTargets.xml somewhere in the build process,
and apply that task on each valus of "allElements".


Well it seems pde.exportFeature is a red herring.  It generates
a useless script :
   https://bugs.eclipse.org/bugs/show_bug.cgi?id=65146


Yes. The problem is - it usually works off plugins in your workspace, so it can't find them when you run a headless Eclipse with the workspace off in no man's land.


I have come up with a solution.  I think it is correct.  Here is what I did:

Create a new file in the same directory as your build.properties and customTargets.xml called "myTargets.xml" (or whatever), containing the following:

<?xml version="1.0" encoding="UTF-8"?>
<project name="Custom Build Targets" default="noDefault">

<!--======================================================-->
<!-- UpdateSite Export target -->
<!-- ==================================================== -->
<target name="updateSiteExport">
<ant antfile="build.xml" dir="${buildDirectory}/features/${id}/" target="build.update.jar">
<property name="feature.destination" value="${UpdateSiteStagingLocation}/features"/>
<property name="plugin.destination" value="${UpdateSiteStagingLocation}/plugins"/>
</ant>
</target>


<!--==================================================== -->
<!-- Default target                                      -->
<!-- =================================================== -->
<target name="noDefault">
	<echo message="This file must be called with explicit targets" />
</target>
</project>

OK - then what I did was add the following to the "postBuild" target of my customTargets.xml:

<target name="postBuild">
    <!-- Create the update site -->
    <antcall target="generateUpdateSite"/>
</target>

<target name="generateUpdateSite">
    <!-- Create the directory structure -->
    <mkdir dir="${UpdateSiteStagingLocation}"/>
    <mkdir dir="${UpdateSiteStagingLocation}/features"/>
    <mkdir dir="${UpdateSiteStagingLocation}/plugins"/>
    <mkdir dir="${UpdateSiteStagingLocation}/web"/>

    <!-- Build the jar files -->
    <antcall target="allElements">
        <param name="genericTargets" value="${builder}/myTargets.xml"/>
        <param name="target" value="updateSiteExport"/>
    </antcall>

<!-- Grab the rest of the site out of CVS -->
<mkdir dir="${buildDirectory}/temp.updatesite"/>
<property name="sitePackagePrefix" value="cvs_path_to_update_site"/>
<cvs cvsRoot="${CVSRoot}"
package="${sitePackagePrefix}"
dest="${buildDirectory}/temp.updatesite"
tag="HEAD"
/>
<!-- Copy to staging area -->
<copy file="${buildDirectory}/temp.updatesite/${sitePackagePrefix}/site.xml" todir="${UpdateSiteStagingLocation}"/>
<copy file="${buildDirectory}/temp.updatesite/${sitePackagePrefix}/index.html" todir="${UpdateSiteStagingLocation}"/>
<copy file="${buildDirectory}/temp.updatesite/${sitePackagePrefix}/web/site.css" todir="${UpdateSiteStagingLocation}/web"/>
<copy file="${buildDirectory}/temp.updatesite/${sitePackagePrefix}/web/site.xsl" todir="${UpdateSiteStagingLocation}/web"/>


    <delete dir="${buildDirectory}/temp.updatesite"/>
</target>

The above task will run the "updateSiteExport" task on all of your top-level features you defined in "allElements", and generate all children plugin jars as well. The only thing that appears "hackish" to me is my temporary reassigning of "genericTargets" to "${builder}/myTargets.xml" - but I don't think there is anything wrong with it - just the naming is kind of misleading.

Obviously you need to define "UpdateSiteStagingLocation", "CVSRoot", and "cvs_path_to_update_site" somewhere. "UpdateSiteStagingLocation" is just a staging folder somewhere on my hard drive. This works for me - all I have left to do is publish it to my server.

Anyway - if you have any questions feel free to email me privately.

Mark.