Build Multi-platform Projects
Scenario
Setup build automation for projects that consist of components which need to be compiled and/or tested on different platforms.
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:
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.html#WorkingwithBuildGrid-nodeattributes) 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.html#WorkingwithBuildGrid-nodeattributes)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.
File requirements are specified like below:
- for step compile component1
- for step compile component2
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