.load [-o] [-e] [-v] [-j] [<relative_path>/]<filename> .load -r|-p <registername> .load -s `<command name>`
The .load command loads a project from an XML file and adds the steps of the loaded project to the current project, after the step that executed the .load command, allowing a project to dynamically create and load steps at run time. Using options, you can cause the .load command to draw its data from a register or from the output of a command.
To write an XML file for a .load command, start with an export file from an existing project to give you the appropriate basic structure. You can also create a project within the system, then export it to use it in a .load command. This topic includes sample XML code.
The steps loaded by a .load command can contain references to inlined or chained projects. By default, the system looks for the definitions of inlined projects within the XML file, and loads their steps; see the -e option below for a way to have the system get the inlined project definition from the database. For pass chained or fail chained projects, the system always looks for the project definition in the database.
Because the system exports inlined projects along with their calling projects, an XML file may contain several projects. The .load command executes the project that is labelled primary in the file. This project has attribute primary="1" on its <project> element.
.load ../../project.xml
loads the file project.xml from the server directory (the directory that contains the project and job directories), assuming that the step's path property is "/" (the default).
.load -r|-p <registername>The -r option loads steps from an ordinary register, while the -p option loads steps from a project register. You can build up data in a register in earlier steps in your project, then load the steps from the register with this command.
.load -s `<command name>`
The following example shows an XML file to use with the .load command. The XML was created by exporting a project named HelloWorldPlusInline.
bfexport -l
<?xml version="1.0" encoding="UTF-8"?> <buildforge schema="7.000301" comment=""> <project access="6" active="Y" name="HelloWorldPlusInline" primary="1" selectorId="Choose_local" maxthread="0" increment="Y" tagsync="0" buildclass="Production" sticky="N" envId="0" tag="BUILD_$B" id="19" exclusive="0"> <tagvar autoincrement="Y" name="B" id="1">2</tagvar> <step absolute="N" failwait="N" selectorId="" dir="/" broadcast="N" timeout="300" id="1" passwait="N" inline="N" threadable="N" chainId="2" access="6" active="Y" passnotify="0" description="EchoHelloWorld" onfail=" " failnotify="0" envId="0"> <command>echo Hello World</command> </step> <step absolute="N" failwait="N" selectorId="" dir="/" broadcast="N" timeout="300" id="2" passwait="N" inline="N" threadable="N" access="6" active="Y" passnotify="0" description="export proj to build and server folders" onfail=" " failnotify="0" envId="0"> <command>.export $BF_PROJECTNAME_PHYS.xml copy /Y $BF_PROJECTNAME_PHYS.xml ..\..</command> </step> </project> <project access="6" active="Y" name="Sleepytime" primary="0" selectorId="Choose_local" maxthread="0" increment="Y" tagsync="0" buildclass="Production" sticky="N" envId="0" tag="SLEEP_$B" id="2" exclusive="0"> <tagvar autoincrement="Y" name="B" id="1">21</tagvar> <step absolute="N" failwait="N" selectorId="" dir="/" broadcast="N" timeout="300" id="1" passwait="N" inline="N" threadable="N" access="6" active="Y" passnotify="0" description="Sleep, perchance to dream" onfail=" " failnotify="0" envId="0"> <command>.sleep 0</command> </step> </project> <class maxdays="0" access="1" entranceprojectId="1" name="Production" keepfiles="B" deletechangedata="N" purgeprojectId="2" exitProjectId="5" candidates="AnyBuild " maxbuilds="0"></class> <selector operator="" required="" access="6" value="" name="Choose_local" selectorId="" property=""></selector> </buildforge>