Open-Source Internship opportunity by OpenGenus for programmers. Apply now.
Software build is the process of converting source code into executable application or program. Build Management plays very important role in releasing an application.
Build Management process can be broken into several distinct aspects:
- Build Identification
- Build Definition
- Build Execution
- Build Reporting
Build Management is to make sure that every build is consistent.
The build process is described as :
- Fetching source code from a central repository.
- Compiled source code and checking/downloading the dependencies.
- Running automated unit/smoke tests to verify the integrity of build.
- On successful build, storing the artifact and sending notification of build.
Build Identification
Build Identification is used to identify what changes to build - the latest changes, agreed-on changes and complete changes. Initially build definition is an informal process where private builds or integration build is created. During the later stages, identification is formal where release builds are carried out.
Generally, there are two types of build types:
- Complete Build
- Incremental Build
Complete Build : In this type, the build is performed from scratch. The dependencies are figured out, entire source code is compiled and the output is bundled as build artifact.
Incremental Build : In this type, the build tool uses the 'last build state' and build only new changes since last build. Incremental builds are much faster since it builds only incremental changes.
Build Definition
Build definition phase tells how to build. In this phase build files, scripts, make files are created which define the compilation to produce a complete system or application. In build definition stage most of the build automation process is carried out. The scripts created in this stage will automate other processes such as database installation and configuration.
Creating builds scripts are the first step to automate the build execution. These scripts can be shell script, python script or XML files, etc. The goal of creating the scripts is to get faster, safer and better builds.
Build Execution
Build Execution phase depends on the scripts, build files, etc., defined in build definition phase. Build execution speed can be increased in two ways - distribute build across multiple machines or build parts of the system since the last build.
A build can be executed in a number of ways:
-
Manual Invocation
-
Automatic Schedule
-
Source code build trigger
-
Manual Invocation : It is the common build trigger. If the build should be triggered to compile the code changes, the user can trigger the build using a build tool.
-
Automatic Schedules : Build execution is triggered at specific intervals, regardless of the source code changes. The best example is Nighty / Weekly builds.
-
Source code Trigger : Build execution is triggered if a developer commits the code into the source code repository.
Build Reporting
In build reporting phase, the build execution results (success/failure) are recorded. Execution results include:
-
Compilation Reports
-
Unit Test Reports
-
Release Reports
-
Build Metrics
-
Sonarqube reports
-
Compilation Reports : The compile reports are generated during the build. Compile reports will provide an overview to developers into what happens in their software during the compile: how much output is generated from their code, which Java packages and class are creating large JavaScript output, and how the code is split.
-
Unit Test Reports : The Maven Surefire plugin can generate unit test results automatically for our project. To enable unit test report in the project documentation site, add the maven-surefire-report-plugin to the reporting section of project's pom.xml.
-
Release Reports : Release report shows all the releases that each project has including cross-project releases. In the report view, we will see the release date, progress and all the associated issues.
-
Build Metrics : Build metrics for a maven build include metrics like total time taken for the build, status of build SUCCESS or FAILURE, test results etc.
-
Sonarqube reports (Code coverage, checkstyle and find bugs report)
How to generate a Build Report
- The build tool is used to execute the Java source code independently. It can compile the entire project, compile the code, package the code to jar etc.
- Maven is a widely used build tool and provides a common platform to perform these activities which makes a programmer's life easier.
Basic Maven Phases :
-
clean : deletes all artifacts and target which were already created.
-
compile : used to compile the source code of the project.
-
test : test the compiled code and these tests do not require package to be deployed.
-
package : package is used to convert project to jar or war etc.
-
install : install the package into local repository for use of another project.
With this, you will have a good knowledge of Build Management system. This will be useful once you move on to manage large projects. Enjoy.