ICS 125: Automated Builds
Overview
- What are build systems? Why use them?
- Build system concepts
- Example
Build systems > What and Why?
- What is a build system?
- Automates the steps needed to transform source code into object code and other deliverables
- This is not simply a single step to do a compilation, it is many steps
- Executable code is not the only deliverable that needs to be
built. Other deliverables include generated documentation, test
reports, and packaged code.
- Why use a build system?
- Manually running build steps is tedious, error prone, and hard to communicate
- Automated builds enable automation of larger processes, e.g., deployment or testing
- Older goal: Optimize compilation time
- Build system history:
- Older build systems, like 'make', were usually run by the
developer from the command-line. Makefiles were complex and
error-prone.
- When IDEs became popular, they hid the build system by
automatically generating the same complext makefiles and running
them with one keystroke. That worked well, so long as everyone used
the same IDE manually.
- Now, Ant uses a much simpler configuration file and works from
the command-line (allowing automation) or from within several
different IDEs.
Build systems > Concepts
- Source files: source code in a programming language, or input files to
other tools, e.g. code or doc generators
- Object files: the output of compilers or other tools.
- The output of one tool could be the input of another, e.g., generated code
- Object files are called "Object" files because they are the
"objective" or "goal" of the build process.
- Dependency: a logical relationship between source and object
files. When a source file changes, the dependant object files must
be updated.
- Build file: instructions to the build system
- Often called a 'makefile' by people who have used 'make' for
years
- Like a small program in a langauge that is specialized for
builds
- Target: Like a procedure/method, typically generates one
object file, or a set of related object files
- Targets can depend on objects that are produced by other
targets
- One target is the default target
Build systems > Example
- Sources
- 1. Java source files
- 2. Database model
- 3. Initial database data
- 4. Programmatic test cases
- 5. Generated Java source to implement database access
- Objects
- A. Generated Java source to implement database access
- B. Java .class files
- C. Java jar files
- D. Java API documentation
- E. Database schema
- F. Initial data in database
- G. Test execution report
- Transformations
- 2 -> A, E: Generate database schema and java code from database model
- 1, A, -> B: Compile java code
- B -> C: Package resulting code into jar for execution
- 1, A -> D: Generate API docs from javadoc comments in code
- E, 3 -> F: Load schema and initial data into database
- C, F -> G: Run test cases to generate report
sample use case templatesample test plan templateexample project plan template