Koen,

  We have something very similar to what you're wanting.  I'm including a snippet from our build script.  I think everything is in there that you need to make it run, but I just copied and pasted J

 

  Basically, it appends to a file with the name of the target it last processed, which you set as a property.  If you set the property 'continue' to true, then it will skip any that are in that file.

 

Hope this is useful...

 

John Cole

 

---------------------------------------------------------------------------------

            <target name="process.targets">

                        <property name="process.targets.start" value="${datetime::now()}" />

                        <echo message="#" file="processed.targets"

                                    if="${bool::parse(continue)==false or file::exists('processed.targets') == false}" />

                        <foreach item="String" in="${targets}" delim="," property="p.target">

                                    <property name="projects.processed" value="${file::get-file('processed.targets')}" />

                                   

                                    <echo message="${string::contains(projects.processed, p.target)} ${p.target}" />

                                    <if test="${string::contains(projects.processed, p.target) == false}">

                                                <call target="${p.target}"/>

                                               

                                                <echo message="${p.target}" file="processed.targets" append="true" />

                                    </if>

                        </foreach>

                        <delete file="processed.targets" if="${file::exists('processed.targets')}" />

                       

                        <property name="process.targets.end" value="${datetime::now()}" />

                        <echo message="Seconds to perform build: ${timespan::get-seconds(timespan::from-ticks(datetime::get-ticks(process..targetsend) - datetime::get-ticks(process.targets.start)))}" />

            </target>

---------------------------------------------------------------------------------

 

 

Here are some examples on how we call it.

 

---------------------------------------------------------------------------------

            <property name="process" value="checkpath32,fix_rel_path" />

            <property name="cleanall" value="unregister,clean,unregister_commonfiles,clean_commonfiles" />

            <property name="post.build" value="commit.2x,tag.2x,tag_commonfiles,update_mantis_version" />

            <!-- <property name="deploy" value="scp.build,copy.build" /> -->

            <property name="deploy" value="copy.build" />

 

            <target name="cleanall">

                        <property name="targets" value="${cleanall}" />

                        <call target="process.targets" />

            </target>

 

 

            <target name="build.daily">

                        <property name="targets" value="${cleanall},get,${process},setversion,readme,projects.make,nantmake,msm.build,nant.make.msi,update_mantis_version,${deploy},cleanreg" />

                        <call target="process.targets" />

            </target>

---------------------------------------------------------------------------------

 

The custom functions in use in the file

 

---------------------------------------------------------------------------------

<script language="C#" prefix="regex">

                        <code><![CDATA[

                                    [Function("replace")]

                                    public static string RegexReplace(string pSource, string pSearch, string pReplace)

                                    {

                                                System.Text.RegularExpressions.Regex re = new System.Text.RegularExpressions.Regex(pSearch, System.Text.RegularExpressions.RegexOptions.Singleline);

                                                return re.Replace(pSource, pReplace);

                                    }

                        ]]></code>

            </script>

           

            <script language="C#" prefix="file">

                        <code><![CDATA[

                                    [Function("get-file")]

                                    public static string GetFile( string pFileName )

                                    {

                                                string s = "";

                                                using (System.IO.StreamReader sr = new System.IO.StreamReader(pFileName))

                                                {

                                                            s = sr.ReadToEnd();

                                                }

                                                return s;

                                    }

           

                        ]]></code>

            </script>

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Koen Mayens
Sent: Tuesday, January 10, 2006 8:42 AM
To: [email protected]
Subject: [NAnt-users] status build

 

Hi,

I'm looking for a way where I can restart a build from the last not succeeded part or task.
This is because our build proces takes more than an hour, and it's not an option to rebuild the whole stuff after the build failed.
I was thinking about using some kind of status file which contains a status of each step in the buildfile and wich will be created at the start of the build. (this because there will always be somebody who forgets to update the status file :))
Is there somebody who has some experience or information about this, or is this possible with nant commands?
I was thinking about implementing it myself, maybe someone already did something equal.

Thanks in advance

Koen



-------------------------------------
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.

Reply via email to