Build Time is a window of time in the Application Development and Release Lifecycle. The exact sequence of events in this Lifecycle depends on the project and project maintainers, with Requirement Gathering and Design typically at the beginning, and Runtime at the very end (following Release, and Deployment). Exactly what takes place in Build Time depends on the application, its language, and DevOps pipeline. The following is an example of what might take place.
Table of Contents
1. Linting and Static Analysis
- Tools like ESLint help to catch syntax errors, enforce coding standards, and identify potential bugs.
- Static Type Checking: If TypeScript is used, type-checking catches type-related errors.
- Component Scaffolding: Front-End frameworks like React generate boilerplate code for components. This allows writing at a higher level of code that provides consistent underlying functionality with best practices.
- CSS Preprocessing: Tools like Sass or LESS generate CSS code at Build Time. They provide features to enable greater modularization of code.
- HTML Templating: Tools like Handlebars can be used to generate HTML code dynamically based on templates. This is especially useful in projects where source code could otherwise experience combinatorial explosion from all the permutations.
- Polyfilling: Includes features that are not supported by older browsers.
4. Module Bundling and Linking
- Tree Shaking: Related to the bundling process, tree shaking is a form of dead-code elimination to reduce the final release artifact size.
5. Asset Optimization
- Image and Asset Optimization: Images and other assets (e.g. fonts, icons) can be optimized to reduce file sizes and enhance page load times and overall performance.
- Asset Copying: Copies assets to the distribution folder.
- Unit Testing: Running pre-merge tests (e.g. unit tests).
- Move remaining necessary files into the distribution folder.
1. Dependency Resolution
- Before compilation, build tools like Maven or Gradle resolve and download dependencies required by the application from repositories.
- Resource Processing: Static assets like properties files, XML configurations are copied into the
- Code Generation Tools: Tools like Jinja2 can be used to generate Java code dynamically based on templates. This is especially useful in projects where source code could otherwise experience combinatorial explosion from all the permutations.
- Serialization and Remote Procedure Call (RPC) Frameworks: Tools like Protocol Buffers use a Domain-Specific Language to define message types that are very efficiently serialized into byte-level schema during transit between microservices. Furthermore, their
.protofiles can generate client and server-side source code that can be imported into your project in a multitude of languages to create remote procedural calls (RPC).
- Source Code Parsing: Raw source code is parsed into an Abstract Syntax Tree for analysis.
- Annotation Processors: Java supports annotations to classes, methods, and other constructs that produce additional source code or configuration files before the actual compilation begins. Examples of tools and frameworks that provide these features are: Java’s built-in libraries in
java.lang.annotation. Spring and Lombok are popular frameworks that offer annotations.
- Compiling Source Code to Bytecode: Java source code is translated into bytecode (
.class), which can be executed by the JVM.
- Automated pre-merge tests (unit tests).
- The compiled bytecode and all processed resources are packaged into a JAR (Java Archive) for libraries and applications, and WAR (Web Application Archive) for some web applications.
Sam Malayek works in Vancouver, using this space to fill in a few gaps. Opinions are his own.