Build Management Kenneth M Anderson University of Colorado Boulder CSCI 5828 Lecture 17 03 09 2010 University of Colorado 2010 1 Goals Review material from Chapter 6 5 of Pilone Miles Build Management How do you build your code Examples make Ant IDEs 2 Build Management I The process for constructing a system should be engineered What are the steps to build a system what subsystems need to be built what libraries are needed what resources are required 3 Build Management II The process for constructing a system should be engineered Who is authorized to build a system Small projects individual programmers Large projects build managers and or configuration managers 4 Build Management III The process for constructing a system should be engineered When are system builds performed e g perhaps a system is so large that it can only be built at night when there are enough resources available 5 Build Management IV Most modern programming environments have build management capabilities built into them For instance a Java development environment typically has the notion of a project and it can compile all project files in the correct order and it only compiles files dependent on a change These capabilities free developers from accidental difficulties having to remember the correct compilation order correctly identifying all files dependent on a change 6 Make The Granddaddy of Build Management Systems In Unix a common build management tool is make Make provides very powerful capabilities via three types of specification styles declarative imperative relational These styles are combined into one specification the make file 7 Why talk about Make 8 In modern projects make is not used directly IDEs have build management features built in modern build tools ant maven etc operate at a higher level open source environments autoconf and configure generate makefiles developers write configure specs autoconf does the rest The reason The same reason calculus students learn how to do limits the hard way before they are taught l H pital s rule Specification Styles Operational or Imperative Described according to desired actions Usually given in terms of an execution model Descriptive or Declarative Described according to desired properties Usually given in terms of axioms or algebras Structural or Relational Described according to desired relationships Usually given in terms of a graph e g UML class diagrams 9 make Specification Language Hybrid Declarative Imperative Relational Dependencies are Relational Make specifies dependencies between artifacts Rules are Declarative Make specifies rules for creating new artifacts Actions are Imperative Make specifies actions to carry out rules This is true of ant and other tools with similar specs 10 Example makefile 11 Target1 Target2 Target3 TargetN t Action1 A Makefile consists of a set of rules t Action2 Each rule contains a target followed by a t colon followed by a list of dependencies t ActionN Target2 Target5 Target6 t Action3 Each subsequent line of a rule begins with a tab character required followed by an action Target3 Target5 Target7 t Action4 If a dependency changes make invokes a rule s action to recreate the target What would happen if Target5 changed Power from Integration make is well integrated into the Unix environment Targets and Dependencies are file names Actions are shell commands program main o input o output o g main o input o output o o program main o main cpp defs h g c main cpp input o input cpp defs h g c input cpp output o output cpp defs h g c output cpp When you realize that any shell command can go here you begin to grok the power of make It is possible to automate the creation and deployment of large systems with make 12 Why use make at all 13 Why use all the complexity of multiple specification styles when ultimately make just invokes shell commands Why not just write a shell script bin bash g c main cpp g c input cpp g c output cpp g main o input o output o o program What style does this specification use Why not use a shell script 14 The Primary Answer A shell script will compile each file every time its run even if the file has not changed since the last compilation When building large systems such an approach does not scale You only want to recompile changed files and the files that depend on them Make is much smarter by only recompiling changed files and their dependencies make can scale to building large software systems make wrap up Build management has been around a long time make was created by Stuart Feldman in 1977 Feldman was part of the group that created Unix at Bell Labs He was an author of the first Fortran 77 compiler Now works for Google as Vice President of Engineering East Coast When you click build in your IDE and it builds your project you have make to thank 15 The Textbook Scenario 16 The book highlights another reason for build management Configuration Management is not enough to support the day to day tasks of software development If a new developer joins the team simply checking out a copy of HEAD is not enough How do I compile the system A search finds five main methods which one do I invoke What configuration do I have to do before the system will run Building your project in one step 17 Build management is all about reducing the complexity of creating your system You do some work up front Then invoke a single command make or ant Then run your system As the book says modern applications are complex beasts consisting of not just code but libraries aka frameworks resources images sounds movies etc and more Example Applications in Mac OS X Finder 18 But look behind the curtain Apps in Mac OS X Terminal 19 Apps are just directories whose names end in the suffix app those pretty icons just live in a standard predefined place in the application bundle or package 20 How complex Lets take a look at the application bundle for OmniGraffle Pro The application I use to create all of my diagrams As we will see it contains Code Frameworks Libraries Plugins Scripts Images tiff png icons color pickers nib files frozen objects localized files for internationalization etc 21 Ant The book delves into the details of Ant Ant is a build system that is used mainly for Java based software development The specification is contained in an XML file called build xml This specification consists of projects properties targets tasks 22 Projects The build xml file exists to build a single project project name BeatBox default dist It
View Full Document
Unlocking...