View Source

h2. Scenario

Setup build automation for projects that consist of components which need to be compiled and/or tested on different platforms.

h2. Solution

This scenario can be solved in QuickBuild by running different component build steps on different agents, and then transferring files between agents by declaring file requirements for appropriate steps. We will use an example to explain the idea. Let's assume that we need to build a project with _component1_ and _component2_. _component1_ needs to be compiled on Linux platform with gcc installed, while _component2_ needs to be compiled on Windows platform with Visual Studio installed. We will use a following step layout:

!multiplatform-build.png!

h5. _node match condition_ of each step is designated as follows:

* *master*: node.isAgent()
This tells the master step to run on an agent node.
* *checkout*: node==current.parent.node
This tells the checkout step to run on the same agent as the master step.
* *compile component1*: (node.getAttribute("os.name").startsWith("Linux") \|\| node.getAttribute("os.name").startsWith("LINUX")) && node.hasAttribute("gcc")
This tells the step _compile component1_ to run on a Linux node with attribute _gcc_ defined. The system attribute _os.name_ is used to determine operating system of the node, and _gcc_ is an user attribute which is defined to point to gcc installation path. Refer to [node attributes|Working with Build Grid#node attributes] on how to examine system attributes and how to define the user attributes for a node.
* *compile component2*: node.getAttribute("os.name").startsWith("Windows") && node.hasAttribute("visualstudio")
This tells the step _compile component2_ to run on a Windows node with attribute _visualstudio_ defined. The system attribute _os.name_ is used to determine operating system of the node, and _visualstudio_ is an user attribute which is defined to point to Visual Studio installation path. Refer to [node attributes|Working with Build Grid#node attributes]on how to examine system attributes and how to define user attributes for a node.
* *package*: node==current.parent.node
This tells the package step to run on the same agent as the master step.
* *publish*: node==current.parent.node
This tells the publish step to run on the same agent as the master step.

h5. File requirements are specified like below:

* *for step* *{_}compile component1{_}*
!filetransfer1.png!
* *for step* *{_}compile component2{_}*
!filetransfer2.png!

We assume that:
* _component1-src_ is checked out by the step _checkout_ to compile compnent1, and the compilation output is placed in the directory _component1-binary_
* _component2-src_ is checked out by the step _checkout_ to compile compnent2, and the compilation output is placed in the directory _component2-binary_